[webkit-changes] [WebKit/WebKit] a4a0ae: Refactor Document.h to reduce build times

Jer Noble noreply at github.com
Mon Jan 23 12:41:58 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a4a0ae0d75768887423c88d42cb963ec2035960b
      https://github.com/WebKit/WebKit/commit/a4a0ae0d75768887423c88d42cb963ec2035960b
  Author: Jer Noble <jer.noble at apple.com>
  Date:   2023-01-23 (Mon, 23 Jan 2023)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Modules/audiosession/DOMAudioSession.h
    M Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.h
    M Source/WebCore/Modules/screen-wake-lock/WakeLock.cpp
    M Source/WebCore/Modules/webxr/WebXRSession.cpp
    M Source/WebCore/Modules/webxr/WebXRWebGLLayer.h
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/bindings/js/ScriptController.cpp
    M Source/WebCore/bindings/js/ScriptController.h
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/DocumentInlines.h
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/FragmentScriptingPermission.h
    M Source/WebCore/dom/KeyboardEvent.cpp
    M Source/WebCore/dom/VisibilityState.h
    M Source/WebCore/html/CanvasBase.h
    A Source/WebCore/html/CanvasObserver.h
    M Source/WebCore/page/Chrome.h
    M Source/WebCore/page/ContextMenuController.cpp
    M Source/WebCore/page/DebugPageOverlays.cpp
    M Source/WebCore/page/DisabledAdaptations.h
    M Source/WebCore/page/DragController.cpp
    M Source/WebCore/page/EventHandler.cpp
    M Source/WebCore/page/ResourceUsageOverlay.cpp
    M Source/WebCore/page/ios/EventHandlerIOS.mm
    M Source/WebCore/page/mac/ImageOverlayControllerMac.mm
    M Source/WebCore/page/mac/ServicesOverlayController.mm
    M Source/WebCore/platform/EventTrackingRegions.h
    M Source/WebCore/platform/KeyboardScrollingAnimator.cpp
    M Source/WebCore/platform/PlatformEvent.h
    M Source/WebCore/platform/PlatformKeyboardEvent.h
    M Source/WebCore/platform/PlatformMouseEvent.h
    M Source/WebCore/platform/PlatformTouchEvent.h
    M Source/WebCore/platform/PlatformWheelEvent.cpp
    M Source/WebCore/platform/PlatformWheelEvent.h
    M Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp
    M Source/WebCore/platform/ios/KeyEventIOS.mm
    M Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm
    M Source/WebCore/platform/ios/ScrollAnimatorIOS.mm
    M Source/WebCore/platform/libwebrtc/LibWebRTCVPXVideoDecoder.cpp
    M Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp
    M Source/WebCore/platform/mac/KeyEventMac.mm
    M Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
    M Source/WebCore/platform/win/KeyEventWin.cpp
    M Source/WebCore/platform/win/PlatformMouseEventWin.cpp
    M Source/WebCore/platform/win/WheelEventWin.cpp
    M Source/WebCore/rendering/style/StyleCanvasImage.h
    M Source/WebCore/rendering/style/StyleCrossfadeImage.h
    M Source/WebCore/xml/DOMParser.cpp
    M Source/WebKit/Shared/WebEventConversion.cpp
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm
    M Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp
    M Source/WebKit/WebProcess/Network/WebSocketChannel.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
    M Source/WebKit/WebProcess/WebPage/FindController.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
    M Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
    M Source/WebKit/WebProcess/WebPage/win/WebPageWin.cpp
    M Source/WebKitLegacy/mac/DOM/DOMDocument.mm
    M Source/WebKitLegacy/mac/WebView/WebFrame.mm
    M Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
    M Source/WebKitLegacy/mac/WebView/WebPDFView.mm
    M Source/WebKitLegacy/win/WebDropSource.cpp
    M Source/WebKitLegacy/win/WebView.cpp

  Log Message:
  -----------
  Refactor Document.h to reduce build times
https://bugs.webkit.org/show_bug.cgi?id=250887
rdar://104465840

Reviewed by Darin Adler.

Replace explicit header includes with forward declarations wherever possible.

For some headers,
this requires enumerations to be moved outside an owning class and into namespace scope so those
enumerations can be forward declared.

For CanvasBase.h, pull CanvasObserver.h into its own file with minimal header dependencies.

For ScriptController, eliminate the requirement for SecurityOrigin to be included by modifying
executeJavaScriptURL() to take an r-value reference to a RefPtr<SecurityOrigin>.

With these changes, the compile-time cost of including Document.h has been reduced by 75%.

* Source/WebCore/Modules/audiosession/DOMAudioSession.h:
* Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
* Source/WebCore/Modules/screen-wake-lock/WakeLock.cpp:
* Source/WebCore/Modules/webxr/WebXRSession.cpp:
* Source/WebCore/Modules/webxr/WebXRWebGLLayer.h:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/ScriptController.cpp:
(WebCore::ScriptController::executeJavaScriptURL):
* Source/WebCore/bindings/js/ScriptController.h:
(WebCore::ScriptController::executeJavaScriptURL):
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::setFocusedElement):
(WebCore::Document::hasListenerTypeForEventType const):
(WebCore::m_reportingScope): Deleted.
* Source/WebCore/dom/Document.h:
(WebCore::Document::setFocusedElement): Deleted.
(WebCore::Document::wasLastFocusByClick const): Deleted.
(WebCore::Document::clientOrigin const): Deleted.
* Source/WebCore/dom/DocumentInlines.h:
(WebCore::Document::clientOrigin const):
(WebCore::Document::wasLastFocusByClick const):
* Source/WebCore/dom/Element.cpp:
(WebCore::isForceEvent):
(WebCore::Element::dispatchMouseForceWillBegin):
* Source/WebCore/dom/FragmentScriptingPermission.h:
* Source/WebCore/dom/KeyboardEvent.cpp:
(WebCore::eventTypeForKeyboardEventType):
* Source/WebCore/dom/VisibilityState.h:
* Source/WebCore/html/CanvasBase.h:
(WebCore::CanvasObserver::isStyleCanvasImage const): Deleted.
* Source/WebCore/html/CanvasObserver.h: Copied from Source/WebCore/page/DisabledAdaptations.h.
(WebCore::CanvasObserver::isStyleCanvasImage const):
* Source/WebCore/page/Chrome.h:
* Source/WebCore/page/ContextMenuController.cpp:
(WebCore::ContextMenuController::showContextMenuAt):
* Source/WebCore/page/DebugPageOverlays.cpp:
(WebCore::InteractionRegionOverlay::mouseEvent):
* Source/WebCore/page/DisabledAdaptations.h:
* Source/WebCore/page/DragController.cpp:
(WebCore::createMouseEvent):
* Source/WebCore/page/EventHandler.cpp:
(WebCore::SyntheticTouchPoint::SyntheticTouchPoint):
(WebCore::SyntheticSingleTouchEvent::SyntheticSingleTouchEvent):
(WebCore::EventHandler::handleMouseForceEvent):
(WebCore::EventHandler::handlePasteGlobalSelection):
(WebCore::EventHandler::sendContextMenuEventForKey):
(WebCore::EventHandler::fakeMouseMoveEventTimerFired):
(WebCore::EventHandler::isKeyEventAllowedInFullScreen const):
(WebCore::EventHandler::internalKeyEvent):
(WebCore::EventHandler::handleDrag):
(WebCore::EventHandler::dispatchSyntheticTouchEventIfEnabled):
* Source/WebCore/page/ResourceUsageOverlay.cpp:
(WebCore::ResourceUsageOverlay::mouseEvent):
* Source/WebCore/page/ios/EventHandlerIOS.mm:
(WebCore::EventHandler::dispatchSimulatedTouchEvent):
(WebCore::EventHandler::tryToBeginDragAtPoint):
* Source/WebCore/page/mac/ImageOverlayControllerMac.mm:
(WebCore::ImageOverlayController::platformHandleMouseEvent):
* Source/WebCore/page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::mouseEvent):
* Source/WebCore/platform/KeyboardScrollingAnimator.cpp:
(WebCore::keyboardScrollingKeyForKeyboardEvent):
* Source/WebCore/platform/PlatformEvent.h:
(WebCore::PlatformEvent::type const):
(WebCore::PlatformEvent::PlatformEvent):
(): Deleted.
* Source/WebCore/platform/PlatformKeyboardEvent.h:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
* Source/WebCore/platform/PlatformMouseEvent.h:
(WebCore::PlatformMouseEvent::PlatformMouseEvent):
* Source/WebCore/platform/PlatformWheelEvent.cpp:
(WebCore::PlatformWheelEvent::createFromGesture):
* Source/WebCore/platform/PlatformWheelEvent.h:
(WebCore::PlatformWheelEvent::PlatformWheelEvent):
* Source/WebCore/platform/ios/KeyEventIOS.mm:
(WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent):
* Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm:
(WebCore::mouseEventType):
(WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder):
(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
(WebCore::touchEventType):
(WebCore::touchPhaseFromPlatformEventType):
* Source/WebCore/platform/ios/ScrollAnimatorIOS.mm:
(WebCore::ScrollAnimatorIOS::handleTouchEvent):
* Source/WebCore/platform/libwebrtc/LibWebRTCVPXVideoDecoder.cpp:
* Source/WebCore/platform/mac/KeyEventMac.mm:
(WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent):
* Source/WebCore/platform/mac/PlatformEventFactoryMac.mm:
(WebCore::mouseEventTypeForEvent):
(WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
(WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder):
(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
* Source/WebCore/rendering/style/StyleCanvasImage.h:
* Source/WebCore/rendering/style/StyleCrossfadeImage.h:
* Source/WebCore/xml/DOMParser.cpp:
* Source/WebKit/Shared/WebEventConversion.cpp:
(WebKit::platform):
(WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
(WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
(WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
(WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent):
(WebKit::WebKit2PlatformGestureEvent::WebKit2PlatformGestureEvent):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm:
(WebKit::ScrollerPairMac::handleMouseEvent):
* Source/WebKit/WebProcess/Network/WebSocketChannel.cpp:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::dispatchSyntheticMouseMove):
(WebKit::WebPage::generateSyntheticEditingCommand):
(WebKit::WebPage::completeSyntheticClick):
(WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
(WebKit::WebPage::requestAdditionalItemsForDragSession):
(WebKit::WebPage::inspectorNodeSearchMovedToPosition):
(WebKit::WebPage::dispatchSyntheticMouseEventsForSelectionGesture):
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::executeKeypressCommandsInternal):
(WebKit::WebPage::handleEditingKeyboardEvent):
* Source/WebKitLegacy/mac/DOM/DOMDocument.mm:
* Source/WebKitLegacy/mac/WebView/WebFrame.mm:
(-[WebFrame _dragSourceEndedAt:operation:]):
* Source/WebKitLegacy/mac/WebView/WebHTMLView.mm:
(currentKeyboardEvent):
(-[WebHTMLView _interpretKeyEvent:savingCommands:]):
* Source/WebKitLegacy/mac/WebView/WebPDFView.mm:
(-[WebPDFView PDFViewWillClickOnLink:withURL:]):

Canonical link: https://commits.webkit.org/259231@main




More information about the webkit-changes mailing list