2 * Copyright 2008,2009 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
34 typedef struct HTMLPluginsCollection HTMLPluginsCollection
;
35 typedef struct HTMLMimeTypesCollection HTMLMimeTypesCollection
;
39 IOmNavigator IOmNavigator_iface
;
41 HTMLPluginsCollection
*plugins
;
42 HTMLMimeTypesCollection
*mime_types
;
47 IHTMLDOMImplementation IHTMLDOMImplementation_iface
;
48 IHTMLDOMImplementation2 IHTMLDOMImplementation2_iface
;
50 nsIDOMDOMImplementation
*implementation
;
51 HTMLDocumentNode
*doc
;
52 } HTMLDOMImplementation
;
54 static inline HTMLDOMImplementation
*impl_from_IHTMLDOMImplementation(IHTMLDOMImplementation
*iface
)
56 return CONTAINING_RECORD(iface
, HTMLDOMImplementation
, IHTMLDOMImplementation_iface
);
59 DISPEX_IDISPATCH_IMPL(HTMLDOMImplementation
, IHTMLDOMImplementation
,
60 impl_from_IHTMLDOMImplementation(iface
)->dispex
)
62 static HRESULT WINAPI
HTMLDOMImplementation_hasFeature(IHTMLDOMImplementation
*iface
, BSTR feature
,
63 VARIANT version
, VARIANT_BOOL
*pfHasFeature
)
65 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
67 FIXME("(%p)->(%s %s %p) returning false\n", This
, debugstr_w(feature
), debugstr_variant(&version
), pfHasFeature
);
69 *pfHasFeature
= VARIANT_FALSE
;
73 static const IHTMLDOMImplementationVtbl HTMLDOMImplementationVtbl
= {
74 HTMLDOMImplementation_QueryInterface
,
75 HTMLDOMImplementation_AddRef
,
76 HTMLDOMImplementation_Release
,
77 HTMLDOMImplementation_GetTypeInfoCount
,
78 HTMLDOMImplementation_GetTypeInfo
,
79 HTMLDOMImplementation_GetIDsOfNames
,
80 HTMLDOMImplementation_Invoke
,
81 HTMLDOMImplementation_hasFeature
84 static inline HTMLDOMImplementation
*impl_from_IHTMLDOMImplementation2(IHTMLDOMImplementation2
*iface
)
86 return CONTAINING_RECORD(iface
, HTMLDOMImplementation
, IHTMLDOMImplementation2_iface
);
89 DISPEX_IDISPATCH_IMPL(HTMLDOMImplementation2
, IHTMLDOMImplementation2
,
90 impl_from_IHTMLDOMImplementation2(iface
)->dispex
)
92 static HRESULT WINAPI
HTMLDOMImplementation2_createDocumentType(IHTMLDOMImplementation2
*iface
, BSTR name
,
93 VARIANT
*public_id
, VARIANT
*system_id
, IDOMDocumentType
**new_type
)
95 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation2(iface
);
96 FIXME("(%p)->(%s %s %s %p)\n", This
, debugstr_w(name
), debugstr_variant(public_id
),
97 debugstr_variant(system_id
), new_type
);
101 static HRESULT WINAPI
HTMLDOMImplementation2_createDocument(IHTMLDOMImplementation2
*iface
, VARIANT
*ns
,
102 VARIANT
*tag_name
, IDOMDocumentType
*document_type
, IHTMLDocument7
**new_document
)
104 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation2(iface
);
105 FIXME("(%p)->(%s %s %p %p)\n", This
, debugstr_variant(ns
), debugstr_variant(tag_name
),
106 document_type
, new_document
);
110 static HRESULT WINAPI
HTMLDOMImplementation2_createHTMLDocument(IHTMLDOMImplementation2
*iface
, BSTR title
,
111 IHTMLDocument7
**new_document
)
113 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation2(iface
);
114 HTMLDocumentNode
*new_document_node
;
120 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(title
), new_document
);
122 if(!This
->doc
|| !This
->doc
->browser
)
125 nsAString_InitDepend(&title_str
, title
);
126 nsres
= nsIDOMDOMImplementation_CreateHTMLDocument(This
->implementation
, &title_str
, &doc
);
127 nsAString_Finish(&title_str
);
128 if(NS_FAILED(nsres
)) {
129 ERR("CreateHTMLDocument failed: %08lx\n", nsres
);
133 hres
= create_document_node(doc
, This
->doc
->browser
, NULL
, This
->doc
->script_global
,
134 dispex_compat_mode(&This
->dispex
), &new_document_node
);
135 nsIDOMDocument_Release(doc
);
139 *new_document
= &new_document_node
->IHTMLDocument7_iface
;
143 static HRESULT WINAPI
HTMLDOMImplementation2_hasFeature(IHTMLDOMImplementation2
*iface
, BSTR feature
,
144 VARIANT version
, VARIANT_BOOL
*pfHasFeature
)
146 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation2(iface
);
148 FIXME("(%p)->(%s %s %p) returning false\n", This
, debugstr_w(feature
), debugstr_variant(&version
), pfHasFeature
);
150 *pfHasFeature
= VARIANT_FALSE
;
154 static const IHTMLDOMImplementation2Vtbl HTMLDOMImplementation2Vtbl
= {
155 HTMLDOMImplementation2_QueryInterface
,
156 HTMLDOMImplementation2_AddRef
,
157 HTMLDOMImplementation2_Release
,
158 HTMLDOMImplementation2_GetTypeInfoCount
,
159 HTMLDOMImplementation2_GetTypeInfo
,
160 HTMLDOMImplementation2_GetIDsOfNames
,
161 HTMLDOMImplementation2_Invoke
,
162 HTMLDOMImplementation2_createDocumentType
,
163 HTMLDOMImplementation2_createDocument
,
164 HTMLDOMImplementation2_createHTMLDocument
,
165 HTMLDOMImplementation2_hasFeature
168 static inline HTMLDOMImplementation
*HTMLDOMImplementation_from_DispatchEx(DispatchEx
*iface
)
170 return CONTAINING_RECORD(iface
, HTMLDOMImplementation
, dispex
);
173 static void *HTMLDOMImplementation_query_interface(DispatchEx
*dispex
, REFIID riid
)
175 HTMLDOMImplementation
*This
= HTMLDOMImplementation_from_DispatchEx(dispex
);
177 if(IsEqualGUID(&IID_IHTMLDOMImplementation
, riid
))
178 return &This
->IHTMLDOMImplementation_iface
;
179 if(IsEqualGUID(&IID_IHTMLDOMImplementation2
, riid
))
180 return &This
->IHTMLDOMImplementation2_iface
;
185 static void HTMLDOMImplementation_traverse(DispatchEx
*dispex
, nsCycleCollectionTraversalCallback
*cb
)
187 HTMLDOMImplementation
*This
= HTMLDOMImplementation_from_DispatchEx(dispex
);
188 if(This
->implementation
)
189 note_cc_edge((nsISupports
*)This
->implementation
, "implementation", cb
);
192 static void HTMLDOMImplementation_unlink(DispatchEx
*dispex
)
194 HTMLDOMImplementation
*This
= HTMLDOMImplementation_from_DispatchEx(dispex
);
195 unlink_ref(&This
->implementation
);
198 static void HTMLDOMImplementation_destructor(DispatchEx
*dispex
)
200 HTMLDOMImplementation
*This
= HTMLDOMImplementation_from_DispatchEx(dispex
);
205 static const dispex_static_data_vtbl_t HTMLDOMImplementation_dispex_vtbl
= {
206 .query_interface
= HTMLDOMImplementation_query_interface
,
207 .destructor
= HTMLDOMImplementation_destructor
,
208 .traverse
= HTMLDOMImplementation_traverse
,
209 .unlink
= HTMLDOMImplementation_unlink
212 static void HTMLDOMImplementation_init_dispex_info(dispex_data_t
*info
, compat_mode_t compat_mode
)
214 if(compat_mode
>= COMPAT_MODE_IE9
)
215 dispex_info_add_interface(info
, IHTMLDOMImplementation2_tid
, NULL
);
218 static const tid_t HTMLDOMImplementation_iface_tids
[] = {
219 IHTMLDOMImplementation_tid
,
222 static dispex_static_data_t HTMLDOMImplementation_dispex
= {
224 &HTMLDOMImplementation_dispex_vtbl
,
225 DispHTMLDOMImplementation_tid
,
226 HTMLDOMImplementation_iface_tids
,
227 HTMLDOMImplementation_init_dispex_info
230 HRESULT
create_dom_implementation(HTMLDocumentNode
*doc_node
, IHTMLDOMImplementation
**ret
)
232 HTMLDOMImplementation
*dom_implementation
;
235 if(!doc_node
->browser
)
238 dom_implementation
= calloc(1, sizeof(*dom_implementation
));
239 if(!dom_implementation
)
240 return E_OUTOFMEMORY
;
242 dom_implementation
->IHTMLDOMImplementation_iface
.lpVtbl
= &HTMLDOMImplementationVtbl
;
243 dom_implementation
->IHTMLDOMImplementation2_iface
.lpVtbl
= &HTMLDOMImplementation2Vtbl
;
244 dom_implementation
->doc
= doc_node
;
246 init_dispatch(&dom_implementation
->dispex
, &HTMLDOMImplementation_dispex
, doc_node
->script_global
, doc_node
->document_mode
);
248 nsres
= nsIDOMDocument_GetImplementation(doc_node
->dom_document
, &dom_implementation
->implementation
);
249 if(NS_FAILED(nsres
)) {
250 ERR("GetDOMImplementation failed: %08lx\n", nsres
);
251 IHTMLDOMImplementation_Release(&dom_implementation
->IHTMLDOMImplementation_iface
);
255 *ret
= &dom_implementation
->IHTMLDOMImplementation_iface
;
259 void detach_dom_implementation(IHTMLDOMImplementation
*iface
)
261 HTMLDOMImplementation
*dom_implementation
= impl_from_IHTMLDOMImplementation(iface
);
262 dom_implementation
->doc
= NULL
;
267 IHTMLScreen IHTMLScreen_iface
;
270 static inline HTMLScreen
*impl_from_IHTMLScreen(IHTMLScreen
*iface
)
272 return CONTAINING_RECORD(iface
, HTMLScreen
, IHTMLScreen_iface
);
275 DISPEX_IDISPATCH_IMPL(HTMLScreen
, IHTMLScreen
, impl_from_IHTMLScreen(iface
)->dispex
)
277 static HRESULT WINAPI
HTMLScreen_get_colorDepth(IHTMLScreen
*iface
, LONG
*p
)
279 HTMLScreen
*This
= impl_from_IHTMLScreen(iface
);
282 TRACE("(%p)->(%p)\n", This
, p
);
284 *p
= GetDeviceCaps(hdc
, BITSPIXEL
);
289 static HRESULT WINAPI
HTMLScreen_put_bufferDepth(IHTMLScreen
*iface
, LONG v
)
291 HTMLScreen
*This
= impl_from_IHTMLScreen(iface
);
292 FIXME("(%p)->(%ld)\n", This
, v
);
296 static HRESULT WINAPI
HTMLScreen_get_bufferDepth(IHTMLScreen
*iface
, LONG
*p
)
298 HTMLScreen
*This
= impl_from_IHTMLScreen(iface
);
299 FIXME("(%p)->(%p)\n", This
, p
);
303 static HRESULT WINAPI
HTMLScreen_get_width(IHTMLScreen
*iface
, LONG
*p
)
305 HTMLScreen
*This
= impl_from_IHTMLScreen(iface
);
307 TRACE("(%p)->(%p)\n", This
, p
);
309 *p
= GetSystemMetrics(SM_CXSCREEN
);
313 static HRESULT WINAPI
HTMLScreen_get_height(IHTMLScreen
*iface
, LONG
*p
)
315 HTMLScreen
*This
= impl_from_IHTMLScreen(iface
);
317 TRACE("(%p)->(%p)\n", This
, p
);
319 *p
= GetSystemMetrics(SM_CYSCREEN
);
323 static HRESULT WINAPI
HTMLScreen_put_updateInterval(IHTMLScreen
*iface
, LONG v
)
325 HTMLScreen
*This
= impl_from_IHTMLScreen(iface
);
326 FIXME("(%p)->(%ld)\n", This
, v
);
330 static HRESULT WINAPI
HTMLScreen_get_updateInterval(IHTMLScreen
*iface
, LONG
*p
)
332 HTMLScreen
*This
= impl_from_IHTMLScreen(iface
);
333 FIXME("(%p)->(%p)\n", This
, p
);
337 static HRESULT WINAPI
HTMLScreen_get_availHeight(IHTMLScreen
*iface
, LONG
*p
)
339 HTMLScreen
*This
= impl_from_IHTMLScreen(iface
);
342 TRACE("(%p)->(%p)\n", This
, p
);
344 if(!SystemParametersInfoW(SPI_GETWORKAREA
, 0, &work_area
, 0))
347 *p
= work_area
.bottom
-work_area
.top
;
351 static HRESULT WINAPI
HTMLScreen_get_availWidth(IHTMLScreen
*iface
, LONG
*p
)
353 HTMLScreen
*This
= impl_from_IHTMLScreen(iface
);
356 TRACE("(%p)->(%p)\n", This
, p
);
358 if(!SystemParametersInfoW(SPI_GETWORKAREA
, 0, &work_area
, 0))
361 *p
= work_area
.right
-work_area
.left
;
365 static HRESULT WINAPI
HTMLScreen_get_fontSmoothingEnabled(IHTMLScreen
*iface
, VARIANT_BOOL
*p
)
367 HTMLScreen
*This
= impl_from_IHTMLScreen(iface
);
368 FIXME("(%p)->(%p)\n", This
, p
);
372 static const IHTMLScreenVtbl HTMLSreenVtbl
= {
373 HTMLScreen_QueryInterface
,
376 HTMLScreen_GetTypeInfoCount
,
377 HTMLScreen_GetTypeInfo
,
378 HTMLScreen_GetIDsOfNames
,
380 HTMLScreen_get_colorDepth
,
381 HTMLScreen_put_bufferDepth
,
382 HTMLScreen_get_bufferDepth
,
383 HTMLScreen_get_width
,
384 HTMLScreen_get_height
,
385 HTMLScreen_put_updateInterval
,
386 HTMLScreen_get_updateInterval
,
387 HTMLScreen_get_availHeight
,
388 HTMLScreen_get_availWidth
,
389 HTMLScreen_get_fontSmoothingEnabled
392 static inline HTMLScreen
*HTMLScreen_from_DispatchEx(DispatchEx
*iface
)
394 return CONTAINING_RECORD(iface
, HTMLScreen
, dispex
);
397 static void *HTMLScreen_query_interface(DispatchEx
*dispex
, REFIID riid
)
399 HTMLScreen
*This
= HTMLScreen_from_DispatchEx(dispex
);
401 if(IsEqualGUID(&IID_IHTMLScreen
, riid
))
402 return &This
->IHTMLScreen_iface
;
407 static void HTMLScreen_destructor(DispatchEx
*dispex
)
409 HTMLScreen
*This
= HTMLScreen_from_DispatchEx(dispex
);
413 static const dispex_static_data_vtbl_t HTMLScreen_dispex_vtbl
= {
414 .query_interface
= HTMLScreen_query_interface
,
415 .destructor
= HTMLScreen_destructor
,
418 static const tid_t HTMLScreen_iface_tids
[] = {
422 static dispex_static_data_t HTMLScreen_dispex
= {
424 &HTMLScreen_dispex_vtbl
,
426 HTMLScreen_iface_tids
429 HRESULT
create_html_screen(HTMLInnerWindow
*window
, IHTMLScreen
**ret
)
433 screen
= calloc(1, sizeof(HTMLScreen
));
435 return E_OUTOFMEMORY
;
437 screen
->IHTMLScreen_iface
.lpVtbl
= &HTMLSreenVtbl
;
439 init_dispatch(&screen
->dispex
, &HTMLScreen_dispex
, window
,
440 dispex_compat_mode(&window
->event_target
.dispex
));
442 *ret
= &screen
->IHTMLScreen_iface
;
446 static inline OmHistory
*impl_from_IOmHistory(IOmHistory
*iface
)
448 return CONTAINING_RECORD(iface
, OmHistory
, IOmHistory_iface
);
451 DISPEX_IDISPATCH_IMPL(OmHistory
, IOmHistory
, impl_from_IOmHistory(iface
)->dispex
)
453 static HRESULT WINAPI
OmHistory_get_length(IOmHistory
*iface
, short *p
)
455 OmHistory
*This
= impl_from_IOmHistory(iface
);
456 GeckoBrowser
*browser
= NULL
;
458 TRACE("(%p)->(%p)\n", This
, p
);
460 if(This
->window
->base
.outer_window
)
461 browser
= This
->window
->base
.outer_window
->browser
;
463 *p
= browser
&& browser
->doc
->travel_log
464 ? ITravelLog_CountEntries(browser
->doc
->travel_log
, browser
->doc
->browser_service
)
469 static HRESULT WINAPI
OmHistory_back(IOmHistory
*iface
, VARIANT
*pvargdistance
)
471 OmHistory
*This
= impl_from_IOmHistory(iface
);
472 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
476 static HRESULT WINAPI
OmHistory_forward(IOmHistory
*iface
, VARIANT
*pvargdistance
)
478 OmHistory
*This
= impl_from_IOmHistory(iface
);
479 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
483 static HRESULT WINAPI
OmHistory_go(IOmHistory
*iface
, VARIANT
*pvargdistance
)
485 OmHistory
*This
= impl_from_IOmHistory(iface
);
486 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
490 static const IOmHistoryVtbl OmHistoryVtbl
= {
491 OmHistory_QueryInterface
,
494 OmHistory_GetTypeInfoCount
,
495 OmHistory_GetTypeInfo
,
496 OmHistory_GetIDsOfNames
,
498 OmHistory_get_length
,
504 static inline OmHistory
*OmHistory_from_DispatchEx(DispatchEx
*iface
)
506 return CONTAINING_RECORD(iface
, OmHistory
, dispex
);
509 static void *OmHistory_query_interface(DispatchEx
*dispex
, REFIID riid
)
511 OmHistory
*This
= OmHistory_from_DispatchEx(dispex
);
513 if(IsEqualGUID(&IID_IOmHistory
, riid
))
514 return &This
->IOmHistory_iface
;
519 static void OmHistory_traverse(DispatchEx
*dispex
, nsCycleCollectionTraversalCallback
*cb
)
521 OmHistory
*This
= OmHistory_from_DispatchEx(dispex
);
524 note_cc_edge((nsISupports
*)&This
->window
->base
.IHTMLWindow2_iface
, "window", cb
);
527 static void OmHistory_unlink(DispatchEx
*dispex
)
529 OmHistory
*This
= OmHistory_from_DispatchEx(dispex
);
532 HTMLInnerWindow
*window
= This
->window
;
534 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
538 static void OmHistory_destructor(DispatchEx
*dispex
)
540 OmHistory
*This
= OmHistory_from_DispatchEx(dispex
);
544 static const dispex_static_data_vtbl_t OmHistory_dispex_vtbl
= {
545 .query_interface
= OmHistory_query_interface
,
546 .destructor
= OmHistory_destructor
,
547 .traverse
= OmHistory_traverse
,
548 .unlink
= OmHistory_unlink
,
551 static const tid_t OmHistory_iface_tids
[] = {
555 static dispex_static_data_t OmHistory_dispex
= {
557 &OmHistory_dispex_vtbl
,
563 HRESULT
create_history(HTMLInnerWindow
*window
, OmHistory
**ret
)
567 history
= calloc(1, sizeof(*history
));
569 return E_OUTOFMEMORY
;
571 init_dispatch(&history
->dispex
, &OmHistory_dispex
, window
,
572 dispex_compat_mode(&window
->event_target
.dispex
));
573 history
->IOmHistory_iface
.lpVtbl
= &OmHistoryVtbl
;
575 history
->window
= window
;
576 IHTMLWindow2_AddRef(&window
->base
.IHTMLWindow2_iface
);
582 struct HTMLPluginsCollection
{
584 IHTMLPluginsCollection IHTMLPluginsCollection_iface
;
586 OmNavigator
*navigator
;
589 static inline HTMLPluginsCollection
*impl_from_IHTMLPluginsCollection(IHTMLPluginsCollection
*iface
)
591 return CONTAINING_RECORD(iface
, HTMLPluginsCollection
, IHTMLPluginsCollection_iface
);
594 DISPEX_IDISPATCH_IMPL(HTMLPluginsCollection
, IHTMLPluginsCollection
,
595 impl_from_IHTMLPluginsCollection(iface
)->dispex
)
597 static HRESULT WINAPI
HTMLPluginsCollection_get_length(IHTMLPluginsCollection
*iface
, LONG
*p
)
599 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
601 TRACE("(%p)->(%p)\n", This
, p
);
603 /* IE always returns 0 here */
608 static HRESULT WINAPI
HTMLPluginsCollection_refresh(IHTMLPluginsCollection
*iface
, VARIANT_BOOL reload
)
610 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
612 TRACE("(%p)->(%x)\n", This
, reload
);
614 /* Nothing to do here. */
618 static const IHTMLPluginsCollectionVtbl HTMLPluginsCollectionVtbl
= {
619 HTMLPluginsCollection_QueryInterface
,
620 HTMLPluginsCollection_AddRef
,
621 HTMLPluginsCollection_Release
,
622 HTMLPluginsCollection_GetTypeInfoCount
,
623 HTMLPluginsCollection_GetTypeInfo
,
624 HTMLPluginsCollection_GetIDsOfNames
,
625 HTMLPluginsCollection_Invoke
,
626 HTMLPluginsCollection_get_length
,
627 HTMLPluginsCollection_refresh
630 static inline HTMLPluginsCollection
*HTMLPluginsCollection_from_DispatchEx(DispatchEx
*iface
)
632 return CONTAINING_RECORD(iface
, HTMLPluginsCollection
, dispex
);
635 static void *HTMLPluginsCollection_query_interface(DispatchEx
*dispex
, REFIID riid
)
637 HTMLPluginsCollection
*This
= HTMLPluginsCollection_from_DispatchEx(dispex
);
639 if(IsEqualGUID(&IID_IHTMLPluginsCollection
, riid
))
640 return &This
->IHTMLPluginsCollection_iface
;
645 static void HTMLPluginsCollection_unlink(DispatchEx
*dispex
)
647 HTMLPluginsCollection
*This
= HTMLPluginsCollection_from_DispatchEx(dispex
);
648 if(This
->navigator
) {
649 This
->navigator
->plugins
= NULL
;
650 This
->navigator
= NULL
;
654 static void HTMLPluginsCollection_destructor(DispatchEx
*dispex
)
656 HTMLPluginsCollection
*This
= HTMLPluginsCollection_from_DispatchEx(dispex
);
660 static const dispex_static_data_vtbl_t HTMLPluginsCollection_dispex_vtbl
= {
661 .query_interface
= HTMLPluginsCollection_query_interface
,
662 .destructor
= HTMLPluginsCollection_destructor
,
663 .unlink
= HTMLPluginsCollection_unlink
666 static const tid_t HTMLPluginsCollection_iface_tids
[] = {
667 IHTMLPluginsCollection_tid
,
670 static dispex_static_data_t HTMLPluginsCollection_dispex
= {
672 &HTMLPluginsCollection_dispex_vtbl
,
674 HTMLPluginsCollection_iface_tids
677 static HRESULT
create_plugins_collection(OmNavigator
*navigator
, HTMLPluginsCollection
**ret
)
679 HTMLPluginsCollection
*col
;
681 col
= calloc(1, sizeof(*col
));
683 return E_OUTOFMEMORY
;
685 col
->IHTMLPluginsCollection_iface
.lpVtbl
= &HTMLPluginsCollectionVtbl
;
686 col
->navigator
= navigator
;
688 init_dispatch_with_owner(&col
->dispex
, &HTMLPluginsCollection_dispex
, &navigator
->dispex
);
694 struct HTMLMimeTypesCollection
{
696 IHTMLMimeTypesCollection IHTMLMimeTypesCollection_iface
;
698 OmNavigator
*navigator
;
701 static inline HTMLMimeTypesCollection
*impl_from_IHTMLMimeTypesCollection(IHTMLMimeTypesCollection
*iface
)
703 return CONTAINING_RECORD(iface
, HTMLMimeTypesCollection
, IHTMLMimeTypesCollection_iface
);
706 DISPEX_IDISPATCH_IMPL(HTMLMimeTypesCollection
, IHTMLMimeTypesCollection
,
707 impl_from_IHTMLMimeTypesCollection(iface
)->dispex
)
709 static HRESULT WINAPI
HTMLMimeTypesCollection_get_length(IHTMLMimeTypesCollection
*iface
, LONG
*p
)
711 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
713 TRACE("(%p)->(%p)\n", This
, p
);
715 /* This is just a stub for compatibility with other browser in IE */
720 static const IHTMLMimeTypesCollectionVtbl HTMLMimeTypesCollectionVtbl
= {
721 HTMLMimeTypesCollection_QueryInterface
,
722 HTMLMimeTypesCollection_AddRef
,
723 HTMLMimeTypesCollection_Release
,
724 HTMLMimeTypesCollection_GetTypeInfoCount
,
725 HTMLMimeTypesCollection_GetTypeInfo
,
726 HTMLMimeTypesCollection_GetIDsOfNames
,
727 HTMLMimeTypesCollection_Invoke
,
728 HTMLMimeTypesCollection_get_length
731 static inline HTMLMimeTypesCollection
*HTMLMimeTypesCollection_from_DispatchEx(DispatchEx
*iface
)
733 return CONTAINING_RECORD(iface
, HTMLMimeTypesCollection
, dispex
);
736 static void *HTMLMimeTypesCollection_query_interface(DispatchEx
*dispex
, REFIID riid
)
738 HTMLMimeTypesCollection
*This
= HTMLMimeTypesCollection_from_DispatchEx(dispex
);
740 if(IsEqualGUID(&IID_IHTMLMimeTypesCollection
, riid
))
741 return &This
->IHTMLMimeTypesCollection_iface
;
746 static void HTMLMimeTypesCollection_unlink(DispatchEx
*dispex
)
748 HTMLMimeTypesCollection
*This
= HTMLMimeTypesCollection_from_DispatchEx(dispex
);
749 if(This
->navigator
) {
750 This
->navigator
->mime_types
= NULL
;
751 This
->navigator
= NULL
;
755 static void HTMLMimeTypesCollection_destructor(DispatchEx
*dispex
)
757 HTMLMimeTypesCollection
*This
= HTMLMimeTypesCollection_from_DispatchEx(dispex
);
761 static const dispex_static_data_vtbl_t HTMLMimeTypesCollection_dispex_vtbl
= {
762 .query_interface
= HTMLMimeTypesCollection_query_interface
,
763 .destructor
= HTMLMimeTypesCollection_destructor
,
764 .unlink
= HTMLMimeTypesCollection_unlink
767 static const tid_t HTMLMimeTypesCollection_iface_tids
[] = {
768 IHTMLMimeTypesCollection_tid
,
771 static dispex_static_data_t HTMLMimeTypesCollection_dispex
= {
773 &HTMLMimeTypesCollection_dispex_vtbl
,
774 IHTMLMimeTypesCollection_tid
,
775 HTMLMimeTypesCollection_iface_tids
778 static HRESULT
create_mime_types_collection(OmNavigator
*navigator
, HTMLMimeTypesCollection
**ret
)
780 HTMLMimeTypesCollection
*col
;
782 col
= calloc(1, sizeof(*col
));
784 return E_OUTOFMEMORY
;
786 col
->IHTMLMimeTypesCollection_iface
.lpVtbl
= &HTMLMimeTypesCollectionVtbl
;
787 col
->navigator
= navigator
;
789 init_dispatch_with_owner(&col
->dispex
, &HTMLMimeTypesCollection_dispex
, &navigator
->dispex
);
795 static inline OmNavigator
*impl_from_IOmNavigator(IOmNavigator
*iface
)
797 return CONTAINING_RECORD(iface
, OmNavigator
, IOmNavigator_iface
);
800 DISPEX_IDISPATCH_IMPL(OmNavigator
, IOmNavigator
,impl_from_IOmNavigator(iface
)->dispex
)
802 static HRESULT WINAPI
OmNavigator_get_appCodeName(IOmNavigator
*iface
, BSTR
*p
)
804 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
806 TRACE("(%p)->(%p)\n", This
, p
);
808 *p
= SysAllocString(L
"Mozilla");
812 static HRESULT WINAPI
OmNavigator_get_appName(IOmNavigator
*iface
, BSTR
*p
)
814 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
816 TRACE("(%p)->(%p)\n", This
, p
);
818 *p
= SysAllocString(dispex_compat_mode(&This
->dispex
) == COMPAT_MODE_IE11
819 ? L
"Netscape" : L
"Microsoft Internet Explorer");
821 return E_OUTOFMEMORY
;
826 /* undocumented, added in IE8 */
827 extern HRESULT WINAPI
MapBrowserEmulationModeToUserAgent(const void*,WCHAR
**);
829 /* Retrieves allocated user agent via CoTaskMemAlloc */
830 static HRESULT
get_user_agent(OmNavigator
*navigator
, WCHAR
**user_agent
)
832 DWORD version
= get_compat_mode_version(dispex_compat_mode(&navigator
->dispex
));
834 return MapBrowserEmulationModeToUserAgent(&version
, user_agent
);
837 static HRESULT WINAPI
OmNavigator_get_appVersion(IOmNavigator
*iface
, BSTR
*p
)
839 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
843 const unsigned skip_prefix
= strlen("Mozilla/");
845 TRACE("(%p)->(%p)\n", This
, p
);
847 hres
= get_user_agent(This
, &user_agent
);
850 len
= wcslen(user_agent
);
852 if(len
< skip_prefix
) {
853 CoTaskMemFree(user_agent
);
858 *p
= SysAllocStringLen(user_agent
+ skip_prefix
, len
- skip_prefix
);
859 CoTaskMemFree(user_agent
);
860 return *p
? S_OK
: E_OUTOFMEMORY
;
863 static HRESULT WINAPI
OmNavigator_get_userAgent(IOmNavigator
*iface
, BSTR
*p
)
865 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
869 TRACE("(%p)->(%p)\n", This
, p
);
871 hres
= get_user_agent(This
, &user_agent
);
875 *p
= SysAllocString(user_agent
);
876 CoTaskMemFree(user_agent
);
877 return *p
? S_OK
: E_OUTOFMEMORY
;
880 static HRESULT WINAPI
OmNavigator_javaEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*enabled
)
882 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
884 FIXME("(%p)->(%p) semi-stub\n", This
, enabled
);
886 *enabled
= VARIANT_TRUE
;
890 static HRESULT WINAPI
OmNavigator_taintEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*enabled
)
892 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
893 FIXME("(%p)->(%p)\n", This
, enabled
);
897 static HRESULT WINAPI
OmNavigator_get_mimeTypes(IOmNavigator
*iface
, IHTMLMimeTypesCollection
**p
)
899 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
901 TRACE("(%p)->(%p)\n", This
, p
);
903 if(!This
->mime_types
) {
906 hres
= create_mime_types_collection(This
, &This
->mime_types
);
910 IHTMLMimeTypesCollection_AddRef(&This
->mime_types
->IHTMLMimeTypesCollection_iface
);
913 *p
= &This
->mime_types
->IHTMLMimeTypesCollection_iface
;
917 static HRESULT WINAPI
OmNavigator_get_plugins(IOmNavigator
*iface
, IHTMLPluginsCollection
**p
)
919 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
921 TRACE("(%p)->(%p)\n", This
, p
);
926 hres
= create_plugins_collection(This
, &This
->plugins
);
930 IHTMLPluginsCollection_AddRef(&This
->plugins
->IHTMLPluginsCollection_iface
);
933 *p
= &This
->plugins
->IHTMLPluginsCollection_iface
;
937 static HRESULT WINAPI
OmNavigator_get_cookieEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*p
)
939 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
941 WARN("(%p)->(%p) semi-stub\n", This
, p
);
947 static HRESULT WINAPI
OmNavigator_get_opsProfile(IOmNavigator
*iface
, IHTMLOpsProfile
**p
)
949 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
950 FIXME("(%p)->(%p)\n", This
, p
);
954 static HRESULT WINAPI
OmNavigator_toString(IOmNavigator
*iface
, BSTR
*String
)
956 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
958 TRACE("(%p)->(%p)\n", This
, String
);
960 return dispex_to_string(&This
->dispex
, String
);
963 static HRESULT WINAPI
OmNavigator_get_cpuClass(IOmNavigator
*iface
, BSTR
*p
)
965 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
967 TRACE("(%p)->(%p)\n", This
, p
);
970 *p
= SysAllocString(L
"x64");
972 *p
= SysAllocString(L
"x86");
974 return *p
? S_OK
: E_OUTOFMEMORY
;
977 static HRESULT
get_language_string(LCID lcid
, BSTR
*p
)
982 len
= LCIDToLocaleName(lcid
, NULL
, 0, 0);
984 WARN("LCIDToLocaleName failed: %lu\n", GetLastError());
988 ret
= SysAllocStringLen(NULL
, len
-1);
990 return E_OUTOFMEMORY
;
992 len
= LCIDToLocaleName(lcid
, ret
, len
, 0);
994 WARN("LCIDToLocaleName failed: %lu\n", GetLastError());
1003 static HRESULT WINAPI
OmNavigator_get_systemLanguage(IOmNavigator
*iface
, BSTR
*p
)
1005 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1007 TRACE("(%p)->(%p)\n", This
, p
);
1009 return get_language_string(LOCALE_SYSTEM_DEFAULT
, p
);
1012 static HRESULT WINAPI
OmNavigator_get_browserLanguage(IOmNavigator
*iface
, BSTR
*p
)
1014 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1016 TRACE("(%p)->(%p)\n", This
, p
);
1018 return get_language_string(GetUserDefaultUILanguage(), p
);
1021 static HRESULT WINAPI
OmNavigator_get_userLanguage(IOmNavigator
*iface
, BSTR
*p
)
1023 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1025 TRACE("(%p)->(%p)\n", This
, p
);
1027 return get_language_string(LOCALE_USER_DEFAULT
, p
);
1030 static HRESULT WINAPI
OmNavigator_get_platform(IOmNavigator
*iface
, BSTR
*p
)
1032 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1034 TRACE("(%p)->(%p)\n", This
, p
);
1037 *p
= SysAllocString(L
"Win64");
1039 *p
= SysAllocString(L
"Win32");
1044 static HRESULT WINAPI
OmNavigator_get_appMinorVersion(IOmNavigator
*iface
, BSTR
*p
)
1046 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1048 TRACE("(%p)->(%p)\n", This
, p
);
1050 /* NOTE: MSIE returns "0" or values like ";SP2;". Returning "0" should be enough. */
1051 *p
= SysAllocString(L
"0");
1055 static HRESULT WINAPI
OmNavigator_get_connectionSpeed(IOmNavigator
*iface
, LONG
*p
)
1057 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1058 FIXME("(%p)->(%p)\n", This
, p
);
1062 static HRESULT WINAPI
OmNavigator_get_onLine(IOmNavigator
*iface
, VARIANT_BOOL
*p
)
1064 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1066 WARN("(%p)->(%p) semi-stub, returning true\n", This
, p
);
1072 static HRESULT WINAPI
OmNavigator_get_userProfile(IOmNavigator
*iface
, IHTMLOpsProfile
**p
)
1074 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1075 FIXME("(%p)->(%p)\n", This
, p
);
1079 static const IOmNavigatorVtbl OmNavigatorVtbl
= {
1080 OmNavigator_QueryInterface
,
1082 OmNavigator_Release
,
1083 OmNavigator_GetTypeInfoCount
,
1084 OmNavigator_GetTypeInfo
,
1085 OmNavigator_GetIDsOfNames
,
1087 OmNavigator_get_appCodeName
,
1088 OmNavigator_get_appName
,
1089 OmNavigator_get_appVersion
,
1090 OmNavigator_get_userAgent
,
1091 OmNavigator_javaEnabled
,
1092 OmNavigator_taintEnabled
,
1093 OmNavigator_get_mimeTypes
,
1094 OmNavigator_get_plugins
,
1095 OmNavigator_get_cookieEnabled
,
1096 OmNavigator_get_opsProfile
,
1097 OmNavigator_toString
,
1098 OmNavigator_get_cpuClass
,
1099 OmNavigator_get_systemLanguage
,
1100 OmNavigator_get_browserLanguage
,
1101 OmNavigator_get_userLanguage
,
1102 OmNavigator_get_platform
,
1103 OmNavigator_get_appMinorVersion
,
1104 OmNavigator_get_connectionSpeed
,
1105 OmNavigator_get_onLine
,
1106 OmNavigator_get_userProfile
1109 static inline OmNavigator
*OmNavigator_from_DispatchEx(DispatchEx
*iface
)
1111 return CONTAINING_RECORD(iface
, OmNavigator
, dispex
);
1114 static void *OmNavigator_query_interface(DispatchEx
*dispex
, REFIID riid
)
1116 OmNavigator
*This
= OmNavigator_from_DispatchEx(dispex
);
1118 if(IsEqualGUID(&IID_IOmNavigator
, riid
))
1119 return &This
->IOmNavigator_iface
;
1124 static void OmNavigator_unlink(DispatchEx
*dispex
)
1126 OmNavigator
*This
= OmNavigator_from_DispatchEx(dispex
);
1128 This
->plugins
->navigator
= NULL
;
1129 This
->plugins
= NULL
;
1131 if(This
->mime_types
) {
1132 This
->mime_types
->navigator
= NULL
;
1133 This
->mime_types
= NULL
;
1137 static void OmNavigator_destructor(DispatchEx
*dispex
)
1139 OmNavigator
*This
= OmNavigator_from_DispatchEx(dispex
);
1143 static const dispex_static_data_vtbl_t OmNavigator_dispex_vtbl
= {
1144 .query_interface
= OmNavigator_query_interface
,
1145 .destructor
= OmNavigator_destructor
,
1146 .unlink
= OmNavigator_unlink
1149 static const tid_t OmNavigator_iface_tids
[] = {
1153 static dispex_static_data_t OmNavigator_dispex
= {
1155 &OmNavigator_dispex_vtbl
,
1156 DispHTMLNavigator_tid
,
1157 OmNavigator_iface_tids
1160 HRESULT
create_navigator(HTMLInnerWindow
*script_global
, IOmNavigator
**navigator
)
1164 ret
= calloc(1, sizeof(*ret
));
1166 return E_OUTOFMEMORY
;
1168 ret
->IOmNavigator_iface
.lpVtbl
= &OmNavigatorVtbl
;
1170 init_dispatch(&ret
->dispex
, &OmNavigator_dispex
, script_global
,
1171 dispex_compat_mode(&script_global
->event_target
.dispex
));
1173 *navigator
= &ret
->IOmNavigator_iface
;
1179 IHTMLPerformanceTiming IHTMLPerformanceTiming_iface
;
1181 HTMLInnerWindow
*window
;
1182 } HTMLPerformanceTiming
;
1184 static inline HTMLPerformanceTiming
*impl_from_IHTMLPerformanceTiming(IHTMLPerformanceTiming
*iface
)
1186 return CONTAINING_RECORD(iface
, HTMLPerformanceTiming
, IHTMLPerformanceTiming_iface
);
1189 DISPEX_IDISPATCH_IMPL(HTMLPerformanceTiming
, IHTMLPerformanceTiming
,
1190 impl_from_IHTMLPerformanceTiming(iface
)->dispex
)
1192 static ULONGLONG
get_fetch_time(HTMLPerformanceTiming
*This
)
1194 HTMLInnerWindow
*window
= This
->window
;
1196 /* If there's no prior doc unloaded and no redirects, fetch time == navigationStart time */
1197 if(!window
->unload_event_end_time
&& !window
->redirect_time
)
1198 return window
->navigation_start_time
;
1200 if(window
->dns_lookup_time
)
1201 return window
->dns_lookup_time
;
1202 if(window
->connect_time
)
1203 return window
->connect_time
;
1204 if(window
->request_time
)
1205 return window
->request_time
;
1206 if(window
->unload_event_end_time
)
1207 return window
->unload_event_end_time
;
1209 return window
->redirect_time
;
1212 static HRESULT WINAPI
HTMLPerformanceTiming_get_navigationStart(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1214 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1216 TRACE("(%p)->(%p)\n", This
, p
);
1218 *p
= This
->window
->navigation_start_time
;
1222 static HRESULT WINAPI
HTMLPerformanceTiming_get_unloadEventStart(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1224 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1226 TRACE("(%p)->(%p)\n", This
, p
);
1228 *p
= This
->window
->unload_event_start_time
;
1232 static HRESULT WINAPI
HTMLPerformanceTiming_get_unloadEventEnd(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1234 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1236 TRACE("(%p)->(%p)\n", This
, p
);
1238 *p
= This
->window
->unload_event_end_time
;
1242 static HRESULT WINAPI
HTMLPerformanceTiming_get_redirectStart(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1244 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1246 TRACE("(%p)->(%p)\n", This
, p
);
1248 *p
= This
->window
->redirect_time
;
1252 static HRESULT WINAPI
HTMLPerformanceTiming_get_redirectEnd(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1254 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1256 TRACE("(%p)->(%p)\n", This
, p
);
1258 *p
= This
->window
->redirect_time
? get_fetch_time(This
) : 0;
1262 static HRESULT WINAPI
HTMLPerformanceTiming_get_fetchStart(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1264 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1266 TRACE("(%p)->(%p)\n", This
, p
);
1268 *p
= get_fetch_time(This
);
1272 static HRESULT WINAPI
HTMLPerformanceTiming_get_domainLookupStart(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1274 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1276 TRACE("(%p)->(%p)\n", This
, p
);
1278 *p
= This
->window
->dns_lookup_time
? This
->window
->dns_lookup_time
: get_fetch_time(This
);
1282 static HRESULT WINAPI
HTMLPerformanceTiming_get_domainLookupEnd(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1284 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1286 TRACE("(%p)->(%p)\n", This
, p
);
1288 *p
= This
->window
->connect_time
? This
->window
->connect_time
:
1289 This
->window
->dns_lookup_time
? This
->window
->dns_lookup_time
: get_fetch_time(This
);
1293 static HRESULT WINAPI
HTMLPerformanceTiming_get_connectStart(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1295 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1297 TRACE("(%p)->(%p)\n", This
, p
);
1299 *p
= This
->window
->connect_time
? This
->window
->connect_time
:
1300 This
->window
->dns_lookup_time
? This
->window
->dns_lookup_time
: get_fetch_time(This
);
1304 static HRESULT WINAPI
HTMLPerformanceTiming_get_connectEnd(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1306 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1308 TRACE("(%p)->(%p)\n", This
, p
);
1310 *p
= This
->window
->request_time
? This
->window
->request_time
:
1311 This
->window
->connect_time
? This
->window
->connect_time
:
1312 This
->window
->dns_lookup_time
? This
->window
->dns_lookup_time
: get_fetch_time(This
);
1316 static HRESULT WINAPI
HTMLPerformanceTiming_get_requestStart(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1318 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1320 TRACE("(%p)->(%p)\n", This
, p
);
1322 *p
= This
->window
->request_time
? This
->window
->request_time
:
1323 This
->window
->connect_time
? This
->window
->connect_time
:
1324 This
->window
->dns_lookup_time
? This
->window
->dns_lookup_time
: get_fetch_time(This
);
1328 static HRESULT WINAPI
HTMLPerformanceTiming_get_responseStart(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1330 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1332 TRACE("(%p)->(%p)\n", This
, p
);
1334 *p
= This
->window
->response_start_time
;
1338 static HRESULT WINAPI
HTMLPerformanceTiming_get_responseEnd(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1340 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1342 TRACE("(%p)->(%p)\n", This
, p
);
1344 *p
= This
->window
->response_end_time
;
1348 static HRESULT WINAPI
HTMLPerformanceTiming_get_domLoading(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1350 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1352 TRACE("(%p)->(%p)\n", This
, p
);
1354 /* Make sure this is after responseEnd, when the Gecko parser starts */
1355 *p
= This
->window
->response_end_time
;
1359 static HRESULT WINAPI
HTMLPerformanceTiming_get_domInteractive(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1361 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1363 TRACE("(%p)->(%p)\n", This
, p
);
1365 *p
= This
->window
->dom_interactive_time
;
1369 static HRESULT WINAPI
HTMLPerformanceTiming_get_domContentLoadedEventStart(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1371 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1373 TRACE("(%p)->(%p)\n", This
, p
);
1375 *p
= This
->window
->dom_content_loaded_event_start_time
;
1379 static HRESULT WINAPI
HTMLPerformanceTiming_get_domContentLoadedEventEnd(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1381 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1383 TRACE("(%p)->(%p)\n", This
, p
);
1385 *p
= This
->window
->dom_content_loaded_event_end_time
;
1389 static HRESULT WINAPI
HTMLPerformanceTiming_get_domComplete(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1391 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1393 TRACE("(%p)->(%p)\n", This
, p
);
1395 *p
= This
->window
->dom_complete_time
;
1399 static HRESULT WINAPI
HTMLPerformanceTiming_get_loadEventStart(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1401 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1403 TRACE("(%p)->(%p)\n", This
, p
);
1405 *p
= This
->window
->load_event_start_time
;
1409 static HRESULT WINAPI
HTMLPerformanceTiming_get_loadEventEnd(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1411 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1413 TRACE("(%p)->(%p)\n", This
, p
);
1415 *p
= This
->window
->load_event_end_time
;
1419 static HRESULT WINAPI
HTMLPerformanceTiming_get_msFirstPaint(IHTMLPerformanceTiming
*iface
, ULONGLONG
*p
)
1421 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1423 TRACE("(%p)->(%p)\n", This
, p
);
1425 *p
= This
->window
->first_paint_time
;
1429 static HRESULT WINAPI
HTMLPerformanceTiming_toString(IHTMLPerformanceTiming
*iface
, BSTR
*string
)
1431 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1433 TRACE("(%p)->(%p)\n", This
, string
);
1435 return dispex_to_string(&This
->dispex
, string
);
1438 static HRESULT WINAPI
HTMLPerformanceTiming_toJSON(IHTMLPerformanceTiming
*iface
, VARIANT
*p
)
1440 HTMLPerformanceTiming
*This
= impl_from_IHTMLPerformanceTiming(iface
);
1441 FIXME("(%p)->(%p)\n", This
, p
);
1445 static const IHTMLPerformanceTimingVtbl HTMLPerformanceTimingVtbl
= {
1446 HTMLPerformanceTiming_QueryInterface
,
1447 HTMLPerformanceTiming_AddRef
,
1448 HTMLPerformanceTiming_Release
,
1449 HTMLPerformanceTiming_GetTypeInfoCount
,
1450 HTMLPerformanceTiming_GetTypeInfo
,
1451 HTMLPerformanceTiming_GetIDsOfNames
,
1452 HTMLPerformanceTiming_Invoke
,
1453 HTMLPerformanceTiming_get_navigationStart
,
1454 HTMLPerformanceTiming_get_unloadEventStart
,
1455 HTMLPerformanceTiming_get_unloadEventEnd
,
1456 HTMLPerformanceTiming_get_redirectStart
,
1457 HTMLPerformanceTiming_get_redirectEnd
,
1458 HTMLPerformanceTiming_get_fetchStart
,
1459 HTMLPerformanceTiming_get_domainLookupStart
,
1460 HTMLPerformanceTiming_get_domainLookupEnd
,
1461 HTMLPerformanceTiming_get_connectStart
,
1462 HTMLPerformanceTiming_get_connectEnd
,
1463 HTMLPerformanceTiming_get_requestStart
,
1464 HTMLPerformanceTiming_get_responseStart
,
1465 HTMLPerformanceTiming_get_responseEnd
,
1466 HTMLPerformanceTiming_get_domLoading
,
1467 HTMLPerformanceTiming_get_domInteractive
,
1468 HTMLPerformanceTiming_get_domContentLoadedEventStart
,
1469 HTMLPerformanceTiming_get_domContentLoadedEventEnd
,
1470 HTMLPerformanceTiming_get_domComplete
,
1471 HTMLPerformanceTiming_get_loadEventStart
,
1472 HTMLPerformanceTiming_get_loadEventEnd
,
1473 HTMLPerformanceTiming_get_msFirstPaint
,
1474 HTMLPerformanceTiming_toString
,
1475 HTMLPerformanceTiming_toJSON
1478 static inline HTMLPerformanceTiming
*HTMLPerformanceTiming_from_DispatchEx(DispatchEx
*iface
)
1480 return CONTAINING_RECORD(iface
, HTMLPerformanceTiming
, dispex
);
1483 static void *HTMLPerformanceTiming_query_interface(DispatchEx
*dispex
, REFIID riid
)
1485 HTMLPerformanceTiming
*This
= HTMLPerformanceTiming_from_DispatchEx(dispex
);
1487 if(IsEqualGUID(&IID_IHTMLPerformanceTiming
, riid
))
1488 return &This
->IHTMLPerformanceTiming_iface
;
1493 static void HTMLPerformanceTiming_traverse(DispatchEx
*dispex
, nsCycleCollectionTraversalCallback
*cb
)
1495 HTMLPerformanceTiming
*This
= HTMLPerformanceTiming_from_DispatchEx(dispex
);
1497 note_cc_edge((nsISupports
*)&This
->window
->base
.IHTMLWindow2_iface
, "window", cb
);
1500 static void HTMLPerformanceTiming_unlink(DispatchEx
*dispex
)
1502 HTMLPerformanceTiming
*This
= HTMLPerformanceTiming_from_DispatchEx(dispex
);
1504 HTMLInnerWindow
*window
= This
->window
;
1505 This
->window
= NULL
;
1506 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
1510 static void HTMLPerformanceTiming_destructor(DispatchEx
*dispex
)
1512 HTMLPerformanceTiming
*This
= HTMLPerformanceTiming_from_DispatchEx(dispex
);
1516 static const dispex_static_data_vtbl_t HTMLPerformanceTiming_dispex_vtbl
= {
1517 .query_interface
= HTMLPerformanceTiming_query_interface
,
1518 .destructor
= HTMLPerformanceTiming_destructor
,
1519 .traverse
= HTMLPerformanceTiming_traverse
,
1520 .unlink
= HTMLPerformanceTiming_unlink
1523 static const tid_t HTMLPerformanceTiming_iface_tids
[] = {
1524 IHTMLPerformanceTiming_tid
,
1527 static dispex_static_data_t HTMLPerformanceTiming_dispex
= {
1528 "PerformanceTiming",
1529 &HTMLPerformanceTiming_dispex_vtbl
,
1530 IHTMLPerformanceTiming_tid
,
1531 HTMLPerformanceTiming_iface_tids
1536 IHTMLPerformanceNavigation IHTMLPerformanceNavigation_iface
;
1538 HTMLInnerWindow
*window
;
1539 } HTMLPerformanceNavigation
;
1541 static inline HTMLPerformanceNavigation
*impl_from_IHTMLPerformanceNavigation(IHTMLPerformanceNavigation
*iface
)
1543 return CONTAINING_RECORD(iface
, HTMLPerformanceNavigation
, IHTMLPerformanceNavigation_iface
);
1546 DISPEX_IDISPATCH_IMPL(HTMLPerformanceNavigation
, IHTMLPerformanceNavigation
,
1547 impl_from_IHTMLPerformanceNavigation(iface
)->dispex
)
1549 static HRESULT WINAPI
HTMLPerformanceNavigation_get_type(IHTMLPerformanceNavigation
*iface
, ULONG
*p
)
1551 HTMLPerformanceNavigation
*This
= impl_from_IHTMLPerformanceNavigation(iface
);
1553 TRACE("(%p)->(%p)\n", This
, p
);
1555 *p
= This
->window
->navigation_type
;
1559 static HRESULT WINAPI
HTMLPerformanceNavigation_get_redirectCount(IHTMLPerformanceNavigation
*iface
, ULONG
*p
)
1561 HTMLPerformanceNavigation
*This
= impl_from_IHTMLPerformanceNavigation(iface
);
1563 TRACE("(%p)->(%p)\n", This
, p
);
1565 *p
= This
->window
->redirect_count
;
1569 static HRESULT WINAPI
HTMLPerformanceNavigation_toString(IHTMLPerformanceNavigation
*iface
, BSTR
*string
)
1571 HTMLPerformanceNavigation
*This
= impl_from_IHTMLPerformanceNavigation(iface
);
1573 TRACE("(%p)->(%p)\n", This
, string
);
1575 return dispex_to_string(&This
->dispex
, string
);
1578 static HRESULT WINAPI
HTMLPerformanceNavigation_toJSON(IHTMLPerformanceNavigation
*iface
, VARIANT
*p
)
1580 HTMLPerformanceNavigation
*This
= impl_from_IHTMLPerformanceNavigation(iface
);
1581 FIXME("(%p)->(%p)\n", This
, p
);
1585 static const IHTMLPerformanceNavigationVtbl HTMLPerformanceNavigationVtbl
= {
1586 HTMLPerformanceNavigation_QueryInterface
,
1587 HTMLPerformanceNavigation_AddRef
,
1588 HTMLPerformanceNavigation_Release
,
1589 HTMLPerformanceNavigation_GetTypeInfoCount
,
1590 HTMLPerformanceNavigation_GetTypeInfo
,
1591 HTMLPerformanceNavigation_GetIDsOfNames
,
1592 HTMLPerformanceNavigation_Invoke
,
1593 HTMLPerformanceNavigation_get_type
,
1594 HTMLPerformanceNavigation_get_redirectCount
,
1595 HTMLPerformanceNavigation_toString
,
1596 HTMLPerformanceNavigation_toJSON
1599 static inline HTMLPerformanceNavigation
*HTMLPerformanceNavigation_from_DispatchEx(DispatchEx
*iface
)
1601 return CONTAINING_RECORD(iface
, HTMLPerformanceNavigation
, dispex
);
1604 static void *HTMLPerformanceNavigation_query_interface(DispatchEx
*dispex
, REFIID riid
)
1606 HTMLPerformanceNavigation
*This
= HTMLPerformanceNavigation_from_DispatchEx(dispex
);
1608 if(IsEqualGUID(&IID_IHTMLPerformanceNavigation
, riid
))
1609 return &This
->IHTMLPerformanceNavigation_iface
;
1614 static void HTMLPerformanceNavigation_traverse(DispatchEx
*dispex
, nsCycleCollectionTraversalCallback
*cb
)
1616 HTMLPerformanceNavigation
*This
= HTMLPerformanceNavigation_from_DispatchEx(dispex
);
1618 note_cc_edge((nsISupports
*)&This
->window
->base
.IHTMLWindow2_iface
, "window", cb
);
1621 static void HTMLPerformanceNavigation_unlink(DispatchEx
*dispex
)
1623 HTMLPerformanceNavigation
*This
= HTMLPerformanceNavigation_from_DispatchEx(dispex
);
1625 HTMLInnerWindow
*window
= This
->window
;
1626 This
->window
= NULL
;
1627 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
1631 static void HTMLPerformanceNavigation_destructor(DispatchEx
*dispex
)
1633 HTMLPerformanceNavigation
*This
= HTMLPerformanceNavigation_from_DispatchEx(dispex
);
1637 static const dispex_static_data_vtbl_t HTMLPerformanceNavigation_dispex_vtbl
= {
1638 .query_interface
= HTMLPerformanceNavigation_query_interface
,
1639 .destructor
= HTMLPerformanceNavigation_destructor
,
1640 .traverse
= HTMLPerformanceNavigation_traverse
,
1641 .unlink
= HTMLPerformanceNavigation_unlink
1644 static const tid_t HTMLPerformanceNavigation_iface_tids
[] = {
1645 IHTMLPerformanceNavigation_tid
,
1648 static dispex_static_data_t HTMLPerformanceNavigation_dispex
= {
1649 "PerformanceNavigation",
1650 &HTMLPerformanceNavigation_dispex_vtbl
,
1651 IHTMLPerformanceNavigation_tid
,
1652 HTMLPerformanceNavigation_iface_tids
1657 IHTMLPerformance IHTMLPerformance_iface
;
1659 HTMLInnerWindow
*window
;
1660 IHTMLPerformanceNavigation
*navigation
;
1661 IHTMLPerformanceTiming
*timing
;
1664 static inline HTMLPerformance
*impl_from_IHTMLPerformance(IHTMLPerformance
*iface
)
1666 return CONTAINING_RECORD(iface
, HTMLPerformance
, IHTMLPerformance_iface
);
1669 DISPEX_IDISPATCH_IMPL(HTMLPerformance
, IHTMLPerformance
, impl_from_IHTMLPerformance(iface
)->dispex
)
1671 static HRESULT WINAPI
HTMLPerformance_get_navigation(IHTMLPerformance
*iface
,
1672 IHTMLPerformanceNavigation
**p
)
1674 HTMLPerformance
*This
= impl_from_IHTMLPerformance(iface
);
1676 TRACE("(%p)->(%p)\n", This
, p
);
1678 if(!This
->navigation
) {
1679 HTMLPerformanceNavigation
*navigation
;
1681 navigation
= calloc(1, sizeof(*navigation
));
1683 return E_OUTOFMEMORY
;
1685 navigation
->IHTMLPerformanceNavigation_iface
.lpVtbl
= &HTMLPerformanceNavigationVtbl
;
1686 navigation
->window
= This
->window
;
1687 IHTMLWindow2_AddRef(&This
->window
->base
.IHTMLWindow2_iface
);
1689 init_dispatch(&navigation
->dispex
, &HTMLPerformanceNavigation_dispex
, This
->window
,
1690 dispex_compat_mode(&This
->dispex
));
1692 This
->navigation
= &navigation
->IHTMLPerformanceNavigation_iface
;
1695 IHTMLPerformanceNavigation_AddRef(*p
= This
->navigation
);
1699 static HRESULT WINAPI
HTMLPerformance_get_timing(IHTMLPerformance
*iface
, IHTMLPerformanceTiming
**p
)
1701 HTMLPerformance
*This
= impl_from_IHTMLPerformance(iface
);
1703 TRACE("(%p)->(%p)\n", This
, p
);
1706 HTMLPerformanceTiming
*timing
;
1708 timing
= calloc(1, sizeof(*timing
));
1710 return E_OUTOFMEMORY
;
1712 timing
->IHTMLPerformanceTiming_iface
.lpVtbl
= &HTMLPerformanceTimingVtbl
;
1713 timing
->window
= This
->window
;
1714 IHTMLWindow2_AddRef(&This
->window
->base
.IHTMLWindow2_iface
);
1716 init_dispatch(&timing
->dispex
, &HTMLPerformanceTiming_dispex
, This
->window
,
1717 dispex_compat_mode(&This
->dispex
));
1719 This
->timing
= &timing
->IHTMLPerformanceTiming_iface
;
1722 IHTMLPerformanceTiming_AddRef(*p
= This
->timing
);
1726 static HRESULT WINAPI
HTMLPerformance_toString(IHTMLPerformance
*iface
, BSTR
*string
)
1728 HTMLPerformance
*This
= impl_from_IHTMLPerformance(iface
);
1730 TRACE("(%p)->(%p)\n", This
, string
);
1732 return dispex_to_string(&This
->dispex
, string
);
1735 static HRESULT WINAPI
HTMLPerformance_toJSON(IHTMLPerformance
*iface
, VARIANT
*var
)
1737 HTMLPerformance
*This
= impl_from_IHTMLPerformance(iface
);
1738 FIXME("(%p)->(%p)\n", This
, var
);
1742 static const IHTMLPerformanceVtbl HTMLPerformanceVtbl
= {
1743 HTMLPerformance_QueryInterface
,
1744 HTMLPerformance_AddRef
,
1745 HTMLPerformance_Release
,
1746 HTMLPerformance_GetTypeInfoCount
,
1747 HTMLPerformance_GetTypeInfo
,
1748 HTMLPerformance_GetIDsOfNames
,
1749 HTMLPerformance_Invoke
,
1750 HTMLPerformance_get_navigation
,
1751 HTMLPerformance_get_timing
,
1752 HTMLPerformance_toString
,
1753 HTMLPerformance_toJSON
1756 static inline HTMLPerformance
*HTMLPerformance_from_DispatchEx(DispatchEx
*iface
)
1758 return CONTAINING_RECORD(iface
, HTMLPerformance
, dispex
);
1761 static void *HTMLPerformance_query_interface(DispatchEx
*dispex
, REFIID riid
)
1763 HTMLPerformance
*This
= HTMLPerformance_from_DispatchEx(dispex
);
1765 if(IsEqualGUID(&IID_IHTMLPerformance
, riid
))
1766 return &This
->IHTMLPerformance_iface
;
1771 static void HTMLPerformance_traverse(DispatchEx
*dispex
, nsCycleCollectionTraversalCallback
*cb
)
1773 HTMLPerformance
*This
= HTMLPerformance_from_DispatchEx(dispex
);
1775 note_cc_edge((nsISupports
*)&This
->window
->base
.IHTMLWindow2_iface
, "window", cb
);
1776 if(This
->navigation
)
1777 note_cc_edge((nsISupports
*)This
->navigation
, "navigation", cb
);
1779 note_cc_edge((nsISupports
*)This
->timing
, "timing", cb
);
1782 static void HTMLPerformance_unlink(DispatchEx
*dispex
)
1784 HTMLPerformance
*This
= HTMLPerformance_from_DispatchEx(dispex
);
1786 HTMLInnerWindow
*window
= This
->window
;
1787 This
->window
= NULL
;
1788 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
1790 unlink_ref(&This
->navigation
);
1791 unlink_ref(&This
->timing
);
1794 static void HTMLPerformance_destructor(DispatchEx
*dispex
)
1796 HTMLPerformance
*This
= HTMLPerformance_from_DispatchEx(dispex
);
1800 static const dispex_static_data_vtbl_t HTMLPerformance_dispex_vtbl
= {
1801 .query_interface
= HTMLPerformance_query_interface
,
1802 .destructor
= HTMLPerformance_destructor
,
1803 .traverse
= HTMLPerformance_traverse
,
1804 .unlink
= HTMLPerformance_unlink
1807 static const tid_t HTMLPerformance_iface_tids
[] = {
1808 IHTMLPerformance_tid
,
1811 static dispex_static_data_t HTMLPerformance_dispex
= {
1813 &HTMLPerformance_dispex_vtbl
,
1814 IHTMLPerformance_tid
,
1815 HTMLPerformance_iface_tids
1818 HRESULT
create_performance(HTMLInnerWindow
*window
, IHTMLPerformance
**ret
)
1820 compat_mode_t compat_mode
= dispex_compat_mode(&window
->event_target
.dispex
);
1821 HTMLPerformance
*performance
;
1823 performance
= calloc(1, sizeof(*performance
));
1825 return E_OUTOFMEMORY
;
1827 performance
->IHTMLPerformance_iface
.lpVtbl
= &HTMLPerformanceVtbl
;
1828 performance
->window
= window
;
1829 IHTMLWindow2_AddRef(&window
->base
.IHTMLWindow2_iface
);
1831 init_dispatch(&performance
->dispex
, &HTMLPerformance_dispex
, window
, compat_mode
);
1833 *ret
= &performance
->IHTMLPerformance_iface
;
1839 IHTMLNamespaceCollection IHTMLNamespaceCollection_iface
;
1840 } HTMLNamespaceCollection
;
1842 static inline HTMLNamespaceCollection
*impl_from_IHTMLNamespaceCollection(IHTMLNamespaceCollection
*iface
)
1844 return CONTAINING_RECORD(iface
, HTMLNamespaceCollection
, IHTMLNamespaceCollection_iface
);
1847 DISPEX_IDISPATCH_IMPL(HTMLNamespaceCollection
, IHTMLNamespaceCollection
,
1848 impl_from_IHTMLNamespaceCollection(iface
)->dispex
)
1850 static HRESULT WINAPI
HTMLNamespaceCollection_get_length(IHTMLNamespaceCollection
*iface
, LONG
*p
)
1852 HTMLNamespaceCollection
*This
= impl_from_IHTMLNamespaceCollection(iface
);
1853 FIXME("(%p)->(%p) returning 0\n", This
, p
);
1858 static HRESULT WINAPI
HTMLNamespaceCollection_item(IHTMLNamespaceCollection
*iface
, VARIANT index
, IDispatch
**p
)
1860 HTMLNamespaceCollection
*This
= impl_from_IHTMLNamespaceCollection(iface
);
1861 FIXME("(%p)->(%s %p)\n", This
, debugstr_variant(&index
), p
);
1865 static HRESULT WINAPI
HTMLNamespaceCollection_add(IHTMLNamespaceCollection
*iface
, BSTR
namespace, BSTR urn
,
1866 VARIANT implementation_url
, IDispatch
**p
)
1868 HTMLNamespaceCollection
*This
= impl_from_IHTMLNamespaceCollection(iface
);
1869 FIXME("(%p)->(%s %s %s %p)\n", This
, debugstr_w(namespace), debugstr_w(urn
), debugstr_variant(&implementation_url
), p
);
1873 static const IHTMLNamespaceCollectionVtbl HTMLNamespaceCollectionVtbl
= {
1874 HTMLNamespaceCollection_QueryInterface
,
1875 HTMLNamespaceCollection_AddRef
,
1876 HTMLNamespaceCollection_Release
,
1877 HTMLNamespaceCollection_GetTypeInfoCount
,
1878 HTMLNamespaceCollection_GetTypeInfo
,
1879 HTMLNamespaceCollection_GetIDsOfNames
,
1880 HTMLNamespaceCollection_Invoke
,
1881 HTMLNamespaceCollection_get_length
,
1882 HTMLNamespaceCollection_item
,
1883 HTMLNamespaceCollection_add
1886 static inline HTMLNamespaceCollection
*HTMLNamespaceCollection_from_DispatchEx(DispatchEx
*iface
)
1888 return CONTAINING_RECORD(iface
, HTMLNamespaceCollection
, dispex
);
1891 static void *HTMLNamespaceCollection_query_interface(DispatchEx
*dispex
, REFIID riid
)
1893 HTMLNamespaceCollection
*This
= HTMLNamespaceCollection_from_DispatchEx(dispex
);
1895 if(IsEqualGUID(&IID_IHTMLNamespaceCollection
, riid
))
1896 return &This
->IHTMLNamespaceCollection_iface
;
1901 static void HTMLNamespaceCollection_destructor(DispatchEx
*dispex
)
1903 HTMLNamespaceCollection
*This
= HTMLNamespaceCollection_from_DispatchEx(dispex
);
1907 static const dispex_static_data_vtbl_t HTMLNamespaceCollection_dispex_vtbl
= {
1908 .query_interface
= HTMLNamespaceCollection_query_interface
,
1909 .destructor
= HTMLNamespaceCollection_destructor
,
1912 static const tid_t HTMLNamespaceCollection_iface_tids
[] = {
1913 IHTMLNamespaceCollection_tid
,
1916 static dispex_static_data_t HTMLNamespaceCollection_dispex
= {
1917 "MSNamespaceInfoCollection",
1918 &HTMLNamespaceCollection_dispex_vtbl
,
1919 DispHTMLNamespaceCollection_tid
,
1920 HTMLNamespaceCollection_iface_tids
1923 HRESULT
create_namespace_collection(HTMLDocumentNode
*doc
, IHTMLNamespaceCollection
**ret
)
1925 HTMLNamespaceCollection
*namespaces
;
1927 if (!(namespaces
= calloc(1, sizeof(*namespaces
))))
1928 return E_OUTOFMEMORY
;
1930 namespaces
->IHTMLNamespaceCollection_iface
.lpVtbl
= &HTMLNamespaceCollectionVtbl
;
1931 init_dispatch(&namespaces
->dispex
, &HTMLNamespaceCollection_dispex
, doc
->script_global
,
1932 dispex_compat_mode(&doc
->node
.event_target
.dispex
));
1933 *ret
= &namespaces
->IHTMLNamespaceCollection_iface
;
1939 IWineMSHTMLConsole IWineMSHTMLConsole_iface
;
1942 static inline struct console
*impl_from_IWineMSHTMLConsole(IWineMSHTMLConsole
*iface
)
1944 return CONTAINING_RECORD(iface
, struct console
, IWineMSHTMLConsole_iface
);
1947 DISPEX_IDISPATCH_IMPL(console
, IWineMSHTMLConsole
, impl_from_IWineMSHTMLConsole(iface
)->dispex
)
1949 static HRESULT WINAPI
console_assert(IWineMSHTMLConsole
*iface
, VARIANT_BOOL
*assertion
, VARIANT
*vararg_start
)
1951 FIXME("iface %p, assertion %p, vararg_start %p stub.\n", iface
, assertion
, vararg_start
);
1956 static HRESULT WINAPI
console_clear(IWineMSHTMLConsole
*iface
)
1958 FIXME("iface %p stub.\n", iface
);
1963 static HRESULT WINAPI
console_count(IWineMSHTMLConsole
*iface
, VARIANT
*label
)
1965 FIXME("iface %p, label %p stub.\n", iface
, label
);
1970 static HRESULT WINAPI
console_debug(IWineMSHTMLConsole
*iface
, VARIANT
*vararg_start
)
1972 FIXME("iface %p, vararg_start %p stub.\n", iface
, vararg_start
);
1977 static HRESULT WINAPI
console_dir(IWineMSHTMLConsole
*iface
, VARIANT
*object
)
1979 FIXME("iface %p, object %p stub.\n", iface
, object
);
1984 static HRESULT WINAPI
console_dirxml(IWineMSHTMLConsole
*iface
, VARIANT
*object
)
1986 FIXME("iface %p, object %p stub.\n", iface
, object
);
1991 static HRESULT WINAPI
console_error(IWineMSHTMLConsole
*iface
, VARIANT
*vararg_start
)
1993 FIXME("iface %p, vararg_start %p stub.\n", iface
, vararg_start
);
1998 static HRESULT WINAPI
console_group(IWineMSHTMLConsole
*iface
, VARIANT
*label
)
2000 FIXME("iface %p, label %p stub.\n", iface
, label
);
2005 static HRESULT WINAPI
console_group_collapsed(IWineMSHTMLConsole
*iface
, VARIANT
*label
)
2007 FIXME("iface %p, label %p stub.\n", iface
, label
);
2012 static HRESULT WINAPI
console_group_end(IWineMSHTMLConsole
*iface
)
2014 FIXME("iface %p, stub.\n", iface
);
2019 static HRESULT WINAPI
console_info(IWineMSHTMLConsole
*iface
, VARIANT
*vararg_start
)
2021 FIXME("iface %p, vararg_start %p stub.\n", iface
, vararg_start
);
2026 static HRESULT WINAPI
console_log(IWineMSHTMLConsole
*iface
, VARIANT
*vararg_start
)
2028 FIXME("iface %p, vararg_start %p stub.\n", iface
, vararg_start
);
2033 static HRESULT WINAPI
console_time(IWineMSHTMLConsole
*iface
, VARIANT
*label
)
2035 FIXME("iface %p, label %p stub.\n", iface
, label
);
2040 static HRESULT WINAPI
console_time_end(IWineMSHTMLConsole
*iface
, VARIANT
*label
)
2042 FIXME("iface %p, label %p stub.\n", iface
, label
);
2047 static HRESULT WINAPI
console_trace(IWineMSHTMLConsole
*iface
, VARIANT
*vararg_start
)
2049 FIXME("iface %p, vararg_start %p stub.\n", iface
, vararg_start
);
2054 static HRESULT WINAPI
console_warn(IWineMSHTMLConsole
*iface
, VARIANT
*vararg_start
)
2056 FIXME("iface %p, vararg_start %p stub.\n", iface
, vararg_start
);
2061 static const IWineMSHTMLConsoleVtbl WineMSHTMLConsoleVtbl
= {
2062 console_QueryInterface
,
2065 console_GetTypeInfoCount
,
2066 console_GetTypeInfo
,
2067 console_GetIDsOfNames
,
2077 console_group_collapsed
,
2087 static inline struct console
*console_from_DispatchEx(DispatchEx
*iface
)
2089 return CONTAINING_RECORD(iface
, struct console
, dispex
);
2092 static void *console_query_interface(DispatchEx
*dispex
, REFIID riid
)
2094 struct console
*console
= console_from_DispatchEx(dispex
);
2096 if(IsEqualGUID(&IID_IWineMSHTMLConsole
, riid
))
2097 return &console
->IWineMSHTMLConsole_iface
;
2102 static void console_destructor(DispatchEx
*dispex
)
2104 struct console
*console
= console_from_DispatchEx(dispex
);
2108 static const dispex_static_data_vtbl_t console_dispex_vtbl
= {
2109 .query_interface
= console_query_interface
,
2110 .destructor
= console_destructor
,
2113 static const tid_t console_iface_tids
[] = {
2114 IWineMSHTMLConsole_tid
,
2117 static dispex_static_data_t console_dispex
= {
2119 &console_dispex_vtbl
,
2120 IWineMSHTMLConsole_tid
,
2124 void create_console(HTMLInnerWindow
*window
, IWineMSHTMLConsole
**ret
)
2126 struct console
*obj
;
2128 obj
= calloc(1, sizeof(*obj
));
2131 ERR("No memory.\n");
2135 obj
->IWineMSHTMLConsole_iface
.lpVtbl
= &WineMSHTMLConsoleVtbl
;
2136 init_dispatch(&obj
->dispex
, &console_dispex
, window
, dispex_compat_mode(&window
->event_target
.dispex
));
2138 *ret
= &obj
->IWineMSHTMLConsole_iface
;
2141 struct media_query_list_listener
{
2143 IDispatch
*function
;
2146 struct media_query_list_callback
;
2147 struct media_query_list
{
2149 IWineMSHTMLMediaQueryList IWineMSHTMLMediaQueryList_iface
;
2150 nsIDOMMediaQueryList
*nsquerylist
;
2151 struct media_query_list_callback
*callback
;
2152 struct list listeners
;
2155 struct media_query_list_callback
{
2156 nsIDOMMediaQueryListListener nsIDOMMediaQueryListListener_iface
;
2157 struct media_query_list
*media_query_list
;
2161 static inline struct media_query_list
*impl_from_IWineMSHTMLMediaQueryList(IWineMSHTMLMediaQueryList
*iface
)
2163 return CONTAINING_RECORD(iface
, struct media_query_list
, IWineMSHTMLMediaQueryList_iface
);
2166 DISPEX_IDISPATCH_IMPL(media_query_list
, IWineMSHTMLMediaQueryList
,
2167 impl_from_IWineMSHTMLMediaQueryList(iface
)->dispex
)
2169 static HRESULT WINAPI
media_query_list_get_media(IWineMSHTMLMediaQueryList
*iface
, BSTR
*p
)
2171 struct media_query_list
*media_query_list
= impl_from_IWineMSHTMLMediaQueryList(iface
);
2174 TRACE("(%p)->(%p)\n", media_query_list
, p
);
2176 nsAString_InitDepend(&nsstr
, NULL
);
2177 return return_nsstr(nsIDOMMediaQueryList_GetMedia(media_query_list
->nsquerylist
, &nsstr
), &nsstr
, p
);
2180 static HRESULT WINAPI
media_query_list_get_matches(IWineMSHTMLMediaQueryList
*iface
, VARIANT_BOOL
*p
)
2182 struct media_query_list
*media_query_list
= impl_from_IWineMSHTMLMediaQueryList(iface
);
2186 TRACE("(%p)->(%p)\n", media_query_list
, p
);
2188 nsres
= nsIDOMMediaQueryList_GetMatches(media_query_list
->nsquerylist
, &b
);
2189 if(NS_FAILED(nsres
))
2190 return map_nsresult(nsres
);
2191 *p
= b
? VARIANT_TRUE
: VARIANT_FALSE
;
2195 static HRESULT WINAPI
media_query_list_addListener(IWineMSHTMLMediaQueryList
*iface
, VARIANT
*listener
)
2197 struct media_query_list
*media_query_list
= impl_from_IWineMSHTMLMediaQueryList(iface
);
2198 struct media_query_list_listener
*entry
;
2200 TRACE("(%p)->(%s)\n", media_query_list
, debugstr_variant(listener
));
2202 if(V_VT(listener
) != VT_DISPATCH
|| !V_DISPATCH(listener
))
2205 LIST_FOR_EACH_ENTRY(entry
, &media_query_list
->listeners
, struct media_query_list_listener
, entry
)
2206 if(entry
->function
== V_DISPATCH(listener
))
2209 if(!(entry
= malloc(sizeof(*entry
))))
2210 return E_OUTOFMEMORY
;
2211 entry
->function
= V_DISPATCH(listener
);
2212 IDispatch_AddRef(V_DISPATCH(listener
));
2214 list_add_tail(&media_query_list
->listeners
, &entry
->entry
);
2218 static HRESULT WINAPI
media_query_list_removeListener(IWineMSHTMLMediaQueryList
*iface
, VARIANT
*listener
)
2220 struct media_query_list
*media_query_list
= impl_from_IWineMSHTMLMediaQueryList(iface
);
2221 struct media_query_list_listener
*entry
;
2223 TRACE("(%p)->(%s)\n", media_query_list
, debugstr_variant(listener
));
2225 if(V_VT(listener
) != VT_DISPATCH
|| !V_DISPATCH(listener
))
2228 LIST_FOR_EACH_ENTRY(entry
, &media_query_list
->listeners
, struct media_query_list_listener
, entry
) {
2229 if(entry
->function
== V_DISPATCH(listener
)) {
2230 list_remove(&entry
->entry
);
2231 IDispatch_Release(entry
->function
);
2240 static const IWineMSHTMLMediaQueryListVtbl media_query_list_vtbl
= {
2241 media_query_list_QueryInterface
,
2242 media_query_list_AddRef
,
2243 media_query_list_Release
,
2244 media_query_list_GetTypeInfoCount
,
2245 media_query_list_GetTypeInfo
,
2246 media_query_list_GetIDsOfNames
,
2247 media_query_list_Invoke
,
2248 media_query_list_get_media
,
2249 media_query_list_get_matches
,
2250 media_query_list_addListener
,
2251 media_query_list_removeListener
2254 static inline struct media_query_list_callback
*impl_from_nsIDOMMediaQueryListListener(nsIDOMMediaQueryListListener
*iface
)
2256 return CONTAINING_RECORD(iface
, struct media_query_list_callback
, nsIDOMMediaQueryListListener_iface
);
2259 static nsresult NSAPI
media_query_list_callback_QueryInterface(nsIDOMMediaQueryListListener
*iface
,
2260 nsIIDRef riid
, void **result
)
2262 struct media_query_list_callback
*callback
= impl_from_nsIDOMMediaQueryListListener(iface
);
2264 if(IsEqualGUID(&IID_nsISupports
, riid
) || IsEqualGUID(&IID_nsIDOMMediaQueryListListener
, riid
)) {
2265 *result
= &callback
->nsIDOMMediaQueryListListener_iface
;
2268 return NS_NOINTERFACE
;
2271 nsIDOMMediaQueryListListener_AddRef(&callback
->nsIDOMMediaQueryListListener_iface
);
2275 static nsrefcnt NSAPI
media_query_list_callback_AddRef(nsIDOMMediaQueryListListener
*iface
)
2277 struct media_query_list_callback
*callback
= impl_from_nsIDOMMediaQueryListListener(iface
);
2278 LONG ref
= InterlockedIncrement(&callback
->ref
);
2280 TRACE("(%p) ref=%ld\n", callback
, ref
);
2285 static nsrefcnt NSAPI
media_query_list_callback_Release(nsIDOMMediaQueryListListener
*iface
)
2287 struct media_query_list_callback
*callback
= impl_from_nsIDOMMediaQueryListListener(iface
);
2288 LONG ref
= InterlockedDecrement(&callback
->ref
);
2290 TRACE("(%p) ref=%ld\n", callback
, ref
);
2297 static nsresult NSAPI
media_query_list_callback_HandleChange(nsIDOMMediaQueryListListener
*iface
, nsIDOMMediaQueryList
*mql
)
2299 struct media_query_list_callback
*callback
= impl_from_nsIDOMMediaQueryListListener(iface
);
2300 IDispatch
*listener_funcs_buf
[4], **listener_funcs
= listener_funcs_buf
;
2301 struct media_query_list
*media_query_list
= callback
->media_query_list
;
2302 struct media_query_list_listener
*listener
;
2303 unsigned cnt
, i
= 0;
2307 if(!media_query_list
)
2310 cnt
= list_count(&media_query_list
->listeners
);
2311 if(cnt
> ARRAY_SIZE(listener_funcs_buf
) && !(listener_funcs
= malloc(cnt
* sizeof(*listener_funcs
))))
2312 return NS_ERROR_OUT_OF_MEMORY
;
2314 LIST_FOR_EACH_ENTRY(listener
, &media_query_list
->listeners
, struct media_query_list_listener
, entry
) {
2315 listener_funcs
[i
] = listener
->function
;
2316 IDispatch_AddRef(listener_funcs
[i
++]);
2319 for(i
= 0; i
< cnt
; i
++) {
2320 DISPPARAMS dp
= { args
, NULL
, 1, 0 };
2322 V_VT(args
) = VT_DISPATCH
;
2323 V_DISPATCH(args
) = (IDispatch
*)&media_query_list
->dispex
.IWineJSDispatchHost_iface
;
2324 V_VT(&v
) = VT_EMPTY
;
2326 TRACE("%p >>>\n", media_query_list
);
2327 hres
= call_disp_func(listener_funcs
[i
], &dp
, &v
);
2329 TRACE("%p <<< %s\n", media_query_list
, debugstr_variant(&v
));
2332 WARN("%p <<< %08lx\n", media_query_list
, hres
);
2334 IDispatch_Release(listener_funcs
[i
]);
2337 if(listener_funcs
!= listener_funcs_buf
)
2338 free(listener_funcs
);
2342 static const nsIDOMMediaQueryListListenerVtbl media_query_list_callback_vtbl
= {
2343 media_query_list_callback_QueryInterface
,
2344 media_query_list_callback_AddRef
,
2345 media_query_list_callback_Release
,
2346 media_query_list_callback_HandleChange
2349 static inline struct media_query_list
*media_query_list_from_DispatchEx(DispatchEx
*iface
)
2351 return CONTAINING_RECORD(iface
, struct media_query_list
, dispex
);
2354 static void *media_query_list_query_interface(DispatchEx
*dispex
, REFIID riid
)
2356 struct media_query_list
*media_query_list
= media_query_list_from_DispatchEx(dispex
);
2358 if(IsEqualGUID(&IID_IWineMSHTMLMediaQueryList
, riid
))
2359 return &media_query_list
->IWineMSHTMLMediaQueryList_iface
;
2364 static void media_query_list_traverse(DispatchEx
*dispex
, nsCycleCollectionTraversalCallback
*cb
)
2366 struct media_query_list
*media_query_list
= media_query_list_from_DispatchEx(dispex
);
2367 struct media_query_list_listener
*listener
;
2369 LIST_FOR_EACH_ENTRY(listener
, &media_query_list
->listeners
, struct media_query_list_listener
, entry
)
2370 note_cc_edge((nsISupports
*)listener
->function
, "function", cb
);
2371 if(media_query_list
->nsquerylist
)
2372 note_cc_edge((nsISupports
*)media_query_list
->nsquerylist
, "nsquerylist", cb
);
2375 static void media_query_list_unlink(DispatchEx
*dispex
)
2377 struct media_query_list
*media_query_list
= media_query_list_from_DispatchEx(dispex
);
2379 media_query_list
->callback
->media_query_list
= NULL
;
2380 while(!list_empty(&media_query_list
->listeners
)) {
2381 struct media_query_list_listener
*listener
= LIST_ENTRY(list_head(&media_query_list
->listeners
), struct media_query_list_listener
, entry
);
2382 list_remove(&listener
->entry
);
2383 IDispatch_Release(listener
->function
);
2386 unlink_ref(&media_query_list
->nsquerylist
);
2389 static void media_query_list_destructor(DispatchEx
*dispex
)
2391 struct media_query_list
*media_query_list
= media_query_list_from_DispatchEx(dispex
);
2392 nsIDOMMediaQueryListListener_Release(&media_query_list
->callback
->nsIDOMMediaQueryListListener_iface
);
2393 free(media_query_list
);
2396 static const dispex_static_data_vtbl_t media_query_list_dispex_vtbl
= {
2397 .query_interface
= media_query_list_query_interface
,
2398 .destructor
= media_query_list_destructor
,
2399 .traverse
= media_query_list_traverse
,
2400 .unlink
= media_query_list_unlink
2403 static const tid_t media_query_list_iface_tids
[] = {
2404 IWineMSHTMLMediaQueryList_tid
,
2407 static dispex_static_data_t media_query_list_dispex
= {
2409 &media_query_list_dispex_vtbl
,
2410 IWineMSHTMLMediaQueryList_tid
,
2411 media_query_list_iface_tids
2414 HRESULT
create_media_query_list(HTMLInnerWindow
*window
, BSTR media_query
, IDispatch
**ret
)
2416 struct media_query_list
*media_query_list
;
2421 if(!media_query
|| !media_query
[0])
2422 return E_INVALIDARG
;
2424 if(!(media_query_list
= malloc(sizeof(*media_query_list
))))
2425 return E_OUTOFMEMORY
;
2427 if(!(media_query_list
->callback
= malloc(sizeof(*media_query_list
->callback
)))) {
2428 free(media_query_list
);
2429 return E_OUTOFMEMORY
;
2431 media_query_list
->callback
->nsIDOMMediaQueryListListener_iface
.lpVtbl
= &media_query_list_callback_vtbl
;
2432 media_query_list
->callback
->media_query_list
= media_query_list
;
2433 media_query_list
->callback
->ref
= 1;
2435 nsAString_InitDepend(&nsstr
, media_query
);
2436 nsres
= nsIDOMWindow_MatchMedia(window
->dom_window
, &nsstr
, &nsunk
);
2437 nsAString_Finish(&nsstr
);
2438 if(NS_FAILED(nsres
)) {
2439 free(media_query_list
->callback
);
2440 free(media_query_list
);
2441 return map_nsresult(nsres
);
2443 nsres
= nsISupports_QueryInterface(nsunk
, &IID_nsIDOMMediaQueryList
, (void**)&media_query_list
->nsquerylist
);
2444 assert(NS_SUCCEEDED(nsres
));
2445 nsISupports_Release(nsunk
);
2447 nsres
= nsIDOMMediaQueryList_SetListener(media_query_list
->nsquerylist
, &media_query_list
->callback
->nsIDOMMediaQueryListListener_iface
);
2448 assert(NS_SUCCEEDED(nsres
));
2450 media_query_list
->IWineMSHTMLMediaQueryList_iface
.lpVtbl
= &media_query_list_vtbl
;
2451 list_init(&media_query_list
->listeners
);
2452 init_dispatch(&media_query_list
->dispex
, &media_query_list_dispex
, window
,
2453 dispex_compat_mode(&window
->event_target
.dispex
));
2455 *ret
= (IDispatch
*)&media_query_list
->IWineMSHTMLMediaQueryList_iface
;