Use WindowProxy instead of DOMWindow in our IDL
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Apr 2018 22:11:00 +0000 (22:11 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Apr 2018 22:11:00 +0000 (22:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=185022

Reviewed by Sam Weinig.

Source/WebCore:

Stop using DOMWindow in all of our IDL files and use WindowProxy as
per their respective specifications. As a result, the implementation
as also updated to use WindowProxy type instead of DOMWindow.

* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMConvertWindowProxy.h: Removed.
* bindings/js/JSWindowProxy.cpp:
(WebCore::JSWindowProxy::windowProxy const):
(WebCore::JSWindowProxy::toWrapped):
* bindings/js/JSWindowProxy.h:
(WebCore::window):
Use static_cast<>() instead of jsCast<>() because jsCast<>()
relies on classInfo() which is not allowed to be called during
JS sweep due to an assertion inside classInfo(). The JSWindowProxy
objects are held strongly by the WindowProxy so we know the JSWindowProxy
object is not getting destroyed here.

(WebCore::toJS):
* bindings/js/WindowProxy.cpp:
(WebCore::WindowProxy::globalObject):
* bindings/js/WindowProxy.h:
(WebCore::WindowProxy::frame const):
* bindings/scripts/CodeGenerator.pm:
(IsBuiltinType):
(ComputeIsCallbackInterface):
(ComputeIsCallbackFunction):
* bindings/scripts/CodeGeneratorJS.pm:
(AddToIncludesForIDLType):
(GetBaseIDLType):
(NativeToJSValueDOMConvertNeedsState):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod9Body):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
* bindings/scripts/test/TestObj.idl:
* dom/CompositionEvent.cpp:
(WebCore::CompositionEvent::CompositionEvent):
(WebCore::CompositionEvent::initCompositionEvent):
* dom/CompositionEvent.h:
* dom/CompositionEvent.idl:
* dom/Document.cpp:
(WebCore::Document::defaultView const):
* dom/Document.h:
* dom/Document.idl:
* dom/DocumentTouch.cpp:
(WebCore::DocumentTouch::createTouch):
* dom/DocumentTouch.h:
* dom/DocumentTouch.idl:
* dom/FocusEvent.cpp:
(WebCore::FocusEvent::FocusEvent):
* dom/FocusEvent.h:
* dom/InputEvent.cpp:
(WebCore::InputEvent::create):
(WebCore::InputEvent::InputEvent):
* dom/InputEvent.h:
* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
(WebCore::KeyboardEvent::create):
(WebCore::KeyboardEvent::initKeyboardEvent):
(WebCore::KeyboardEvent::charCode const):
* dom/KeyboardEvent.h:
* dom/KeyboardEvent.idl:
* dom/MessageEvent.h:
* dom/MessageEvent.idl:
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::create):
(WebCore::MouseEvent::MouseEvent):
(WebCore::MouseEvent::initMouseEvent):
(WebCore::MouseEvent::initMouseEventQuirk):
* dom/MouseEvent.h:
* dom/MouseEvent.idl:
* dom/MouseRelatedEvent.cpp:
(WebCore::MouseRelatedEvent::MouseRelatedEvent):
(WebCore::MouseRelatedEvent::init):
(WebCore::MouseRelatedEvent::frameViewFromWindowProxy):
(WebCore::MouseRelatedEvent::initCoordinates):
(WebCore::MouseRelatedEvent::documentToAbsoluteScaleFactor const):
(WebCore::MouseRelatedEvent::computePageLocation):
(WebCore::MouseRelatedEvent::locationInRootViewCoordinates const):
* dom/MouseRelatedEvent.h:
* dom/Node.cpp:
* dom/SimulatedClick.cpp:
* dom/TextEvent.cpp:
(WebCore::TextEvent::create):
(WebCore::TextEvent::createForPlainTextPaste):
(WebCore::TextEvent::createForFragmentPaste):
(WebCore::TextEvent::createForDrop):
(WebCore::TextEvent::createForDictation):
(WebCore::TextEvent::TextEvent):
(WebCore::TextEvent::initTextEvent):
* dom/TextEvent.h:
* dom/TextEvent.idl:
* dom/TouchEvent.idl:
* dom/UIEvent.cpp:
(WebCore::UIEvent::UIEvent):
(WebCore::UIEvent::initUIEvent):
* dom/UIEvent.h:
(WebCore::UIEvent::create):
(WebCore::UIEvent::view const):
* dom/UIEvent.idl:
* dom/UIEventInit.h:
* dom/UIEventInit.idl:
* dom/UIEventWithKeyState.h:
(WebCore::UIEventWithKeyState::UIEventWithKeyState):
* dom/WheelEvent.cpp:
(WebCore::WheelEvent::WheelEvent):
(WebCore::WheelEvent::create):
(WebCore::WheelEvent::initWebKitWheelEvent):
* dom/WheelEvent.h:
* dom/WheelEvent.idl:
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::insertDictatedText):
* editing/Editor.cpp:
(WebCore::Editor::pasteAsPlainText):
(WebCore::Editor::pasteAsFragment):
(WebCore::Editor::setComposition):
* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::namedItem):
* html/HTMLDocument.h:
* html/HTMLDocument.idl:
* html/HTMLFrameElement.idl:
* html/HTMLFrameOwnerElement.cpp:
(WebCore::HTMLFrameOwnerElement::contentWindow const):
* html/HTMLFrameOwnerElement.h:
* html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::namedItem):
* html/HTMLFrameSetElement.h:
* html/HTMLFrameSetElement.idl:
* html/HTMLIFrameElement.idl:
* html/ImageDocument.cpp:
* page/DOMWindow.cpp:
(WebCore::PostMessageTimer::PostMessageTimer):
(WebCore::PostMessageTimer::event):
(WebCore::DOMWindow::postMessage):
* page/DragController.cpp:
(WebCore::DragController::dispatchTextInputEventFor):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleTextInputEvent):

Source/WebKitLegacy/mac:

* DOM/DOMAbstractView.mm:
(kit):
(toWindowProxy):
* DOM/DOMAbstractViewInternal.h:
* DOM/DOMDocument.mm:
(-[DOMDocument defaultView]):
(-[DOMDocument getComputedStyle:pseudoElement:]):
(-[DOMDocument getMatchedCSSRules:pseudoElement:authorOnly:]):
* DOM/DOMHTMLFrameElement.mm:
(-[DOMHTMLFrameElement contentWindow]):
* DOM/DOMHTMLIFrameElement.mm:
(-[DOMHTMLIFrameElement contentWindow]):
* DOM/DOMKeyboardEvent.mm:
(-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:location:ctrlKey:altKey:shiftKey:metaKey:altGraphKey:]):
(-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:location:ctrlKey:altKey:shiftKey:metaKey:]):
(-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:keyLocation:ctrlKey:altKey:shiftKey:metaKey:altGraphKey:]):
(-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:keyLocation:ctrlKey:altKey:shiftKey:metaKey:]):
* DOM/DOMMouseEvent.mm:
(-[DOMMouseEvent initMouseEvent:canBubble:cancelable:view:detail:screenX:screenY:clientX:clientY:ctrlKey:altKey:shiftKey:metaKey:button:relatedTarget:]):
* DOM/DOMTextEvent.mm:
(-[DOMTextEvent initTextEvent:canBubbleArg:cancelableArg:viewArg:dataArg:]):
* DOM/DOMUIEvent.mm:
(-[DOMUIEvent view]):
(-[DOMUIEvent initUIEvent:canBubble:cancelable:view:detail:]):
* DOM/DOMWheelEvent.mm:
(-[DOMWheelEvent initWheelEvent:wheelDeltaY:view:screenX:screenY:clientX:clientY:ctrlKey:altKey:shiftKey:metaKey:]):

Source/WebKitLegacy/win:

* DOMCoreClasses.cpp:
(DOMDocument::getComputedStyle):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@231114 268f45cc-cd09-0410-ab3c-d52691b4dbfc

92 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/IDLTypes.h
Source/WebCore/bindings/js/JSDOMConvertWindowProxy.h [deleted file]
Source/WebCore/bindings/js/JSWindowProxy.cpp
Source/WebCore/bindings/js/JSWindowProxy.h
Source/WebCore/bindings/js/WindowProxy.cpp
Source/WebCore/bindings/js/WindowProxy.h
Source/WebCore/bindings/scripts/CodeGenerator.pm
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/TestObj.idl
Source/WebCore/dom/CompositionEvent.cpp
Source/WebCore/dom/CompositionEvent.h
Source/WebCore/dom/CompositionEvent.idl
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Document.idl
Source/WebCore/dom/DocumentTouch.cpp
Source/WebCore/dom/DocumentTouch.h
Source/WebCore/dom/DocumentTouch.idl
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/FocusEvent.cpp
Source/WebCore/dom/FocusEvent.h
Source/WebCore/dom/InputEvent.cpp
Source/WebCore/dom/InputEvent.h
Source/WebCore/dom/KeyboardEvent.cpp
Source/WebCore/dom/KeyboardEvent.h
Source/WebCore/dom/KeyboardEvent.idl
Source/WebCore/dom/MessageEvent.h
Source/WebCore/dom/MessageEvent.idl
Source/WebCore/dom/MouseEvent.cpp
Source/WebCore/dom/MouseEvent.h
Source/WebCore/dom/MouseEvent.idl
Source/WebCore/dom/MouseRelatedEvent.cpp
Source/WebCore/dom/MouseRelatedEvent.h
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/SimulatedClick.cpp
Source/WebCore/dom/TextEvent.cpp
Source/WebCore/dom/TextEvent.h
Source/WebCore/dom/TextEvent.idl
Source/WebCore/dom/TouchEvent.cpp
Source/WebCore/dom/TouchEvent.h
Source/WebCore/dom/TouchEvent.idl
Source/WebCore/dom/UIEvent.cpp
Source/WebCore/dom/UIEvent.h
Source/WebCore/dom/UIEvent.idl
Source/WebCore/dom/UIEventInit.h
Source/WebCore/dom/UIEventInit.idl
Source/WebCore/dom/UIEventWithKeyState.h
Source/WebCore/dom/WheelEvent.cpp
Source/WebCore/dom/WheelEvent.h
Source/WebCore/dom/WheelEvent.idl
Source/WebCore/editing/AlternativeTextController.cpp
Source/WebCore/editing/Editor.cpp
Source/WebCore/html/HTMLDocument.cpp
Source/WebCore/html/HTMLDocument.h
Source/WebCore/html/HTMLDocument.idl
Source/WebCore/html/HTMLFrameElement.idl
Source/WebCore/html/HTMLFrameOwnerElement.cpp
Source/WebCore/html/HTMLFrameOwnerElement.h
Source/WebCore/html/HTMLFrameSetElement.cpp
Source/WebCore/html/HTMLFrameSetElement.h
Source/WebCore/html/HTMLFrameSetElement.idl
Source/WebCore/html/HTMLIFrameElement.idl
Source/WebCore/html/ImageDocument.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DragController.cpp
Source/WebCore/page/EventHandler.cpp
Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp
Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindowPrivate.h
Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp
Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameElement.cpp
Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLIFrameElement.cpp
Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMKeyboardEvent.cpp
Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMouseEvent.cpp
Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.cpp
Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMWheelEvent.cpp
Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/DOM/DOMAbstractView.mm
Source/WebKitLegacy/mac/DOM/DOMAbstractViewInternal.h
Source/WebKitLegacy/mac/DOM/DOMDocument.mm
Source/WebKitLegacy/mac/DOM/DOMKeyboardEvent.mm
Source/WebKitLegacy/mac/DOM/DOMMouseEvent.mm
Source/WebKitLegacy/mac/DOM/DOMTextEvent.mm
Source/WebKitLegacy/mac/DOM/DOMUIEvent.mm
Source/WebKitLegacy/mac/DOM/DOMWheelEvent.mm
Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/DOMCoreClasses.cpp

index ac2119a..655d0a1 100644 (file)
@@ -1,3 +1,148 @@
+2018-04-27  Chris Dumez  <cdumez@apple.com>
+
+        Use WindowProxy instead of DOMWindow in our IDL
+        https://bugs.webkit.org/show_bug.cgi?id=185022
+
+        Reviewed by Sam Weinig.
+
+        Stop using DOMWindow in all of our IDL files and use WindowProxy as
+        per their respective specifications. As a result, the implementation
+        as also updated to use WindowProxy type instead of DOMWindow.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSDOMConvertWindowProxy.h: Removed.
+        * bindings/js/JSWindowProxy.cpp:
+        (WebCore::JSWindowProxy::windowProxy const):
+        (WebCore::JSWindowProxy::toWrapped):
+        * bindings/js/JSWindowProxy.h:
+        (WebCore::window):
+        Use static_cast<>() instead of jsCast<>() because jsCast<>()
+        relies on classInfo() which is not allowed to be called during
+        JS sweep due to an assertion inside classInfo(). The JSWindowProxy
+        objects are held strongly by the WindowProxy so we know the JSWindowProxy
+        object is not getting destroyed here.
+
+        (WebCore::toJS):
+        * bindings/js/WindowProxy.cpp:
+        (WebCore::WindowProxy::globalObject):
+        * bindings/js/WindowProxy.h:
+        (WebCore::WindowProxy::frame const):
+        * bindings/scripts/CodeGenerator.pm:
+        (IsBuiltinType):
+        (ComputeIsCallbackInterface):
+        (ComputeIsCallbackFunction):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (AddToIncludesForIDLType):
+        (GetBaseIDLType):
+        (NativeToJSValueDOMConvertNeedsState):
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9Body):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
+        * bindings/scripts/test/TestObj.idl:
+        * dom/CompositionEvent.cpp:
+        (WebCore::CompositionEvent::CompositionEvent):
+        (WebCore::CompositionEvent::initCompositionEvent):
+        * dom/CompositionEvent.h:
+        * dom/CompositionEvent.idl:
+        * dom/Document.cpp:
+        (WebCore::Document::defaultView const):
+        * dom/Document.h:
+        * dom/Document.idl:
+        * dom/DocumentTouch.cpp:
+        (WebCore::DocumentTouch::createTouch):
+        * dom/DocumentTouch.h:
+        * dom/DocumentTouch.idl:
+        * dom/FocusEvent.cpp:
+        (WebCore::FocusEvent::FocusEvent):
+        * dom/FocusEvent.h:
+        * dom/InputEvent.cpp:
+        (WebCore::InputEvent::create):
+        (WebCore::InputEvent::InputEvent):
+        * dom/InputEvent.h:
+        * dom/KeyboardEvent.cpp:
+        (WebCore::KeyboardEvent::KeyboardEvent):
+        (WebCore::KeyboardEvent::create):
+        (WebCore::KeyboardEvent::initKeyboardEvent):
+        (WebCore::KeyboardEvent::charCode const):
+        * dom/KeyboardEvent.h:
+        * dom/KeyboardEvent.idl:
+        * dom/MessageEvent.h:
+        * dom/MessageEvent.idl:
+        * dom/MouseEvent.cpp:
+        (WebCore::MouseEvent::create):
+        (WebCore::MouseEvent::MouseEvent):
+        (WebCore::MouseEvent::initMouseEvent):
+        (WebCore::MouseEvent::initMouseEventQuirk):
+        * dom/MouseEvent.h:
+        * dom/MouseEvent.idl:
+        * dom/MouseRelatedEvent.cpp:
+        (WebCore::MouseRelatedEvent::MouseRelatedEvent):
+        (WebCore::MouseRelatedEvent::init):
+        (WebCore::MouseRelatedEvent::frameViewFromWindowProxy):
+        (WebCore::MouseRelatedEvent::initCoordinates):
+        (WebCore::MouseRelatedEvent::documentToAbsoluteScaleFactor const):
+        (WebCore::MouseRelatedEvent::computePageLocation):
+        (WebCore::MouseRelatedEvent::locationInRootViewCoordinates const):
+        * dom/MouseRelatedEvent.h:
+        * dom/Node.cpp:
+        * dom/SimulatedClick.cpp:
+        * dom/TextEvent.cpp:
+        (WebCore::TextEvent::create):
+        (WebCore::TextEvent::createForPlainTextPaste):
+        (WebCore::TextEvent::createForFragmentPaste):
+        (WebCore::TextEvent::createForDrop):
+        (WebCore::TextEvent::createForDictation):
+        (WebCore::TextEvent::TextEvent):
+        (WebCore::TextEvent::initTextEvent):
+        * dom/TextEvent.h:
+        * dom/TextEvent.idl:
+        * dom/TouchEvent.idl:
+        * dom/UIEvent.cpp:
+        (WebCore::UIEvent::UIEvent):
+        (WebCore::UIEvent::initUIEvent):
+        * dom/UIEvent.h:
+        (WebCore::UIEvent::create):
+        (WebCore::UIEvent::view const):
+        * dom/UIEvent.idl:
+        * dom/UIEventInit.h:
+        * dom/UIEventInit.idl:
+        * dom/UIEventWithKeyState.h:
+        (WebCore::UIEventWithKeyState::UIEventWithKeyState):
+        * dom/WheelEvent.cpp:
+        (WebCore::WheelEvent::WheelEvent):
+        (WebCore::WheelEvent::create):
+        (WebCore::WheelEvent::initWebKitWheelEvent):
+        * dom/WheelEvent.h:
+        * dom/WheelEvent.idl:
+        * editing/AlternativeTextController.cpp:
+        (WebCore::AlternativeTextController::insertDictatedText):
+        * editing/Editor.cpp:
+        (WebCore::Editor::pasteAsPlainText):
+        (WebCore::Editor::pasteAsFragment):
+        (WebCore::Editor::setComposition):
+        * html/HTMLDocument.cpp:
+        (WebCore::HTMLDocument::namedItem):
+        * html/HTMLDocument.h:
+        * html/HTMLDocument.idl:
+        * html/HTMLFrameElement.idl:
+        * html/HTMLFrameOwnerElement.cpp:
+        (WebCore::HTMLFrameOwnerElement::contentWindow const):
+        * html/HTMLFrameOwnerElement.h:
+        * html/HTMLFrameSetElement.cpp:
+        (WebCore::HTMLFrameSetElement::namedItem):
+        * html/HTMLFrameSetElement.h:
+        * html/HTMLFrameSetElement.idl:
+        * html/HTMLIFrameElement.idl:
+        * html/ImageDocument.cpp:
+        * page/DOMWindow.cpp:
+        (WebCore::PostMessageTimer::PostMessageTimer):
+        (WebCore::PostMessageTimer::event):
+        (WebCore::DOMWindow::postMessage):
+        * page/DragController.cpp:
+        (WebCore::DragController::dispatchTextInputEventFor):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleTextInputEvent):
+
 2018-04-27  Nan Wang  <n_wang@apple.com>
 
         AX: Accessibility needs to know which part of the content view is visible on iOS
index 334bd27..f27ed18 100644 (file)
                83B2D1751B8BCD6A00A02E47 /* NativeNodeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E959E11B8BC22B004D9385 /* NativeNodeFilter.h */; settings = {ATTRIBUTES = (Private, ); }; };
                83B74EF61F3E0BF200996BC7 /* KeepaliveRequestTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B74EF31F3E0BD700996BC7 /* KeepaliveRequestTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
                83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */; };
-               83B9E70B2086BA4300E5D756 /* JSDOMConvertWindowProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B9E7092086BA2700E5D756 /* JSDOMConvertWindowProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };
                83BB5C881D5D6F45005A71F4 /* AllDescendantsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BB5C871D5D6F3A005A71F4 /* AllDescendantsCollection.h */; };
                83C05A5B1A686212007E5DEA /* StylePropertyShorthandFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */; };
                83C1D425178D5AB400141E68 /* SVGPathSegArcAbs.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C1D413178D5AB400141E68 /* SVGPathSegArcAbs.h */; };
                83B74EF21F3E0BD700996BC7 /* KeepaliveRequestTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeepaliveRequestTracker.cpp; sourceTree = "<group>"; };
                83B74EF31F3E0BD700996BC7 /* KeepaliveRequestTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeepaliveRequestTracker.h; sourceTree = "<group>"; };
                83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderConverter.h; sourceTree = "<group>"; };
-               83B9E7092086BA2700E5D756 /* JSDOMConvertWindowProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMConvertWindowProxy.h; sourceTree = "<group>"; };
                83BB5C871D5D6F3A005A71F4 /* AllDescendantsCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllDescendantsCollection.h; sourceTree = "<group>"; };
                83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StylePropertyShorthandFunctions.cpp; sourceTree = "<group>"; };
                83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StylePropertyShorthandFunctions.h; sourceTree = "<group>"; };
                                7C8E34AA1E4A338E0054CE23 /* JSDOMConvertVariadic.h */,
                                7CBA5BA61F0B4BDE0034D745 /* JSDOMConvertWebGL.cpp */,
                                7C8E34AB1E4A338E0054CE23 /* JSDOMConvertWebGL.h */,
-                               83B9E7092086BA2700E5D756 /* JSDOMConvertWindowProxy.h */,
                                7C8E34AC1E4A338E0054CE23 /* JSDOMConvertXPathNSResolver.h */,
                        );
                        name = Conversions;
                                7C8E34C41E4A33B00054CE23 /* JSDOMConvertUnion.h in Headers */,
                                7C8E34C51E4A33B00054CE23 /* JSDOMConvertVariadic.h in Headers */,
                                7C8E34C61E4A33B00054CE23 /* JSDOMConvertWebGL.h in Headers */,
-                               83B9E70B2086BA4300E5D756 /* JSDOMConvertWindowProxy.h in Headers */,
                                7C8E34C71E4A33B00054CE23 /* JSDOMConvertXPathNSResolver.h in Headers */,
                                FC9E0E4D16419C1E00392BE3 /* JSDOMCSSNamespace.h in Headers */,
                                BC60D7C10D29A46300B9918F /* JSDOMException.h in Headers */,
index 5fe77e8..8057dfa 100644 (file)
@@ -274,7 +274,6 @@ struct IDLScheduledAction : IDLType<std::unique_ptr<ScheduledAction>> { };
 template<typename T> struct IDLSerializedScriptValue : IDLWrapper<T> { };
 template<typename T> struct IDLEventListener : IDLWrapper<T> { };
 template<typename T> struct IDLXPathNSResolver : IDLWrapper<T> { };
-struct IDLWindowProxy : IDLWrapper<JSWindowProxy> { };
 
 struct IDLIDBKey : IDLWrapper<IDBKey> { };
 struct IDLIDBKeyData : IDLWrapper<IDBKeyData> { };
diff --git a/Source/WebCore/bindings/js/JSDOMConvertWindowProxy.h b/Source/WebCore/bindings/js/JSDOMConvertWindowProxy.h
deleted file mode 100644 (file)
index 82c1ff4..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "IDLTypes.h"
-#include "JSDOMConvertBase.h"
-#include "JSWindowProxy.h"
-
-namespace WebCore {
-
-template<> struct JSConverter<IDLWindowProxy> {
-    static constexpr bool needsState = true;
-    static constexpr bool needsGlobalObject = false;
-
-    template <typename U>
-    static JSC::JSValue convert(JSC::ExecState& state, U&& value)
-    {
-        return toJS(&state, std::forward<U>(value));
-    }
-};
-
-}
index 188671e..a4b1805 100644 (file)
@@ -119,6 +119,12 @@ void JSWindowProxy::setWindow(AbstractDOMWindow& domWindow)
     ASSERT(prototype->globalObject() == window);
 }
 
+WindowProxy* JSWindowProxy::windowProxy() const
+{
+    auto& window = wrapped();
+    return window.frame() ? &window.frame()->windowProxy() : nullptr;
+}
+
 void JSWindowProxy::attachDebugger(JSC::Debugger* debugger)
 {
     auto* globalObject = window();
@@ -138,12 +144,6 @@ AbstractDOMWindow& JSWindowProxy::wrapped() const
     return jsCast<JSDOMWindowBase*>(window)->wrapped();
 }
 
-AbstractDOMWindow* JSWindowProxy::toWrapped(VM& vm, JSObject* value)
-{
-    auto* wrapper = jsDynamicCast<JSWindowProxy*>(vm, value);
-    return wrapper ? &wrapper->wrapped() : nullptr;
-}
-
 JSValue toJS(ExecState* state, WindowProxy& windowProxy)
 {
     return &windowProxy.jsWindowProxy(currentWorld(*state));
@@ -154,4 +154,14 @@ JSWindowProxy& toJSWindowProxy(WindowProxy& windowProxy, DOMWrapperWorld& world)
     return windowProxy.jsWindowProxy(world);
 }
 
+WindowProxy* JSWindowProxy::toWrapped(VM& vm, JSValue value)
+{
+    if (!value.isObject())
+        return nullptr;
+    JSObject* object = asObject(value);
+    if (object->inherits<JSWindowProxy>(vm))
+        return jsCast<JSWindowProxy*>(object)->windowProxy();
+    return nullptr;
+}
+
 } // namespace WebCore
index 185a545..e6f171c 100644 (file)
@@ -28,7 +28,9 @@
 
 #pragma once
 
+#include "JSDOMConvertInterface.h"
 #include "JSDOMWindow.h"
+#include "WindowProxy.h"
 #include <JavaScriptCore/JSProxy.h>
 
 namespace JSC {
@@ -39,7 +41,6 @@ namespace WebCore {
 
 class AbstractDOMWindow;
 class AbstractFrame;
-class WindowProxy;
 
 class JSWindowProxy final : public JSC::JSProxy {
     using Base = JSC::JSProxy;
@@ -49,12 +50,14 @@ public:
 
     DECLARE_INFO;
 
-    JSDOMGlobalObject* window() const { return JSC::jsCast<JSDOMGlobalObject*>(target()); }
+    JSDOMGlobalObject* window() const { return static_cast<JSDOMGlobalObject*>(target()); }
     void setWindow(JSC::VM&, JSDOMGlobalObject&);
     void setWindow(AbstractDOMWindow&);
 
+    WindowProxy* windowProxy() const;
+
     AbstractDOMWindow& wrapped() const;
-    static WEBCORE_EXPORT AbstractDOMWindow* toWrapped(JSC::VM&, JSC::JSObject*);
+    static WEBCORE_EXPORT WindowProxy* toWrapped(JSC::VM&, JSC::JSValue);
 
     DOMWrapperWorld& world() { return m_world; }
 
@@ -71,10 +74,16 @@ private:
 // It is, however, strongly owned by AbstractFrame via its WindowProxy, so we can get one from a WindowProxy.
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, WindowProxy&);
 inline JSC::JSValue toJS(JSC::ExecState* state, WindowProxy* windowProxy) { return windowProxy ? toJS(state, *windowProxy) : JSC::jsNull(); }
-inline JSC::JSValue toJS(JSC::ExecState* state, const RefPtr<WindowProxy>& windowProxy) { return toJS(state, windowProxy.get()); }
+inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject*, WindowProxy& windowProxy) { return toJS(state, windowProxy); }
+inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, WindowProxy* windowProxy) { return windowProxy ? toJS(state, globalObject, *windowProxy) : JSC::jsNull(); }
 
 JSWindowProxy& toJSWindowProxy(WindowProxy&, DOMWrapperWorld&);
 inline JSWindowProxy* toJSWindowProxy(WindowProxy* windowProxy, DOMWrapperWorld& world) { return windowProxy ? &toJSWindowProxy(*windowProxy, world) : nullptr; }
 
 
+template<> struct JSDOMWrapperConverterTraits<WindowProxy> {
+    using WrapperClass = JSWindowProxy;
+    using ToWrappedReturnType = WindowProxy*;
+};
+
 } // namespace WebCore
index 8e8f513..9018d23 100644 (file)
@@ -24,6 +24,7 @@
 #include "CommonVM.h"
 #include "Frame.h"
 #include "GCController.h"
+#include "JSWindowProxy.h"
 #include "Page.h"
 #include "PageConsoleClient.h"
 #include "PageGroup.h"
@@ -91,6 +92,11 @@ Vector<JSC::Strong<JSWindowProxy>> WindowProxy::jsWindowProxiesAsVector() const
     return copyToVector(m_jsWindowProxies.values());
 }
 
+JSDOMGlobalObject* WindowProxy::globalObject(DOMWrapperWorld& world)
+{
+    return jsWindowProxy(world).window();
+}
+
 JSWindowProxy& WindowProxy::createJSWindowProxyWithInitializedScript(DOMWrapperWorld& world)
 {
     JSLockHolder lock(world.vm());
index 7772298..11f0224 100644 (file)
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include "JSWindowProxy.h"
+#include "DOMWrapperWorld.h"
 #include <JavaScriptCore/Strong.h>
 #include <wtf/HashMap.h>
 
@@ -30,7 +30,10 @@ class Debugger;
 
 namespace WebCore {
 
+class AbstractDOMWindow;
 class AbstractFrame;
+class JSDOMGlobalObject;
+class JSWindowProxy;
 
 class WindowProxy {
     WTF_MAKE_FAST_ALLOCATED;
@@ -40,6 +43,8 @@ public:
     explicit WindowProxy(AbstractFrame&);
     ~WindowProxy();
 
+    AbstractFrame& frame() const { return m_frame; }
+
     void destroyJSWindowProxy(DOMWrapperWorld&);
 
     ProxyMap::ValuesConstIteratorRange jsWindowProxies() const { return m_jsWindowProxies.values(); }
@@ -63,10 +68,7 @@ public:
         return (it != m_jsWindowProxies.end()) ? it->value.get() : nullptr;
     }
 
-    JSDOMGlobalObject* globalObject(DOMWrapperWorld& world)
-    {
-        return jsWindowProxy(world).window();
-    }
+    WEBCORE_EXPORT JSDOMGlobalObject* globalObject(DOMWrapperWorld&);
 
     void clearJSWindowProxiesNotMatchingDOMWindow(AbstractDOMWindow*, bool goingIntoPageCache);
 
index 952429a..2fcfee3 100644 (file)
@@ -891,7 +891,6 @@ sub IsBuiltinType
     return 1 if $type->name eq "XPathNSResolver";
     return 1 if $type->name eq "any";
     return 1 if $type->name eq "object";
-    return 1 if $type->name eq "WindowProxy";
 
     return 0;
 }
@@ -1001,6 +1000,7 @@ sub ComputeIsCallbackInterface
     assert("Not a type") if ref($type) ne "IDLType";
 
     return 0 unless $object->IsInterfaceType($type);
+    return 0 if $type->name eq "WindowProxy";
 
     my $typeName = $type->name;
     my $idlFile = $object->IDLFileForInterface($typeName) or assert("Could NOT find IDL file for interface \"$typeName\"!\n");
@@ -1038,6 +1038,7 @@ sub ComputeIsCallbackFunction
     assert("Not a type") if ref($type) ne "IDLType";
 
     return 0 unless $object->IsInterfaceType($type);
+    return 0 if $type->name eq "WindowProxy";
 
     my $typeName = $type->name;
     my $idlFile = $object->IDLFileForInterface($typeName) or assert("Could NOT find IDL file for interface \"$typeName\"!\n");
index 626a9f0..30a374c 100644 (file)
@@ -421,13 +421,6 @@ sub AddToIncludesForIDLType
         return;
     }
 
-    if ($type->name eq "WindowProxy") {
-        AddToIncludes("WindowProxy.h", $includesRef, $conditional);
-        AddToIncludes("JSWindowProxy.h", $includesRef, $conditional);
-        AddToIncludes("JSDOMConvertWindowProxy.h", $includesRef, $conditional);
-        return;
-    }
-
     if ($codeGenerator->IsStringType($type)) {
         AddToIncludes("JSDOMConvertStrings.h", $includesRef, $conditional);
         return;
@@ -6393,7 +6386,6 @@ sub GetBaseIDLType
         "JSON" => "IDLJSON",
         "ScheduledAction" => "IDLScheduledAction",
         "SerializedScriptValue" => "IDLSerializedScriptValue<SerializedScriptValue>",
-        "WindowProxy" => "IDLWindowProxy",
         "XPathNSResolver" => "IDLXPathNSResolver<XPathNSResolver>",
     );
 
@@ -6554,7 +6546,6 @@ sub NativeToJSValueDOMConvertNeedsState
     return 1 if $type->name eq "JSON";
     return 1 if $type->name eq "SerializedScriptValue";
     return 1 if $type->name eq "XPathNSResolver";
-    return 1 if $type->name eq "WindowProxy";
     
     return 0;
 }
index ba45bb9..c0466c2 100644 (file)
@@ -55,7 +55,6 @@
 #include "JSDOMOperation.h"
 #include "JSDOMOperationReturningPromise.h"
 #include "JSDOMStringList.h"
-#include "JSDOMWindow.h"
 #include "JSDOMWindowBase.h"
 #include "JSDOMWrapperCache.h"
 #include "JSDocument.h"
@@ -6957,7 +6956,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod9Bod
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    auto window = convert<IDLInterface<DOMWindow>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "window", "TestObject", "overloadedMethod", "DOMWindow"); });
+    auto window = convert<IDLInterface<WindowProxy>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "window", "TestObject", "overloadedMethod", "WindowProxy"); });
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethod(*window);
     return JSValue::encode(jsUndefined());
@@ -7029,7 +7028,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethodOver
             return jsTestObjPrototypeFunctionOverloadedMethod6Body(state, castedThis, throwScope);
         if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSTestObj>(vm))
             return jsTestObjPrototypeFunctionOverloadedMethod8Body(state, castedThis, throwScope);
-        if (distinguishingArg.isObject() && (asObject(distinguishingArg)->inherits<JSWindowProxy>(vm) || asObject(distinguishingArg)->inherits<JSDOMWindow>(vm)))
+        if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSWindowProxy>(vm))
             return jsTestObjPrototypeFunctionOverloadedMethod9Body(state, castedThis, throwScope);
         if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSBlob>(vm))
             return jsTestObjPrototypeFunctionOverloadedMethod13Body(state, castedThis, throwScope);
index c83eeee..71ddfc4 100644 (file)
@@ -286,7 +286,7 @@ enum TestConfidence { "high", "kinda-low" };
     void    overloadedMethod(DOMStringList? listArg);
     void    overloadedMethod(sequence<DOMString>? arrayArg);
     void    overloadedMethod(TestObj objArg);
-    void    overloadedMethod(DOMWindow window);
+    void    overloadedMethod(WindowProxy window);
     void    overloadedMethod(sequence<DOMString> arrayArg);
     void    overloadedMethod(sequence<unsigned long> arrayArg);
     void    overloadedMethod(DOMString strArg);
index 0e38a67..007af7d 100644 (file)
@@ -31,8 +31,8 @@ namespace WebCore {
 
 CompositionEvent::CompositionEvent() = default;
 
-CompositionEvent::CompositionEvent(const AtomicString& type, DOMWindow* view, const String& data)
-    : UIEvent(type, true, true, view, 0)
+CompositionEvent::CompositionEvent(const AtomicString& type, RefPtr<WindowProxy>&& view, const String& data)
+    : UIEvent(type, true, true, WTFMove(view), 0)
     , m_data(data)
 {
 }
@@ -45,12 +45,12 @@ CompositionEvent::CompositionEvent(const AtomicString& type, const Init& initial
 
 CompositionEvent::~CompositionEvent() = default;
 
-void CompositionEvent::initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, const String& data)
+void CompositionEvent::initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, const String& data)
 {
     if (isBeingDispatched())
         return;
 
-    initUIEvent(type, canBubble, cancelable, view, 0);
+    initUIEvent(type, canBubble, cancelable, WTFMove(view), 0);
 
     m_data = data;
 }
index 8ff02ec..3b1c46d 100644 (file)
@@ -32,9 +32,9 @@ namespace WebCore {
 
 class CompositionEvent final : public UIEvent {
 public:
-    static Ref<CompositionEvent> create(const AtomicString& type, DOMWindow* view, const String& data)
+    static Ref<CompositionEvent> create(const AtomicString& type, RefPtr<WindowProxy>&& view, const String& data)
     {
-        return adoptRef(*new CompositionEvent(type, view, data));
+        return adoptRef(*new CompositionEvent(type, WTFMove(view), data));
     }
 
     static Ref<CompositionEvent> createForBindings()
@@ -53,7 +53,7 @@ public:
 
     virtual ~CompositionEvent();
 
-    void initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, const String& data);
+    void initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, const String& data);
 
     String data() const { return m_data; }
 
@@ -61,7 +61,7 @@ public:
 
 private:
     CompositionEvent();
-    CompositionEvent(const AtomicString& type, DOMWindow*, const String&);
+    CompositionEvent(const AtomicString& type, RefPtr<WindowProxy>&&, const String&);
     CompositionEvent(const AtomicString& type, const Init&, IsTrusted);
 
     bool isCompositionEvent() const override;
index d872408..20aac7e 100644 (file)
@@ -33,7 +33,7 @@
     void initCompositionEvent(optional DOMString typeArg = "undefined",
                               optional boolean canBubbleArg = false,
                               optional boolean cancelableArg = false,
-                              optional DOMWindow? viewArg = null,
+                              optional WindowProxy? viewArg = null,
                               optional DOMString dataArg = "undefined");
 
 };
index 08d6f5a..a995aae 100644 (file)
@@ -4280,6 +4280,13 @@ void Document::takeDOMWindowFrom(Document* document)
     ASSERT(m_domWindow->frame() == m_frame);
 }
 
+WindowProxy* Document::windowProxy() const
+{
+    if (!m_frame)
+        return nullptr;
+    return &m_frame->windowProxy();
+}
+
 Document& Document::contextDocument() const
 {
     if (m_contextDocument)
index 4381d9b..da2e749 100644 (file)
@@ -799,7 +799,7 @@ public:
 
     DOMWindow* domWindow() const { return m_domWindow.get(); }
     // In DOM Level 2, the Document's DOMWindow is called the defaultView.
-    DOMWindow* defaultView() const { return domWindow(); } 
+    WEBCORE_EXPORT WindowProxy* windowProxy() const;
 
     Document& contextDocument() const;
     void setContextDocument(Document& document) { m_contextDocument = document.createWeakPtr(); }
index 2d5baad..413e53e 100644 (file)
@@ -113,7 +113,7 @@ typedef (
     [CEReactions, CallWith=ResponsibleDocument, MayThrowException] void writeln(DOMString... text);
 
     // User interaction.
-    readonly attribute DOMWindow? defaultView;
+    [ImplementedAs=windowProxy] readonly attribute WindowProxy? defaultView;
     boolean hasFocus();
     [CEReactions] attribute DOMString designMode;
     [CEReactions] boolean execCommand(DOMString commandId, optional boolean showUI = false, optional DOMString? value = null); // FIXME: value should not be nullable.
index 3d9123d..5d126c3 100644 (file)
 
 #if ENABLE(TOUCH_EVENTS)
 
-#include "DOMWindow.h"
 #include "Document.h"
+#include "Frame.h"
 #include "Touch.h"
 #include "TouchList.h"
+#include "WindowProxy.h"
 
 namespace WebCore {
 
-Ref<Touch> DocumentTouch::createTouch(Document& document, DOMWindow* window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force)
+Ref<Touch> DocumentTouch::createTouch(Document& document, RefPtr<WindowProxy>&& window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force)
 {
+    Frame* frame;
+    if (window && is<Frame>(window->frame()))
+        frame = &downcast<Frame>(window->frame());
+    else
+        frame = document.frame();
+
     // FIXME: It's not clear from the documentation at
     // http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html
     // when this method should throw and nor is it by inspection of iOS behavior. It would be nice to verify any cases where it throws under iOS
     // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=47819
-    return Touch::create(window ? window->frame() : document.frame(), target, identifier, screenX, screenY, pageX, pageY, radiusX, radiusY, rotationAngle, force);
+    return Touch::create(frame, target, identifier, screenX, screenY, pageX, pageY, radiusX, radiusY, rotationAngle, force);
 }
 
 Ref<TouchList> DocumentTouch::createTouchList(Document&, Vector<std::reference_wrapper<Touch>>&& touches)
index e0daf50..72c4888 100644 (file)
 
 namespace WebCore {
 
-class DOMWindow;
 class Document;
 class EventTarget;
 class Touch;
 class TouchList;
+class WindowProxy;
 
 class DocumentTouch {
 public:
-    static Ref<Touch> createTouch(Document&, DOMWindow*, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force);
+    static Ref<Touch> createTouch(Document&, RefPtr<WindowProxy>&&, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force);
     static Ref<TouchList> createTouchList(Document&, Vector<std::reference_wrapper<Touch>>&&);
 };
 
index 7a27374..0489a36 100644 (file)
@@ -22,7 +22,7 @@
     Conditional=TOUCH_EVENTS
 ] partial interface Document {
     // FIXME: This has been dropped from the standard now that Touch has a constructor.
-    [NewObject] Touch createTouch(optional DOMWindow? window = null, optional EventTarget? target = null,
+    [NewObject] Touch createTouch(optional WindowProxy? window = null, optional EventTarget? target = null,
         optional long identifier = 0,
         optional long pageX = 0, optional long pageY = 0, optional long screenX = 0, optional long screenY = 0,
         optional long webkitRadiusX = 0, optional long webkitRadiusY = 0,
index 0a23263..a432397 100644 (file)
@@ -273,7 +273,7 @@ bool Element::dispatchMouseEvent(const PlatformMouseEvent& platformEvent, const
     if (isForceEvent(platformEvent) && !document().hasListenerTypeForEventType(platformEvent.type()))
         return false;
 
-    Ref<MouseEvent> mouseEvent = MouseEvent::create(eventType, document().defaultView(), platformEvent, detail, relatedTarget);
+    Ref<MouseEvent> mouseEvent = MouseEvent::create(eventType, document().windowProxy(), platformEvent, detail, relatedTarget);
 
     if (mouseEvent->type().isEmpty())
         return true; // Shouldn't happen.
@@ -304,7 +304,7 @@ bool Element::dispatchMouseEvent(const PlatformMouseEvent& platformEvent, const
 
 bool Element::dispatchWheelEvent(const PlatformWheelEvent& platformEvent)
 {
-    auto event = WheelEvent::create(platformEvent, document().defaultView());
+    auto event = WheelEvent::create(platformEvent, document().windowProxy());
 
     // Events with no deltas are important because they convey platform information about scroll gestures
     // and momentum beginning or ending. However, those events should not be sent to the DOM since some
@@ -321,7 +321,7 @@ bool Element::dispatchWheelEvent(const PlatformWheelEvent& platformEvent)
 
 bool Element::dispatchKeyEvent(const PlatformKeyboardEvent& platformEvent)
 {
-    auto event = KeyboardEvent::create(platformEvent, document().defaultView());
+    auto event = KeyboardEvent::create(platformEvent, document().windowProxy());
 
     if (Frame* frame = document().frame()) {
         if (frame->eventHandler().accessibilityPreventsEventPropagation(event))
@@ -2546,28 +2546,28 @@ void Element::dispatchFocusInEvent(const AtomicString& eventType, RefPtr<Element
 {
     ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isScriptAllowed());
     ASSERT(eventType == eventNames().focusinEvent || eventType == eventNames().DOMFocusInEvent);
-    dispatchScopedEvent(FocusEvent::create(eventType, true, false, document().defaultView(), 0, WTFMove(oldFocusedElement)));
+    dispatchScopedEvent(FocusEvent::create(eventType, true, false, document().windowProxy(), 0, WTFMove(oldFocusedElement)));
 }
 
 void Element::dispatchFocusOutEvent(const AtomicString& eventType, RefPtr<Element>&& newFocusedElement)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isScriptAllowed());
     ASSERT(eventType == eventNames().focusoutEvent || eventType == eventNames().DOMFocusOutEvent);
-    dispatchScopedEvent(FocusEvent::create(eventType, true, false, document().defaultView(), 0, WTFMove(newFocusedElement)));
+    dispatchScopedEvent(FocusEvent::create(eventType, true, false, document().windowProxy(), 0, WTFMove(newFocusedElement)));
 }
 
 void Element::dispatchFocusEvent(RefPtr<Element>&& oldFocusedElement, FocusDirection)
 {
     if (auto* page = document().page())
         page->chrome().client().elementDidFocus(*this);
-    dispatchEvent(FocusEvent::create(eventNames().focusEvent, false, false, document().defaultView(), 0, WTFMove(oldFocusedElement)));
+    dispatchEvent(FocusEvent::create(eventNames().focusEvent, false, false, document().windowProxy(), 0, WTFMove(oldFocusedElement)));
 }
 
 void Element::dispatchBlurEvent(RefPtr<Element>&& newFocusedElement)
 {
     if (auto* page = document().page())
         page->chrome().client().elementDidBlur(*this);
-    dispatchEvent(FocusEvent::create(eventNames().blurEvent, false, false, document().defaultView(), 0, WTFMove(newFocusedElement)));
+    dispatchEvent(FocusEvent::create(eventNames().blurEvent, false, false, document().windowProxy(), 0, WTFMove(newFocusedElement)));
 }
 
 void Element::dispatchWebKitImageReadyEventForTesting()
@@ -2587,7 +2587,7 @@ bool Element::dispatchMouseForceWillBegin()
         return false;
 
     PlatformMouseEvent platformMouseEvent { frame->eventHandler().lastKnownMousePosition(), frame->eventHandler().lastKnownMouseGlobalPosition(), NoButton, PlatformEvent::NoType, 1, false, false, false, false, WallTime::now(), ForceAtClick, NoTap };
-    auto mouseForceWillBeginEvent = MouseEvent::create(eventNames().webkitmouseforcewillbeginEvent, document().defaultView(), platformMouseEvent, 0, nullptr);
+    auto mouseForceWillBeginEvent = MouseEvent::create(eventNames().webkitmouseforcewillbeginEvent, document().windowProxy(), platformMouseEvent, 0, nullptr);
     mouseForceWillBeginEvent->setTarget(this);
     dispatchEvent(mouseForceWillBeginEvent);
 
index 16d8b3f..9868773 100644 (file)
@@ -40,8 +40,8 @@ bool FocusEvent::isFocusEvent() const
     return true;
 }
 
-FocusEvent::FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, RefPtr<EventTarget>&& relatedTarget)
-    : UIEvent(type, canBubble, cancelable, view, detail)
+FocusEvent::FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, RefPtr<EventTarget>&& relatedTarget)
+    : UIEvent(type, canBubble, cancelable, WTFMove(view), detail)
     , m_relatedTarget(WTFMove(relatedTarget))
 {
 }
index 0672557..c7a4df8 100644 (file)
@@ -35,9 +35,9 @@ class Node;
 
 class FocusEvent final : public UIEvent {
 public:
-    static Ref<FocusEvent> create(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, RefPtr<EventTarget>&& relatedTarget)
+    static Ref<FocusEvent> create(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, RefPtr<EventTarget>&& relatedTarget)
     {
-        return adoptRef(*new FocusEvent(type, canBubble, cancelable, view, detail, WTFMove(relatedTarget)));
+        return adoptRef(*new FocusEvent(type, canBubble, cancelable, WTFMove(view), detail, WTFMove(relatedTarget)));
     }
 
     static Ref<FocusEvent> createForBindings()
@@ -58,7 +58,7 @@ public:
 
 private:
     FocusEvent() = default;
-    FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int, RefPtr<EventTarget>&&);
+    FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, int, RefPtr<EventTarget>&&);
     FocusEvent(const AtomicString& type, const Init&, IsTrusted);
 
     EventInterface eventInterface() const final;
index d449294..c17bf18 100644 (file)
 #include "config.h"
 #include "InputEvent.h"
 
-#include "DOMWindow.h"
 #include "DataTransfer.h"
 #include "Node.h"
+#include "WindowProxy.h"
 #include <wtf/Vector.h>
 
 namespace WebCore {
 
-Ref<InputEvent> InputEvent::create(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, WebCore::DOMWindow *view, const String& data, RefPtr<DataTransfer>&& dataTransfer, const Vector<RefPtr<StaticRange>>& targetRanges, int detail)
+Ref<InputEvent> InputEvent::create(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, const String& data, RefPtr<DataTransfer>&& dataTransfer, const Vector<RefPtr<StaticRange>>& targetRanges, int detail)
 {
-    return adoptRef(*new InputEvent(eventType, inputType, canBubble, cancelable, view, data, WTFMove(dataTransfer), targetRanges, detail));
+    return adoptRef(*new InputEvent(eventType, inputType, canBubble, cancelable, WTFMove(view), data, WTFMove(dataTransfer), targetRanges, detail));
 }
 
-InputEvent::InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow* view, const String& data, RefPtr<DataTransfer>&& dataTransfer, const Vector<RefPtr<StaticRange>>& targetRanges, int detail)
-    : UIEvent(eventType, canBubble, cancelable, view, detail)
+InputEvent::InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, const String& data, RefPtr<DataTransfer>&& dataTransfer, const Vector<RefPtr<StaticRange>>& targetRanges, int detail)
+    : UIEvent(eventType, canBubble, cancelable, WTFMove(view), detail)
     , m_inputType(inputType)
     , m_data(data)
     , m_dataTransfer(dataTransfer)
index cad8dce..d050763 100644 (file)
@@ -30,8 +30,8 @@
 
 namespace WebCore {
 
-class DOMWindow;
 class DataTransfer;
+class WindowProxy;
 
 class InputEvent final : public UIEvent {
 public:
@@ -39,13 +39,13 @@ public:
         String data;
     };
 
-    static Ref<InputEvent> create(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow* view, const String& data, RefPtr<DataTransfer>&&, const Vector<RefPtr<StaticRange>>& targetRanges, int detail);
+    static Ref<InputEvent> create(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, const String& data, RefPtr<DataTransfer>&&, const Vector<RefPtr<StaticRange>>& targetRanges, int detail);
     static Ref<InputEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No)
     {
         return adoptRef(*new InputEvent(type, initializer, isTrusted));
     }
 
-    InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow*, const String& data, RefPtr<DataTransfer>&&, const Vector<RefPtr<StaticRange>>& targetRanges, int detail);
+    InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, const String& data, RefPtr<DataTransfer>&&, const Vector<RefPtr<StaticRange>>& targetRanges, int detail);
     InputEvent(const AtomicString& eventType, const Init&, IsTrusted);
 
     bool isInputEvent() const override { return true; }
index 4da1017..4acb5f4 100644 (file)
@@ -23,6 +23,7 @@
 #include "config.h"
 #include "KeyboardEvent.h"
 
+#include "DOMWindow.h"
 #include "Document.h"
 #include "Editor.h"
 #include "EventHandler.h"
@@ -92,8 +93,8 @@ static inline KeyboardEvent::KeyLocationCode keyLocationCode(const PlatformKeybo
 
 inline KeyboardEvent::KeyboardEvent() = default;
 
-inline KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, DOMWindow* view)
-    : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true, key.timestamp().approximateMonotonicTime(), view, 0, key.ctrlKey(), key.altKey(), key.shiftKey(), key.metaKey(), false, key.modifiers().contains(PlatformEvent::Modifier::CapsLockKey))
+inline KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, RefPtr<WindowProxy>&& view)
+    : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true, key.timestamp().approximateMonotonicTime(), view.copyRef(), 0, key.ctrlKey(), key.altKey(), key.shiftKey(), key.metaKey(), false, key.modifiers().contains(PlatformEvent::Modifier::CapsLockKey))
     , m_underlyingPlatformEvent(std::make_unique<PlatformKeyboardEvent>(key))
 #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
     , m_key(key.key())
@@ -104,7 +105,7 @@ inline KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, DOMWindow*
     , m_keyIdentifier(key.keyIdentifier())
     , m_location(keyLocationCode(key))
     , m_repeat(key.isAutoRepeat())
-    , m_isComposing(view && view->frame() && view->frame()->editor().hasComposition())
+    , m_isComposing(view && is<DOMWindow>(view->window()) && downcast<DOMWindow>(*view->window()).frame() && downcast<DOMWindow>(*view->window()).frame()->editor().hasComposition())
 #if USE(APPKIT)
     , m_handledByInputMethod(key.handledByInputMethod())
     , m_keypressCommands(key.commands())
@@ -132,9 +133,9 @@ inline KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const Init& i
 
 KeyboardEvent::~KeyboardEvent() = default;
 
-Ref<KeyboardEvent> KeyboardEvent::create(const PlatformKeyboardEvent& platformEvent, DOMWindow* view)
+Ref<KeyboardEvent> KeyboardEvent::create(const PlatformKeyboardEvent& platformEvent, RefPtr<WindowProxy>&& view)
 {
-    return adoptRef(*new KeyboardEvent(platformEvent, view));
+    return adoptRef(*new KeyboardEvent(platformEvent, WTFMove(view)));
 }
 
 Ref<KeyboardEvent> KeyboardEvent::createForBindings()
@@ -147,13 +148,13 @@ Ref<KeyboardEvent> KeyboardEvent::create(const AtomicString& type, const Init& i
     return adoptRef(*new KeyboardEvent(type, initializer, isTrusted));
 }
 
-void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view,
+void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view,
     const String& keyIdentifier, unsigned location, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey)
 {
     if (isBeingDispatched())
         return;
 
-    initUIEvent(type, canBubble, cancelable, view, 0);
+    initUIEvent(type, canBubble, cancelable, WTFMove(view), 0);
 
     m_keyIdentifier = keyIdentifier;
     m_location = location;
@@ -227,8 +228,9 @@ int KeyboardEvent::charCode() const
     // Firefox: 0 for keydown/keyup events, character code for keypress
     // We match Firefox, unless in backward compatibility mode, where we always return the character code.
     bool backwardCompatibilityMode = false;
-    if (view() && view()->frame())
-        backwardCompatibilityMode = view()->frame()->eventHandler().needsKeyboardEventDisambiguationQuirks();
+    auto* window = view() ? view()->window() : nullptr;
+    if (is<DOMWindow>(window) && downcast<DOMWindow>(*window).frame())
+        backwardCompatibilityMode = downcast<DOMWindow>(*window).frame()->eventHandler().needsKeyboardEventDisambiguationQuirks();
 
     if (!m_underlyingPlatformEvent || (type() != eventNames().keypressEvent && !backwardCompatibilityMode))
         return 0;
index 8210330..1d3cc24 100644 (file)
@@ -43,7 +43,7 @@ public:
         DOM_KEY_LOCATION_NUMPAD = 0x03
     };
 
-    WEBCORE_EXPORT static Ref<KeyboardEvent> create(const PlatformKeyboardEvent&, DOMWindow*);
+    WEBCORE_EXPORT static Ref<KeyboardEvent> create(const PlatformKeyboardEvent&, RefPtr<WindowProxy>&&);
     static Ref<KeyboardEvent> createForBindings();
 
     struct Init : public EventModifierInit {
@@ -65,7 +65,7 @@ public:
 
     virtual ~KeyboardEvent();
     
-    WEBCORE_EXPORT void initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*,
+    WEBCORE_EXPORT void initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&,
         const String& keyIdentifier, unsigned location,
         bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey = false);
     
@@ -102,7 +102,7 @@ public:
 
 private:
     KeyboardEvent();
-    KeyboardEvent(const PlatformKeyboardEvent&, DOMWindow*);
+    KeyboardEvent(const PlatformKeyboardEvent&, RefPtr<WindowProxy>&&);
     KeyboardEvent(const AtomicString&, const Init&, IsTrusted);
 
     std::unique_ptr<PlatformKeyboardEvent> m_underlyingPlatformEvent;
index 757c077..cde450c 100644 (file)
@@ -52,7 +52,7 @@
     // FIXME: this does not match the version in the DOM spec.
     // FIXME: Using "undefined" as default parameter value is wrong.
     void initKeyboardEvent(optional DOMString type = "undefined", optional boolean canBubble = false, optional boolean cancelable = false,
-        optional DOMWindow? view = null, optional DOMString keyIdentifier = "undefined", optional unsigned long location = 0,
+        optional WindowProxy? view = null, optional DOMString keyIdentifier = "undefined", optional unsigned long location = 0,
         optional boolean ctrlKey = false, optional boolean altKey = false, optional boolean shiftKey = false, optional boolean metaKey = false, optional boolean altGraphKey = false);
 };
 
index 5197d5b..3309278 100644 (file)
 
 #pragma once
 
-#include "DOMWindow.h"
 #include "Event.h"
 #include "JSValueInWrappedObject.h"
 #include "MessagePort.h"
 #include "SerializedScriptValue.h"
 #include "ServiceWorker.h"
+#include "WindowProxy.h"
 #include <wtf/Variant.h>
 
 namespace WebCore {
@@ -40,9 +40,9 @@ namespace WebCore {
 class Blob;
 
 #if ENABLE(SERVICE_WORKER)
-using MessageEventSource = Variant<RefPtr<DOMWindow>, RefPtr<MessagePort>, RefPtr<ServiceWorker>>;
+using MessageEventSource = Variant<RefPtr<WindowProxy>, RefPtr<MessagePort>, RefPtr<ServiceWorker>>;
 #else
-using MessageEventSource = Variant<RefPtr<DOMWindow>, RefPtr<MessagePort>>;
+using MessageEventSource = Variant<RefPtr<WindowProxy>, RefPtr<MessagePort>>;
 #endif
 
 class MessageEvent final : public Event {
index 02438fd..fa48c8f 100644 (file)
@@ -27,9 +27,9 @@
  */
 
 #if defined(ENABLE_SERVICE_WORKER) && ENABLE_SERVICE_WORKER
-typedef (DOMWindow or MessagePort or ServiceWorker) MessageEventSource;
+typedef (WindowProxy or MessagePort or ServiceWorker) MessageEventSource;
 #else
-typedef (DOMWindow or MessagePort) MessageEventSource;
+typedef (WindowProxy or MessagePort) MessageEventSource;
 #endif
 
 [
index a147e12..c896f86 100644 (file)
@@ -44,13 +44,13 @@ Ref<MouseEvent> MouseEvent::create(const AtomicString& type, const MouseEventIni
     return adoptRef(*new MouseEvent(type, initializer, isTrusted));
 }
 
-Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, DOMWindow* view, const PlatformMouseEvent& event, int detail, Node* relatedTarget)
+Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, RefPtr<WindowProxy>&& view, const PlatformMouseEvent& event, int detail, Node* relatedTarget)
 {
     bool isMouseEnterOrLeave = eventType == eventNames().mouseenterEvent || eventType == eventNames().mouseleaveEvent;
     bool isCancelable = eventType != eventNames().mousemoveEvent && !isMouseEnterOrLeave;
     bool canBubble = !isMouseEnterOrLeave;
 
-    return MouseEvent::create(eventType, canBubble, isCancelable, event.timestamp().approximateMonotonicTime(), view,
+    return MouseEvent::create(eventType, canBubble, isCancelable, event.timestamp().approximateMonotonicTime(), WTFMove(view),
         detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
 #if ENABLE(POINTER_LOCK)
         event.movementDelta().x(), event.movementDelta().y(),
@@ -59,13 +59,13 @@ Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, DOMWindow* vie
         relatedTarget, event.force(), event.syntheticClickType());
 }
 
-Ref<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow* view, int detail, int screenX, int screenY, int pageX, int pageY,
+Ref<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail, int screenX, int screenY, int pageX, int pageY,
 #if ENABLE(POINTER_LOCK)
     int movementX, int movementY,
 #endif
     bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, bool isSimulated)
 {
-    return adoptRef(*new MouseEvent(type, canBubble, cancelable, timestamp, view,
+    return adoptRef(*new MouseEvent(type, canBubble, cancelable, timestamp, WTFMove(view),
         detail, { screenX, screenY }, { pageX, pageY },
 #if ENABLE(POINTER_LOCK)
         { movementX, movementY },
@@ -73,19 +73,19 @@ Ref<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, boo
         ctrlKey, altKey, shiftKey, metaKey, button, buttons, relatedTarget, force, syntheticClickType, dataTransfer, isSimulated));
 }
 
-Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget)
+Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget)
 {
-    return adoptRef(*new MouseEvent(eventType, canBubble, cancelable, view, detail, { screenX, screenY }, { clientX, clientY }, ctrlKey, altKey, shiftKey, metaKey, button, buttons, syntheticClickType, relatedTarget));
+    return adoptRef(*new MouseEvent(eventType, canBubble, cancelable, WTFMove(view), detail, { screenX, screenY }, { clientX, clientY }, ctrlKey, altKey, shiftKey, metaKey, button, buttons, syntheticClickType, relatedTarget));
 }
 
 MouseEvent::MouseEvent() = default;
 
-MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow* view, int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
+MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
 #if ENABLE(POINTER_LOCK)
         const IntPoint& movementDelta,
 #endif
         bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, bool isSimulated)
-    : MouseRelatedEvent(eventType, canBubble, cancelable, timestamp, view, detail, screenLocation, windowLocation,
+    : MouseRelatedEvent(eventType, canBubble, cancelable, timestamp, WTFMove(view), detail, screenLocation, windowLocation,
 #if ENABLE(POINTER_LOCK)
         movementDelta,
 #endif
@@ -100,8 +100,8 @@ MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance
 {
 }
 
-MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow* view, int detail, const IntPoint& screenLocation, const IntPoint& clientLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget)
-    : MouseRelatedEvent(eventType, canBubble, cancelable, MonotonicTime::now(), view, detail, screenLocation, { },
+MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, const IntPoint& screenLocation, const IntPoint& clientLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget)
+    : MouseRelatedEvent(eventType, canBubble, cancelable, MonotonicTime::now(), WTFMove(view), detail, screenLocation, { },
 #if ENABLE(POINTER_LOCK)
         { },
 #endif
@@ -127,12 +127,12 @@ MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init
 
 MouseEvent::~MouseEvent() = default;
 
-void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget)
+void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget)
 {
     if (isBeingDispatched())
         return;
 
-    initUIEvent(type, canBubble, cancelable, view, detail);
+    initUIEvent(type, canBubble, cancelable, WTFMove(view), detail);
 
     m_screenLocation = IntPoint(screenX, screenY);
     m_ctrlKey = ctrlKey;
@@ -152,7 +152,7 @@ void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool c
 
 // FIXME: We need this quirk because iAd Producer is calling this function with a relatedTarget that is not an EventTarget (rdar://problem/30640101).
 // We should remove this quirk when possible.
-void MouseEvent::initMouseEventQuirk(ExecState& state, ScriptExecutionContext& scriptExecutionContext, const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, JSValue relatedTargetValue)
+void MouseEvent::initMouseEventQuirk(ExecState& state, ScriptExecutionContext& scriptExecutionContext, const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, JSValue relatedTargetValue)
 {
     EventTarget* relatedTarget = nullptr;
 #if PLATFORM(MAC)
@@ -176,7 +176,7 @@ void MouseEvent::initMouseEventQuirk(ExecState& state, ScriptExecutionContext& s
 #if PLATFORM(MAC)
     }
 #endif
-    initMouseEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget);
+    initMouseEvent(type, canBubble, cancelable, WTFMove(view), detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget);
 }
 
 EventInterface MouseEvent::eventInterface() const
index 26caf8f..4b28079 100644 (file)
 namespace WebCore {
 
 class DataTransfer;
+class Node;
 class PlatformMouseEvent;
 
 class MouseEvent : public MouseRelatedEvent {
 public:
-    WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow*, int detail, int screenX, int screenY, int pageX, int pageY,
+    WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&&, int detail, int screenX, int screenY, int pageX, int pageY,
 #if ENABLE(POINTER_LOCK)
         int movementX, int movementY,
 #endif
         bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* = nullptr, bool isSimulated = false);
 
-    WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& eventType, DOMWindow*, const PlatformMouseEvent&, int detail, Node* relatedTarget);
+    WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& eventType, RefPtr<WindowProxy>&&, const PlatformMouseEvent&, int detail, Node* relatedTarget);
 
-    static Ref<MouseEvent> create(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow*, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget);
+    static Ref<MouseEvent> create(const AtomicString& eventType, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget);
 
     static Ref<MouseEvent> createForBindings() { return adoptRef(*new MouseEvent); }
 
@@ -49,8 +50,8 @@ public:
 
     virtual ~MouseEvent();
 
-    WEBCORE_EXPORT void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget);
-    void initMouseEventQuirk(JSC::ExecState&, ScriptExecutionContext&, const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, JSC::JSValue relatedTarget);
+    WEBCORE_EXPORT void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget);
+    void initMouseEventQuirk(JSC::ExecState&, ScriptExecutionContext&, const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, JSC::JSValue relatedTarget);
 
     unsigned short button() const { return m_button; }
     unsigned short buttons() const { return m_buttons; }
@@ -70,7 +71,7 @@ public:
     int which() const final;
 
 protected:
-    MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow*,
+    MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&&,
         int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
 #if ENABLE(POINTER_LOCK)
         const IntPoint& movementDelta,
@@ -78,7 +79,7 @@ protected:
         bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons,
         EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer*, bool isSimulated);
 
-    MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*,
+    MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&,
         int detail, const IntPoint& screenLocation, const IntPoint& clientLocation,
         bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
         unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget);
index 0be0f88..60c4466 100644 (file)
@@ -43,7 +43,7 @@
     // FIXME: relatedTarget should be of type EventTarget? but we need to use any to support a quirk for iAd Producer (rdar://problem/30640101).
     [CallWith=ScriptState&ScriptExecutionContext, ImplementedAs=initMouseEventQuirk] void initMouseEvent(optional DOMString type = "undefined",
         optional boolean canBubble = false, optional boolean cancelable = false,
-        optional DOMWindow? view = null, optional long detail = 0,
+        optional WindowProxy? view = null, optional long detail = 0,
         optional long screenX = 0, optional long screenY = 0, optional long clientX = 0, optional long clientY = 0,
         optional boolean ctrlKey = false, optional boolean altKey = false, optional boolean shiftKey = false, optional boolean metaKey = false,
         optional unsigned short button = 0, optional any relatedTarget = null);
index 853714d..80a8267 100644 (file)
 
 namespace WebCore {
 
-MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow* DOMWindow,
+MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&& view,
                                      int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
 #if ENABLE(POINTER_LOCK)
                                      const IntPoint& movementDelta,
 #endif
                                      bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated)
-    : UIEventWithKeyState(eventType, canBubble, cancelable, timestamp, DOMWindow, detail, ctrlKey, altKey, shiftKey, metaKey, false, false)
+    : UIEventWithKeyState(eventType, canBubble, cancelable, timestamp, WTFMove(view), detail, ctrlKey, altKey, shiftKey, metaKey, false, false)
     , m_screenLocation(screenLocation)
 #if ENABLE(POINTER_LOCK)
     , m_movementDelta(movementDelta)
@@ -61,7 +61,7 @@ MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, const MouseR
 void MouseRelatedEvent::init(bool isSimulated, const IntPoint& windowLocation)
 {
     if (!isSimulated) {
-        if (auto* frameView = frameViewFromDOMWindow(view())) {
+        if (auto* frameView = frameViewFromWindowProxy(view())) {
             FloatPoint absolutePoint = frameView->windowToContents(windowLocation);
             FloatPoint documentPoint = frameView->absoluteToDocumentPoint(absolutePoint);
             m_pageLocation = flooredLayoutPoint(documentPoint);
@@ -83,13 +83,13 @@ void MouseRelatedEvent::initCoordinates()
     m_hasCachedRelativePosition = false;
 }
 
-FrameView* MouseRelatedEvent::frameViewFromDOMWindow(DOMWindow* window)
+FrameView* MouseRelatedEvent::frameViewFromWindowProxy(WindowProxy* windowProxy)
 {
-    auto* frame = window ? window->frame() : nullptr;
-    if (!frame)
+    if (!windowProxy || !is<DOMWindow>(windowProxy->window()))
         return nullptr;
 
-    return frame->view();
+    auto* frame = downcast<DOMWindow>(*windowProxy->window()).frame();
+    return frame ? frame->view() : nullptr;
 }
 
 LayoutPoint MouseRelatedEvent::pagePointToClientPoint(LayoutPoint pagePoint, FrameView* frameView)
@@ -113,7 +113,7 @@ void MouseRelatedEvent::initCoordinates(const LayoutPoint& clientLocation)
     // Set up initial values for coordinates.
     // Correct values are computed lazily, see computeRelativePosition.
     FloatSize documentToClientOffset;
-    if (auto* frameView = frameViewFromDOMWindow(view()))
+    if (auto* frameView = frameViewFromWindowProxy(view()))
         documentToClientOffset = frameView->documentToClientOffset();
 
     m_clientLocation = clientLocation;
@@ -128,7 +128,7 @@ void MouseRelatedEvent::initCoordinates(const LayoutPoint& clientLocation)
 
 float MouseRelatedEvent::documentToAbsoluteScaleFactor() const
 {
-    if (auto* frameView = frameViewFromDOMWindow(view()))
+    if (auto* frameView = frameViewFromWindowProxy(view()))
         return frameView->documentToAbsoluteScaleFactor();
 
     return 1;
@@ -136,7 +136,7 @@ float MouseRelatedEvent::documentToAbsoluteScaleFactor() const
 
 void MouseRelatedEvent::computePageLocation()
 {
-    m_absoluteLocation = pagePointToAbsolutePoint(m_pageLocation, frameViewFromDOMWindow(view()));
+    m_absoluteLocation = pagePointToAbsolutePoint(m_pageLocation, frameViewFromWindowProxy(view()));
 }
 
 void MouseRelatedEvent::receivedTarget()
@@ -185,7 +185,7 @@ void MouseRelatedEvent::computeRelativePosition()
     
 FloatPoint MouseRelatedEvent::locationInRootViewCoordinates() const
 {
-    if (auto* frameView = frameViewFromDOMWindow(view()))
+    if (auto* frameView = frameViewFromWindowProxy(view()))
         return frameView->contentsToRootView(roundedIntPoint(m_absoluteLocation));
 
     return m_absoluteLocation;
index 0d83c36..ad4e5d0 100644 (file)
@@ -67,14 +67,14 @@ public:
     // usable with RenderObject::absoluteToLocal).
     const LayoutPoint& absoluteLocation() const { return m_absoluteLocation; }
     
-    static FrameView* frameViewFromDOMWindow(DOMWindow*);
+    static FrameView* frameViewFromWindowProxy(WindowProxy*);
 
     static LayoutPoint pagePointToClientPoint(LayoutPoint pagePoint, FrameView*);
     static LayoutPoint pagePointToAbsolutePoint(LayoutPoint pagePoint, FrameView*);
 
 protected:
     MouseRelatedEvent() = default;
-    MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow*,
+    MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&&,
         int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
 #if ENABLE(POINTER_LOCK)
         const IntPoint& movementDelta,
index 4b1e872..bba678a 100644 (file)
@@ -33,6 +33,7 @@
 #include "ComposedTreeAncestorIterator.h"
 #include "ContainerNodeAlgorithms.h"
 #include "ContextMenuController.h"
+#include "DOMWindow.h"
 #include "DataTransfer.h"
 #include "DocumentType.h"
 #include "ElementIterator.h"
@@ -2350,7 +2351,7 @@ void Node::dispatchDOMActivateEvent(Event& underlyingClickEvent)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(ScriptDisallowedScope::InMainThread::isScriptAllowed());
     int detail = is<UIEvent>(underlyingClickEvent) ? downcast<UIEvent>(underlyingClickEvent).detail() : 0;
-    auto event = UIEvent::create(eventNames().DOMActivateEvent, true, true, document().defaultView(), detail);
+    auto event = UIEvent::create(eventNames().DOMActivateEvent, true, true, document().windowProxy(), detail);
     event->setUnderlyingEvent(&underlyingClickEvent);
     dispatchScopedEvent(event);
     if (event->defaultHandled())
index e0f4e35..f46439a 100644 (file)
@@ -37,14 +37,14 @@ namespace WebCore {
 
 class SimulatedMouseEvent final : public MouseEvent {
 public:
-    static Ref<SimulatedMouseEvent> create(const AtomicString& eventType, DOMWindow* view, RefPtr<Event>&& underlyingEvent, Element& target, SimulatedClickSource source)
+    static Ref<SimulatedMouseEvent> create(const AtomicString& eventType, RefPtr<WindowProxy>&& view, RefPtr<Event>&& underlyingEvent, Element& target, SimulatedClickSource source)
     {
-        return adoptRef(*new SimulatedMouseEvent(eventType, view, WTFMove(underlyingEvent), target, source));
+        return adoptRef(*new SimulatedMouseEvent(eventType, WTFMove(view), WTFMove(underlyingEvent), target, source));
     }
 
 private:
-    SimulatedMouseEvent(const AtomicString& eventType, DOMWindow* view, RefPtr<Event>&& underlyingEvent, Element& target, SimulatedClickSource source)
-        : MouseEvent(eventType, true, true, underlyingEvent ? underlyingEvent->timeStamp() : MonotonicTime::now(), view, 0, { }, { },
+    SimulatedMouseEvent(const AtomicString& eventType, RefPtr<WindowProxy>&& view, RefPtr<Event>&& underlyingEvent, Element& target, SimulatedClickSource source)
+        : MouseEvent(eventType, true, true, underlyingEvent ? underlyingEvent->timeStamp() : MonotonicTime::now(), WTFMove(view), 0, { }, { },
 #if ENABLE(POINTER_LOCK)
             { },
 #endif
@@ -79,7 +79,7 @@ private:
 
 static void simulateMouseEvent(const AtomicString& eventType, Element& element, Event* underlyingEvent, SimulatedClickSource source)
 {
-    element.dispatchEvent(SimulatedMouseEvent::create(eventType, element.document().defaultView(), underlyingEvent, element, source));
+    element.dispatchEvent(SimulatedMouseEvent::create(eventType, element.document().windowProxy(), underlyingEvent, element, source));
 }
 
 void simulateClick(Element& element, Event* underlyingEvent, SimulatedClickMouseEventOptions mouseEventOptions, SimulatedClickVisualOptions visualOptions, SimulatedClickSource creationOptions)
index bd024ea..b094493 100644 (file)
@@ -38,29 +38,29 @@ Ref<TextEvent> TextEvent::createForBindings()
     return adoptRef(*new TextEvent);
 }
 
-Ref<TextEvent> TextEvent::create(DOMWindow* view, const String& data, TextEventInputType inputType)
+Ref<TextEvent> TextEvent::create(RefPtr<WindowProxy>&& view, const String& data, TextEventInputType inputType)
 {
-    return adoptRef(*new TextEvent(view, data, inputType));
+    return adoptRef(*new TextEvent(WTFMove(view), data, inputType));
 }
 
-Ref<TextEvent> TextEvent::createForPlainTextPaste(DOMWindow* view, const String& data, bool shouldSmartReplace)
+Ref<TextEvent> TextEvent::createForPlainTextPaste(RefPtr<WindowProxy>&& view, const String& data, bool shouldSmartReplace)
 {
-    return adoptRef(*new TextEvent(view, data, 0, shouldSmartReplace, false, MailBlockquoteHandling::RespectBlockquote));
+    return adoptRef(*new TextEvent(WTFMove(view), data, 0, shouldSmartReplace, false, MailBlockquoteHandling::RespectBlockquote));
 }
 
-Ref<TextEvent> TextEvent::createForFragmentPaste(DOMWindow* view, RefPtr<DocumentFragment>&& data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling)
+Ref<TextEvent> TextEvent::createForFragmentPaste(RefPtr<WindowProxy>&& view, RefPtr<DocumentFragment>&& data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling)
 {
-    return adoptRef(*new TextEvent(view, emptyString(), WTFMove(data), shouldSmartReplace, shouldMatchStyle, mailBlockquoteHandling));
+    return adoptRef(*new TextEvent(WTFMove(view), emptyString(), WTFMove(data), shouldSmartReplace, shouldMatchStyle, mailBlockquoteHandling));
 }
 
-Ref<TextEvent> TextEvent::createForDrop(DOMWindow* view, const String& data)
+Ref<TextEvent> TextEvent::createForDrop(RefPtr<WindowProxy>&& view, const String& data)
 {
-    return adoptRef(*new TextEvent(view, data, TextEventInputDrop));
+    return adoptRef(*new TextEvent(WTFMove(view), data, TextEventInputDrop));
 }
 
-Ref<TextEvent> TextEvent::createForDictation(DOMWindow* view, const String& data, const Vector<DictationAlternative>& dictationAlternatives)
+Ref<TextEvent> TextEvent::createForDictation(RefPtr<WindowProxy>&& view, const String& data, const Vector<DictationAlternative>& dictationAlternatives)
 {
-    return adoptRef(*new TextEvent(view, data, dictationAlternatives));
+    return adoptRef(*new TextEvent(WTFMove(view), data, dictationAlternatives));
 }
 
 TextEvent::TextEvent()
@@ -71,8 +71,8 @@ TextEvent::TextEvent()
 {
 }
 
-TextEvent::TextEvent(DOMWindow* view, const String& data, TextEventInputType inputType)
-    : UIEvent(eventNames().textInputEvent, true, true, view, 0)
+TextEvent::TextEvent(RefPtr<WindowProxy>&& view, const String& data, TextEventInputType inputType)
+    : UIEvent(eventNames().textInputEvent, true, true, WTFMove(view), 0)
     , m_inputType(inputType)
     , m_data(data)
     , m_shouldSmartReplace(false)
@@ -81,8 +81,8 @@ TextEvent::TextEvent(DOMWindow* view, const String& data, TextEventInputType inp
 {
 }
 
-TextEvent::TextEvent(DOMWindow* view, const String& data, RefPtr<DocumentFragment>&& pastingFragment, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling)
-    : UIEvent(eventNames().textInputEvent, true, true, view, 0)
+TextEvent::TextEvent(RefPtr<WindowProxy>&& view, const String& data, RefPtr<DocumentFragment>&& pastingFragment, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling)
+    : UIEvent(eventNames().textInputEvent, true, true, WTFMove(view), 0)
     , m_inputType(TextEventInputPaste)
     , m_data(data)
     , m_pastingFragment(WTFMove(pastingFragment))
@@ -92,8 +92,8 @@ TextEvent::TextEvent(DOMWindow* view, const String& data, RefPtr<DocumentFragmen
 {
 }
 
-TextEvent::TextEvent(DOMWindow* view, const String& data, const Vector<DictationAlternative>& dictationAlternatives)
-    : UIEvent(eventNames().textInputEvent, true, true, view, 0)
+TextEvent::TextEvent(RefPtr<WindowProxy>&& view, const String& data, const Vector<DictationAlternative>& dictationAlternatives)
+    : UIEvent(eventNames().textInputEvent, true, true, WTFMove(view), 0)
     , m_inputType(TextEventInputDictation)
     , m_data(data)
     , m_shouldSmartReplace(false)
@@ -105,12 +105,12 @@ TextEvent::TextEvent(DOMWindow* view, const String& data, const Vector<Dictation
 
 TextEvent::~TextEvent() = default;
 
-void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, const String& data)
+void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, const String& data)
 {
     if (isBeingDispatched())
         return;
 
-    initUIEvent(type, canBubble, cancelable, view, 0);
+    initUIEvent(type, canBubble, cancelable, WTFMove(view), 0);
 
     m_inputType = TextEventInputKeyboard;
 
index 29eb26d..0ae2ac8 100644 (file)
@@ -38,16 +38,16 @@ namespace WebCore {
 
     class TextEvent final : public UIEvent {
     public:
-        static Ref<TextEvent> create(DOMWindow*, const String& data, TextEventInputType = TextEventInputKeyboard);
+        static Ref<TextEvent> create(RefPtr<WindowProxy>&&, const String& data, TextEventInputType = TextEventInputKeyboard);
         static Ref<TextEvent> createForBindings();
-        static Ref<TextEvent> createForPlainTextPaste(DOMWindow*, const String& data, bool shouldSmartReplace);
-        static Ref<TextEvent> createForFragmentPaste(DOMWindow*, RefPtr<DocumentFragment>&& data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling);
-        static Ref<TextEvent> createForDrop(DOMWindow*, const String& data);
-        static Ref<TextEvent> createForDictation(DOMWindow*, const String& data, const Vector<DictationAlternative>& dictationAlternatives);
+        static Ref<TextEvent> createForPlainTextPaste(RefPtr<WindowProxy>&&, const String& data, bool shouldSmartReplace);
+        static Ref<TextEvent> createForFragmentPaste(RefPtr<WindowProxy>&&, RefPtr<DocumentFragment>&& data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling);
+        static Ref<TextEvent> createForDrop(RefPtr<WindowProxy>&&, const String& data);
+        static Ref<TextEvent> createForDictation(RefPtr<WindowProxy>&&, const String& data, const Vector<DictationAlternative>& dictationAlternatives);
 
         virtual ~TextEvent();
     
-        WEBCORE_EXPORT void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, const String& data);
+        WEBCORE_EXPORT void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, const String& data);
     
         String data() const { return m_data; }
 
@@ -71,9 +71,9 @@ namespace WebCore {
     private:
         TextEvent();
 
-        TextEvent(DOMWindow*, const String& data, TextEventInputType = TextEventInputKeyboard);
-        TextEvent(DOMWindow*, const String& data, RefPtr<DocumentFragment>&&, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling);
-        TextEvent(DOMWindow*, const String& data, const Vector<DictationAlternative>& dictationAlternatives);
+        TextEvent(RefPtr<WindowProxy>&&, const String& data, TextEventInputType = TextEventInputKeyboard);
+        TextEvent(RefPtr<WindowProxy>&&, const String& data, RefPtr<DocumentFragment>&&, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling);
+        TextEvent(RefPtr<WindowProxy>&&, const String& data, const Vector<DictationAlternative>& dictationAlternatives);
 
         bool isTextEvent() const override;
 
index 364065f..ce8b30a 100644 (file)
@@ -32,7 +32,7 @@ interface TextEvent : UIEvent {
     void initTextEvent(optional DOMString typeArg = "undefined",
                        optional boolean canBubbleArg = false,
                        optional boolean cancelableArg = false,
-                       optional DOMWindow? viewArg = null,
+                       optional WindowProxy? viewArg = null,
                        optional DOMString dataArg = "undefined");
 
 };
index 61c08f2..00237cd 100644 (file)
@@ -38,9 +38,9 @@ TouchEvent::TouchEvent() = default;
 
 TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches,
         TouchList* changedTouches, const AtomicString& type, 
-        DOMWindow* view, int screenX, int screenY, int pageX, int pageY,
+        RefPtr<WindowProxy>&& view, int screenX, int screenY, int pageX, int pageY,
         bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
-    : MouseRelatedEvent(type, true, true, MonotonicTime::now(), view, 0, IntPoint(screenX, screenY),
+    : MouseRelatedEvent(type, true, true, MonotonicTime::now(), WTFMove(view), 0, IntPoint(screenX, screenY),
                         IntPoint(pageX, pageY),
 #if ENABLE(POINTER_LOCK)
                         IntPoint(0, 0),
@@ -64,13 +64,13 @@ TouchEvent::~TouchEvent() = default;
 
 void TouchEvent::initTouchEvent(TouchList* touches, TouchList* targetTouches,
         TouchList* changedTouches, const AtomicString& type, 
-        DOMWindow* view, int screenX, int screenY, int clientX, int clientY,
+        RefPtr<WindowProxy>&& view, int screenX, int screenY, int clientX, int clientY,
         bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
 {
     if (isBeingDispatched())
         return;
 
-    initUIEvent(type, true, true, view, 0);
+    initUIEvent(type, true, true, WTFMove(view), 0);
 
     m_touches = touches;
     m_targetTouches = targetTouches;
index d339c0b..85fa161 100644 (file)
@@ -41,12 +41,12 @@ public:
 
     static Ref<TouchEvent> create(TouchList* touches, 
             TouchList* targetTouches, TouchList* changedTouches, 
-            const AtomicString& type, DOMWindow* view,
+            const AtomicString& type, RefPtr<WindowProxy>&& view,
             int screenX, int screenY, int pageX, int pageY,
             bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
     {
         return adoptRef(*new TouchEvent(touches, targetTouches, changedTouches,
-                type, view, screenX, screenY, pageX, pageY,
+                type, WTFMove(view), screenX, screenY, pageX, pageY,
                 ctrlKey, altKey, shiftKey, metaKey));
     }
     static Ref<TouchEvent> createForBindings()
@@ -67,7 +67,7 @@ public:
 
     void initTouchEvent(TouchList* touches, TouchList* targetTouches,
             TouchList* changedTouches, const AtomicString& type, 
-            DOMWindow*, int screenX, int screenY,
+            RefPtr<WindowProxy>&&, int screenX, int screenY,
             int clientX, int clientY,
             bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
 
@@ -87,7 +87,7 @@ private:
     TouchEvent();
     TouchEvent(TouchList* touches, TouchList* targetTouches,
             TouchList* changedTouches, const AtomicString& type,
-            DOMWindow*, int screenX, int screenY, int pageX,
+            RefPtr<WindowProxy>&&, int screenX, int screenY, int pageX,
             int pageY,
             bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
     TouchEvent(const AtomicString&, const Init&, IsTrusted);
index 8105835..54e99db 100644 (file)
@@ -40,7 +40,7 @@
                         optional TouchList? targetTouches = null,
                         optional TouchList? changedTouches = null,
                         optional DOMString type = "undefined",
-                        optional DOMWindow? view = null,
+                        optional WindowProxy? view = null,
                         optional long screenX = 0,
                         optional long screenY = 0,
                         optional long clientX = 0,
index ab20eec..0a6f81a 100644 (file)
@@ -32,16 +32,16 @@ UIEvent::UIEvent()
 {
 }
 
-UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, DOMWindow* viewArg, int detailArg)
+UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, RefPtr<WindowProxy>&& viewArg, int detailArg)
     : Event(eventType, canBubbleArg, cancelableArg)
-    , m_view(viewArg)
+    , m_view(WTFMove(viewArg))
     , m_detail(detailArg)
 {
 }
 
-UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, MonotonicTime timestamp, DOMWindow* viewArg, int detailArg)
+UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, MonotonicTime timestamp, RefPtr<WindowProxy>&& viewArg, int detailArg)
     : Event(eventType, canBubbleArg, cancelableArg, timestamp)
-    , m_view(viewArg)
+    , m_view(WTFMove(viewArg))
     , m_detail(detailArg)
 {
 }
@@ -55,7 +55,7 @@ UIEvent::UIEvent(const AtomicString& eventType, const UIEventInit& initializer,
 
 UIEvent::~UIEvent() = default;
 
-void UIEvent::initUIEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, DOMWindow* viewArg, int detailArg)
+void UIEvent::initUIEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, RefPtr<WindowProxy>&& viewArg, int detailArg)
 {
     if (isBeingDispatched())
         return;
index baa731f..50f2d17 100644 (file)
 
 #pragma once
 
-#include "DOMWindow.h"
 #include "Event.h"
 #include "UIEventInit.h"
+#include "WindowProxy.h"
 
 namespace WebCore {
 
 // FIXME: Remove this when no one is depending on it anymore.
-typedef DOMWindow AbstractView;
+typedef WindowProxy AbstractView;
 
 class UIEvent : public Event {
 public:
-    static Ref<UIEvent> create(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail)
+    static Ref<UIEvent> create(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail)
     {
-        return adoptRef(*new UIEvent(type, canBubble, cancelable, view, detail));
+        return adoptRef(*new UIEvent(type, canBubble, cancelable, WTFMove(view), detail));
     }
     static Ref<UIEvent> createForBindings()
     {
@@ -48,9 +48,9 @@ public:
     }
     virtual ~UIEvent();
 
-    WEBCORE_EXPORT void initUIEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int detail);
+    WEBCORE_EXPORT void initUIEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, int detail);
 
-    DOMWindow* view() const { return m_view.get(); }
+    WindowProxy* view() const { return m_view.get(); }
     int detail() const { return m_detail; }
 
     EventInterface eventInterface() const override;
@@ -65,14 +65,14 @@ public:
 
 protected:
     UIEvent();
-    UIEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int detail);
-    UIEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow*, int detail);
+    UIEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, int detail);
+    UIEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&&, int detail);
     UIEvent(const AtomicString&, const UIEventInit&, IsTrusted);
 
 private:
     bool isUIEvent() const final;
 
-    RefPtr<DOMWindow> m_view;
+    RefPtr<WindowProxy> m_view;
     int m_detail;
 };
 
index 87b3915..6a35c57 100644 (file)
 [
     Constructor(DOMString type, optional UIEventInit eventInitDict)
 ] interface UIEvent : Event {
-    readonly attribute DOMWindow view;
+    readonly attribute WindowProxy view;
     readonly attribute long detail;
     
     // FIXME: Using "undefined" as default parameter value is wrong.
-    void initUIEvent(optional DOMString type = "undefined", optional boolean canBubble = false, optional boolean cancelable = false, optional DOMWindow? view = null, optional long detail = 0);
+    void initUIEvent(optional DOMString type = "undefined", optional boolean canBubble = false, optional boolean cancelable = false, optional WindowProxy? view = null, optional long detail = 0);
 
     readonly attribute long layerX;
     readonly attribute long layerY;
index 0316bc0..e1128a7 100644 (file)
 
 #pragma once
 
-#include "DOMWindow.h"
 #include "EventInit.h"
+#include "WindowProxy.h"
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
 
 struct UIEventInit : public EventInit {
-    RefPtr<DOMWindow> view;
+    RefPtr<WindowProxy> view;
     int detail { 0 };
 };
 
index 0d7eb8e..3ccbbed 100644 (file)
@@ -24,6 +24,6 @@
  */
 
 dictionary UIEventInit : EventInit {
-    DOMWindow? view = null;
+    WindowProxy? view = null;
     long detail = 0;
 };
index 0a8e403..085a031 100644 (file)
@@ -40,8 +40,8 @@ public:
 protected:
     UIEventWithKeyState() = default;
 
-    UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
-        : UIEvent(type, canBubble, cancelable, view, detail)
+    UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
+        : UIEvent(type, canBubble, cancelable, WTFMove(view), detail)
         , m_ctrlKey(ctrlKey)
         , m_altKey(altKey)
         , m_shiftKey(shiftKey)
@@ -49,9 +49,9 @@ protected:
     {
     }
 
-    UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow* view,
+    UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&& view,
         int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey, bool capsLockKey)
-            : UIEvent(type, canBubble, cancelable, timestamp, view, detail)
+            : UIEvent(type, canBubble, cancelable, timestamp, WTFMove(view), detail)
             , m_ctrlKey(ctrlKey)
             , m_altKey(altKey)
             , m_shiftKey(shiftKey)
index d2b8fb7..537cb19 100644 (file)
@@ -47,8 +47,8 @@ inline WheelEvent::WheelEvent(const AtomicString& type, const Init& initializer,
 {
 }
 
-inline WheelEvent::WheelEvent(const PlatformWheelEvent& event, DOMWindow* view)
-    : MouseEvent(eventNames().wheelEvent, true, true, event.timestamp().approximateMonotonicTime(), view, 0, event.globalPosition(), event.position()
+inline WheelEvent::WheelEvent(const PlatformWheelEvent& event, RefPtr<WindowProxy>&& view)
+    : MouseEvent(eventNames().wheelEvent, true, true, event.timestamp().approximateMonotonicTime(), WTFMove(view), 0, event.globalPosition(), event.position()
 #if ENABLE(POINTER_LOCK)
         , { }
 #endif
@@ -61,9 +61,9 @@ inline WheelEvent::WheelEvent(const PlatformWheelEvent& event, DOMWindow* view)
 {
 }
 
-Ref<WheelEvent> WheelEvent::create(const PlatformWheelEvent& event, DOMWindow* view)
+Ref<WheelEvent> WheelEvent::create(const PlatformWheelEvent& event, RefPtr<WindowProxy>&& view)
 {
-    return adoptRef(*new WheelEvent(event, view));
+    return adoptRef(*new WheelEvent(event, WTFMove(view)));
 }
 
 Ref<WheelEvent> WheelEvent::createForBindings()
@@ -76,12 +76,12 @@ Ref<WheelEvent> WheelEvent::create(const AtomicString& type, const Init& initial
     return adoptRef(*new WheelEvent(type, initializer, isTrusted));
 }
 
-void WheelEvent::initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, DOMWindow* view, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
+void WheelEvent::initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, RefPtr<WindowProxy>&& view, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
 {
     if (isBeingDispatched())
         return;
     
-    initMouseEvent(eventNames().wheelEvent, true, true, view, 0, screenX, screenY, pageX, pageY, ctrlKey, altKey, shiftKey, metaKey, 0, nullptr);
+    initMouseEvent(eventNames().wheelEvent, true, true, WTFMove(view), 0, screenX, screenY, pageX, pageY, ctrlKey, altKey, shiftKey, metaKey, 0, nullptr);
 
     // Normalize to 120 multiple for compatibility with IE.
     m_wheelDelta = { rawDeltaX * TickMultiplier, rawDeltaY * TickMultiplier };
index 4d34b30..10b62e0 100644 (file)
@@ -39,7 +39,7 @@ public:
         DOM_DELTA_PAGE
     };
 
-    static Ref<WheelEvent> create(const PlatformWheelEvent&, DOMWindow*);
+    static Ref<WheelEvent> create(const PlatformWheelEvent&, RefPtr<WindowProxy>&&);
     static Ref<WheelEvent> createForBindings();
 
     struct Init : MouseEventInit {
@@ -53,7 +53,7 @@ public:
 
     static Ref<WheelEvent> create(const AtomicString& type, const Init&, IsTrusted = IsTrusted::No);
 
-    WEBCORE_EXPORT void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, DOMWindow*, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
+    WEBCORE_EXPORT void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, RefPtr<WindowProxy>&&, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
 
     const std::optional<PlatformWheelEvent>& underlyingPlatformEvent() const { return m_underlyingPlatformEvent; }
 
@@ -75,7 +75,7 @@ public:
 private:
     WheelEvent();
     WheelEvent(const AtomicString&, const Init&, IsTrusted);
-    WheelEvent(const PlatformWheelEvent&, DOMWindow*);
+    WheelEvent(const PlatformWheelEvent&, RefPtr<WindowProxy>&&);
 
     EventInterface eventInterface() const final;
 
index 93c53a4..b281da1 100644 (file)
@@ -39,7 +39,7 @@
 
     readonly attribute boolean webkitDirectionInvertedFromDevice;
 
-    void initWebKitWheelEvent(optional long wheelDeltaX = 0, optional long wheelDeltaY = 0, optional DOMWindow? view = null,
+    void initWebKitWheelEvent(optional long wheelDeltaX = 0, optional long wheelDeltaY = 0, optional WindowProxy? view = null,
         optional long screenX = 0, optional long screenY = 0, optional long clientX = 0, optional long clientY = 0,
         optional boolean ctrlKey = false, optional boolean altKey = false,
         optional boolean shiftKey = false, optional boolean metaKey = false);
index d147242..d453f64 100644 (file)
@@ -632,7 +632,7 @@ bool AlternativeTextController::insertDictatedText(const String& text, const Vec
     if (FrameView* view = m_frame.view())
         view->disableLayerFlushThrottlingTemporarilyForInteraction();
 
-    Ref<TextEvent> event = TextEvent::createForDictation(m_frame.document()->domWindow(), text, dictationAlternatives);
+    auto event = TextEvent::createForDictation(&m_frame.windowProxy(), text, dictationAlternatives);
     event->setUnderlyingEvent(triggeringEvent);
 
     target->dispatchEvent(event);
index cb8b6b8..6c66907 100644 (file)
@@ -115,7 +115,7 @@ static bool dispatchBeforeInputEvent(Element& element, const AtomicString& input
     if (!element.document().settings().inputEventsEnabled())
         return true;
 
-    auto event = InputEvent::create(eventNames().beforeinputEvent, inputType, true, cancelable, element.document().defaultView(), data, WTFMove(dataTransfer), targetRanges, 0);
+    auto event = InputEvent::create(eventNames().beforeinputEvent, inputType, true, cancelable, element.document().windowProxy(), data, WTFMove(dataTransfer), targetRanges, 0);
     element.dispatchEvent(event);
     return !event->defaultPrevented();
 }
@@ -127,7 +127,7 @@ static void dispatchInputEvent(Element& element, const AtomicString& inputType,
         // but TypingCommands are special in that existing TypingCommands that are applied again fire input events *from within* the scope by calling typingAddedToOpenCommand.
         // Instead, TypingCommands should always dispatch events synchronously after the end of the scoped queue in CompositeEditCommand::apply. To work around this for the
         // time being, just revert back to calling dispatchScopedEvent.
-        element.dispatchScopedEvent(InputEvent::create(eventNames().inputEvent, inputType, true, false, element.document().defaultView(), data, WTFMove(dataTransfer), targetRanges, 0));
+        element.dispatchScopedEvent(InputEvent::create(eventNames().inputEvent, inputType, true, false, element.document().windowProxy(), data, WTFMove(dataTransfer), targetRanges, 0));
     } else
         element.dispatchInputEvent();
 }
@@ -569,7 +569,7 @@ void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace)
     Element* target = findEventTargetFromSelection();
     if (!target)
         return;
-    target->dispatchEvent(TextEvent::createForPlainTextPaste(document().domWindow(), pastingText, smartReplace));
+    target->dispatchEvent(TextEvent::createForPlainTextPaste(document().windowProxy(), pastingText, smartReplace));
 }
 
 void Editor::pasteAsFragment(Ref<DocumentFragment>&& pastingFragment, bool smartReplace, bool matchStyle, MailBlockquoteHandling respectsMailBlockquote)
@@ -577,7 +577,7 @@ void Editor::pasteAsFragment(Ref<DocumentFragment>&& pastingFragment, bool smart
     Element* target = findEventTargetFromSelection();
     if (!target)
         return;
-    target->dispatchEvent(TextEvent::createForFragmentPaste(document().domWindow(), WTFMove(pastingFragment), smartReplace, matchStyle, respectsMailBlockquote));
+    target->dispatchEvent(TextEvent::createForFragmentPaste(document().windowProxy(), WTFMove(pastingFragment), smartReplace, matchStyle, respectsMailBlockquote));
 }
 
 void Editor::pasteAsPlainTextBypassingDHTML()
@@ -1848,7 +1848,7 @@ void Editor::setComposition(const String& text, SetCompositionMode mode)
     insertTextForConfirmedComposition(text);
 
     if (auto* target = document().focusedElement())
-        target->dispatchEvent(CompositionEvent::create(eventNames().compositionendEvent, document().domWindow(), text));
+        target->dispatchEvent(CompositionEvent::create(eventNames().compositionendEvent, document().windowProxy(), text));
 
     if (mode == CancelComposition) {
         // An open typing command that disagrees about current selection would cause issues with typing later on.
@@ -1908,11 +1908,11 @@ void Editor::setComposition(const String& text, const Vector<CompositionUnderlin
             // We should send a compositionstart event only when the given text is not empty because this
             // function doesn't create a composition node when the text is empty.
             if (!text.isEmpty()) {
-                target->dispatchEvent(CompositionEvent::create(eventNames().compositionstartEvent, document().domWindow(), originalText));
-                event = CompositionEvent::create(eventNames().compositionupdateEvent, document().domWindow(), text);
+                target->dispatchEvent(CompositionEvent::create(eventNames().compositionstartEvent, document().windowProxy(), originalText));
+                event = CompositionEvent::create(eventNames().compositionupdateEvent, document().windowProxy(), text);
             }
         } else if (!text.isEmpty())
-            event = CompositionEvent::create(eventNames().compositionupdateEvent, document().domWindow(), text);
+            event = CompositionEvent::create(eventNames().compositionupdateEvent, document().windowProxy(), text);
 
         if (event)
             target->dispatchEvent(*event);
@@ -1923,7 +1923,7 @@ void Editor::setComposition(const String& text, const Vector<CompositionUnderlin
     if (text.isEmpty()) {
         TypingCommand::deleteSelection(document(), TypingCommand::PreventSpellChecking, TypingCommand::TextCompositionPending);
         if (target)
-            target->dispatchEvent(CompositionEvent::create(eventNames().compositionendEvent, document().domWindow(), text));
+            target->dispatchEvent(CompositionEvent::create(eventNames().compositionendEvent, document().windowProxy(), text));
     }
 
     m_compositionNode = nullptr;
index a3d7d97..9d581ce 100644 (file)
@@ -114,7 +114,7 @@ Ref<DocumentParser> HTMLDocument::createParser()
 }
 
 // https://html.spec.whatwg.org/multipage/dom.html#dom-document-nameditem
-std::optional<Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>>> HTMLDocument::namedItem(const AtomicString& name)
+std::optional<Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>>> HTMLDocument::namedItem(const AtomicString& name)
 {
     if (name.isNull() || !hasDocumentNamedItem(*name.impl()))
         return std::nullopt;
@@ -122,16 +122,16 @@ std::optional<Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>
     if (UNLIKELY(documentNamedItemContainsMultipleElements(*name.impl()))) {
         auto collection = documentNamedItems(name);
         ASSERT(collection->length() > 1);
-        return Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>> { RefPtr<HTMLCollection> { WTFMove(collection) } };
+        return Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>> { RefPtr<HTMLCollection> { WTFMove(collection) } };
     }
 
     auto& element = *documentNamedItem(*name.impl());
     if (UNLIKELY(is<HTMLIFrameElement>(element))) {
         if (auto domWindow = makeRefPtr(downcast<HTMLIFrameElement>(element).contentWindow()))
-            return Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>> { WTFMove(domWindow) };
+            return Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>> { WTFMove(domWindow) };
     }
 
-    return Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>> { RefPtr<Element> { &element } };
+    return Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>> { RefPtr<Element> { &element } };
 }
 
 Vector<AtomicString> HTMLDocument::supportedPropertyNames() const
index a363974..0b3d341 100644 (file)
@@ -44,7 +44,7 @@ public:
     WEBCORE_EXPORT int width();
     WEBCORE_EXPORT int height();
     
-    std::optional<Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>>> namedItem(const AtomicString&);
+    std::optional<Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>>> namedItem(const AtomicString&);
     Vector<AtomicString> supportedPropertyNames() const;
 
     Element* documentNamedItem(const AtomicStringImpl& name) const { return m_documentNamedItem.getElementByDocumentNamedItem(name, *this); }
index 127f264..a999b03 100644 (file)
@@ -23,5 +23,5 @@
     NewImpurePropertyFiresWatchpoints,
     OverrideBuiltins,
 ] interface HTMLDocument : Document {    
-    getter (DOMWindow or Element or HTMLCollection) (DOMString name);
+    getter (WindowProxy or Element or HTMLCollection) (DOMString name);
 };
index cd63a21..ed7c0b6 100644 (file)
@@ -26,7 +26,7 @@ interface HTMLFrameElement : HTMLElement {
     [Reflect, URL] attribute USVString longDesc;
     [Reflect] attribute boolean noResize;
     [CheckSecurityForNode] readonly attribute Document contentDocument;
-    readonly attribute DOMWindow contentWindow;
+    readonly attribute WindowProxy contentWindow;
 
     [Reflect] attribute [TreatNullAs=EmptyString] DOMString marginHeight;
     [Reflect] attribute [TreatNullAs=EmptyString] DOMString marginWidth;
index 5887398..b9bef17 100644 (file)
@@ -99,9 +99,9 @@ Document* HTMLFrameOwnerElement::contentDocument() const
     return m_contentFrame ? m_contentFrame->document() : nullptr;
 }
 
-DOMWindow* HTMLFrameOwnerElement::contentWindow() const
+WindowProxy* HTMLFrameOwnerElement::contentWindow() const
 {
-    return m_contentFrame ? m_contentFrame->document()->domWindow() : nullptr;
+    return m_contentFrame ? &m_contentFrame->windowProxy() : nullptr;
 }
 
 void HTMLFrameOwnerElement::setSandboxFlags(SandboxFlags flags)
index 865eddb..80f1820 100644 (file)
@@ -37,7 +37,7 @@ public:
     virtual ~HTMLFrameOwnerElement();
 
     Frame* contentFrame() const { return m_contentFrame; }
-    WEBCORE_EXPORT DOMWindow* contentWindow() const;
+    WEBCORE_EXPORT WindowProxy* contentWindow() const;
     WEBCORE_EXPORT Document* contentDocument() const;
 
     void setContentFrame(Frame*);
index 2856424..5d237d4 100644 (file)
@@ -231,15 +231,13 @@ void HTMLFrameSetElement::removedFromAncestor(RemovalType removalType, Container
     }
 }
 
-DOMWindow* HTMLFrameSetElement::namedItem(const AtomicString& name)
+WindowProxy* HTMLFrameSetElement::namedItem(const AtomicString& name)
 {
     auto frameElement = makeRefPtr(children()->namedItem(name));
     if (!is<HTMLFrameElement>(frameElement))
         return nullptr;
 
-    if (auto document = makeRefPtr(downcast<HTMLFrameElement>(frameElement.get())->contentDocument()))
-        return document->domWindow();
-    return nullptr;
+    return downcast<HTMLFrameElement>(*frameElement).contentWindow();
 }
 
 Vector<AtomicString> HTMLFrameSetElement::supportedPropertyNames() const
index d1f379b..c3c68b5 100644 (file)
@@ -48,7 +48,7 @@ public:
     static RefPtr<HTMLFrameSetElement> findContaining(Element* descendant);
     
     Vector<AtomicString> supportedPropertyNames() const;
-    DOMWindow* namedItem(const AtomicString&);
+    WindowProxy* namedItem(const AtomicString&);
 
 private:
     HTMLFrameSetElement(const QualifiedName&, Document&);
index 3250b94..6942173 100644 (file)
@@ -33,7 +33,7 @@ interface HTMLFrameSetElement : HTMLElement {
 
     // Non-standard named getter
     // FIXME: This is not in the standard, can we remove this?
-    getter DOMWindow (DOMString name);
+    getter WindowProxy (DOMString name);
 };
 
 HTMLFrameSetElement implements WindowEventHandlers;
index 3e3bdcc..c163922 100644 (file)
@@ -38,7 +38,7 @@ interface HTMLIFrameElement : HTMLElement {
 
     [CheckSecurityForNode] readonly attribute Document contentDocument;
 
-    readonly attribute DOMWindow contentWindow;
+    readonly attribute WindowProxy contentWindow;
 
     [CheckSecurityForNode, MayThrowException] Document getSVGDocument();
 };
index d151273..85c13ff 100644 (file)
@@ -28,6 +28,7 @@
 #include "CachedImage.h"
 #include "Chrome.h"
 #include "ChromeClient.h"
+#include "DOMWindow.h"
 #include "DocumentLoader.h"
 #include "EventListener.h"
 #include "EventNames.h"
index c709a2d..e402a99 100644 (file)
@@ -148,7 +148,7 @@ using namespace Inspector;
 
 class PostMessageTimer : public TimerBase {
 public:
-    PostMessageTimer(DOMWindow& window, MessageWithMessagePorts&& message, const String& sourceOrigin, DOMWindow& source, RefPtr<SecurityOrigin>&& targetOrigin, RefPtr<ScriptCallStack>&& stackTrace)
+    PostMessageTimer(DOMWindow& window, MessageWithMessagePorts&& message, const String& sourceOrigin, RefPtr<WindowProxy>&& source, RefPtr<SecurityOrigin>&& targetOrigin, RefPtr<ScriptCallStack>&& stackTrace)
         : m_window(window)
         , m_message(WTFMove(message))
         , m_origin(sourceOrigin)
@@ -161,7 +161,7 @@ public:
 
     Ref<MessageEvent> event(ScriptExecutionContext& context)
     {
-        return MessageEvent::create(MessagePort::entanglePorts(context, WTFMove(m_message.transferredPorts)), m_message.message.releaseNonNull(), m_origin, { }, MessageEventSource(RefPtr<DOMWindow>(WTFMove(m_source))));
+        return MessageEvent::create(MessagePort::entanglePorts(context, WTFMove(m_message.transferredPorts)), m_message.message.releaseNonNull(), m_origin, { }, m_source ? std::make_optional(MessageEventSource(WTFMove(m_source))) : std::nullopt);
     }
 
     SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); }
@@ -180,7 +180,7 @@ private:
     Ref<DOMWindow> m_window;
     MessageWithMessagePorts m_message;
     String m_origin;
-    Ref<DOMWindow> m_source;
+    RefPtr<WindowProxy> m_source;
     RefPtr<SecurityOrigin> m_targetOrigin;
     RefPtr<ScriptCallStack> m_stackTrace;
     RefPtr<UserGestureToken> m_userGestureToForward;
@@ -960,7 +960,8 @@ ExceptionOr<void> DOMWindow::postMessage(JSC::ExecState& state, DOMWindow& incum
     MessageWithMessagePorts message { messageData.releaseReturnValue(), disentangledPorts.releaseReturnValue() };
 
     // Schedule the message.
-    auto* timer = new PostMessageTimer(*this, WTFMove(message), sourceOrigin, incumbentWindow, WTFMove(target), WTFMove(stackTrace));
+    RefPtr<WindowProxy> incumbentWindowProxy = incumbentWindow.frame() ? &incumbentWindow.frame()->windowProxy() : nullptr;
+    auto* timer = new PostMessageTimer(*this, WTFMove(message), sourceOrigin, WTFMove(incumbentWindowProxy), WTFMove(target), WTFMove(stackTrace));
     timer->startOneShot(0_s);
 
     InspectorInstrumentation::didPostMessage(*m_frame, *timer, state);
index e264a9f..4705550 100644 (file)
@@ -509,7 +509,7 @@ bool DragController::dispatchTextInputEventFor(Frame* innerFrame, const DragData
     String text = m_page.dragCaretController().isContentRichlyEditable() ? emptyString() : dragData.asPlainText();
     Element* target = innerFrame->editor().findEventTargetFrom(m_page.dragCaretController().caretPosition());
     // FIXME: What guarantees target is not null?
-    auto event = TextEvent::createForDrop(innerFrame->document()->domWindow(), text);
+    auto event = TextEvent::createForDrop(&innerFrame->windowProxy(), text);
     target->dispatchEvent(event);
     return !event->defaultPrevented();
 }
index 87d1277..8b3c6d1 100644 (file)
@@ -2198,7 +2198,7 @@ bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Element& dra
 
     view->disableLayerFlushThrottlingTemporarilyForInteraction();
     Ref<MouseEvent> me = MouseEvent::create(eventType,
-        true, true, event.timestamp().approximateMonotonicTime(), m_frame.document()->defaultView(),
+        true, true, event.timestamp().approximateMonotonicTime(), &m_frame.windowProxy(),
         0, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
 #if ENABLE(POINTER_LOCK)
         event.movementDelta().x(), event.movementDelta().y(),
@@ -3248,7 +3248,7 @@ bool EventHandler::internalKeyEvent(const PlatformKeyboardEvent& initialKeyEvent
     PlatformKeyboardEvent keyDownEvent = initialKeyEvent;    
     if (keyDownEvent.type() != PlatformEvent::RawKeyDown)
         keyDownEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown, backwardCompatibilityMode);
-    auto keydown = KeyboardEvent::create(keyDownEvent, m_frame.document()->defaultView());
+    auto keydown = KeyboardEvent::create(keyDownEvent, &m_frame.windowProxy());
     if (matchedAnAccessKey)
         keydown->preventDefault();
     keydown->setTarget(element);
@@ -3271,7 +3271,7 @@ bool EventHandler::internalKeyEvent(const PlatformKeyboardEvent& initialKeyEvent
     
     if (handledByInputMethod) {
         keyDownEvent.setWindowsVirtualKeyCode(CompositionEventKeyCode);
-        keydown = KeyboardEvent::create(keyDownEvent, m_frame.document()->defaultView());
+        keydown = KeyboardEvent::create(keyDownEvent, &m_frame.windowProxy());
         keydown->setTarget(element);
         keydown->setDefaultHandled();
     }
@@ -3301,7 +3301,7 @@ bool EventHandler::internalKeyEvent(const PlatformKeyboardEvent& initialKeyEvent
     keyPressEvent.disambiguateKeyDownEvent(PlatformEvent::Char, backwardCompatibilityMode);
     if (keyPressEvent.text().isEmpty())
         return keydownResult;
-    auto keypress = KeyboardEvent::create(keyPressEvent, m_frame.document()->defaultView());
+    auto keypress = KeyboardEvent::create(keyPressEvent, &m_frame.windowProxy());
     keypress->setTarget(element);
     if (keydownResult)
         keypress->preventDefault();
@@ -3802,7 +3802,7 @@ bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEve
     if (FrameView* view = m_frame.view())
         view->disableLayerFlushThrottlingTemporarilyForInteraction();
 
-    Ref<TextEvent> event = TextEvent::create(m_frame.document()->domWindow(), text, inputType);
+    auto event = TextEvent::create(&m_frame.windowProxy(), text, inputType);
     event->setUnderlyingEvent(underlyingEvent);
 
     target->dispatchEvent(event);
@@ -4211,7 +4211,7 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
 
             Ref<TouchEvent> touchEvent =
                 TouchEvent::create(effectiveTouches.get(), targetTouches.get(), changedTouches[state].m_touches.get(),
-                    stateName, downcast<Node>(*target).document().defaultView(),
+                    stateName, downcast<Node>(*target).document().windowProxy(),
                     0, 0, 0, 0, event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey());
             target->dispatchEvent(touchEvent);
             swallowedEvent = swallowedEvent || touchEvent->defaultPrevented() || touchEvent->defaultHandled();
index 7b09c81..677d66c 100644 (file)
@@ -64,6 +64,22 @@ WebKitDOMDOMWindow* kit(WebCore::DOMWindow* obj)
     return wrapDOMWindow(obj);
 }
 
+WebKitDOMDOMWindow* kit(WebCore::WindowProxy* windowProxy)
+{
+    if (!windowProxy || !is<WebCore::DOMWindow>(windowProxy->window()))
+        return nullptr;
+
+    return kit(downcast<WebCore::DOMWindow>(windowProxy->window()));
+}
+
+WebCore::WindowProxy* toWindowProxy(WebKitDOMDOMWindow* view)
+{
+    auto* window = core(view);
+    if (!window || !window->frame())
+        return nullptr;
+    return &window->frame()->windowProxy();
+}
+
 WebCore::DOMWindow* core(WebKitDOMDOMWindow* request)
 {
     return request ? static_cast<WebCore::DOMWindow*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0;
index e31d227..6684ec6 100644 (file)
 #define WebKitDOMDOMWindowPrivate_h
 
 #include <WebCore/DOMWindow.h>
+#include <WebCore/WindowProxy.h>
 #include <webkitdom/WebKitDOMDOMWindow.h>
 
 namespace WebKit {
 WebKitDOMDOMWindow* wrapDOMWindow(WebCore::DOMWindow*);
 WebKitDOMDOMWindow* kit(WebCore::DOMWindow*);
+WebKitDOMDOMWindow* kit(WebCore::WindowProxy*);
 WebCore::DOMWindow* core(WebKitDOMDOMWindow*);
+WebCore::WindowProxy* toWindowProxy(WebKitDOMDOMWindow*);
 } // namespace WebKit
 
 #endif /* WebKitDOMDOMWindowPrivate_h */
index 950541f..0557aa6 100644 (file)
@@ -1494,8 +1494,7 @@ WebKitDOMDOMWindow* webkit_dom_document_get_default_view(WebKitDOMDocument* self
     WebCore::JSMainThreadNullState state;
     g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0);
     WebCore::Document* item = WebKit::core(self);
-    RefPtr<WebCore::DOMWindow> gobjectResult = WTF::getPtr(item->defaultView());
-    return WebKit::kit(gobjectResult.get());
+    return WebKit::kit(item->windowProxy());
 }
 
 WebKitDOMStyleSheetList* webkit_dom_document_get_style_sheets(WebKitDOMDocument* self)
index c15f6a4..5b67152 100644 (file)
@@ -492,8 +492,7 @@ WebKitDOMDOMWindow* webkit_dom_html_frame_element_get_content_window(WebKitDOMHT
     WebCore::JSMainThreadNullState state;
     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_FRAME_ELEMENT(self), 0);
     WebCore::HTMLFrameElement* item = WebKit::core(self);
-    RefPtr<WebCore::DOMWindow> gobjectResult = WTF::getPtr(item->contentWindow());
-    return WebKit::kit(gobjectResult.get());
+    return WebKit::kit(item->contentWindow());
 }
 
 glong webkit_dom_html_frame_element_get_width(WebKitDOMHTMLFrameElement* self)
index 28b51ce..3e674af 100644 (file)
@@ -538,8 +538,7 @@ WebKitDOMDOMWindow* webkit_dom_html_iframe_element_get_content_window(WebKitDOMH
     WebCore::JSMainThreadNullState state;
     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IFRAME_ELEMENT(self), 0);
     WebCore::HTMLIFrameElement* item = WebKit::core(self);
-    RefPtr<WebCore::DOMWindow> gobjectResult = WTF::getPtr(item->contentWindow());
-    return WebKit::kit(gobjectResult.get());
+    return WebKit::kit(item->contentWindow());
 }
 
 G_GNUC_END_IGNORE_DEPRECATIONS;
index 41fcc97..7da3263 100644 (file)
@@ -202,9 +202,8 @@ void webkit_dom_keyboard_event_init_keyboard_event(WebKitDOMKeyboardEvent* self,
     g_return_if_fail(keyIdentifier);
     WebCore::KeyboardEvent* item = WebKit::core(self);
     WTF::String convertedType = WTF::String::fromUTF8(type);
-    WebCore::DOMWindow* convertedView = WebKit::core(view);
     WTF::String convertedKeyIdentifier = WTF::String::fromUTF8(keyIdentifier);
-    item->initKeyboardEvent(convertedType, canBubble, cancelable, convertedView, convertedKeyIdentifier, location, ctrlKey, altKey, shiftKey, metaKey, altGraphKey);
+    item->initKeyboardEvent(convertedType, canBubble, cancelable, WebKit::toWindowProxy(view), convertedKeyIdentifier, location, ctrlKey, altKey, shiftKey, metaKey, altGraphKey);
 }
 
 gchar* webkit_dom_keyboard_event_get_key_identifier(WebKitDOMKeyboardEvent* self)
index 05800a3..217e565 100644 (file)
@@ -319,9 +319,8 @@ void webkit_dom_mouse_event_init_mouse_event(WebKitDOMMouseEvent* self, const gc
     g_return_if_fail(WEBKIT_DOM_IS_EVENT_TARGET(relatedTarget));
     WebCore::MouseEvent* item = WebKit::core(self);
     WTF::String convertedType = WTF::String::fromUTF8(type);
-    WebCore::DOMWindow* convertedView = WebKit::core(view);
     WebCore::EventTarget* convertedRelatedTarget = WebKit::core(relatedTarget);
-    item->initMouseEvent(convertedType, canBubble, cancelable, convertedView, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, convertedRelatedTarget);
+    item->initMouseEvent(convertedType, canBubble, cancelable, WebKit::toWindowProxy(view), detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, convertedRelatedTarget);
 }
 
 glong webkit_dom_mouse_event_get_screen_x(WebKitDOMMouseEvent* self)
index 9ae0123..a0f6a90 100644 (file)
@@ -204,8 +204,7 @@ void webkit_dom_ui_event_init_ui_event(WebKitDOMUIEvent* self, const gchar* type
     g_return_if_fail(WEBKIT_DOM_IS_DOM_WINDOW(view));
     WebCore::UIEvent* item = WebKit::core(self);
     WTF::String convertedType = WTF::String::fromUTF8(type);
-    WebCore::DOMWindow* convertedView = WebKit::core(view);
-    item->initUIEvent(convertedType, canBubble, cancelable, convertedView, detail);
+    item->initUIEvent(convertedType, canBubble, cancelable, WebKit::toWindowProxy(view), detail);
 }
 
 WebKitDOMDOMWindow* webkit_dom_ui_event_get_view(WebKitDOMUIEvent* self)
@@ -213,8 +212,7 @@ WebKitDOMDOMWindow* webkit_dom_ui_event_get_view(WebKitDOMUIEvent* self)
     WebCore::JSMainThreadNullState state;
     g_return_val_if_fail(WEBKIT_DOM_IS_UI_EVENT(self), 0);
     WebCore::UIEvent* item = WebKit::core(self);
-    RefPtr<WebCore::DOMWindow> gobjectResult = WTF::getPtr(item->view());
-    return WebKit::kit(gobjectResult.get());
+    return WebKit::kit(item->view());
 }
 
 glong webkit_dom_ui_event_get_detail(WebKitDOMUIEvent* self)
index 0e1ba6d..e774cd1 100644 (file)
@@ -131,8 +131,7 @@ void webkit_dom_wheel_event_init_wheel_event(WebKitDOMWheelEvent* self, glong wh
     g_return_if_fail(WEBKIT_DOM_IS_WHEEL_EVENT(self));
     g_return_if_fail(WEBKIT_DOM_IS_DOM_WINDOW(view));
     WebCore::WheelEvent* item = WebKit::core(self);
-    WebCore::DOMWindow* convertedView = WebKit::core(view);
-    item->initWebKitWheelEvent(wheelDeltaX, wheelDeltaY, convertedView, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey);
+    item->initWebKitWheelEvent(wheelDeltaX, wheelDeltaY, WebKit::toWindowProxy(view), screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey);
 }
 
 glong webkit_dom_wheel_event_get_wheel_delta_x(WebKitDOMWheelEvent* self)
index 4816676..a749ea6 100644 (file)
@@ -1680,7 +1680,7 @@ void PDFPlugin::clickedLink(NSURL *url)
 
     RefPtr<Event> coreEvent;
     if (m_lastMouseEvent.type() != WebEvent::NoType)
-        coreEvent = MouseEvent::create(eventNames().clickEvent, frame->document()->defaultView(), platform(m_lastMouseEvent), 0, 0);
+        coreEvent = MouseEvent::create(eventNames().clickEvent, &frame->windowProxy(), platform(m_lastMouseEvent), 0, 0);
 
     frame->loader().urlSelected(coreURL, emptyString(), coreEvent.get(), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, ShouldOpenExternalURLsPolicy::ShouldAllow);
 }
index 6699df0..a82871d 100644 (file)
@@ -2705,7 +2705,7 @@ void WebPage::setInitialFocus(bool forward, bool isKeyboardEventValid, const Web
     if (isKeyboardEventValid && event.type() == WebEvent::KeyDown) {
         PlatformKeyboardEvent platformEvent(platform(event));
         platformEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown);
-        m_page->focusController().setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, &KeyboardEvent::create(platformEvent, frame.document()->defaultView()).get());
+        m_page->focusController().setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, &KeyboardEvent::create(platformEvent, &frame.windowProxy()).get());
 
         send(Messages::WebPageProxy::VoidCallback(callbackID));
         return;
index 44c99da..56fd0cb 100644 (file)
@@ -1,3 +1,37 @@
+2018-04-27  Chris Dumez  <cdumez@apple.com>
+
+        Use WindowProxy instead of DOMWindow in our IDL
+        https://bugs.webkit.org/show_bug.cgi?id=185022
+
+        Reviewed by Sam Weinig.
+
+        * DOM/DOMAbstractView.mm:
+        (kit):
+        (toWindowProxy):
+        * DOM/DOMAbstractViewInternal.h:
+        * DOM/DOMDocument.mm:
+        (-[DOMDocument defaultView]):
+        (-[DOMDocument getComputedStyle:pseudoElement:]):
+        (-[DOMDocument getMatchedCSSRules:pseudoElement:authorOnly:]):
+        * DOM/DOMHTMLFrameElement.mm:
+        (-[DOMHTMLFrameElement contentWindow]):
+        * DOM/DOMHTMLIFrameElement.mm:
+        (-[DOMHTMLIFrameElement contentWindow]):
+        * DOM/DOMKeyboardEvent.mm:
+        (-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:location:ctrlKey:altKey:shiftKey:metaKey:altGraphKey:]):
+        (-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:location:ctrlKey:altKey:shiftKey:metaKey:]):
+        (-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:keyLocation:ctrlKey:altKey:shiftKey:metaKey:altGraphKey:]):
+        (-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:keyLocation:ctrlKey:altKey:shiftKey:metaKey:]):
+        * DOM/DOMMouseEvent.mm:
+        (-[DOMMouseEvent initMouseEvent:canBubble:cancelable:view:detail:screenX:screenY:clientX:clientY:ctrlKey:altKey:shiftKey:metaKey:button:relatedTarget:]):
+        * DOM/DOMTextEvent.mm:
+        (-[DOMTextEvent initTextEvent:canBubbleArg:cancelableArg:viewArg:dataArg:]):
+        * DOM/DOMUIEvent.mm:
+        (-[DOMUIEvent view]):
+        (-[DOMUIEvent initUIEvent:canBubble:cancelable:view:detail:]):
+        * DOM/DOMWheelEvent.mm:
+        (-[DOMWheelEvent initWheelEvent:wheelDeltaY:view:screenX:screenY:clientX:clientY:ctrlKey:altKey:shiftKey:metaKey:]):
+
 2018-04-26  Simon Fraser  <simon.fraser@apple.com>
 
         Implement rendering support for the color-filter CSS property
index 1a4c29b..169e4ae 100644 (file)
@@ -36,6 +36,7 @@
 #import <WebCore/Frame.h>
 #import <WebCore/ThreadCheck.h>
 #import <WebCore/WebScriptObjectPrivate.h>
+#import <WebCore/WindowProxy.h>
 
 #define IMPL reinterpret_cast<WebCore::Frame*>(_internal)
 
@@ -100,3 +101,19 @@ DOMAbstractView *kit(WebCore::AbstractDOMWindow* value)
 
     return kit(downcast<WebCore::DOMWindow>(value));
 }
+
+DOMAbstractView *kit(WebCore::WindowProxy* windowProxy)
+{
+    if (!windowProxy)
+        return nil;
+
+    return kit(windowProxy->window());
+}
+
+WebCore::WindowProxy* toWindowProxy(DOMAbstractView *view)
+{
+    auto* window = core(view);
+    if (!window || !window->frame())
+        return nil;
+    return &window->frame()->windowProxy();
+}
index c4d7325..359f05e 100644 (file)
 namespace WebCore {
 class AbstractDOMWindow;
 class DOMWindow;
+class WindowProxy;
 }
 
 WebCore::DOMWindow* core(DOMAbstractView *);
 DOMAbstractView *kit(WebCore::DOMWindow*);
 DOMAbstractView *kit(WebCore::AbstractDOMWindow*);
+DOMAbstractView *kit(WebCore::WindowProxy*);
+WebCore::WindowProxy* toWindowProxy(DOMAbstractView *);
 
 @interface DOMAbstractView (WebKitLegacyInternal)
 - (void)_disconnectFrame;
index 6c2f36d..30b8c45 100644 (file)
 - (DOMAbstractView *)defaultView
 {
     WebCore::JSMainThreadNullState state;
-    return kit(WTF::getPtr(IMPL->defaultView()));
+    return kit(WTF::getPtr(IMPL->windowProxy()));
 }
 
 - (DOMStyleSheetList *)styleSheets
@@ -684,7 +684,7 @@ static RefPtr<WebCore::XPathNSResolver> wrap(id <DOMXPathNSResolver> resolver)
     WebCore::JSMainThreadNullState state;
     if (!element)
         raiseTypeErrorException();
-    WebCore::DOMWindow* dv = IMPL->defaultView();
+    WebCore::DOMWindow* dv = IMPL->domWindow();
     if (!dv)
         return nil;
     return kit(WTF::getPtr(dv->getComputedStyle(*core(element), pseudoElement)));
@@ -698,7 +698,7 @@ static RefPtr<WebCore::XPathNSResolver> wrap(id <DOMXPathNSResolver> resolver)
 - (DOMCSSRuleList *)getMatchedCSSRules:(DOMElement *)element pseudoElement:(NSString *)pseudoElement authorOnly:(BOOL)authorOnly
 {
     WebCore::JSMainThreadNullState state;
-    WebCore::DOMWindow* dv = IMPL->defaultView();
+    WebCore::DOMWindow* dv = IMPL->domWindow();
     if (!dv)
         return nil;
     return kit(WTF::getPtr(dv->getMatchedCSSRules(core(element), pseudoElement, authorOnly)));
index e9ab1fe..ba2fbe4 100644 (file)
 - (void)initKeyboardEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view keyIdentifier:(NSString *)inKeyIdentifier location:(unsigned)inLocation ctrlKey:(BOOL)inCtrlKey altKey:(BOOL)inAltKey shiftKey:(BOOL)inShiftKey metaKey:(BOOL)inMetaKey altGraphKey:(BOOL)inAltGraphKey
 {
     WebCore::JSMainThreadNullState state;
-    IMPL->initKeyboardEvent(type, canBubble, cancelable, core(view), inKeyIdentifier, inLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey, inAltGraphKey);
+    IMPL->initKeyboardEvent(type, canBubble, cancelable, toWindowProxy(view), inKeyIdentifier, inLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey, inAltGraphKey);
 }
 
 - (void)initKeyboardEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view keyIdentifier:(NSString *)inKeyIdentifier location:(unsigned)inLocation ctrlKey:(BOOL)inCtrlKey altKey:(BOOL)inAltKey shiftKey:(BOOL)inShiftKey metaKey:(BOOL)inMetaKey
 {
     WebCore::JSMainThreadNullState state;
-    IMPL->initKeyboardEvent(type, canBubble, cancelable, core(view), inKeyIdentifier, inLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey);
+    IMPL->initKeyboardEvent(type, canBubble, cancelable, toWindowProxy(view), inKeyIdentifier, inLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey);
 }
 
 - (void)initKeyboardEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view keyIdentifier:(NSString *)inKeyIdentifier keyLocation:(unsigned)inKeyLocation ctrlKey:(BOOL)inCtrlKey altKey:(BOOL)inAltKey shiftKey:(BOOL)inShiftKey metaKey:(BOOL)inMetaKey altGraphKey:(BOOL)inAltGraphKey
 {
     WebCore::JSMainThreadNullState state;
-    IMPL->initKeyboardEvent(type, canBubble, cancelable, core(view), inKeyIdentifier, inKeyLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey, inAltGraphKey);
+    IMPL->initKeyboardEvent(type, canBubble, cancelable, toWindowProxy(view), inKeyIdentifier, inKeyLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey, inAltGraphKey);
 }
 
 - (void)initKeyboardEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view keyIdentifier:(NSString *)inKeyIdentifier keyLocation:(unsigned)inKeyLocation ctrlKey:(BOOL)inCtrlKey altKey:(BOOL)inAltKey shiftKey:(BOOL)inShiftKey metaKey:(BOOL)inMetaKey
 {
     WebCore::JSMainThreadNullState state;
-    IMPL->initKeyboardEvent(type, canBubble, cancelable, core(view), inKeyIdentifier, inKeyLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey);
+    IMPL->initKeyboardEvent(type, canBubble, cancelable, toWindowProxy(view), inKeyIdentifier, inKeyLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey);
 }
 
 @end
index 7c7e0dd..e515d89 100644 (file)
     WebCore::JSMainThreadNullState state;
     DOMNode* inRelatedTargetObjC = inRelatedTarget;
     WebCore::Node* inRelatedTargetNode = core(inRelatedTargetObjC);
-    IMPL->initMouseEvent(type, canBubble, cancelable, core(view), detail, inScreenX, inScreenY, inClientX, inClientY, inCtrlKey, inAltKey, inShiftKey, inMetaKey, inButton, inRelatedTargetNode);
+    IMPL->initMouseEvent(type, canBubble, cancelable, toWindowProxy(view), detail, inScreenX, inScreenY, inClientX, inClientY, inCtrlKey, inAltKey, inShiftKey, inMetaKey, inButton, inRelatedTargetNode);
 }
 
 @end
index 2867bc8..dfa7620 100644 (file)
@@ -50,7 +50,7 @@
 - (void)initTextEvent:(NSString *)typeArg canBubbleArg:(BOOL)canBubbleArg cancelableArg:(BOOL)cancelableArg viewArg:(DOMAbstractView *)viewArg dataArg:(NSString *)dataArg
 {
     WebCore::JSMainThreadNullState state;
-    IMPL->initTextEvent(typeArg, canBubbleArg, cancelableArg, core(viewArg), dataArg);
+    IMPL->initTextEvent(typeArg, canBubbleArg, cancelableArg, toWindowProxy(viewArg), dataArg);
 }
 
 @end
index a464dac..3dc97b3 100644 (file)
 - (void)initUIEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)inView detail:(int)inDetail
 {
     WebCore::JSMainThreadNullState state;
-    IMPL->initUIEvent(type, canBubble, cancelable, core(inView), inDetail);
+    IMPL->initUIEvent(type, canBubble, cancelable, toWindowProxy(inView), inDetail);
 }
 
 @end
index 8f0569c..dd4a57b 100644 (file)
@@ -96,7 +96,7 @@
 - (void)initWheelEvent:(int)inWheelDeltaX wheelDeltaY:(int)inWheelDeltaY view:(DOMAbstractView *)view screenX:(int)screenX screenY:(int)screenY clientX:(int)clientX clientY:(int)clientY ctrlKey:(BOOL)ctrlKey altKey:(BOOL)altKey shiftKey:(BOOL)shiftKey metaKey:(BOOL)metaKey
 {
     WebCore::JSMainThreadNullState state;
-    IMPL->initWebKitWheelEvent(inWheelDeltaX, inWheelDeltaY, core(view), screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey);
+    IMPL->initWebKitWheelEvent(inWheelDeltaX, inWheelDeltaY, toWindowProxy(view), screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey);
 }
 
 @end
index 2b7b9e3..41b7bc7 100644 (file)
@@ -4533,10 +4533,10 @@ static RefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame)
     case NSEventTypeKeyDown: {
         PlatformKeyboardEvent platformEvent = PlatformEventFactory::createPlatformKeyboardEvent(event);
         platformEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown);
-        return KeyboardEvent::create(platformEvent, coreFrame->document()->defaultView());
+        return KeyboardEvent::create(platformEvent, &coreFrame->windowProxy());
     }
     case NSEventTypeKeyUp:
-        return KeyboardEvent::create(PlatformEventFactory::createPlatformKeyboardEvent(event), coreFrame->document()->defaultView());
+        return KeyboardEvent::create(PlatformEventFactory::createPlatformKeyboardEvent(event), &coreFrame->windowProxy());
     default:
         return nullptr;
     }
@@ -4547,7 +4547,7 @@ static RefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame)
     WebEventType type = event.type;
     if (type == WebEventKeyDown || type == WebEventKeyUp) {
         Document* document = coreFrame->document();
-        return KeyboardEvent::create(PlatformEventFactory::createPlatformKeyboardEvent(event), document ? document->defaultView() : 0);
+        return KeyboardEvent::create(PlatformEventFactory::createPlatformKeyboardEvent(event), document ? document->windowProxy() : 0);
     }
     return nullptr;
 #endif
index e71a302..7073627 100644 (file)
@@ -1,3 +1,13 @@
+2018-04-27  Chris Dumez  <cdumez@apple.com>
+
+        Use WindowProxy instead of DOMWindow in our IDL
+        https://bugs.webkit.org/show_bug.cgi?id=185022
+
+        Reviewed by Sam Weinig.
+
+        * DOMCoreClasses.cpp:
+        (DOMDocument::getComputedStyle):
+
 2018-04-23  Daniel Bates  <dabates@apple.com>
 
         Implement Same-Site cookies
index 1b43dd9..b25261f 100644 (file)
@@ -802,7 +802,7 @@ HRESULT DOMDocument::getComputedStyle(_In_opt_ IDOMElement* elt, _In_ BSTR pseud
     if (!element)
         return E_FAIL;
 
-    WebCore::DOMWindow* dv = m_document->defaultView();
+    auto* dv = m_document->domWindow();
     String pseudoEltString(pseudoElt);
     
     if (!dv)