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
3f2365d5
Commit
3f2365d5
authored
Sep 10, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 10, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added support for navigating to anchors with IDs containing '#'.
parent
7293e841
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
3 deletions
+51
-3
navigate.c
dlls/mshtml/navigate.c
+40
-3
nsiface.idl
dlls/mshtml/nsiface.idl
+11
-0
No files found.
dlls/mshtml/navigate.c
View file @
3f2365d5
...
...
@@ -19,6 +19,7 @@
#include "config.h"
#include <stdarg.h>
#include <assert.h>
#define COBJMACROS
#define NONAMELESSUNION
...
...
@@ -1925,10 +1926,13 @@ static HRESULT navigate_fragment(HTMLOuterWindow *window, IUri *uri)
{
nsIDOMLocation
*
nslocation
;
nsAString
nsfrag_str
;
WCHAR
*
selector
;
BSTR
frag
;
nsresult
nsres
;
HRESULT
hres
;
const
WCHAR
selector_formatW
[]
=
{
'a'
,
'['
,
'i'
,
'd'
,
'='
,
'"'
,
'%'
,
's'
,
'"'
,
']'
,
0
};
set_current_uri
(
window
,
uri
);
nsres
=
nsIDOMWindow_GetLocation
(
window
->
nswindow
,
&
nslocation
);
...
...
@@ -1945,12 +1949,45 @@ static HRESULT navigate_fragment(HTMLOuterWindow *window, IUri *uri)
nsres
=
nsIDOMLocation_SetHash
(
nslocation
,
&
nsfrag_str
);
nsAString_Finish
(
&
nsfrag_str
);
nsIDOMLocation_Release
(
nslocation
);
SysFreeString
(
frag
);
if
(
NS_FAILED
(
nsres
))
{
if
(
NS_FAILED
(
nsres
))
ERR
(
"SetHash failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
/*
* IE supports scrolling to anchor elements with "#hash" ids (note that '#' is part of the id),
* while Gecko scrolls only to elements with "hash" ids. We scroll the page ourselves if
* a[id="#hash"] element can be found.
*/
selector
=
heap_alloc
(
sizeof
(
selector_formatW
)
+
SysStringLen
(
frag
)
*
sizeof
(
WCHAR
));
if
(
selector
)
{
nsIDOMNodeSelector
*
node_selector
;
nsIDOMElement
*
nselem
=
NULL
;
nsAString
selector_str
;
nsres
=
nsIDOMHTMLDocument_QueryInterface
(
window
->
base
.
inner_window
->
doc
->
nsdoc
,
&
IID_nsIDOMNodeSelector
,
(
void
**
)
&
node_selector
);
assert
(
nsres
==
NS_OK
);
sprintfW
(
selector
,
selector_formatW
,
frag
);
nsAString_InitDepend
(
&
selector_str
,
selector
);
/* NOTE: Gecko doesn't set result to NULL if there is no match, so nselem must be initialized */
nsres
=
nsIDOMNodeSelector_QuerySelector
(
node_selector
,
&
selector_str
,
&
nselem
);
nsIDOMNodeSelector_Release
(
node_selector
);
nsAString_Finish
(
&
selector_str
);
heap_free
(
selector
);
if
(
NS_SUCCEEDED
(
nsres
)
&&
nselem
)
{
nsIDOMHTMLElement
*
html_elem
;
nsres
=
nsIDOMElement_QueryInterface
(
nselem
,
&
IID_nsIDOMHTMLElement
,
(
void
**
)
&
html_elem
);
nsIDOMElement_Release
(
nselem
);
if
(
NS_SUCCEEDED
(
nsres
))
{
nsIDOMHTMLElement_ScrollIntoView
(
html_elem
,
TRUE
,
1
);
nsIDOMHTMLElement_Release
(
html_elem
);
}
}
}
SysFreeString
(
frag
);
if
(
window
->
doc_obj
->
doc_object_service
)
{
IDocObjectService_FireNavigateComplete2
(
window
->
doc_obj
->
doc_object_service
,
&
window
->
base
.
IHTMLWindow2_iface
,
0x10
);
IDocObjectService_FireDocumentComplete
(
window
->
doc_obj
->
doc_object_service
,
&
window
->
base
.
IHTMLWindow2_iface
,
0
);
...
...
dlls/mshtml/nsiface.idl
View file @
3f2365d5
...
...
@@ -2073,6 +2073,17 @@ interface nsIDOMHTMLStyleElement : nsIDOMHTMLElement
[
object,
uuid(7cebc153-168a-416c-ba5a-56a8c2ddb2ec),
local
]
interface nsIDOMNodeSelector : nsISupports
{
nsresult QuerySelector(const nsAString *selectors, nsIDOMElement **_retval);
nsresult QuerySelectorAll(const nsAString *selectors, nsIDOMNodeList **_retval);
}
[
object,
uuid(94928ab3-8b63-11d3-989d-001083010e9b),
local
]
...
...
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