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
8b0868c1
Commit
8b0868c1
authored
Jan 18, 2023
by
Evan Tang
Committed by
Alexandre Julliard
Jan 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Implement IHTMLRect2 for HTMLRect.
parent
8870d51d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
151 additions
and
1 deletion
+151
-1
htmlelem.c
dlls/mshtml/htmlelem.c
+109
-1
mshtml_private.h
dlls/mshtml/mshtml_private.h
+1
-0
documentmode.js
dlls/mshtml/tests/documentmode.js
+17
-0
dom.js
dlls/mshtml/tests/dom.js
+2
-0
mshtmdid.h
include/mshtmdid.h
+4
-0
mshtml.idl
include/mshtml.idl
+18
-0
No files found.
dlls/mshtml/htmlelem.c
View file @
8b0868c1
...
...
@@ -529,6 +529,7 @@ HRESULT create_element(HTMLDocumentNode *doc, const WCHAR *tag, HTMLElement **re
typedef
struct
{
DispatchEx
dispex
;
IHTMLRect
IHTMLRect_iface
;
IHTMLRect2
IHTMLRect2_iface
;
LONG
ref
;
...
...
@@ -550,6 +551,8 @@ static HRESULT WINAPI HTMLRect_QueryInterface(IHTMLRect *iface, REFIID riid, voi
*
ppv
=
&
This
->
IHTMLRect_iface
;
}
else
if
(
IsEqualGUID
(
&
IID_IHTMLRect
,
riid
))
{
*
ppv
=
&
This
->
IHTMLRect_iface
;
}
else
if
(
IsEqualGUID
(
&
IID_IHTMLRect2
,
riid
))
{
*
ppv
=
&
This
->
IHTMLRect2_iface
;
}
else
if
(
dispex_query_interface
(
&
This
->
dispex
,
riid
,
ppv
))
{
return
*
ppv
?
S_OK
:
E_NOINTERFACE
;
}
else
{
...
...
@@ -723,6 +726,91 @@ static HRESULT WINAPI HTMLRect_get_bottom(IHTMLRect *iface, LONG *p)
return
S_OK
;
}
static
inline
HTMLRect
*
impl_from_IHTMLRect2
(
IHTMLRect2
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
HTMLRect
,
IHTMLRect2_iface
);
}
static
HRESULT
WINAPI
HTMLRect2_QueryInterface
(
IHTMLRect2
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
HTMLRect
*
This
=
impl_from_IHTMLRect2
(
iface
);
return
IHTMLRect_QueryInterface
(
&
This
->
IHTMLRect_iface
,
riid
,
ppv
);
}
static
ULONG
WINAPI
HTMLRect2_AddRef
(
IHTMLRect2
*
iface
)
{
HTMLRect
*
This
=
impl_from_IHTMLRect2
(
iface
);
return
IHTMLRect_AddRef
(
&
This
->
IHTMLRect_iface
);
}
static
ULONG
WINAPI
HTMLRect2_Release
(
IHTMLRect2
*
iface
)
{
HTMLRect
*
This
=
impl_from_IHTMLRect2
(
iface
);
return
IHTMLRect_Release
(
&
This
->
IHTMLRect_iface
);
}
static
HRESULT
WINAPI
HTMLRect2_GetTypeInfoCount
(
IHTMLRect2
*
iface
,
UINT
*
pctinfo
)
{
HTMLRect
*
This
=
impl_from_IHTMLRect2
(
iface
);
return
IDispatchEx_GetTypeInfoCount
(
&
This
->
dispex
.
IDispatchEx_iface
,
pctinfo
);
}
static
HRESULT
WINAPI
HTMLRect2_GetTypeInfo
(
IHTMLRect2
*
iface
,
UINT
iTInfo
,
LCID
lcid
,
ITypeInfo
**
ppTInfo
)
{
HTMLRect
*
This
=
impl_from_IHTMLRect2
(
iface
);
return
IDispatchEx_GetTypeInfo
(
&
This
->
dispex
.
IDispatchEx_iface
,
iTInfo
,
lcid
,
ppTInfo
);
}
static
HRESULT
WINAPI
HTMLRect2_GetIDsOfNames
(
IHTMLRect2
*
iface
,
REFIID
riid
,
LPOLESTR
*
rgszNames
,
UINT
cNames
,
LCID
lcid
,
DISPID
*
rgDispId
)
{
HTMLRect
*
This
=
impl_from_IHTMLRect2
(
iface
);
return
IDispatchEx_GetIDsOfNames
(
&
This
->
dispex
.
IDispatchEx_iface
,
riid
,
rgszNames
,
cNames
,
lcid
,
rgDispId
);
}
static
HRESULT
WINAPI
HTMLRect2_Invoke
(
IHTMLRect2
*
iface
,
DISPID
dispIdMember
,
REFIID
riid
,
LCID
lcid
,
WORD
wFlags
,
DISPPARAMS
*
pDispParams
,
VARIANT
*
pVarResult
,
EXCEPINFO
*
pExcepInfo
,
UINT
*
puArgErr
)
{
HTMLRect
*
This
=
impl_from_IHTMLRect2
(
iface
);
return
IDispatchEx_Invoke
(
&
This
->
dispex
.
IDispatchEx_iface
,
dispIdMember
,
riid
,
lcid
,
wFlags
,
pDispParams
,
pVarResult
,
pExcepInfo
,
puArgErr
);
}
static
HRESULT
WINAPI
HTMLRect2_get_width
(
IHTMLRect2
*
iface
,
FLOAT
*
p
)
{
HTMLRect
*
This
=
impl_from_IHTMLRect2
(
iface
);
nsresult
nsres
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
nsres
=
nsIDOMClientRect_GetWidth
(
This
->
nsrect
,
p
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"GetWidth failed: %08lx
\n
"
,
nsres
);
return
E_FAIL
;
}
return
S_OK
;
}
static
HRESULT
WINAPI
HTMLRect2_get_height
(
IHTMLRect2
*
iface
,
FLOAT
*
p
)
{
HTMLRect
*
This
=
impl_from_IHTMLRect2
(
iface
);
nsresult
nsres
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
nsres
=
nsIDOMClientRect_GetHeight
(
This
->
nsrect
,
p
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"GetHeight failed: %08lx
\n
"
,
nsres
);
return
E_FAIL
;
}
return
S_OK
;
}
static
const
IHTMLRectVtbl
HTMLRectVtbl
=
{
HTMLRect_QueryInterface
,
HTMLRect_AddRef
,
...
...
@@ -741,6 +829,24 @@ static const IHTMLRectVtbl HTMLRectVtbl = {
HTMLRect_get_bottom
};
static
const
IHTMLRect2Vtbl
HTMLRect2Vtbl
=
{
HTMLRect2_QueryInterface
,
HTMLRect2_AddRef
,
HTMLRect2_Release
,
HTMLRect2_GetTypeInfoCount
,
HTMLRect2_GetTypeInfo
,
HTMLRect2_GetIDsOfNames
,
HTMLRect2_Invoke
,
HTMLRect2_get_width
,
HTMLRect2_get_height
,
};
void
HTMLRect_init_dispex_info
(
dispex_data_t
*
info
,
compat_mode_t
mode
)
{
if
(
mode
>=
COMPAT_MODE_IE9
)
dispex_info_add_interface
(
info
,
IHTMLRect2_tid
,
NULL
);
}
static
const
tid_t
HTMLRect_iface_tids
[]
=
{
IHTMLRect_tid
,
0
...
...
@@ -749,7 +855,8 @@ static dispex_static_data_t HTMLRect_dispex = {
L"ClientRect"
,
NULL
,
IHTMLRect_tid
,
HTMLRect_iface_tids
HTMLRect_iface_tids
,
HTMLRect_init_dispex_info
};
static
HRESULT
create_html_rect
(
nsIDOMClientRect
*
nsrect
,
compat_mode_t
compat_mode
,
IHTMLRect
**
ret
)
...
...
@@ -761,6 +868,7 @@ static HRESULT create_html_rect(nsIDOMClientRect *nsrect, compat_mode_t compat_m
return
E_OUTOFMEMORY
;
rect
->
IHTMLRect_iface
.
lpVtbl
=
&
HTMLRectVtbl
;
rect
->
IHTMLRect2_iface
.
lpVtbl
=
&
HTMLRect2Vtbl
;
rect
->
ref
=
1
;
init_dispatch
(
&
rect
->
dispex
,
(
IUnknown
*
)
&
rect
->
IHTMLRect_iface
,
&
HTMLRect_dispex
,
compat_mode
);
...
...
dlls/mshtml/mshtml_private.h
View file @
8b0868c1
...
...
@@ -237,6 +237,7 @@ typedef struct EventTarget EventTarget;
XIID(IHTMLPerformanceTiming) \
XIID(IHTMLPluginsCollection) \
XIID(IHTMLRect) \
XIID(IHTMLRect2) \
XIID(IHTMLRectCollection) \
XIID(IHTMLScreen) \
XIID(IHTMLScriptElement) \
...
...
dlls/mshtml/tests/documentmode.js
View file @
8b0868c1
...
...
@@ -557,6 +557,23 @@ sync_test("stylesheet_props", function() {
test_exposed
(
"rules"
,
true
);
});
sync_test
(
"rect_props"
,
function
()
{
document
.
body
.
innerHTML
=
'<div>test</div>'
;
var
elem
=
document
.
body
.
firstChild
;
var
rect
=
elem
.
getBoundingClientRect
();
function
test_exposed
(
prop
,
expect
)
{
if
(
expect
)
ok
(
prop
in
rect
,
prop
+
" not found in rect object."
);
else
ok
(
!
(
prop
in
rect
),
prop
+
" found in rect object."
);
}
var
v
=
document
.
documentMode
;
test_exposed
(
"width"
,
v
>=
9
);
test_exposed
(
"height"
,
v
>=
9
);
});
sync_test
(
"xhr open"
,
function
()
{
var
e
=
false
;
try
{
...
...
dlls/mshtml/tests/dom.js
View file @
8b0868c1
...
...
@@ -293,6 +293,8 @@ sync_test("rects", function() {
ok
(
rects
.
length
===
1
,
"rect.length = "
+
rects
.
length
);
ok
(
rects
[
0
].
top
===
rect
.
top
,
"rects[0].top = "
+
rects
[
0
].
top
+
" rect.top = "
+
rect
.
top
);
ok
(
rects
[
0
].
bottom
===
rect
.
bottom
,
"rects[0].bottom = "
+
rects
[
0
].
bottom
+
" rect.bottom = "
+
rect
.
bottom
);
ok
(
rect
.
height
===
rect
.
bottom
-
rect
.
top
,
"rect.height = "
+
rect
.
height
+
" rect.bottom = "
+
rect
.
bottom
+
" rect.top = "
+
rect
.
top
);
ok
(
rect
.
width
===
rect
.
right
-
rect
.
left
,
"rect.width = "
+
rect
.
width
+
" rect.right = "
+
rect
.
right
+
" rect.left = "
+
rect
.
left
);
elem
=
document
.
createElement
(
"style"
);
rects
=
elem
.
getClientRects
();
...
...
include/mshtmdid.h
View file @
8b0868c1
...
...
@@ -4135,6 +4135,10 @@
#define DISPID_IHTMLRECT_RIGHT DISPID_OMRECT+3
#define DISPID_IHTMLRECT_BOTTOM DISPID_OMRECT+4
/* IHTMLRect2 */
#define DISPID_IHTMLRECT2_WIDTH DISPID_OMRECT+5
#define DISPID_IHTMLRECT2_HEIGHT DISPID_OMRECT+6
/* IHTMLRectCollection */
#define DISPID_IHTMLRECTCOLLECTION_LENGTH DISPID_COLLECTION
#define DISPID_IHTMLRECTCOLLECTION__NEWENUM DISPID_NEWENUM
...
...
include/mshtml.idl
View file @
8b0868c1
...
...
@@ -7938,6 +7938,24 @@ interface IHTMLRect : IDispatch
}
/*****************************************************************************
*
IHTMLRect2
interface
*/
[
odl
,
oleautomation
,
dual
,
uuid
(
3051076
c
-
98b5
-
11
cf
-
bb82
-
00
aa00bdce0b
)
]
interface
IHTMLRect2
:
IDispatch
{
[
propget
,
id
(
DISPID_IHTMLRECT2_WIDTH
)
]
HRESULT
width
(
[
retval
,
out
]
FLOAT
*
p
)
;
[
propget
,
id
(
DISPID_IHTMLRECT2_HEIGHT
)
]
HRESULT
height
(
[
retval
,
out
]
FLOAT
*
p
)
;
}
/*****************************************************************************
*
IHTMLRectCollection
interface
*/
[
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