Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
52b78f05
Commit
52b78f05
authored
Oct 18, 2007
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 19, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Set selection to default on IHTMLSelectionObject::createRange if there…
mshtml: Set selection to default on IHTMLSelectionObject::createRange if there is no range selected.
parent
7e922836
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
1 deletion
+63
-1
selection.c
dlls/mshtml/selection.c
+29
-1
dom.c
dlls/mshtml/tests/dom.c
+34
-0
No files found.
dlls/mshtml/selection.c
View file @
52b78f05
...
...
@@ -153,8 +153,36 @@ static HRESULT WINAPI HTMLSelectionObject_createRange(IHTMLSelectionObject *ifac
nsresult
nsres
;
nsISelection_GetRangeCount
(
This
->
nsselection
,
&
nsrange_cnt
);
if
(
nsrange_cnt
!=
1
)
if
(
!
nsrange_cnt
)
{
nsIDOMDocument
*
nsdoc
;
nsIDOMHTMLDocument
*
nshtmldoc
;
nsIDOMHTMLElement
*
nsbody
=
NULL
;
TRACE
(
"nsrange_cnt = 0
\n
"
);
nsres
=
nsIWebNavigation_GetDocument
(
This
->
doc
->
nscontainer
->
navigation
,
&
nsdoc
);
if
(
NS_FAILED
(
nsres
)
||
!
nsdoc
)
{
ERR
(
"GetDocument failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
nsIDOMDocument_QueryInterface
(
nsdoc
,
&
IID_nsIDOMHTMLDocument
,
(
void
**
)
&
nshtmldoc
);
nsIDOMDocument_Release
(
nsdoc
);
nsres
=
nsIDOMHTMLDocument_GetBody
(
nshtmldoc
,
&
nsbody
);
nsIDOMHTMLDocument_Release
(
nshtmldoc
);
if
(
NS_FAILED
(
nsres
)
||
!
nsbody
)
{
ERR
(
"Could not get body: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
nsres
=
nsISelection_Collapse
(
This
->
nsselection
,
(
nsIDOMNode
*
)
nsbody
,
0
);
nsIDOMHTMLElement_Release
(
nsbody
);
if
(
NS_FAILED
(
nsres
))
ERR
(
"Collapse failed: %08x
\n
"
,
nsres
);
}
else
if
(
nsrange_cnt
>
1
)
{
FIXME
(
"range_cnt = %d
\n
"
,
nsrange_cnt
);
}
nsres
=
nsISelection_GetRangeAt
(
This
->
nsselection
,
0
,
&
nsrange
);
if
(
NS_FAILED
(
nsres
))
...
...
dlls/mshtml/tests/dom.c
View file @
52b78f05
...
...
@@ -539,6 +539,20 @@ static void _test_range_isequal(unsigned line, IHTMLTxtRange *range1, IHTMLTxtRa
}
}
#define test_range_parent(r,t) _test_range_parent(__LINE__,r,t)
static
void
_test_range_parent
(
unsigned
line
,
IHTMLTxtRange
*
range
,
elem_type_t
type
)
{
IHTMLElement
*
elem
;
HRESULT
hres
;
hres
=
IHTMLTxtRange_parentElement
(
range
,
&
elem
);
ok_
(
__FILE__
,
line
)
(
hres
==
S_OK
,
"parentElement failed: %08x
\n
"
,
hres
);
_test_elem_type
(
line
,
(
IUnknown
*
)
elem
,
type
);
IHTMLElement_Release
(
elem
);
}
static
void
test_elem_collection
(
IHTMLElementCollection
*
col
,
const
elem_type_t
*
elem_types
,
long
exlen
)
{
long
len
;
...
...
@@ -695,6 +709,8 @@ static void test_txtrange(IHTMLDocument2 *doc)
IHTMLElement
*
elem
;
IHTMLBodyElement
*
body
;
IHTMLTxtRange
*
body_range
,
*
range
,
*
range2
;
IHTMLSelectionObject
*
selection
;
IDispatch
*
disp_range
;
HRESULT
hres
;
hres
=
IHTMLDocument2_get_body
(
doc
,
&
elem
);
...
...
@@ -841,6 +857,24 @@ static void test_txtrange(IHTMLDocument2 *doc)
IHTMLTxtRange_Release
(
range
);
IHTMLTxtRange_Release
(
body_range
);
hres
=
IHTMLDocument2_get_selection
(
doc
,
&
selection
);
ok
(
hres
==
S_OK
,
"IHTMLDocument2_get_selection failed: %08x
\n
"
,
hres
);
hres
=
IHTMLSelectionObject_createRange
(
selection
,
&
disp_range
);
ok
(
hres
==
S_OK
,
"IHTMLSelectionObject_createRange failed: %08x
\n
"
,
hres
);
IHTMLSelectionObject_Release
(
selection
);
hres
=
IDispatch_QueryInterface
(
disp_range
,
&
IID_IHTMLTxtRange
,
(
void
**
)
&
range
);
ok
(
hres
==
S_OK
,
"Could not get IID_IHTMLTxtRange interface: 0x%08x
\n
"
,
hres
);
IDispatch_Release
(
disp_range
);
test_range_text
(
range
,
NULL
);
test_range_moveend
(
range
,
characterW
,
3
,
3
);
test_range_text
(
range
,
"wor"
);
test_range_parent
(
range
,
ET_BODY
);
IHTMLTxtRange_Release
(
range
);
}
static
void
test_compatmode
(
IHTMLDocument2
*
doc
)
...
...
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