Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4ef4ebaa
Commit
4ef4ebaa
authored
Dec 29, 2014
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 29, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Use new end point representation in IHTMLTxtRange::expand("word") implementation.
parent
26dd5f56
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
58 deletions
+75
-58
txtrange.c
dlls/mshtml/txtrange.c
+75
-58
No files found.
dlls/mshtml/txtrange.c
View file @
4ef4ebaa
...
@@ -333,6 +333,13 @@ static void set_start_point(HTMLTxtRange *This, const rangepoint_t *start)
...
@@ -333,6 +333,13 @@ static void set_start_point(HTMLTxtRange *This, const rangepoint_t *start)
ERR
(
"failed: %08x
\n
"
,
nsres
);
ERR
(
"failed: %08x
\n
"
,
nsres
);
}
}
static
void
set_end_point
(
HTMLTxtRange
*
This
,
const
rangepoint_t
*
end
)
{
nsresult
nsres
=
nsIDOMRange_SetEnd
(
This
->
nsrange
,
end
->
node
,
end
->
off
);
if
(
NS_FAILED
(
nsres
))
ERR
(
"failed: %08x
\n
"
,
nsres
);
}
static
BOOL
is_elem_tag
(
nsIDOMNode
*
node
,
LPCWSTR
istag
)
static
BOOL
is_elem_tag
(
nsIDOMNode
*
node
,
LPCWSTR
istag
)
{
{
nsIDOMElement
*
elem
;
nsIDOMElement
*
elem
;
...
@@ -956,6 +963,60 @@ static LONG move_by_chars(rangepoint_t *iter, LONG cnt)
...
@@ -956,6 +963,60 @@ static LONG move_by_chars(rangepoint_t *iter, LONG cnt)
return
ret
;
return
ret
;
}
}
static
LONG
find_prev_space
(
rangepoint_t
*
iter
,
BOOL
first_space
)
{
rangepoint_t
prev
;
WCHAR
c
;
init_rangepoint
(
&
prev
,
iter
->
node
,
iter
->
off
);
c
=
move_prev_char
(
&
prev
);
if
(
!
c
||
(
first_space
&&
isspaceW
(
c
)))
return
FALSE
;
do
{
free_rangepoint
(
iter
);
init_rangepoint
(
iter
,
prev
.
node
,
prev
.
off
);
c
=
move_prev_char
(
&
prev
);
}
while
(
c
&&
!
isspaceW
(
c
));
free_rangepoint
(
&
prev
);
return
TRUE
;
}
static
BOOL
find_word_end
(
rangepoint_t
*
iter
,
BOOL
is_collapsed
)
{
rangepoint_t
prev_iter
;
WCHAR
c
;
BOOL
ret
=
FALSE
;
if
(
!
is_collapsed
)
{
init_rangepoint
(
&
prev_iter
,
iter
->
node
,
iter
->
off
);
c
=
move_prev_char
(
&
prev_iter
);
free_rangepoint
(
&
prev_iter
);
if
(
isspaceW
(
c
))
return
FALSE
;
}
do
{
init_rangepoint
(
&
prev_iter
,
iter
->
node
,
iter
->
off
);
c
=
move_next_char
(
iter
);
if
(
c
==
'\n'
)
{
free_rangepoint
(
iter
);
*
iter
=
prev_iter
;
return
ret
;
}
if
(
!
c
)
{
if
(
!
ret
)
ret
=
!
rangepoint_cmp
(
iter
,
&
prev_iter
);
}
else
{
ret
=
TRUE
;
}
free_rangepoint
(
&
prev_iter
);
}
while
(
c
&&
!
isspaceW
(
c
));
return
ret
;
}
static
WCHAR
get_pos_char
(
const
dompos_t
*
pos
)
static
WCHAR
get_pos_char
(
const
dompos_t
*
pos
)
{
{
switch
(
pos
->
type
)
{
switch
(
pos
->
type
)
{
...
@@ -1273,7 +1334,7 @@ static LONG move_prev_chars(HTMLTxtRange *This, LONG cnt, const dompos_t *pos, B
...
@@ -1273,7 +1334,7 @@ static LONG move_prev_chars(HTMLTxtRange *This, LONG cnt, const dompos_t *pos, B
return
ret
;
return
ret
;
}
}
static
LONG
find_prev_space
(
HTMLTxtRange
*
This
,
const
dompos_t
*
pos
,
BOOL
first_space
,
dompos_t
*
ret
)
static
LONG
dompos_
find_prev_space
(
HTMLTxtRange
*
This
,
const
dompos_t
*
pos
,
BOOL
first_space
,
dompos_t
*
ret
)
{
{
dompos_t
iter
,
tmp
;
dompos_t
iter
,
tmp
;
WCHAR
c
;
WCHAR
c
;
...
@@ -1298,45 +1359,6 @@ static LONG find_prev_space(HTMLTxtRange *This, const dompos_t *pos, BOOL first_
...
@@ -1298,45 +1359,6 @@ static LONG find_prev_space(HTMLTxtRange *This, const dompos_t *pos, BOOL first_
return
TRUE
;
return
TRUE
;
}
}
static
int
find_word_end
(
const
dompos_t
*
pos
,
dompos_t
*
ret
)
{
dompos_t
iter
,
tmp
;
int
cnt
=
1
;
WCHAR
c
;
c
=
get_pos_char
(
pos
);
if
(
isspaceW
(
c
))
{
*
ret
=
*
pos
;
dompos_addref
(
ret
);
return
0
;
}
c
=
next_char
(
pos
,
&
iter
);
if
(
!
c
)
{
*
ret
=
iter
;
return
0
;
}
if
(
c
==
'\n'
)
{
*
ret
=
*
pos
;
dompos_addref
(
ret
);
return
0
;
}
while
(
c
&&
!
isspaceW
(
c
))
{
tmp
=
iter
;
c
=
next_char
(
&
tmp
,
&
iter
);
if
(
c
==
'\n'
)
{
dompos_release
(
&
iter
);
iter
=
tmp
;
}
else
{
cnt
++
;
dompos_release
(
&
tmp
);
}
}
*
ret
=
iter
;
return
cnt
;
}
static
LONG
move_next_words
(
LONG
cnt
,
const
dompos_t
*
pos
,
dompos_t
*
new_pos
)
static
LONG
move_next_words
(
LONG
cnt
,
const
dompos_t
*
pos
,
dompos_t
*
new_pos
)
{
{
dompos_t
iter
,
tmp
;
dompos_t
iter
,
tmp
;
...
@@ -1374,7 +1396,7 @@ static LONG move_prev_words(HTMLTxtRange *This, LONG cnt, const dompos_t *pos, d
...
@@ -1374,7 +1396,7 @@ static LONG move_prev_words(HTMLTxtRange *This, LONG cnt, const dompos_t *pos, d
dompos_addref
(
&
iter
);
dompos_addref
(
&
iter
);
while
(
ret
<
cnt
)
{
while
(
ret
<
cnt
)
{
if
(
!
find_prev_space
(
This
,
&
iter
,
FALSE
,
&
tmp
))
if
(
!
dompos_
find_prev_space
(
This
,
&
iter
,
FALSE
,
&
tmp
))
break
;
break
;
dompos_release
(
&
iter
);
dompos_release
(
&
iter
);
...
@@ -1712,31 +1734,26 @@ static HRESULT WINAPI HTMLTxtRange_expand(IHTMLTxtRange *iface, BSTR Unit, VARIA
...
@@ -1712,31 +1734,26 @@ static HRESULT WINAPI HTMLTxtRange_expand(IHTMLTxtRange *iface, BSTR Unit, VARIA
switch
(
unit
)
{
switch
(
unit
)
{
case
RU_WORD
:
{
case
RU_WORD
:
{
dompos_t
end_pos
,
start_pos
,
new_start_pos
,
new_end_pos
;
rangepoint_t
end
,
start
;
cpp_bool
collapsed
;
cpp_bool
is_
collapsed
;
nsIDOMRange_GetCollapsed
(
This
->
nsrange
,
&
collapsed
);
get_start_point
(
This
,
&
start
);
get_end_point
(
This
,
&
end
);
get_cur_pos
(
This
,
TRUE
,
&
start_pos
);
nsIDOMRange_GetCollapsed
(
This
->
nsrange
,
&
is_collapsed
);
get_cur_pos
(
This
,
FALSE
,
&
end_pos
);
if
(
find_word_end
(
&
end
_pos
,
&
new_end_pos
)
||
collapsed
)
{
if
(
find_word_end
(
&
end
,
is_collapsed
)
)
{
set_
range_pos
(
This
,
FALSE
,
&
new_end_pos
);
set_
end_point
(
This
,
&
end
);
*
Success
=
VARIANT_TRUE
;
*
Success
=
VARIANT_TRUE
;
}
}
if
(
start_pos
.
type
&&
(
get_pos_char
(
&
end_pos
)
||
!
dompos_cmp
(
&
new_end_pos
,
&
end_pos
)))
{
if
(
find_prev_space
(
&
start
,
TRUE
))
{
if
(
find_prev_space
(
This
,
&
start_pos
,
TRUE
,
&
new_start_pos
))
{
set_start_point
(
This
,
&
start
);
set_range_pos
(
This
,
TRUE
,
&
new_start_pos
);
*
Success
=
VARIANT_TRUE
;
*
Success
=
VARIANT_TRUE
;
}
dompos_release
(
&
new_start_pos
);
}
}
dompos_release
(
&
new_end_pos
);
free_rangepoint
(
&
end
);
dompos_release
(
&
end_pos
);
free_rangepoint
(
&
start
);
dompos_release
(
&
start_pos
);
break
;
break
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment