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
07dfef53
Commit
07dfef53
authored
Oct 14, 2007
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 15, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added more range tests and fixes.
parent
924b6678
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
10 deletions
+30
-10
dom.c
dlls/mshtml/tests/dom.c
+4
-0
txtrange.c
dlls/mshtml/txtrange.c
+26
-10
No files found.
dlls/mshtml/tests/dom.c
View file @
07dfef53
...
...
@@ -726,6 +726,10 @@ static void test_txtrange(IHTMLDocument2 *doc)
test_range_expand
(
range
,
wordW
,
VARIANT_FALSE
,
"123"
);
test_range_move
(
range
,
characterW
,
2
,
2
);
test_range_expand
(
range
,
wordW
,
VARIANT_TRUE
,
"123"
);
test_range_moveend
(
range
,
characterW
,
-
5
,
-
5
);
test_range_text
(
range
,
NULL
);
test_range_moveend
(
range
,
characterW
,
3
,
3
);
test_range_text
(
range
,
"c 1"
);
IHTMLTxtRange_Release
(
range
);
...
...
dlls/mshtml/txtrange.c
View file @
07dfef53
...
...
@@ -413,6 +413,11 @@ static inline void dompos_addref(dompos_t *pos)
fill_nodestr
(
pos
);
}
static
inline
BOOL
dompos_cmp
(
const
dompos_t
*
pos1
,
const
dompos_t
*
pos2
)
{
return
pos1
->
node
==
pos2
->
node
&&
pos1
->
off
==
pos2
->
off
;
}
static
void
range_to_string
(
HTMLTxtRange
*
This
,
wstrbuf_t
*
buf
)
{
nsIDOMNode
*
iter
,
*
tmp
;
...
...
@@ -601,12 +606,16 @@ static long move_next_chars(long cnt, const dompos_t *pos, BOOL col, dompos_t *n
return
ret
;
}
static
long
move_prev_chars
(
HTMLTxtRange
*
This
,
long
cnt
,
const
dompos_t
*
pos
,
BOOL
end
,
dompos_t
*
new_pos
)
static
long
move_prev_chars
(
HTMLTxtRange
*
This
,
long
cnt
,
const
dompos_t
*
pos
,
BOOL
end
,
const
dompos_t
*
bound_pos
,
BOOL
*
bounded
,
dompos_t
*
new_pos
)
{
dompos_t
iter
,
tmp
;
long
ret
=
0
;
WCHAR
c
;
if
(
bounded
)
*
bounded
=
FALSE
;
c
=
prev_char
(
This
,
pos
,
&
iter
);
if
(
c
)
ret
++
;
...
...
@@ -620,8 +629,12 @@ static long move_prev_chars(HTMLTxtRange *This, long cnt, const dompos_t *pos, B
ret
++
;
break
;
}
ret
++
;
dompos_release
(
&
tmp
);
if
(
bound_pos
&&
dompos_cmp
(
&
iter
,
bound_pos
))
*
bounded
=
TRUE
;
}
*
new_pos
=
iter
;
...
...
@@ -1114,7 +1127,7 @@ static HRESULT WINAPI HTMLTxtRange_move(IHTMLTxtRange *iface, BSTR Unit,
IHTMLTxtRange_collapse
(
HTMLTXTRANGE
(
This
),
FALSE
);
dompos_release
(
&
new_pos
);
}
else
{
*
ActualCount
=
-
move_prev_chars
(
This
,
-
Count
,
&
cur_pos
,
FALSE
,
&
new_pos
);
*
ActualCount
=
-
move_prev_chars
(
This
,
-
Count
,
&
cur_pos
,
FALSE
,
NULL
,
NULL
,
&
new_pos
);
set_range_pos
(
This
,
TRUE
,
&
new_pos
);
IHTMLTxtRange_collapse
(
HTMLTXTRANGE
(
This
),
TRUE
);
dompos_release
(
&
new_pos
);
...
...
@@ -1180,24 +1193,27 @@ static HRESULT WINAPI HTMLTxtRange_moveEnd(IHTMLTxtRange *iface, BSTR Unit,
switch
(
unit
)
{
case
RU_CHAR
:
{
dompos_t
cur
_pos
,
new_pos
;
dompos_t
start_pos
,
end
_pos
,
new_pos
;
PRBool
collapsed
;
get_cur_pos
(
This
,
FALSE
,
&
cur_pos
);
get_cur_pos
(
This
,
TRUE
,
&
start_pos
);
get_cur_pos
(
This
,
FALSE
,
&
end_pos
);
nsIDOMRange_GetCollapsed
(
This
->
nsrange
,
&
collapsed
);
if
(
Count
>
0
)
{
*
ActualCount
=
move_next_chars
(
Count
,
&
cur
_pos
,
collapsed
,
&
new_pos
);
*
ActualCount
=
move_next_chars
(
Count
,
&
end
_pos
,
collapsed
,
&
new_pos
);
set_range_pos
(
This
,
FALSE
,
&
new_pos
);
}
else
{
*
ActualCount
=
-
move_prev_chars
(
This
,
-
Count
,
&
cur_pos
,
TRUE
,
&
new_pos
);
if
(
*
ActualCount
==
Count
)
set_range_pos
(
This
,
FALSE
,
&
new_pos
);
else
BOOL
bounded
;
*
ActualCount
=
-
move_prev_chars
(
This
,
-
Count
,
&
end_pos
,
TRUE
,
&
start_pos
,
&
bounded
,
&
new_pos
);
set_range_pos
(
This
,
bounded
,
&
new_pos
);
if
(
bounded
)
IHTMLTxtRange_collapse
(
HTMLTXTRANGE
(
This
),
TRUE
);
}
dompos_release
(
&
cur_pos
);
dompos_release
(
&
start_pos
);
dompos_release
(
&
end_pos
);
dompos_release
(
&
new_pos
);
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