haikuwebkit/Source/WebCore/page/PageOverlayController.h

111 lines
4.2 KiB
C
Raw Permalink Normal View History

Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
/*
* Copyright (C) 2014 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
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 <rdar://problem/18508258> Reviewed by Anders Carlsson. * CMakeLists.txt: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebCore.exp.in: Export the new PageOverlay[Controller] symbols from WebCore. * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::documentOverlayLayerForFrame): Deleted. Add attachViewOverlayGraphicsLayer, which allows PageOverlayController to push view-relative page overlay root layers down to WebKit to be installed just inside the view. Remove documentOverlayLayerForFrame because RenderLayerCompositor can now talk directly to PageOverlayController. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): When the mouse is moved, pressed, or released, give PageOverlayController the first shot at handling the event. * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): Inform PageOverlayController that the main FrameView's size changed, so it can update the size of view-relative overlays. (WebCore::FrameView::setContentsSize): Inform PageOverlayController that the main FrameView's contents size changed, so it can update the size of document-relative overlays. (WebCore::FrameView::setFixedVisibleContentRect): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::scrollTo): (WebCore::FrameView::wheelEvent): Inform PageOverlayController that something scrolled. (WebCore::FrameView::setExposedRect): Inform PageOverlayController that the exposed rect changed, so it can push the new exposed rect down to the overlays. * page/FrameView.h: Add didChangeScrollOffset. * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: Keep one PageOverlayController per MainFrame. * page/Page.cpp: (WebCore::Page::setDeviceScaleFactor): Inform PageOverlayController that the device scale factor changed. (WebCore::Page::setSessionID): Remove a blank line. * page/PageOverlay.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp. Move PageOverlay from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere (WebCore::PageOverlay::bounds): It is possible to install an overlay before we have a FrameView. We will eventually get a view/contents size changed notification and try again. (WebCore::PageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeNames): Split copyAccessibilityAttribute into "StringValueForPoint" and "BoolValueForPoint" variants, because we don't have anything like WKTypeRef here. * page/PageOverlay.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.h. Make PageOverlay a normal RefCounted object instead of a WebKit2 API object. Leave a comment noting that we should move the PageOverlay's GraphicsLayer to PageOverlay instead of a map on PageOverlayController. * page/PageOverlayController.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.cpp. Move PageOverlayController from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere Leave a FIXME that didChangeSettings is not currently called when settings change. This is not a problem for normal use of overlays, only for dynamically changing layer border/repaint counter settings. (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): We will now lazily initialize the root layers when we first try to use them, because otherwise we try to create them before the ChromeClient's GraphicsLayerFactory is hooked up, in some cases, and that can cause us to create the wrong kind of GraphicsLayers. (WebCore::PageOverlayController::installPageOverlay): Enter compositing mode when installing a PageOverlay. Avoid pushing the Page to the PageOverlay until after we've set up its root layer, so that the installation process can make use of that layer; clients may, for example, expect to be able to setNeedsDisplay() in the didMoveToPage callback. Avoid updateOverlayGeometry until the layer is created and we've pushed the Page down, so that e.g. bounds() will use the right Page. (WebCore::PageOverlayController::didChangeSettings): Leave a FIXME about a future improvement to didChangeSettings. (WebCore::PageOverlayController::deviceScaleFactor): (WebCore::PageOverlayController::notifyFlushRequired): Null-check Page; these can get called when tearing down the Frame. * page/PageOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.h. * platform/graphics/GraphicsLayerClient.h: Add wtf/Forward.h, because GraphicsLayerClient.h uses String. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): Inform PageOverlayController that something scrolled. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers): Make hasAnyAdditionalCompositedLayers return true if there are any page overlays, because we need to avoid falling out of compositing mode if we still have page overlays. (WebCore::RenderLayerCompositor::updateCompositingLayers): Enter compositing mode if we have page overlays. (WebCore::RenderLayerCompositor::appendOverlayLayers): Deleted. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): Rename appendOverlayLayers -> appendDocumentOverlayLayers. (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Attach/detach the view overlay root layer when attaching/detaching the normal compositing root layer. (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Add an empty ChromeClient override. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: Add an empty ChromeClient override. Canonical link: https://commits.webkit.org/155152@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-02 21:06:14 +00:00
#include "GraphicsLayerClient.h"
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
#include "PageOverlay.h"
#include <wtf/HashMap.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
Support document-relative and custom-frame page overlays https://bugs.webkit.org/show_bug.cgi?id=131560 <rdar://problem/16595556> Reviewed by Simon Fraser. Add "document-relative" overlays, which attach to (and scroll with) the document, and can be given a frame rect within the document to avoid overallocation of backing store. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::mainFrame): (WebKit::WebPage::mainFrameView): (WebKit::WebPage::didChangeScrollOffsetForFrame): * WebProcess/WebPage/WebPage.h: Let the PageOverlayController know *which* frame scrolled, instead of "any frame". * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): Factor out shared code. (WebKit::FindController::willMoveToWebPage): (WebKit::FindController::drawRect): We can use clearRect() instead of a transparency layer and fillRect(). I've looked through all the other overlay clients I know of and none of them depend on having a transparency layer at the overlay level. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::create): (WebKit::PageOverlay::PageOverlay): (WebKit::PageOverlay::bounds): (WebKit::PageOverlay::frame): (WebKit::PageOverlay::setFrame): (WebKit::PageOverlay::drawRect): Add OverlayType, which allows creation of Document or View relative overlays. All overlays up to this point are View relative, so we default to that. Document-relative overlays scroll with the page instead of repainting as the page scrolls. They can also be given an explicit frame, allowing them to be smaller than the entire document. * WebProcess/WebPage/PageOverlay.h: (WebKit::PageOverlay::overlayType): (WebKit::PageOverlay::webPage): (WebKit::PageOverlay::client): Deleted. * WebProcess/WebPage/PageOverlayController.cpp: (WebKit::PageOverlayController::initialize): (WebKit::PageOverlayController::installPageOverlay): (WebKit::PageOverlayController::uninstallPageOverlay): (WebKit::PageOverlayController::updateForceSynchronousScrollLayerPositionUpdates): (WebKit::updateOverlayGeometry): (WebKit::PageOverlayController::setPageOverlayNeedsDisplay): (WebKit::PageOverlayController::didChangeViewSize): (WebKit::PageOverlayController::didChangeDocumentSize): (WebKit::PageOverlayController::didChangeDeviceScaleFactor): (WebKit::PageOverlayController::didScrollFrame): (WebKit::PageOverlayController::flushPageOverlayLayers): (WebKit::PageOverlayController::didChangeOverlayFrame): Keep two overlay root layers - one for view-relative and one for document-relative overlays. Don't force synchronous scrolling if we only have document-relative overlays. Update the overlay's position as well as its size whenever necessary. Update document-relative overlay geometry when the document size changes. Only explicitly flush view-relative overlays; document-relative ones are plugged into the WebCore layer tree and flushed along with the page. * WebProcess/WebPage/PageOverlayController.h: (WebKit::PageOverlayController::documentOverlayRootLayer): (WebKit::PageOverlayController::viewOverlayRootLayer): * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Let the PageOverlay controller know when the document size changes. When we set up compositing, push the document overlay root layer down into WebCore. * WebCore.exp.in: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::RenderLayerCompositor): (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): (WebCore::RenderLayerCompositor::setDocumentOverlayRootLayer): * rendering/RenderLayerCompositor.h: Add the concept of a document overlay layer, which is plugged in as the last child of the root content layer. Expose it to WebKit2. Canonical link: https://commits.webkit.org/149624@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167152 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-11 21:41:28 +00:00
namespace WebCore {
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 <rdar://problem/18508258> Reviewed by Anders Carlsson. * CMakeLists.txt: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebCore.exp.in: Export the new PageOverlay[Controller] symbols from WebCore. * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::documentOverlayLayerForFrame): Deleted. Add attachViewOverlayGraphicsLayer, which allows PageOverlayController to push view-relative page overlay root layers down to WebKit to be installed just inside the view. Remove documentOverlayLayerForFrame because RenderLayerCompositor can now talk directly to PageOverlayController. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): When the mouse is moved, pressed, or released, give PageOverlayController the first shot at handling the event. * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): Inform PageOverlayController that the main FrameView's size changed, so it can update the size of view-relative overlays. (WebCore::FrameView::setContentsSize): Inform PageOverlayController that the main FrameView's contents size changed, so it can update the size of document-relative overlays. (WebCore::FrameView::setFixedVisibleContentRect): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::scrollTo): (WebCore::FrameView::wheelEvent): Inform PageOverlayController that something scrolled. (WebCore::FrameView::setExposedRect): Inform PageOverlayController that the exposed rect changed, so it can push the new exposed rect down to the overlays. * page/FrameView.h: Add didChangeScrollOffset. * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: Keep one PageOverlayController per MainFrame. * page/Page.cpp: (WebCore::Page::setDeviceScaleFactor): Inform PageOverlayController that the device scale factor changed. (WebCore::Page::setSessionID): Remove a blank line. * page/PageOverlay.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp. Move PageOverlay from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere (WebCore::PageOverlay::bounds): It is possible to install an overlay before we have a FrameView. We will eventually get a view/contents size changed notification and try again. (WebCore::PageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeNames): Split copyAccessibilityAttribute into "StringValueForPoint" and "BoolValueForPoint" variants, because we don't have anything like WKTypeRef here. * page/PageOverlay.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.h. Make PageOverlay a normal RefCounted object instead of a WebKit2 API object. Leave a comment noting that we should move the PageOverlay's GraphicsLayer to PageOverlay instead of a map on PageOverlayController. * page/PageOverlayController.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.cpp. Move PageOverlayController from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere Leave a FIXME that didChangeSettings is not currently called when settings change. This is not a problem for normal use of overlays, only for dynamically changing layer border/repaint counter settings. (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): We will now lazily initialize the root layers when we first try to use them, because otherwise we try to create them before the ChromeClient's GraphicsLayerFactory is hooked up, in some cases, and that can cause us to create the wrong kind of GraphicsLayers. (WebCore::PageOverlayController::installPageOverlay): Enter compositing mode when installing a PageOverlay. Avoid pushing the Page to the PageOverlay until after we've set up its root layer, so that the installation process can make use of that layer; clients may, for example, expect to be able to setNeedsDisplay() in the didMoveToPage callback. Avoid updateOverlayGeometry until the layer is created and we've pushed the Page down, so that e.g. bounds() will use the right Page. (WebCore::PageOverlayController::didChangeSettings): Leave a FIXME about a future improvement to didChangeSettings. (WebCore::PageOverlayController::deviceScaleFactor): (WebCore::PageOverlayController::notifyFlushRequired): Null-check Page; these can get called when tearing down the Frame. * page/PageOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.h. * platform/graphics/GraphicsLayerClient.h: Add wtf/Forward.h, because GraphicsLayerClient.h uses String. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): Inform PageOverlayController that something scrolled. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers): Make hasAnyAdditionalCompositedLayers return true if there are any page overlays, because we need to avoid falling out of compositing mode if we still have page overlays. (WebCore::RenderLayerCompositor::updateCompositingLayers): Enter compositing mode if we have page overlays. (WebCore::RenderLayerCompositor::appendOverlayLayers): Deleted. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): Rename appendOverlayLayers -> appendDocumentOverlayLayers. (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Attach/detach the view overlay root layer when attaching/detaching the normal compositing root layer. (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Add an empty ChromeClient override. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: Add an empty ChromeClient override. Canonical link: https://commits.webkit.org/155152@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-02 21:06:14 +00:00
class Frame;
class Page;
class PlatformMouseEvent;
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 <rdar://problem/18508258> Reviewed by Anders Carlsson. * CMakeLists.txt: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebCore.exp.in: Export the new PageOverlay[Controller] symbols from WebCore. * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::documentOverlayLayerForFrame): Deleted. Add attachViewOverlayGraphicsLayer, which allows PageOverlayController to push view-relative page overlay root layers down to WebKit to be installed just inside the view. Remove documentOverlayLayerForFrame because RenderLayerCompositor can now talk directly to PageOverlayController. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): When the mouse is moved, pressed, or released, give PageOverlayController the first shot at handling the event. * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): Inform PageOverlayController that the main FrameView's size changed, so it can update the size of view-relative overlays. (WebCore::FrameView::setContentsSize): Inform PageOverlayController that the main FrameView's contents size changed, so it can update the size of document-relative overlays. (WebCore::FrameView::setFixedVisibleContentRect): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::scrollTo): (WebCore::FrameView::wheelEvent): Inform PageOverlayController that something scrolled. (WebCore::FrameView::setExposedRect): Inform PageOverlayController that the exposed rect changed, so it can push the new exposed rect down to the overlays. * page/FrameView.h: Add didChangeScrollOffset. * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: Keep one PageOverlayController per MainFrame. * page/Page.cpp: (WebCore::Page::setDeviceScaleFactor): Inform PageOverlayController that the device scale factor changed. (WebCore::Page::setSessionID): Remove a blank line. * page/PageOverlay.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp. Move PageOverlay from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere (WebCore::PageOverlay::bounds): It is possible to install an overlay before we have a FrameView. We will eventually get a view/contents size changed notification and try again. (WebCore::PageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeNames): Split copyAccessibilityAttribute into "StringValueForPoint" and "BoolValueForPoint" variants, because we don't have anything like WKTypeRef here. * page/PageOverlay.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.h. Make PageOverlay a normal RefCounted object instead of a WebKit2 API object. Leave a comment noting that we should move the PageOverlay's GraphicsLayer to PageOverlay instead of a map on PageOverlayController. * page/PageOverlayController.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.cpp. Move PageOverlayController from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere Leave a FIXME that didChangeSettings is not currently called when settings change. This is not a problem for normal use of overlays, only for dynamically changing layer border/repaint counter settings. (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): We will now lazily initialize the root layers when we first try to use them, because otherwise we try to create them before the ChromeClient's GraphicsLayerFactory is hooked up, in some cases, and that can cause us to create the wrong kind of GraphicsLayers. (WebCore::PageOverlayController::installPageOverlay): Enter compositing mode when installing a PageOverlay. Avoid pushing the Page to the PageOverlay until after we've set up its root layer, so that the installation process can make use of that layer; clients may, for example, expect to be able to setNeedsDisplay() in the didMoveToPage callback. Avoid updateOverlayGeometry until the layer is created and we've pushed the Page down, so that e.g. bounds() will use the right Page. (WebCore::PageOverlayController::didChangeSettings): Leave a FIXME about a future improvement to didChangeSettings. (WebCore::PageOverlayController::deviceScaleFactor): (WebCore::PageOverlayController::notifyFlushRequired): Null-check Page; these can get called when tearing down the Frame. * page/PageOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.h. * platform/graphics/GraphicsLayerClient.h: Add wtf/Forward.h, because GraphicsLayerClient.h uses String. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): Inform PageOverlayController that something scrolled. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers): Make hasAnyAdditionalCompositedLayers return true if there are any page overlays, because we need to avoid falling out of compositing mode if we still have page overlays. (WebCore::RenderLayerCompositor::updateCompositingLayers): Enter compositing mode if we have page overlays. (WebCore::RenderLayerCompositor::appendOverlayLayers): Deleted. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): Rename appendOverlayLayers -> appendDocumentOverlayLayers. (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Attach/detach the view overlay root layer when attaching/detaching the normal compositing root layer. (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Add an empty ChromeClient override. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: Add an empty ChromeClient override. Canonical link: https://commits.webkit.org/155152@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-02 21:06:14 +00:00
class PageOverlayController final : public GraphicsLayerClient {
WTF_MAKE_FAST_ALLOCATED;
PageOverlayController's layers should be created lazily https://bugs.webkit.org/show_bug.cgi?id=194199 Source/WebCore: Reviewed by Tim Horton. Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays() and use them to only parent the overlay-hosting layers when necessary. For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(), which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer compositing updates that parents the layerWithDocumentOverlays(). View overlays are added to the layer tree via the DrawingArea. When we go between having none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer() on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a compositing flush (this has to be done manually because view overlay layers are outside the subtree managed by RenderLayerCompositor). Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer; there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer(). * loader/EmptyClients.h: * page/ChromeClient.h: * page/FrameView.cpp: (WebCore::FrameView::setNeedsCompositingConfigurationUpdate): These functions need to schedule a compositing flush because there may be nothing else that does. (WebCore::FrameView::setNeedsCompositingGeometryUpdate): * page/Page.cpp: (WebCore::Page::installedPageOverlaysChanged): * page/Page.h: * page/PageOverlayController.cpp: (WebCore::PageOverlayController::hasDocumentOverlays const): (WebCore::PageOverlayController::hasViewOverlays const): (WebCore::PageOverlayController::attachViewOverlayLayers): PageOverlayController has the Page so it might as well be the one to call through the ChromeClient. (WebCore::PageOverlayController::detachViewOverlayLayers): (WebCore::PageOverlayController::installPageOverlay): (WebCore::PageOverlayController::uninstallPageOverlay): * page/PageOverlayController.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): isFullUpdate is always true; remove it. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Source/WebKit: rdar://problem/46571593 Reviewed by Tim Horton. Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays() and use them to only parent the overlay-hosting layers when necessary. For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(), which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer compositing updates that parents the layerWithDocumentOverlays(). View overlays are added to the layer tree via the DrawingArea. When we go between having none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer() on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a compositing flush (this has to be done manually because view overlay layers are outside the subtree managed by RenderLayerCompositor). Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer; there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer(). * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/AcceleratedDrawingArea.cpp: (WebKit::AcceleratedDrawingArea::attachViewOverlayGraphicsLayer): * WebProcess/WebPage/AcceleratedDrawingArea.h: * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): Source/WebKitLegacy/mac: rdar://problem/46571593 Reviewed by Tim Horton. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Source/WebKitLegacy/win: rdar://problem/46571593 Reviewed by Tim Horton. Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays() and use them to only parent the overlay-hosting layers when necessary. For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(), which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer compositing updates that parents the layerWithDocumentOverlays(). View overlays are added to the layer tree via the DrawingArea. When we go between having none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer() on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a compositing flush (this has to be done manually because view overlay layers are outside the subtree managed by RenderLayerCompositor). Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer; there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer(). * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: LayoutTests: rdar://problem/46571593 Reviewed by Tim Horton. * pageoverlay/overlay-remove-reinsert-view-expected.txt: We no longer unparent the overlays on view removal, so new results. * platform/ios-wk2/TestExpectations: Unskip some iOS tests. * platform/ios-wk2/pageoverlay/overlay-installation-expected.txt: Added. * platform/ios-wk2/pageoverlay/overlay-large-document-expected.txt: Added. * platform/ios-wk2/pageoverlay/overlay-large-document-scrolled-expected.txt: Added. * platform/ios/TestExpectations: Unskip some iOS tests. Canonical link: https://commits.webkit.org/208700@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-02-04 21:16:22 +00:00
friend class MockPageOverlayClient;
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
public:
Drop MainFrame class https://bugs.webkit.org/show_bug.cgi?id=184191 Reviewed by Darin Adler. Source/WebCore: Drop MainFrame class and move contents into Page / Frame since there is a 1:1 relationship between the Page and the MainFrame. This is ground work for introducing LocalFrame / RemoteFrame concepts. * Modules/applepay/ApplePaySession.cpp: (WebCore::ApplePaySession::create): (WebCore::ApplePaySession::supportsVersion): (WebCore::ApplePaySession::canMakePayments): (WebCore::ApplePaySession::canMakePaymentsWithActiveCard): (WebCore::ApplePaySession::openPaymentSetup): (WebCore::ApplePaySession::paymentCoordinator const): * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::paymentCoordinator): * Modules/mediastream/MediaDevicesEnumerationRequest.cpp: * Modules/mediastream/UserMediaRequest.cpp: * Modules/plugins/QuickTimePluginReplacement.mm: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::mainFrame const): (WebCore::AccessibilityObject::visiblePositionForBounds const): * accessibility/AccessibilityObject.h: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: * bindings/js/ScriptController.cpp: * bindings/js/ScriptState.cpp: * contentextensions/ContentExtensionsBackend.cpp: * css/MediaQueryEvaluator.cpp: (WebCore::displayModeEvaluate): * dom/DOMImplementation.cpp: * dom/Document.cpp: * dom/DocumentMarkerController.cpp: * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/EventDispatcher.cpp: * dom/ScriptedAnimationController.cpp: * editing/Editor.cpp: (WebCore::Editor::scanSelectionForTelephoneNumbers): * editing/EditorCommand.cpp: * editing/SelectionRectGatherer.cpp: (WebCore::SelectionRectGatherer::Notifier::~Notifier): * editing/cocoa/WebContentReaderCocoa.mm: * editing/markup.cpp: * history/CachedFrame.cpp: * history/CachedPage.cpp: * history/PageCache.cpp: (WebCore::destroyRenderTree): * html/HTMLMediaElement.cpp: * html/HTMLPlugInImageElement.cpp: * html/ImageDocument.cpp: * html/MediaElementSession.cpp: (WebCore::isMainContentForPurposesOfAutoplay): * html/canvas/WebGLRenderingContextBase.cpp: * inspector/InspectorClient.cpp: * inspector/InspectorController.cpp: * inspector/InspectorFrontendClientLocal.cpp: * inspector/InspectorFrontendHost.cpp: * inspector/InspectorInstrumentation.cpp: * inspector/InspectorOverlay.cpp: * inspector/PageScriptDebugServer.cpp: * inspector/agents/InspectorApplicationCacheAgent.cpp: * inspector/agents/InspectorCanvasAgent.cpp: * inspector/agents/InspectorDOMAgent.cpp: * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::mainFrame): * inspector/agents/InspectorPageAgent.h: * inspector/agents/page/PageDebuggerAgent.cpp: * inspector/agents/page/PageRuntimeAgent.cpp: * loader/DocumentLoader.cpp: * loader/DocumentWriter.cpp: * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::setState): * loader/HistoryController.cpp: * loader/NavigationDisabler.h: * loader/ProgressTracker.cpp: * loader/ResourceLoadObserver.cpp: * loader/ResourceLoader.cpp: * loader/SubframeLoader.cpp: * loader/SubresourceLoader.cpp: * loader/appcache/ApplicationCacheHost.cpp: * loader/archive/mhtml/MHTMLArchive.cpp: * loader/cache/CachedResource.cpp: * loader/cache/CachedResourceLoader.cpp: * page/AutoscrollController.cpp: * page/Chrome.cpp: * page/ContextMenuController.cpp: * page/DOMWindow.cpp: * page/DebugPageOverlays.cpp: (WebCore::MouseWheelRegionOverlay::updateRegion): (WebCore::NonFastScrollableRegionOverlay::updateRegion): (WebCore::RegionOverlay::create): (WebCore::RegionOverlay::RegionOverlay): (WebCore::RegionOverlay::~RegionOverlay): (WebCore::DebugPageOverlays::ensureRegionOverlayForPage): (WebCore::DebugPageOverlays::showRegionOverlay): (WebCore::DebugPageOverlays::hideRegionOverlay): (WebCore::DebugPageOverlays::regionChanged): (WebCore::DebugPageOverlays::regionOverlayForPage const): (WebCore::DebugPageOverlays::updateOverlayRegionVisibility): (WebCore::DebugPageOverlays::settingsChanged): * page/DebugPageOverlays.h: (WebCore::DebugPageOverlays::hasOverlaysForPage const): (WebCore::DebugPageOverlays::hasOverlays): (WebCore::DebugPageOverlays::didLayout): (WebCore::DebugPageOverlays::didChangeEventHandlers): * page/DragController.cpp: (WebCore::DragController::performDragOperation): (WebCore::DragController::tryDHTMLDrag): (WebCore::DragController::beginDrag): (WebCore::DragController::doSystemDrag): * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): (WebCore::EventHandler::handleWheelEvent): (WebCore::EventHandler::clearLatchedState): (WebCore::EventHandler::defaultWheelEventHandler): * page/FocusController.cpp: * page/Frame.cpp: (WebCore::Frame::Frame): (WebCore::Frame::dropChildren): (WebCore::Frame::selfOnlyRef): (WebCore::Frame::selfOnlyDeref): * page/Frame.h: (WebCore::Frame::mainFrame const): * page/FrameTree.cpp: * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): (WebCore::FrameView::setContentsSize): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::setViewExposedRect): * page/History.cpp: * page/MainFrame.cpp: Removed. * page/MainFrame.h: Removed. * page/MemoryRelease.cpp: * page/Page.cpp: (WebCore::Page::Page): (WebCore::m_applicationManifest): (WebCore::Page::setDeviceScaleFactor): (WebCore::Page::latchingState): (WebCore::Page::pushNewLatchingState): (WebCore::Page::resetLatchingState): (WebCore::Page::popLatchingState): (WebCore::Page::removeLatchingStateForTarget): (WebCore::Page::setPaymentCoordinator): * page/Page.h: (WebCore::Page::mainFrame): (WebCore::Page::mainFrame const): (WebCore::Page::wheelEventDeltaFilter): (WebCore::Page::pageOverlayController): (WebCore::Page::servicesOverlayController): (WebCore::Page::paymentCoordinator const): (WebCore::Page::applicationManifest const): (WebCore::Page::performanceLogging const): * page/PageConsoleClient.cpp: * page/PageDebuggable.cpp: * page/PageGroup.cpp: * page/PageGroupLoadDeferrer.cpp: * page/PageOverlay.cpp: (WebCore::PageOverlay::controller const): * page/PageOverlayController.cpp: (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): (WebCore::PageOverlayController::layerWithDocumentOverlays): (WebCore::PageOverlayController::layerWithViewOverlays): (WebCore::PageOverlayController::installPageOverlay): (WebCore::PageOverlayController::updateForceSynchronousScrollLayerPositionUpdates): (WebCore::PageOverlayController::didChangeViewExposedRect): (WebCore::PageOverlayController::updateSettingsForLayer): (WebCore::PageOverlayController::deviceScaleFactor const): (WebCore::PageOverlayController::notifyFlushRequired): (WebCore::PageOverlayController::tiledBackingUsageChanged): * page/PageOverlayController.h: * page/PageSerializer.cpp: * page/PerformanceLogging.cpp: (WebCore::PerformanceLogging::PerformanceLogging): (WebCore::PerformanceLogging::didReachPointOfInterest): * page/PerformanceLogging.h: * page/PerformanceMonitor.cpp: * page/ResourceUsageOverlay.cpp: (WebCore::ResourceUsageOverlay::~ResourceUsageOverlay): (WebCore::ResourceUsageOverlay::initialize): * page/SettingsBase.cpp: * page/SpatialNavigation.cpp: * page/UserContentProvider.cpp: * page/ios/FrameIOS.mm: * page/mac/DragControllerMac.mm: * page/mac/EventHandlerMac.mm: (WebCore::latchingIsLockedToPlatformFrame): (WebCore::latchingIsLockedToAncestorOfThisFrame): (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded): (WebCore::EventHandler::platformPrepareForWheelEvents): (WebCore::EventHandler::platformRecordWheelEvent): (WebCore::EventHandler::platformCompleteWheelEvent): (WebCore::EventHandler::platformCompletePlatformWidgetWheelEvent): * page/mac/PageMac.mm: * page/mac/ServicesOverlayController.h: (WebCore::ServicesOverlayController::page const): * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::Highlight::Highlight): (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired): (WebCore::ServicesOverlayController::Highlight::deviceScaleFactor const): (WebCore::ServicesOverlayController::ServicesOverlayController): (WebCore::ServicesOverlayController::invalidateHighlightsOfType): (WebCore::ServicesOverlayController::buildPotentialHighlightsIfNeeded): (WebCore::ServicesOverlayController::remainingTimeUntilHighlightShouldBeShown const): (WebCore::ServicesOverlayController::buildPhoneNumberHighlights): (WebCore::ServicesOverlayController::buildSelectionHighlight): (WebCore::ServicesOverlayController::hasRelevantSelectionServices): (WebCore::ServicesOverlayController::createOverlayIfNeeded): (WebCore::ServicesOverlayController::telephoneNumberRangesForFocusedFrame): (WebCore::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight): (WebCore::ServicesOverlayController::mouseEvent): (WebCore::ServicesOverlayController::handleClick): (WebCore::ServicesOverlayController::mainFrame const): * page/scrolling/AsyncScrollingCoordinator.cpp: * page/scrolling/ScrollingCoordinator.cpp: * page/scrolling/ios/ScrollingCoordinatorIOS.mm: * page/scrolling/mac/ScrollingCoordinatorMac.mm: * platform/graphics/ca/win/CACFLayerTreeHost.cpp: * plugins/DOMMimeType.cpp: * plugins/PluginInfoProvider.cpp: (WebCore::PluginInfoProvider::refresh): * rendering/RenderBox.cpp: * rendering/RenderLayer.cpp: * rendering/RenderLayerBacking.cpp: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers const): (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderObject.cpp: * replay/UserInputBridge.cpp: * storage/StorageEventDispatcher.cpp: * style/StyleTreeResolver.cpp: (WebCore::Style::suspendMemoryCacheClientCalls): * svg/SVGSVGElement.cpp: * svg/graphics/SVGImage.cpp: * testing/InternalSettings.cpp: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::installMockPageOverlay): (WebCore::Internals::pageOverlayLayerTreeAsText const): * testing/MockPageOverlay.cpp: * testing/MockPageOverlay.h: * testing/MockPageOverlayClient.cpp: (WebCore::MockPageOverlayClient::installOverlay): (WebCore::MockPageOverlayClient::layerTreeAsText): * testing/MockPageOverlayClient.h: * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::MockPaymentCoordinator): (WebCore::MockPaymentCoordinator::showPaymentUI): (WebCore::MockPaymentCoordinator::completeMerchantValidation): (WebCore::MockPaymentCoordinator::changeShippingOption): (WebCore::MockPaymentCoordinator::changePaymentMethod): (WebCore::MockPaymentCoordinator::acceptPayment): (WebCore::MockPaymentCoordinator::cancelPayment): * testing/MockPaymentCoordinator.h: * workers/service/context/ServiceWorkerThreadProxy.cpp: Source/WebKit: Drop MainFrame class and move contents into Page / Frame since there is a 1:1 relationship between the Page and the MainFrame. This is ground work for introducing LocalFrame / RemoteFrame concepts. * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::paymentCoordinator): * WebProcess/Automation/WebAutomationSessionProxy.cpp: * WebProcess/FullScreen/WebFullScreenManager.cpp: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/InjectedBundle/InjectedBundle.cpp: * WebProcess/Plugins/PDF/PDFPlugin.mm: * WebProcess/Plugins/PluginView.cpp: * WebProcess/Plugins/WebPluginInfoProvider.cpp: * WebProcess/WebCoreSupport/WebChromeClient.cpp: * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::~WebInspectorClient): (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): (WebKit::WebInspectorClient::showPaintRect): * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: * WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp: * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm: * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: * WebProcess/WebPage/AcceleratedDrawingArea.cpp: * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp: * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp: * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp: * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::updatePreferences): * WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.mm: * WebProcess/WebPage/WebBackForwardListProxy.cpp: * WebProcess/WebPage/WebFrame.cpp: * WebProcess/WebPage/WebInspector.cpp: * WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::mainFrame const): (WebKit::WebPage::determinePrimarySnapshottedPlugIn): (WebKit::WebPage::plugInIntersectsSearchRect): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/WebPageIOS.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updatePreferences): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm: * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performImmediateActionHitTestAtLocation): (WebKit::WebPage::dataDetectorsDidPresentUI): (WebKit::WebPage::dataDetectorsDidChangeUI): (WebKit::WebPage::dataDetectorsDidHideUI): * WebProcess/WebProcess.cpp: * WebProcess/WebStorage/StorageAreaMap.cpp: Source/WebKitLegacy/mac: Drop MainFrame class and move contents into Page / Frame since there is a 1:1 relationship between the Page and the MainFrame. This is ground work for introducing LocalFrame / RemoteFrame concepts. * WebCoreSupport/WebDragClient.mm: * WebCoreSupport/WebFrameLoaderClient.mm: * WebCoreSupport/WebInspectorClient.mm: * WebCoreSupport/WebPlatformStrategies.mm: * WebCoreSupport/WebPluginInfoProvider.mm: * WebView/WebFrame.mm: * WebView/WebFrameView.mm: * WebView/WebHTMLView.mm: * WebView/WebView.mm: Source/WebKitLegacy/win: Drop MainFrame class and move contents into Page / Frame since there is a 1:1 relationship between the Page and the MainFrame. This is ground work for introducing LocalFrame / RemoteFrame concepts. * WebCoreSupport/AcceleratedCompositingContext.cpp: * WebCoreSupport/WebContextMenuClient.cpp: * WebCoreSupport/WebDragClient.cpp: * WebDropSource.cpp: * WebFrame.cpp: * WebView.cpp: Tools: * TestWebKitAPI/Tests/WebCore/cocoa/WebCoreNSURLSession.mm: Canonical link: https://commits.webkit.org/199818@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230211 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-03 18:01:41 +00:00
PageOverlayController(Page&);
Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 <rdar://problem/18508258> Reviewed by Anders Carlsson. * CMakeLists.txt: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebCore.exp.in: Export the new PageOverlay[Controller] symbols from WebCore. * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::documentOverlayLayerForFrame): Deleted. Add attachViewOverlayGraphicsLayer, which allows PageOverlayController to push view-relative page overlay root layers down to WebKit to be installed just inside the view. Remove documentOverlayLayerForFrame because RenderLayerCompositor can now talk directly to PageOverlayController. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): When the mouse is moved, pressed, or released, give PageOverlayController the first shot at handling the event. * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): Inform PageOverlayController that the main FrameView's size changed, so it can update the size of view-relative overlays. (WebCore::FrameView::setContentsSize): Inform PageOverlayController that the main FrameView's contents size changed, so it can update the size of document-relative overlays. (WebCore::FrameView::setFixedVisibleContentRect): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::scrollTo): (WebCore::FrameView::wheelEvent): Inform PageOverlayController that something scrolled. (WebCore::FrameView::setExposedRect): Inform PageOverlayController that the exposed rect changed, so it can push the new exposed rect down to the overlays. * page/FrameView.h: Add didChangeScrollOffset. * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: Keep one PageOverlayController per MainFrame. * page/Page.cpp: (WebCore::Page::setDeviceScaleFactor): Inform PageOverlayController that the device scale factor changed. (WebCore::Page::setSessionID): Remove a blank line. * page/PageOverlay.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp. Move PageOverlay from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere (WebCore::PageOverlay::bounds): It is possible to install an overlay before we have a FrameView. We will eventually get a view/contents size changed notification and try again. (WebCore::PageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeNames): Split copyAccessibilityAttribute into "StringValueForPoint" and "BoolValueForPoint" variants, because we don't have anything like WKTypeRef here. * page/PageOverlay.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.h. Make PageOverlay a normal RefCounted object instead of a WebKit2 API object. Leave a comment noting that we should move the PageOverlay's GraphicsLayer to PageOverlay instead of a map on PageOverlayController. * page/PageOverlayController.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.cpp. Move PageOverlayController from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere Leave a FIXME that didChangeSettings is not currently called when settings change. This is not a problem for normal use of overlays, only for dynamically changing layer border/repaint counter settings. (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): We will now lazily initialize the root layers when we first try to use them, because otherwise we try to create them before the ChromeClient's GraphicsLayerFactory is hooked up, in some cases, and that can cause us to create the wrong kind of GraphicsLayers. (WebCore::PageOverlayController::installPageOverlay): Enter compositing mode when installing a PageOverlay. Avoid pushing the Page to the PageOverlay until after we've set up its root layer, so that the installation process can make use of that layer; clients may, for example, expect to be able to setNeedsDisplay() in the didMoveToPage callback. Avoid updateOverlayGeometry until the layer is created and we've pushed the Page down, so that e.g. bounds() will use the right Page. (WebCore::PageOverlayController::didChangeSettings): Leave a FIXME about a future improvement to didChangeSettings. (WebCore::PageOverlayController::deviceScaleFactor): (WebCore::PageOverlayController::notifyFlushRequired): Null-check Page; these can get called when tearing down the Frame. * page/PageOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.h. * platform/graphics/GraphicsLayerClient.h: Add wtf/Forward.h, because GraphicsLayerClient.h uses String. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): Inform PageOverlayController that something scrolled. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers): Make hasAnyAdditionalCompositedLayers return true if there are any page overlays, because we need to avoid falling out of compositing mode if we still have page overlays. (WebCore::RenderLayerCompositor::updateCompositingLayers): Enter compositing mode if we have page overlays. (WebCore::RenderLayerCompositor::appendOverlayLayers): Deleted. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): Rename appendOverlayLayers -> appendDocumentOverlayLayers. (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Attach/detach the view overlay root layer when attaching/detaching the normal compositing root layer. (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Add an empty ChromeClient override. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: Add an empty ChromeClient override. Canonical link: https://commits.webkit.org/155152@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-02 21:06:14 +00:00
virtual ~PageOverlayController();
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
PageOverlayController's layers should be created lazily https://bugs.webkit.org/show_bug.cgi?id=194199 Source/WebCore: Reviewed by Tim Horton. Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays() and use them to only parent the overlay-hosting layers when necessary. For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(), which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer compositing updates that parents the layerWithDocumentOverlays(). View overlays are added to the layer tree via the DrawingArea. When we go between having none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer() on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a compositing flush (this has to be done manually because view overlay layers are outside the subtree managed by RenderLayerCompositor). Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer; there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer(). * loader/EmptyClients.h: * page/ChromeClient.h: * page/FrameView.cpp: (WebCore::FrameView::setNeedsCompositingConfigurationUpdate): These functions need to schedule a compositing flush because there may be nothing else that does. (WebCore::FrameView::setNeedsCompositingGeometryUpdate): * page/Page.cpp: (WebCore::Page::installedPageOverlaysChanged): * page/Page.h: * page/PageOverlayController.cpp: (WebCore::PageOverlayController::hasDocumentOverlays const): (WebCore::PageOverlayController::hasViewOverlays const): (WebCore::PageOverlayController::attachViewOverlayLayers): PageOverlayController has the Page so it might as well be the one to call through the ChromeClient. (WebCore::PageOverlayController::detachViewOverlayLayers): (WebCore::PageOverlayController::installPageOverlay): (WebCore::PageOverlayController::uninstallPageOverlay): * page/PageOverlayController.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): isFullUpdate is always true; remove it. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Source/WebKit: rdar://problem/46571593 Reviewed by Tim Horton. Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays() and use them to only parent the overlay-hosting layers when necessary. For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(), which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer compositing updates that parents the layerWithDocumentOverlays(). View overlays are added to the layer tree via the DrawingArea. When we go between having none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer() on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a compositing flush (this has to be done manually because view overlay layers are outside the subtree managed by RenderLayerCompositor). Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer; there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer(). * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/AcceleratedDrawingArea.cpp: (WebKit::AcceleratedDrawingArea::attachViewOverlayGraphicsLayer): * WebProcess/WebPage/AcceleratedDrawingArea.h: * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): Source/WebKitLegacy/mac: rdar://problem/46571593 Reviewed by Tim Horton. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Source/WebKitLegacy/win: rdar://problem/46571593 Reviewed by Tim Horton. Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays() and use them to only parent the overlay-hosting layers when necessary. For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(), which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer compositing updates that parents the layerWithDocumentOverlays(). View overlays are added to the layer tree via the DrawingArea. When we go between having none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer() on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a compositing flush (this has to be done manually because view overlay layers are outside the subtree managed by RenderLayerCompositor). Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer; there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer(). * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: LayoutTests: rdar://problem/46571593 Reviewed by Tim Horton. * pageoverlay/overlay-remove-reinsert-view-expected.txt: We no longer unparent the overlays on view removal, so new results. * platform/ios-wk2/TestExpectations: Unskip some iOS tests. * platform/ios-wk2/pageoverlay/overlay-installation-expected.txt: Added. * platform/ios-wk2/pageoverlay/overlay-large-document-expected.txt: Added. * platform/ios-wk2/pageoverlay/overlay-large-document-scrolled-expected.txt: Added. * platform/ios/TestExpectations: Unskip some iOS tests. Canonical link: https://commits.webkit.org/208700@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-02-04 21:16:22 +00:00
bool hasDocumentOverlays() const;
bool hasViewOverlays() const;
Clean up how GraphicsLayer's "inWindow" state is set, and fix some issues with Page Overlays https://bugs.webkit.org/show_bug.cgi?id=167850 Reviewed by Tim Horton. Source/WebCore: RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants() walked the RenderLayer tree to set the GraphicsLayer's "inWindow" state. This had the problem of skipping non-primary GraphicsLayers. We also never did this work for page overlay layers. Fix by giving GraphicsLayers a recursive function that sets the inWindow state, and call that from RenderLayerCompositor::setIsInWindow() and PageOverlayController. PageOverlayController also needs to implement tiledBackingUsageChanged so that tiled backings created dynamically get the correct in-window state. Page overlays also had some serious issues in MiniBrowser, in that they disappeared on reload, and on hide/show web view. This was because the overlay root layers were re-parented, but addChild() for each overlay's layer wasn't called. Clean up by replacing willAttachRootLayer() followed by viewOverlayRootLayer()/documentOverlayRootLayer() with single calls that set up the layers, update the inWindow state, and return the layer. Make it possible to dump tile caches in page overlay tests. Make showGraphicsLayers() always dump page overlay layers (source of much confusion). Test: pageoverlay/overlay-remove-reinsert-view.html * page/PageOverlayController.cpp: (WebCore::PageOverlayController::documentOverlayRootLayer): (WebCore::PageOverlayController::viewOverlayRootLayer): (WebCore::PageOverlayController::layerWithDocumentOverlays): (WebCore::PageOverlayController::layerWithViewOverlays): (WebCore::PageOverlayController::tiledBackingUsageChanged): (WebCore::PageOverlayController::willAttachRootLayer): Deleted. * page/PageOverlayController.h: * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): (WebCore::dumpChildren): * platform/graphics/GraphicsLayer.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): (WebCore::RenderLayerCompositor::setIsInWindow): (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): (WebCore::RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants): Deleted. * rendering/RenderLayerCompositor.h: * testing/Internals.cpp: (WebCore::toLayerTreeFlags): (WebCore::Internals::layerTreeAsText): (WebCore::Internals::pageOverlayLayerTreeAsText): * testing/Internals.h: * testing/Internals.idl: * testing/MockPageOverlayClient.cpp: (WebCore::MockPageOverlayClient::layerTreeAsText): * testing/MockPageOverlayClient.h: Tools: * DumpRenderTree/TestRunner.cpp: (TestRunner::uiScriptDidComplete): Fix an assertion that fires for non-16-bit strings. LayoutTests: * pageoverlay/overlay-large-document-expected.txt: * pageoverlay/overlay-large-document-scrolled-expected.txt: * pageoverlay/overlay-remove-reinsert-view-expected.txt: Added. * pageoverlay/overlay-remove-reinsert-view.html: Added. * platform/ios-simulator-wk2/pageoverlay/overlay-remove-reinsert-view-expected.txt: Added. * platform/mac-wk1/pageoverlay/overlay-remove-reinsert-view-expected.txt: Added. * tiled-drawing/tiled-backing-in-window-expected.txt: Canonical link: https://commits.webkit.org/184886@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211683 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-05 19:18:16 +00:00
GraphicsLayer& layerWithDocumentOverlays();
GraphicsLayer& layerWithViewOverlays();
Add bundle SPI allowing PageOverlay to customize the action menu https://bugs.webkit.org/show_bug.cgi?id=138388 <rdar://problem/18875579> Reviewed by Anders Carlsson. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: Bump the BundlePageOverlay client version. (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Don't return if we have a version; the version check happens later anyway, and now it is valid to have a version >0. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h: Bump the BundlePageOverlay client version. Add prepareForActionMenu callback. * WebProcess/WebPage/WebPageOverlay.h: (WebKit::WebPageOverlay::Client::prepareForActionMenu): * WebProcess/WebPage/WebPageOverlay.cpp: (WebKit::overlayMap): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::fromCoreOverlay): (WebKit::WebPageOverlay::pageOverlayDestroyed): Keep track of a map of PageOverlay to WebPageOverlay. (WebKit::WebPageOverlay::prepareForActionMenu): Forward prepareForActionMenu to the client. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performActionMenuHitTestAtLocation): Iterate through the overlays and let them prepareForActionMenu; the first overlay that returns true wins. If no overlays want to do anything, hand preparation along to the context menu client. * page/PageOverlayController.h: Expose the list of all overlays. Canonical link: https://commits.webkit.org/156218@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175597 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-11-05 01:39:47 +00:00
const Vector<RefPtr<PageOverlay>>& pageOverlays() const { return m_pageOverlays; }
Remove PassRefPtr from "page" directory of WebCore, also deploy references https://bugs.webkit.org/show_bug.cgi?id=167224 Reviewed by Chris Dumez. Source/WebCore: * Modules/fetch/DOMWindowFetch.cpp: (WebCore::DOMWindowFetch::fetch): Use DOMWindow::document instead of scriptExecutionContext. * Modules/webdatabase/DatabaseContext.cpp: (WebCore::DatabaseContext::databaseExceededQuota): Pass a reference. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]): Pass a reference. * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::getOwnPropertySlot): Pass a reference. * dom/Document.cpp: (WebCore::Document::childrenChanged): Pass a reference. Also made the didReceiveDocType code unconditional instead of iOS-only. (WebCore::Document::platformSuspendOrStopActiveDOMObjects): Ditto. (WebCore::Document::updateViewportArguments): Ditto. (WebCore::Document::setFocusedElement): Ditto. (WebCore::Document::createDOMWindow): Ditto. (WebCore::Document::takeDOMWindowFrom): Ditto. (WebCore::Document::requestFullScreenForElement): Ditto. (WebCore::Document::webkitExitFullscreen): Ditto. * dom/Element.cpp: (WebCore::Element::focus): Ditto. (WebCore::Element::blur): Ditto. (WebCore::Element::dispatchFocusEvent): Ditto. (WebCore::Element::dispatchBlurEvent): Ditto. * dom/Node.cpp: (WebCore::Node::defaultEventHandler): Ditto. * editing/EditorCommand.cpp: (WebCore::executePrint): Ditto. * editing/FrameSelection.cpp: (WebCore::FrameSelection::setFocusedElementIfNeeded): Ditto. * history/CachedFrame.cpp: (WebCore::CachedFrameBase::restore): Ditto. (WebCore::CachedFrame::CachedFrame): Ditto. * html/ColorInputType.cpp: (WebCore::ColorInputType::handleDOMActivateEvent): Ditto. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::isKeyboardFocusable): Ditto. * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::isKeyboardFocusable): Pass a reference, and also rewrote to use && for clarity. * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::supportsFullscreen): Pass a reference. * html/shadow/SpinButtonElement.cpp: (WebCore::SpinButtonElement::defaultEventHandler): Ditto. (WebCore::SpinButtonElement::releaseCapture): Ditto. * html/shadow/mac/ImageControlsButtonElementMac.cpp: (WebCore::ImageControlsButtonElementMac::defaultEventHandler): Ditto. * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::showContextMenu): Ditto. (WebCore::InspectorFrontendHost::dispatchEventAsContextMenuEvent): Ditto. * loader/EmptyClients.cpp: (WebCore::EmptyChromeClient::createPopupMenu): Updated to take reference. (WebCore::EmptyChromeClient::createSearchPopupMenu): Ditto. (WebCore::EmptyChromeClient::createColorChooser): Ditto. * loader/EmptyClients.h: Ditto. * loader/FrameLoader.cpp: (WebCore::FrameLoader::submitForm): Pass a reference. (WebCore::FrameLoader::commitProvisionalLoad): Ditto. (WebCore::FrameLoader::closeAndRemoveChild): Take a reference. (WebCore::FrameLoader::detachFromParent): Pass a reference. (WebCore::FrameLoader::dispatchBeforeUnloadEvent): Ditto. (WebCore::createWindow): Ditto. * loader/FrameLoader.h: Updated for the above. * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNewWindowPolicy): Pass a reference. * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::recalculateAvailableSpaceInQuota): Ditto. * loader/appcache/ApplicationCacheGroup.h: Return a reference from origin. * loader/appcache/ApplicationCacheStorage.cpp: (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin): Take a reference. (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache): Ditto. (WebCore::ApplicationCacheStorage::store): Pass a reference. (WebCore::ApplicationCacheStorage::checkOriginQuota): Updated since origin now returns areference. * loader/appcache/ApplicationCacheStorage.h: Updated for the above. * loader/archive/mhtml/MHTMLArchive.cpp: (WebCore::MHTMLArchive::generateMHTMLData): Pass a reference. * mathml/MathMLElement.cpp: (WebCore::MathMLElement::isKeyboardFocusable): Ditto. * page/Chrome.cpp: (WebCore::Chrome::Chrome): Moved initialization of data members to the class definition. (WebCore::Chrome::contentsSizeChanged): Take a reference. (WebCore::Chrome::createWindow): Ditto. (WebCore::Chrome::runBeforeUnloadConfirmPanel): Ditto. (WebCore::Chrome::runJavaScriptAlert): Ditto. (WebCore::Chrome::runJavaScriptConfirm): Ditto. (WebCore::Chrome::runJavaScriptPrompt): Ditto. (WebCore::Chrome::setStatusbarText): Ditto. (WebCore::Chrome::print): Ditto. (WebCore::Chrome::createColorChooser): Ditto. (WebCore::Chrome::createPopupMenu): Ditto. (WebCore::Chrome::createSearchPopupMenu): Ditto. (WebCore::Chrome::didReceiveDocType): Ditto. Also made unconditional, but empty for non-iOS platforms. (WebCore::Chrome::registerPopupOpeningObserver): Take a reference. (WebCore::Chrome::unregisterPopupOpeningObserver): Ditto. * page/Chrome.h: Updated for the above. * page/ChromeClient.h: Take references. Also updated some arguments from Node to Element. * page/ContextMenuController.cpp: (WebCore::ContextMenuController::handleContextMenuEvent): Take a reference. (WebCore::ContextMenuController::showContextMenu): Ditto. (WebCore::ContextMenuController::maybeCreateContextMenu): Ditto. Also use make_unique instead of unique_ptr plus new. (WebCore::openNewWindow): Ditto. (WebCore::insertUnicodeCharacter): Ditto. (WebCore::ContextMenuController::contextMenuItemSelected): Ditto. (WebCore::ContextMenuController::showContextMenuAt): Ditto. (WebCore::ContextMenuController::showImageControlsMenu): Ditto. * page/ContextMenuController.h: Updated for the above. * page/DOMTimer.cpp: (WebCore::DOMTimer::fired): Pass a reference. * page/DOMWindow.cpp: (WebCore::PostMessageTimer::PostMessageTimer): Take Ref&& instead of PassRefPtr. (WebCore::DOMWindow::adjustWindowRect): Use a reference. (WebCore::DOMWindow::allowPopUp): Ditto. Also rewrite to use || instead of successive if statements. (WebCore::DOMWindow::canShowModalDialog): Ditto. (WebCore::DOMWindow::DOMWindow): Ditto. (WebCore::DOMWindow::didSecureTransitionTo): Ditto. (WebCore::DOMWindow::registerProperty): Ditto. (WebCore::DOMWindow::unregisterProperty): Ditto. (WebCore::DOMWindow::postMessageTimerFired): Merge with the function immediately followed, called only from here. (WebCore::DOMWindow::dispatchMessageEventWithOriginCheck): Deleted. (WebCore::DOMWindow::print): Pass a reference. (WebCore::DOMWindow::alert): Ditto. (WebCore::DOMWindow::confirm): Ditto. (WebCore::DOMWindow::prompt): Ditto. (WebCore::DOMWindow::setStatus): Ditto. (WebCore::DOMWindow::setDefaultStatus): Ditto. (WebCore::DOMWindow::moveBy): Ditto. (WebCore::DOMWindow::moveTo): Ditto. (WebCore::DOMWindow::resizeBy): Ditto. (WebCore::DOMWindow::resizeTo): Ditto. (WebCore::DOMWindow::clearTimeout): Ditto. (WebCore::DOMWindow::incrementScrollEventListenersCount): Ditto. (WebCore::DOMWindow::decrementScrollEventListenersCount): Ditto. (WebCore::DOMWindow::showModalDialog): Ditto. * page/DOMWindow.h: Updated for the above. ALso made functions private and final. * page/DOMWindowProperty.cpp: (WebCore::DOMWindowProperty::DOMWindowProperty): Pass a reference. (WebCore::DOMWindowProperty::~DOMWindowProperty): Ditto. (WebCore::DOMWindowProperty::willDestroyGlobalObjectInCachedFrame): Ditto. (WebCore::DOMWindowProperty::willDestroyGlobalObjectInFrame): Ditto. * page/DebugPageOverlays.cpp: (WebCore::RegionOverlay::create): Return RefPtr instead of PassRefPtr. (WebCore::RegionOverlay::~RegionOverlay): Pass a reference. (WebCore::DebugPageOverlays::showRegionOverlay): Ditto. (WebCore::DebugPageOverlays::hideRegionOverlay): Ditto. * page/DragController.cpp: (WebCore::DragController::dragExited): Pass a reference. (WebCore::DragController::performDragOperation): Ditto. (WebCore::DragController::concludeEditDrag): Ditto. (WebCore::DragController::tryDHTMLDrag): Ditto. * page/EventHandler.cpp: Replaced OptionalCursor with std::optional<Cursor>. (WebCore::EventHandler::updateCursor): Refactor into two functions so we can share more code with selectCursor. (WebCore::EventHandler::selectCursor): Updated to use std::optional. (WebCore::EventHandler::handleMouseMoveEvent): Use the new updateCursor. (WebCore::EventHandler::startPanScrolling): Use a reference. (WebCore::EventHandler::updateDragAndDrop): Ditto. (WebCore::EventHandler::cancelDragAndDrop): Ditto. (WebCore::EventHandler::performDragAndDrop): Ditto. (WebCore::EventHandler::setCapturingMouseEventsElement): Take a raw pointer instead of a PassRefPtr. (WebCore::EventHandler::dispatchMouseEvent): Use a reference. (WebCore::EventHandler::updateDragStateAfterEditDragIfNeeded): Ditto. (WebCore::EventHandler::isKeyboardOptionTab): Ditto. (WebCore::EventHandler::eventInvertsTabsToLinksClientCallResult): Ditto. (WebCore::EventHandler::tabsToLinks): Ditto. * page/EventHandler.h: Updated for the above. * page/FocusController.cpp: (WebCore::FocusController::setFocusedFrame): Take pointer instead of PassRefPtr. (WebCore::FocusController::setFocusedElement): Take reference instead of PassRefPtr. * page/FocusController.h: Updated for the above changes. * page/FrameTree.cpp: (WebCore::FrameTree::transferChild): Deleted. Unused function. (WebCore::FrameTree::appendChild): Merged with the following function since it's now only used here. Take reference instead of PassRefPtr. (WebCore::FrameTree::actuallyAppendChild): Deleted. (WebCore::FrameTree::removeChild): Take reference instead of pointer. Use move instead of trickier swap. * page/FrameTree.h: Updated for the above. * page/FrameView.cpp: (WebCore::FrameView::setContentsSize): Use a reference. * page/MainFrame.cpp: (WebCore::MainFrame::dropChildren): Ditto. * page/Page.cpp: (WebCore::Page::scrollingCoordinator): Ditto. * page/PageOverlay.cpp: (WebCore::PageOverlay::fadeAnimationTimerFired): Ditto. * page/PageOverlayController.cpp: (WebCore::PageOverlayController::installPageOverlay): Take reference instead of PassRefPtr. (WebCore::PageOverlayController::uninstallPageOverlay): Take reference intead of pointer. * page/PageOverlayController.h: Updated for the above. * page/PageSerializer.cpp: (WebCore::PageSerializer::PageSerializer): Moved most initialization to the class definition. (WebCore::PageSerializer::serialize): Use reference. (WebCore::PageSerializer::serializeFrame): Use initializer list instead of constructor for resource. (WebCore::PageSerializer::serializeCSSStyleSheet): Ditto. (WebCore::PageSerializer::addImageToResources): Ditto. * page/PageSerializer.h: Removed constructors from PageSerializer::Resource struct since structures don't really need them. Updated for the above. Changed SerializerMarkupAccumulator into a nested class. * page/PerformanceEntry.h: (WebCore::PerformanceEntry::startTimeCompareLessThan): Use const RefPtr& instead of PassRefPtr to compare RefPtr in place. * page/PerformanceUserTiming.cpp: (WebCore::insertPerformanceEntry): Take Ref&& instead of PassRefPtr. * page/ResourceUsageOverlay.cpp: (WebCore::ResourceUsageOverlay::~ResourceUsageOverlay): Use refrence. (WebCore::ResourceUsageOverlay::initialize): Ditto. * page/animation/AnimationBase.h: Removed unneeded include. * page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::clear): Use reference. (WebCore::AnimationControllerPrivate::fireEventsAndUpdateStyle): Ditto. (WebCore::AnimationControllerPrivate::addEventToDispatch): Use the append function instead of a hand-written alternative. (WebCore::AnimationControllerPrivate::addElementChangeToDispatch): Take a reference rather than a Ref&& since no caller is passing ownership. * page/animation/AnimationControllerPrivate.h: Updated for the above. * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): Return RefPtr instead of PassRefPtr. (WebCore::blendFilter): Ditto. (WebCore::crossfadeBlend): Ditto. * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::updateTransitions): Updated to use animationForProperty, which returns a raw pointer. (WebCore::CompositeAnimation::animationForProperty): Renamed from getAnimationForProperty and changed to return raw pointer instead of PassRefPtr. * page/animation/CompositeAnimation.h: Updated for the above. * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::onAnimationEnd): Use animationForProperty. (WebCore::ImplicitAnimation::sendTransitionEvent): Pass reference. * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::sendAnimationEvent): Ditto. * page/efl/EventHandlerEfl.cpp: (WebCore::EventHandler::tabsToAllFormControls): Take reference. (WebCore::EventHandler::createDraggingDataTransfer): Return Ref. * page/gtk/EventHandlerGtk.cpp: (WebCore::EventHandler::tabsToAllFormControls): Ditto. (WebCore::EventHandler::createDraggingDataTransfer): Ditto. * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::tabsToAllFormControls): Ditto. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::createDraggingDataTransfer): Ditto. (WebCore::EventHandler::tabsToAllFormControls): Ditto. (WebCore::EventHandler::platformPrepareForWheelEvents): Ditto. * page/mac/ServicesOverlayController.h: Take Ref&& for ranges instead of PassRefPtr. Use references. * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::Highlight::createForSelection): Ditto. (WebCore::ServicesOverlayController::Highlight::createForTelephoneNumber): Ditto. (WebCore::ServicesOverlayController::Highlight::Highlight): Ditto. (WebCore::ServicesOverlayController::buildPotentialHighlightsIfNeeded): Ditto. (WebCore::ServicesOverlayController::buildPhoneNumberHighlights): Ditto. (WebCore::ServicesOverlayController::buildSelectionHighlight): Ditto. (WebCore::ServicesOverlayController::highlightsAreEquivalent): Ditto. (WebCore::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight): Ditto. (WebCore::ServicesOverlayController::handleClick): Ditto. * page/mac/TextIndicatorWindow.mm: (-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]): Take a reference instead of PassRefPtr. (WebCore::TextIndicatorWindow::setTextIndicator): Updated for the above. * page/scrolling/AsyncScrollingCoordinator.h: Use Ref&& and RefPtr intead of PsasRefPtr. * page/scrolling/ScrollLatchingState.cpp: (WebCore::ScrollLatchingState::ScrollLatchingState): Initialize data members in class definition. (WebCore::ScrollLatchingState::setWheelEventElement): Use raw pointer instead of PassRefPtr. (WebCore::ScrollLatchingState::setPreviousWheelScrolledElement): Use raw pointer instead of RefPtr&&. (WebCore::ScrollLatchingState::setScrollableContainer): Use raw pointer instead of PassRefPtr. * page/scrolling/ScrollLatchingState.h: Updated for the above. * page/scrolling/ScrollingStateNode.cpp: (WebCore::ScrollingStateNode::cloneAndReset): Use Ref instead of PassRefPtr. (WebCore::ScrollingStateNode::appendChild): Use Ref&& instead of PassRefPtr. * page/scrolling/ScrollingStateNode.h: Updated for the above. * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::createNode): Use Ref instead of PassRefPtr. (WebCore::ScrollingStateTree::attachNode): Updated for the abve. (WebCore::ScrollingStateTree::commit): Ditto. * page/scrolling/ScrollingStateTree.h: Ditto. * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::updateTreeFromStateNode): Use reference. * page/scrolling/ScrollingTree.h: Return Ref instead of PassRefPtr. * page/scrolling/ScrollingTreeNode.cpp: (WebCore::ScrollingTreeNode::appendChild): Take Ref&& instead of PassRefPtr. (WebCore::ScrollingTreeNode::removeChild): Take reference instead of pointer. * page/scrolling/ScrollingTreeNode.h: Updated for the above. * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::ThreadedScrollingTree): Take reference instead of pointer. * page/scrolling/ThreadedScrollingTree.h: Updated for the above. * page/scrolling/ios/ScrollingCoordinatorIOS.mm: (WebCore::ScrollingCoordinatorIOS::ScrollingCoordinatorIOS): Pass reference. * page/scrolling/ios/ScrollingTreeIOS.cpp: (WebCore::ScrollingTreeIOS::create): Take a reference. (WebCore::ScrollingTreeIOS::ScrollingTreeIOS): Ditto. (WebCore::ScrollingTreeIOS::createScrollingTreeNode): Return Ref instead of PassRefPtr. * page/scrolling/ios/ScrollingTreeIOS.h: Updated for the above. * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::ScrollingCoordinatorMac): Use reference. * page/scrolling/mac/ScrollingTreeMac.cpp: (ScrollingTreeMac::create): Take a reference. (ScrollingTreeMac::ScrollingTreeMac): Ditto. (ScrollingTreeMac::createScrollingTreeNode): Return a Ref instead of a PassRefPtr. * page/scrolling/mac/ScrollingTreeMac.h: Updated for the above. * page/win/EventHandlerWin.cpp: (WebCore::EventHandler::tabsToAllFormControls): Take reference. (WebCore::EventHandler::createDraggingDataTransfer): Return Ref. * platform/Cursor.h: Rearranged the header a bit. Got rid of the explicit copy constructor, assignment operator, and destructor. Using the ones that the compiler automatically generates will work for all platforms and we then also get move constructor and move assignment operator. * platform/efl/CursorEfl.cpp: (WebCore::Cursor::Cursor): Deleted. (WebCore::Cursor::~Cursor): Deleted. (WebCore::Cursor::operator=): Deleted. * platform/gtk/CursorGtk.cpp: (WebCore::Cursor::Cursor): Deleted. (WebCore::Cursor::operator=): Deleted. (WebCore::Cursor::~Cursor): Deleted. * platform/mac/CursorMac.mm: (WebCore::Cursor::Cursor): Deleted. (WebCore::Cursor::operator=): Deleted. (WebCore::Cursor::~Cursor): Deleted. * platform/win/CursorWin.cpp: (WebCore::SharedCursor::SharedCursor): Moved this here from the header since it is only used within this file. (WebCore::SharedCursor::create): Ditto. (WebCore::Cursor::Cursor): Deleted. (WebCore::Cursor::operator=): Deleted. (WebCore::Cursor::~Cursor): Deleted. * rendering/RenderEmbeddedObject.cpp: (WebCore::RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent): Pass reference. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::RenderLayerBacking): Get to FrameView through the render tree itself, rather than through the frame. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateLayerForHeader): Use reference. (WebCore::RenderLayerCompositor::updateLayerForFooter): Ditto. (WebCore::RenderLayerCompositor::attachRootLayer): Ditto. (WebCore::RenderLayerCompositor::detachRootLayer): Ditto. * rendering/RenderMenuList.cpp: (RenderMenuList::showPopup): Ditto. * rendering/RenderSearchField.cpp: (WebCore::RenderSearchField::addSearchResult): Ditto. (WebCore::RenderSearchField::showPopup): Ditto. (WebCore::RenderSearchField::valueChanged): Ditto. * svg/SVGAElement.cpp: (WebCore::SVGAElement::isKeyboardFocusable): Ditto. * testing/MockPageOverlayClient.cpp: (WebCore::MockPageOverlayClient::installOverlay): Ditto. (WebCore::MockPageOverlayClient::uninstallAllOverlays): Ditto. Source/WebKit/ios: * WebCoreSupport/WebChromeClientIOS.h: Update for changes to ChromeClient. * WebCoreSupport/WebChromeClientIOS.mm: (WebChromeClientIOS::runJavaScriptAlert): Ditto. (WebChromeClientIOS::runJavaScriptConfirm): Ditto. (WebChromeClientIOS::runJavaScriptPrompt): Ditto. (WebChromeClientIOS::setNeedsScrollNotifications): Ditto. (WebChromeClientIOS::observedContentChange): Ditto. (WebChromeClientIOS::clearContentChangeObservers): Ditto. (WebChromeClientIOS::notifyRevealedSelectionByScrollingFrame): Ditto. (WebChromeClientIOS::elementDidFocus): Ditto. (WebChromeClientIOS::elementDidBlur): Ditto. (WebChromeClientIOS::createPopupMenu): Ditto. (WebChromeClientIOS::createSearchPopupMenu): Ditto. (WebChromeClientIOS::attachRootGraphicsLayer): Ditto. Source/WebKit/mac: * WebCoreSupport/WebApplicationCacheQuotaManager.mm: (-[WebApplicationCacheQuotaManager quota]): Pass reference. * WebCoreSupport/WebChromeClient.h: Updated for changes to ChromeClient. * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::focusedElementChanged): Ditto. (WebChromeClient::createWindow): Ditto. (WebChromeClient::runBeforeUnloadConfirmPanel): Ditto. (WebChromeClient::runJavaScriptAlert): Ditto. (WebChromeClient::runJavaScriptConfirm): Ditto. (WebChromeClient::runJavaScriptPrompt): Ditto. (WebChromeClient::contentsSizeChanged): Ditto. (WebChromeClient::unavailablePluginButtonClicked): Ditto. (WebChromeClient::print): Ditto. (WebChromeClient::exceededDatabaseQuota): Ditto. (WebChromeClient::reachedApplicationCacheOriginQuota): Ditto. (WebChromeClient::createColorChooser): Ditto. (WebChromeClient::elementDidFocus): Ditto. (WebChromeClient::elementDidBlur): Ditto. (WebChromeClient::createPopupMenu): Ditto. (WebChromeClient::createSearchPopupMenu): Ditto. (WebChromeClient::attachRootGraphicsLayer): Ditto. (WebChromeClient::attachViewOverlayGraphicsLayer): Ditto. (WebChromeClient::supportsFullScreenForElement): Ditto. (WebChromeClient::enterFullScreenForElement): Ditto. (WebChromeClient::exitFullScreenForElement): Ditto. * WebView/WebFrame.mm: (+[WebFrame _createFrameWithPage:frameName:frameView:ownerElement:]): Updated for change to the appendChild function. Source/WebKit/win: * Plugins/PluginView.cpp: (WebCore::PluginView::status): Pass reference. (WebCore::PluginView::focusPluginElement): Ditto. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::createWindow): Updated for change to ChromeClient. (WebChromeClient::runBeforeUnloadConfirmPanel): Ditto. (WebChromeClient::runJavaScriptAlert): Ditto. (WebChromeClient::runJavaScriptConfirm): Ditto. (WebChromeClient::runJavaScriptPrompt): Ditto. (WebChromeClient::contentsSizeChanged): Ditto. (WebChromeClient::unavailablePluginButtonClicked): Ditto. (WebChromeClient::print): Ditto. (WebChromeClient::exceededDatabaseQuota): Ditto. (WebChromeClient::reachedApplicationCacheOriginQuota): Ditto. (WebChromeClient::attachRootGraphicsLayer): Ditto. (WebChromeClient::attachViewOverlayGraphicsLayer): Ditto. (WebChromeClient::enterVideoFullscreenForVideoElement): Ditto. (WebChromeClient::createPopupMenu): Ditto. (WebChromeClient::createSearchPopupMenu): Ditto. (WebChromeClient::supportsFullScreenForElement): Ditto. (WebChromeClient::enterFullScreenForElement): Ditto. (WebChromeClient::exitFullScreenForElement): Ditto. (WebChromeClient::shouldUseTiledBackingForFrameView): Ditto. * WebCoreSupport/WebChromeClient.h: Ditto. Source/WebKit2: * UIProcess/Scrolling/RemoteScrollingTree.cpp: (WebKit::RemoteScrollingTree::createScrollingTreeNode): Return a Ref instead of PassRefPtr. * UIProcess/Scrolling/RemoteScrollingTree.h: Updated for the above. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): Pass a reference. (WKBundlePageUninstallPageOverlay): Ditto. (WKBundlePageInstallPageOverlayWithAnimation): Ditto. (WKBundlePageUninstallPageOverlayWithAnimation): Ditto. * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm: (WebKit::PDFPlugin::jsPDFDocPrint): Ditto. * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::focusPluginElement): Ditto. (WebKit::PluginView::setStatusbarText): Ditto. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::elementDidFocus): Updated for changes to ChromeClient. (WebKit::WebChromeClient::elementDidBlur): Ditto. (WebKit::WebChromeClient::makeFirstResponder): Ditto. (WebKit::WebChromeClient::createWindow): Ditto. (WebKit::WebChromeClient::runBeforeUnloadConfirmPanel): Ditto. (WebKit::WebChromeClient::runJavaScriptAlert): Ditto. (WebKit::WebChromeClient::runJavaScriptConfirm): Ditto. (WebKit::WebChromeClient::runJavaScriptPrompt): Ditto. (WebKit::WebChromeClient::contentsSizeChanged): Ditto. (WebKit::WebChromeClient::unavailablePluginButtonClicked): Ditto. (WebKit::WebChromeClient::print): Ditto. (WebKit::WebChromeClient::exceededDatabaseQuota): Ditto. (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota): Ditto. (WebKit::WebChromeClient::createColorChooser): Ditto. (WebKit::WebChromeClient::createPopupMenu): Ditto. (WebKit::WebChromeClient::createSearchPopupMenu): Ditto. (WebKit::WebChromeClient::attachRootGraphicsLayer): Ditto. (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Ditto. (WebKit::WebChromeClient::createScrollingCoordinator): Ditto. (WebKit::WebChromeClient::supportsFullScreenForElement): Ditto. (WebKit::WebChromeClient::enterFullScreenForElement): Ditto. (WebKit::WebChromeClient::exitFullScreenForElement): Ditto. (WebKit::WebChromeClient::didAddHeaderLayer): Ditto. (WebKit::WebChromeClient::didAddFooterLayer): Ditto. (WebKit::WebChromeClient::shouldUseTiledBackingForFrameView): Ditto. * WebProcess/WebCoreSupport/WebChromeClient.h: Ditto. * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: (WebKit::WebChromeClient::elementDidRefocus): Ditto. (WebKit::WebChromeClient::didReceiveMobileDocType): Ditto. (WebKit::WebChromeClient::observedContentChange): Ditto. (WebKit::WebChromeClient::clearContentChangeObservers): Ditto. (WebKit::WebChromeClient::notifyRevealedSelectionByScrollingFrame): Ditto. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchCreatePage): Pass reference. * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::~WebInspectorClient): Ditto. (WebKit::WebInspectorClient::hideHighlight): Ditto. (WebKit::WebInspectorClient::showPaintRect): Ditto. * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): Ditto. (WebKit::FindController::hideFindUI): Ditto. * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::createWithCoreMainFrame): Return Ref instead of PassRefPtr. (WebKit::WebFrame::createSubframe): Ditto. (WebKit::WebFrame::create): Ditto. * WebProcess/WebPage/WebFrame.h: Updated for the above. * WebProcess/WebPage/WebInspector.cpp: (WebKit::WebInspector::openInNewTab): Pass reference. * WebProcess/WebPage/ios/FindControllerIOS.mm: (WebKit::FindController::updateFindIndicator): Use reference. (WebKit::FindController::hideFindIndicator): Ditto. Canonical link: https://commits.webkit.org/184345@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211033 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-23 06:24:18 +00:00
WEBCORE_EXPORT void installPageOverlay(PageOverlay&, PageOverlay::FadeMode);
WEBCORE_EXPORT void uninstallPageOverlay(PageOverlay&, PageOverlay::FadeMode);
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 <rdar://problem/18508258> Reviewed by Anders Carlsson. * CMakeLists.txt: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebCore.exp.in: Export the new PageOverlay[Controller] symbols from WebCore. * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::documentOverlayLayerForFrame): Deleted. Add attachViewOverlayGraphicsLayer, which allows PageOverlayController to push view-relative page overlay root layers down to WebKit to be installed just inside the view. Remove documentOverlayLayerForFrame because RenderLayerCompositor can now talk directly to PageOverlayController. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): When the mouse is moved, pressed, or released, give PageOverlayController the first shot at handling the event. * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): Inform PageOverlayController that the main FrameView's size changed, so it can update the size of view-relative overlays. (WebCore::FrameView::setContentsSize): Inform PageOverlayController that the main FrameView's contents size changed, so it can update the size of document-relative overlays. (WebCore::FrameView::setFixedVisibleContentRect): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::scrollTo): (WebCore::FrameView::wheelEvent): Inform PageOverlayController that something scrolled. (WebCore::FrameView::setExposedRect): Inform PageOverlayController that the exposed rect changed, so it can push the new exposed rect down to the overlays. * page/FrameView.h: Add didChangeScrollOffset. * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: Keep one PageOverlayController per MainFrame. * page/Page.cpp: (WebCore::Page::setDeviceScaleFactor): Inform PageOverlayController that the device scale factor changed. (WebCore::Page::setSessionID): Remove a blank line. * page/PageOverlay.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp. Move PageOverlay from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere (WebCore::PageOverlay::bounds): It is possible to install an overlay before we have a FrameView. We will eventually get a view/contents size changed notification and try again. (WebCore::PageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeNames): Split copyAccessibilityAttribute into "StringValueForPoint" and "BoolValueForPoint" variants, because we don't have anything like WKTypeRef here. * page/PageOverlay.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.h. Make PageOverlay a normal RefCounted object instead of a WebKit2 API object. Leave a comment noting that we should move the PageOverlay's GraphicsLayer to PageOverlay instead of a map on PageOverlayController. * page/PageOverlayController.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.cpp. Move PageOverlayController from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere Leave a FIXME that didChangeSettings is not currently called when settings change. This is not a problem for normal use of overlays, only for dynamically changing layer border/repaint counter settings. (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): We will now lazily initialize the root layers when we first try to use them, because otherwise we try to create them before the ChromeClient's GraphicsLayerFactory is hooked up, in some cases, and that can cause us to create the wrong kind of GraphicsLayers. (WebCore::PageOverlayController::installPageOverlay): Enter compositing mode when installing a PageOverlay. Avoid pushing the Page to the PageOverlay until after we've set up its root layer, so that the installation process can make use of that layer; clients may, for example, expect to be able to setNeedsDisplay() in the didMoveToPage callback. Avoid updateOverlayGeometry until the layer is created and we've pushed the Page down, so that e.g. bounds() will use the right Page. (WebCore::PageOverlayController::didChangeSettings): Leave a FIXME about a future improvement to didChangeSettings. (WebCore::PageOverlayController::deviceScaleFactor): (WebCore::PageOverlayController::notifyFlushRequired): Null-check Page; these can get called when tearing down the Frame. * page/PageOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.h. * platform/graphics/GraphicsLayerClient.h: Add wtf/Forward.h, because GraphicsLayerClient.h uses String. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): Inform PageOverlayController that something scrolled. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers): Make hasAnyAdditionalCompositedLayers return true if there are any page overlays, because we need to avoid falling out of compositing mode if we still have page overlays. (WebCore::RenderLayerCompositor::updateCompositingLayers): Enter compositing mode if we have page overlays. (WebCore::RenderLayerCompositor::appendOverlayLayers): Deleted. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): Rename appendOverlayLayers -> appendDocumentOverlayLayers. (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Attach/detach the view overlay root layer when attaching/detaching the normal compositing root layer. (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Add an empty ChromeClient override. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: Add an empty ChromeClient override. Canonical link: https://commits.webkit.org/155152@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-02 21:06:14 +00:00
void setPageOverlayNeedsDisplay(PageOverlay&, const IntRect&);
Support setting a background color on page overlays https://bugs.webkit.org/show_bug.cgi?id=131600 Reviewed by Darin Adler. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::PageOverlay): (WebKit::PageOverlay::bounds): (WebKit::PageOverlay::startFadeInAnimation): (WebKit::PageOverlay::startFadeOutAnimation): (WebKit::PageOverlay::startFadeAnimation): (WebKit::PageOverlay::fadeAnimationTimerFired): Minor style adjustments. Use more references everywhere. (WebKit::PageOverlay::setBackgroundColor): (WebKit::PageOverlay::setNeedsDisplay): * WebProcess/WebPage/PageOverlay.h: (WebKit::PageOverlay::backgroundColor): Keep track of our background color, and push it down to the page overlay controller if we have one. * WebProcess/WebPage/PageOverlayController.cpp: (WebKit::updateOverlayGeometry): (WebKit::PageOverlayController::clearPageOverlay): Page overlays will always have the right size, and just use drawsContents to determine whether or not they should tile/have backing store/etc. (WebKit::PageOverlayController::installPageOverlay): (WebKit::PageOverlayController::didChangeOverlayBackgroundColor): Set the background color of the layer. * WebProcess/WebPage/PageOverlayController.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): References! * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::setDocumentOverlayRootLayer): Mark the compositing tree as needing a rebuild when we get a new document-relative overlay layer; otherwise we were depending on something else coming along and requiring a rebuild, which didn't always happen. Canonical link: https://commits.webkit.org/149682@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-14 08:10:22 +00:00
void setPageOverlayOpacity(PageOverlay&, float);
void clearPageOverlay(PageOverlay&);
Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 <rdar://problem/18508258> Reviewed by Anders Carlsson. * CMakeLists.txt: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebCore.exp.in: Export the new PageOverlay[Controller] symbols from WebCore. * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::documentOverlayLayerForFrame): Deleted. Add attachViewOverlayGraphicsLayer, which allows PageOverlayController to push view-relative page overlay root layers down to WebKit to be installed just inside the view. Remove documentOverlayLayerForFrame because RenderLayerCompositor can now talk directly to PageOverlayController. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): When the mouse is moved, pressed, or released, give PageOverlayController the first shot at handling the event. * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): Inform PageOverlayController that the main FrameView's size changed, so it can update the size of view-relative overlays. (WebCore::FrameView::setContentsSize): Inform PageOverlayController that the main FrameView's contents size changed, so it can update the size of document-relative overlays. (WebCore::FrameView::setFixedVisibleContentRect): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::scrollTo): (WebCore::FrameView::wheelEvent): Inform PageOverlayController that something scrolled. (WebCore::FrameView::setExposedRect): Inform PageOverlayController that the exposed rect changed, so it can push the new exposed rect down to the overlays. * page/FrameView.h: Add didChangeScrollOffset. * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: Keep one PageOverlayController per MainFrame. * page/Page.cpp: (WebCore::Page::setDeviceScaleFactor): Inform PageOverlayController that the device scale factor changed. (WebCore::Page::setSessionID): Remove a blank line. * page/PageOverlay.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp. Move PageOverlay from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere (WebCore::PageOverlay::bounds): It is possible to install an overlay before we have a FrameView. We will eventually get a view/contents size changed notification and try again. (WebCore::PageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeNames): Split copyAccessibilityAttribute into "StringValueForPoint" and "BoolValueForPoint" variants, because we don't have anything like WKTypeRef here. * page/PageOverlay.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.h. Make PageOverlay a normal RefCounted object instead of a WebKit2 API object. Leave a comment noting that we should move the PageOverlay's GraphicsLayer to PageOverlay instead of a map on PageOverlayController. * page/PageOverlayController.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.cpp. Move PageOverlayController from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere Leave a FIXME that didChangeSettings is not currently called when settings change. This is not a problem for normal use of overlays, only for dynamically changing layer border/repaint counter settings. (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): We will now lazily initialize the root layers when we first try to use them, because otherwise we try to create them before the ChromeClient's GraphicsLayerFactory is hooked up, in some cases, and that can cause us to create the wrong kind of GraphicsLayers. (WebCore::PageOverlayController::installPageOverlay): Enter compositing mode when installing a PageOverlay. Avoid pushing the Page to the PageOverlay until after we've set up its root layer, so that the installation process can make use of that layer; clients may, for example, expect to be able to setNeedsDisplay() in the didMoveToPage callback. Avoid updateOverlayGeometry until the layer is created and we've pushed the Page down, so that e.g. bounds() will use the right Page. (WebCore::PageOverlayController::didChangeSettings): Leave a FIXME about a future improvement to didChangeSettings. (WebCore::PageOverlayController::deviceScaleFactor): (WebCore::PageOverlayController::notifyFlushRequired): Null-check Page; these can get called when tearing down the Frame. * page/PageOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.h. * platform/graphics/GraphicsLayerClient.h: Add wtf/Forward.h, because GraphicsLayerClient.h uses String. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): Inform PageOverlayController that something scrolled. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers): Make hasAnyAdditionalCompositedLayers return true if there are any page overlays, because we need to avoid falling out of compositing mode if we still have page overlays. (WebCore::RenderLayerCompositor::updateCompositingLayers): Enter compositing mode if we have page overlays. (WebCore::RenderLayerCompositor::appendOverlayLayers): Deleted. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): Rename appendOverlayLayers -> appendDocumentOverlayLayers. (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Attach/detach the view overlay root layer when attaching/detaching the normal compositing root layer. (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Add an empty ChromeClient override. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: Add an empty ChromeClient override. Canonical link: https://commits.webkit.org/155152@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-02 21:06:14 +00:00
GraphicsLayer& layerForOverlay(PageOverlay&) const;
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
void didChangeViewSize();
Support document-relative and custom-frame page overlays https://bugs.webkit.org/show_bug.cgi?id=131560 <rdar://problem/16595556> Reviewed by Simon Fraser. Add "document-relative" overlays, which attach to (and scroll with) the document, and can be given a frame rect within the document to avoid overallocation of backing store. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::mainFrame): (WebKit::WebPage::mainFrameView): (WebKit::WebPage::didChangeScrollOffsetForFrame): * WebProcess/WebPage/WebPage.h: Let the PageOverlayController know *which* frame scrolled, instead of "any frame". * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): Factor out shared code. (WebKit::FindController::willMoveToWebPage): (WebKit::FindController::drawRect): We can use clearRect() instead of a transparency layer and fillRect(). I've looked through all the other overlay clients I know of and none of them depend on having a transparency layer at the overlay level. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::create): (WebKit::PageOverlay::PageOverlay): (WebKit::PageOverlay::bounds): (WebKit::PageOverlay::frame): (WebKit::PageOverlay::setFrame): (WebKit::PageOverlay::drawRect): Add OverlayType, which allows creation of Document or View relative overlays. All overlays up to this point are View relative, so we default to that. Document-relative overlays scroll with the page instead of repainting as the page scrolls. They can also be given an explicit frame, allowing them to be smaller than the entire document. * WebProcess/WebPage/PageOverlay.h: (WebKit::PageOverlay::overlayType): (WebKit::PageOverlay::webPage): (WebKit::PageOverlay::client): Deleted. * WebProcess/WebPage/PageOverlayController.cpp: (WebKit::PageOverlayController::initialize): (WebKit::PageOverlayController::installPageOverlay): (WebKit::PageOverlayController::uninstallPageOverlay): (WebKit::PageOverlayController::updateForceSynchronousScrollLayerPositionUpdates): (WebKit::updateOverlayGeometry): (WebKit::PageOverlayController::setPageOverlayNeedsDisplay): (WebKit::PageOverlayController::didChangeViewSize): (WebKit::PageOverlayController::didChangeDocumentSize): (WebKit::PageOverlayController::didChangeDeviceScaleFactor): (WebKit::PageOverlayController::didScrollFrame): (WebKit::PageOverlayController::flushPageOverlayLayers): (WebKit::PageOverlayController::didChangeOverlayFrame): Keep two overlay root layers - one for view-relative and one for document-relative overlays. Don't force synchronous scrolling if we only have document-relative overlays. Update the overlay's position as well as its size whenever necessary. Update document-relative overlay geometry when the document size changes. Only explicitly flush view-relative overlays; document-relative ones are plugged into the WebCore layer tree and flushed along with the page. * WebProcess/WebPage/PageOverlayController.h: (WebKit::PageOverlayController::documentOverlayRootLayer): (WebKit::PageOverlayController::viewOverlayRootLayer): * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Let the PageOverlay controller know when the document size changes. When we set up compositing, push the document overlay root layer down into WebCore. * WebCore.exp.in: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::RenderLayerCompositor): (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): (WebCore::RenderLayerCompositor::setDocumentOverlayRootLayer): * rendering/RenderLayerCompositor.h: Add the concept of a document overlay layer, which is plugged in as the last child of the root content layer. Expose it to WebKit2. Canonical link: https://commits.webkit.org/149624@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167152 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-11 21:41:28 +00:00
void didChangeDocumentSize();
Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 <rdar://problem/18508258> Reviewed by Anders Carlsson. * CMakeLists.txt: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebCore.exp.in: Export the new PageOverlay[Controller] symbols from WebCore. * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::documentOverlayLayerForFrame): Deleted. Add attachViewOverlayGraphicsLayer, which allows PageOverlayController to push view-relative page overlay root layers down to WebKit to be installed just inside the view. Remove documentOverlayLayerForFrame because RenderLayerCompositor can now talk directly to PageOverlayController. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): When the mouse is moved, pressed, or released, give PageOverlayController the first shot at handling the event. * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): Inform PageOverlayController that the main FrameView's size changed, so it can update the size of view-relative overlays. (WebCore::FrameView::setContentsSize): Inform PageOverlayController that the main FrameView's contents size changed, so it can update the size of document-relative overlays. (WebCore::FrameView::setFixedVisibleContentRect): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::scrollTo): (WebCore::FrameView::wheelEvent): Inform PageOverlayController that something scrolled. (WebCore::FrameView::setExposedRect): Inform PageOverlayController that the exposed rect changed, so it can push the new exposed rect down to the overlays. * page/FrameView.h: Add didChangeScrollOffset. * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: Keep one PageOverlayController per MainFrame. * page/Page.cpp: (WebCore::Page::setDeviceScaleFactor): Inform PageOverlayController that the device scale factor changed. (WebCore::Page::setSessionID): Remove a blank line. * page/PageOverlay.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp. Move PageOverlay from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere (WebCore::PageOverlay::bounds): It is possible to install an overlay before we have a FrameView. We will eventually get a view/contents size changed notification and try again. (WebCore::PageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeNames): Split copyAccessibilityAttribute into "StringValueForPoint" and "BoolValueForPoint" variants, because we don't have anything like WKTypeRef here. * page/PageOverlay.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.h. Make PageOverlay a normal RefCounted object instead of a WebKit2 API object. Leave a comment noting that we should move the PageOverlay's GraphicsLayer to PageOverlay instead of a map on PageOverlayController. * page/PageOverlayController.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.cpp. Move PageOverlayController from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere Leave a FIXME that didChangeSettings is not currently called when settings change. This is not a problem for normal use of overlays, only for dynamically changing layer border/repaint counter settings. (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): We will now lazily initialize the root layers when we first try to use them, because otherwise we try to create them before the ChromeClient's GraphicsLayerFactory is hooked up, in some cases, and that can cause us to create the wrong kind of GraphicsLayers. (WebCore::PageOverlayController::installPageOverlay): Enter compositing mode when installing a PageOverlay. Avoid pushing the Page to the PageOverlay until after we've set up its root layer, so that the installation process can make use of that layer; clients may, for example, expect to be able to setNeedsDisplay() in the didMoveToPage callback. Avoid updateOverlayGeometry until the layer is created and we've pushed the Page down, so that e.g. bounds() will use the right Page. (WebCore::PageOverlayController::didChangeSettings): Leave a FIXME about a future improvement to didChangeSettings. (WebCore::PageOverlayController::deviceScaleFactor): (WebCore::PageOverlayController::notifyFlushRequired): Null-check Page; these can get called when tearing down the Frame. * page/PageOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.h. * platform/graphics/GraphicsLayerClient.h: Add wtf/Forward.h, because GraphicsLayerClient.h uses String. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): Inform PageOverlayController that something scrolled. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers): Make hasAnyAdditionalCompositedLayers return true if there are any page overlays, because we need to avoid falling out of compositing mode if we still have page overlays. (WebCore::RenderLayerCompositor::updateCompositingLayers): Enter compositing mode if we have page overlays. (WebCore::RenderLayerCompositor::appendOverlayLayers): Deleted. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): Rename appendOverlayLayers -> appendDocumentOverlayLayers. (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Attach/detach the view overlay root layer when attaching/detaching the normal compositing root layer. (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Add an empty ChromeClient override. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: Add an empty ChromeClient override. Canonical link: https://commits.webkit.org/155152@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-02 21:06:14 +00:00
void didChangeSettings();
Add additional WEBCORE_EXPORTs https://bugs.webkit.org/show_bug.cgi?id=181414 Reviewed by Alex Christensen. No new tests. No change in behavior. * dom/Document.h: * dom/ViewportArguments.h: * page/DOMWindow.h: * page/FrameView.h: * page/PageOverlayController.h: * platform/ContextMenuItem.h: * platform/Pasteboard.h: * platform/SharedBuffer.h: * platform/UserAgent.h: * platform/graphics/GLContext.h: * platform/graphics/GraphicsContext.h: * platform/graphics/GraphicsLayerTransform.h: * platform/graphics/PlatformDisplay.h: * platform/graphics/cairo/BackingStoreBackendCairoImpl.h: * platform/graphics/cairo/PlatformContextCairo.h: * platform/graphics/cairo/RefPtrCairo.h: * platform/graphics/nicosia/NicosiaBuffer.h: * platform/graphics/nicosia/NicosiaPaintingEngine.h: * platform/graphics/texmap/TextureMapper.h: * platform/graphics/texmap/TextureMapperAnimation.h: * platform/graphics/texmap/TextureMapperBackingStore.h: * platform/graphics/texmap/TextureMapperFPSCounter.h: * platform/graphics/texmap/TextureMapperLayer.h: (WebCore::TextureMapperLayer::TextureMapperLayer): Deleted. (WebCore::TextureMapperLayer::setID): Deleted. (WebCore::TextureMapperLayer::id): Deleted. (WebCore::TextureMapperLayer:: const): Deleted. (WebCore::TextureMapperLayer::setScrollClient): Deleted. (WebCore::TextureMapperLayer::setIsScrollable): Deleted. (WebCore::TextureMapperLayer::isScrollable const): Deleted. (WebCore::TextureMapperLayer::textureMapper const): Deleted. (WebCore::TextureMapperLayer::setTextureMapper): Deleted. (WebCore::TextureMapperLayer::drawsContent const): Deleted. (WebCore::TextureMapperLayer::contentsAreVisible const): Deleted. (WebCore::TextureMapperLayer::size const): Deleted. (WebCore::TextureMapperLayer::opacity const): Deleted. (WebCore::TextureMapperLayer::transform const): Deleted. (WebCore::TextureMapperLayer::hasFilters const): Deleted. (WebCore::TextureMapperLayer::isShowingRepaintCounter const): Deleted. (WebCore::TextureMapperLayer::fixedToViewport const): Deleted. (WebCore::TextureMapperLayer::rootLayer const): Deleted. (WebCore::TextureMapperLayer::texture): Deleted. (WebCore::TextureMapperLayer::adjustedPosition const): Deleted. (WebCore::TextureMapperLayer::layerRect const): Deleted. (WebCore::TextureMapperLayer::State::State): Deleted. * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h: * platform/graphics/texmap/TextureMapperTile.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: (WebCore::CoordinatedGraphicsLayer::isScrollable const): Deleted. (WebCore::CoordinatedGraphicsLayer::id const): Deleted. (WebCore::CoordinatedGraphicsLayer::coverRect const): Deleted. (WebCore::CoordinatedGraphicsLayer::fixedToViewport const): Deleted. * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h: (WebCore::CoordinatedImageBacking::id const): Deleted. * platform/graphics/texmap/coordinated/TiledBackingStore.h: * platform/graphics/texmap/coordinated/UpdateAtlas.h: * platform/network/AuthenticationChallengeBase.h: * platform/network/CredentialBase.h: * platform/network/ProtectionSpaceBase.h: * platform/network/curl/SocketStreamHandleImpl.h: * replay/UserInputBridge.h: Canonical link: https://commits.webkit.org/197307@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226657 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-09 21:17:20 +00:00
WEBCORE_EXPORT void didChangeDeviceScaleFactor();
Rename exposedRect to viewExposedRect and propagate it as Optional<> through WK2 https://bugs.webkit.org/show_bug.cgi?id=156274 Reviewed by NOBODY (OOPS!). DrawingArea and FrameView have an "exposedRect" property that is used by applications on Mac, like Mail, that embed web views inside scroll views. However, this name is very similar to the "exposedContentRect" that is used on iOS to denote the part of the view whose pixels are visible, including through blurring overlaid UI. To disambiguate these two, rename the Mac "exposedRect" to "viewExposedRect" to emphasize that it's a rect that takes into account clipping in the native view hierarchy. Also make this rect Optional<> through the DrawingArea, removing comparisons against FloatRect::infiniteRect(). Do some other minor renaming in VisibleContentRectUpdateInfo. Source/WebCore: * page/FrameView.cpp: (WebCore::FrameView::setViewExposedRect): This now takes an Optional<> because WebViewImpl::updateViewExposedRect() can clear it. * page/FrameView.h: * page/PageOverlayController.cpp: (WebCore::PageOverlayController::didChangeViewExposedRect): (WebCore::PageOverlayController::didChangeExposedRect): Deleted. * page/PageOverlayController.h: * rendering/RenderLayerBacking.cpp: (WebCore::computeTileCoverage): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::flushPendingLayerChanges): Source/WebKit2: * Shared/VisibleContentRectUpdateInfo.cpp: Rename "exposedRect" and "unobscuredRect" to have "Content" in the names. (WebKit::VisibleContentRectUpdateInfo::encode): (WebKit::VisibleContentRectUpdateInfo::decode): * Shared/VisibleContentRectUpdateInfo.h: (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo): (WebKit::VisibleContentRectUpdateInfo::exposedContentRect): (WebKit::VisibleContentRectUpdateInfo::unobscuredContentRect): (WebKit::operator==): (WebKit::VisibleContentRectUpdateInfo::exposedRect): Deleted. (WebKit::VisibleContentRectUpdateInfo::unobscuredRect): Deleted. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::updateViewExposedRect): * UIProcess/DrawingAreaProxy.cpp: (WebKit::DrawingAreaProxy::DrawingAreaProxy): (WebKit::DrawingAreaProxy::setViewExposedRect): (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired): (WebKit::DrawingAreaProxy::setExposedRect): Deleted. (WebKit::DrawingAreaProxy::exposedRectChangedTimerFired): Deleted. * UIProcess/DrawingAreaProxy.h: (WebKit::DrawingAreaProxy::viewExposedRect): (WebKit::DrawingAreaProxy::exposedRect): Deleted. * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::exposedContentRect): (WebKit::WebPageProxy::unobscuredContentRect): * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h: * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::setViewExposedRect): (WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorLocation): (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator): (WebKit::RemoteLayerTreeDrawingAreaProxy::scaledExposedRect): Deleted. (WebKit::RemoteLayerTreeDrawingAreaProxy::setExposedRect): Deleted. This was only used to position the indicator, and confusingly used either exposedContentRect() or viewExposedRect() depending on platform. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/DrawingArea.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::updateVisibleContentRects): * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::setViewExposedRect): (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): Deleted. (WebKit::RemoteLayerTreeDrawingArea::setExposedRect): Deleted. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::setViewExposedRect): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): Deleted. (WebKit::TiledCoreAnimationDrawingArea::setExposedRect): Deleted. Canonical link: https://commits.webkit.org/174384@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199111 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-04-06 19:22:57 +00:00
void didChangeViewExposedRect();
Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 <rdar://problem/18508258> Reviewed by Anders Carlsson. * CMakeLists.txt: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebCore.exp.in: Export the new PageOverlay[Controller] symbols from WebCore. * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::documentOverlayLayerForFrame): Deleted. Add attachViewOverlayGraphicsLayer, which allows PageOverlayController to push view-relative page overlay root layers down to WebKit to be installed just inside the view. Remove documentOverlayLayerForFrame because RenderLayerCompositor can now talk directly to PageOverlayController. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): When the mouse is moved, pressed, or released, give PageOverlayController the first shot at handling the event. * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): Inform PageOverlayController that the main FrameView's size changed, so it can update the size of view-relative overlays. (WebCore::FrameView::setContentsSize): Inform PageOverlayController that the main FrameView's contents size changed, so it can update the size of document-relative overlays. (WebCore::FrameView::setFixedVisibleContentRect): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::scrollTo): (WebCore::FrameView::wheelEvent): Inform PageOverlayController that something scrolled. (WebCore::FrameView::setExposedRect): Inform PageOverlayController that the exposed rect changed, so it can push the new exposed rect down to the overlays. * page/FrameView.h: Add didChangeScrollOffset. * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: Keep one PageOverlayController per MainFrame. * page/Page.cpp: (WebCore::Page::setDeviceScaleFactor): Inform PageOverlayController that the device scale factor changed. (WebCore::Page::setSessionID): Remove a blank line. * page/PageOverlay.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp. Move PageOverlay from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere (WebCore::PageOverlay::bounds): It is possible to install an overlay before we have a FrameView. We will eventually get a view/contents size changed notification and try again. (WebCore::PageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeNames): Split copyAccessibilityAttribute into "StringValueForPoint" and "BoolValueForPoint" variants, because we don't have anything like WKTypeRef here. * page/PageOverlay.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.h. Make PageOverlay a normal RefCounted object instead of a WebKit2 API object. Leave a comment noting that we should move the PageOverlay's GraphicsLayer to PageOverlay instead of a map on PageOverlayController. * page/PageOverlayController.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.cpp. Move PageOverlayController from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere Leave a FIXME that didChangeSettings is not currently called when settings change. This is not a problem for normal use of overlays, only for dynamically changing layer border/repaint counter settings. (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): We will now lazily initialize the root layers when we first try to use them, because otherwise we try to create them before the ChromeClient's GraphicsLayerFactory is hooked up, in some cases, and that can cause us to create the wrong kind of GraphicsLayers. (WebCore::PageOverlayController::installPageOverlay): Enter compositing mode when installing a PageOverlay. Avoid pushing the Page to the PageOverlay until after we've set up its root layer, so that the installation process can make use of that layer; clients may, for example, expect to be able to setNeedsDisplay() in the didMoveToPage callback. Avoid updateOverlayGeometry until the layer is created and we've pushed the Page down, so that e.g. bounds() will use the right Page. (WebCore::PageOverlayController::didChangeSettings): Leave a FIXME about a future improvement to didChangeSettings. (WebCore::PageOverlayController::deviceScaleFactor): (WebCore::PageOverlayController::notifyFlushRequired): Null-check Page; these can get called when tearing down the Frame. * page/PageOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.h. * platform/graphics/GraphicsLayerClient.h: Add wtf/Forward.h, because GraphicsLayerClient.h uses String. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): Inform PageOverlayController that something scrolled. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers): Make hasAnyAdditionalCompositedLayers return true if there are any page overlays, because we need to avoid falling out of compositing mode if we still have page overlays. (WebCore::RenderLayerCompositor::updateCompositingLayers): Enter compositing mode if we have page overlays. (WebCore::RenderLayerCompositor::appendOverlayLayers): Deleted. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): Rename appendOverlayLayers -> appendDocumentOverlayLayers. (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Attach/detach the view overlay root layer when attaching/detaching the normal compositing root layer. (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Add an empty ChromeClient override. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: Add an empty ChromeClient override. Canonical link: https://commits.webkit.org/155152@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-02 21:06:14 +00:00
void didScrollFrame(Frame&);
Support setting a background color on page overlays https://bugs.webkit.org/show_bug.cgi?id=131600 Reviewed by Darin Adler. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::PageOverlay): (WebKit::PageOverlay::bounds): (WebKit::PageOverlay::startFadeInAnimation): (WebKit::PageOverlay::startFadeOutAnimation): (WebKit::PageOverlay::startFadeAnimation): (WebKit::PageOverlay::fadeAnimationTimerFired): Minor style adjustments. Use more references everywhere. (WebKit::PageOverlay::setBackgroundColor): (WebKit::PageOverlay::setNeedsDisplay): * WebProcess/WebPage/PageOverlay.h: (WebKit::PageOverlay::backgroundColor): Keep track of our background color, and push it down to the page overlay controller if we have one. * WebProcess/WebPage/PageOverlayController.cpp: (WebKit::updateOverlayGeometry): (WebKit::PageOverlayController::clearPageOverlay): Page overlays will always have the right size, and just use drawsContents to determine whether or not they should tile/have backing store/etc. (WebKit::PageOverlayController::installPageOverlay): (WebKit::PageOverlayController::didChangeOverlayBackgroundColor): Set the background color of the layer. * WebProcess/WebPage/PageOverlayController.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): References! * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::setDocumentOverlayRootLayer): Mark the compositing tree as needing a rebuild when we get a new document-relative overlay layer; otherwise we were depending on something else coming along and requiring a rebuild, which didn't always happen. Canonical link: https://commits.webkit.org/149682@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-14 08:10:22 +00:00
void didChangeOverlayFrame(PageOverlay&);
void didChangeOverlayBackgroundColor(PageOverlay&);
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 <rdar://problem/18508258> Reviewed by Anders Carlsson. * CMakeLists.txt: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebCore.exp.in: Export the new PageOverlay[Controller] symbols from WebCore. * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::documentOverlayLayerForFrame): Deleted. Add attachViewOverlayGraphicsLayer, which allows PageOverlayController to push view-relative page overlay root layers down to WebKit to be installed just inside the view. Remove documentOverlayLayerForFrame because RenderLayerCompositor can now talk directly to PageOverlayController. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): When the mouse is moved, pressed, or released, give PageOverlayController the first shot at handling the event. * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): Inform PageOverlayController that the main FrameView's size changed, so it can update the size of view-relative overlays. (WebCore::FrameView::setContentsSize): Inform PageOverlayController that the main FrameView's contents size changed, so it can update the size of document-relative overlays. (WebCore::FrameView::setFixedVisibleContentRect): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::scrollTo): (WebCore::FrameView::wheelEvent): Inform PageOverlayController that something scrolled. (WebCore::FrameView::setExposedRect): Inform PageOverlayController that the exposed rect changed, so it can push the new exposed rect down to the overlays. * page/FrameView.h: Add didChangeScrollOffset. * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: Keep one PageOverlayController per MainFrame. * page/Page.cpp: (WebCore::Page::setDeviceScaleFactor): Inform PageOverlayController that the device scale factor changed. (WebCore::Page::setSessionID): Remove a blank line. * page/PageOverlay.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp. Move PageOverlay from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere (WebCore::PageOverlay::bounds): It is possible to install an overlay before we have a FrameView. We will eventually get a view/contents size changed notification and try again. (WebCore::PageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeNames): Split copyAccessibilityAttribute into "StringValueForPoint" and "BoolValueForPoint" variants, because we don't have anything like WKTypeRef here. * page/PageOverlay.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.h. Make PageOverlay a normal RefCounted object instead of a WebKit2 API object. Leave a comment noting that we should move the PageOverlay's GraphicsLayer to PageOverlay instead of a map on PageOverlayController. * page/PageOverlayController.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.cpp. Move PageOverlayController from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere Leave a FIXME that didChangeSettings is not currently called when settings change. This is not a problem for normal use of overlays, only for dynamically changing layer border/repaint counter settings. (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): We will now lazily initialize the root layers when we first try to use them, because otherwise we try to create them before the ChromeClient's GraphicsLayerFactory is hooked up, in some cases, and that can cause us to create the wrong kind of GraphicsLayers. (WebCore::PageOverlayController::installPageOverlay): Enter compositing mode when installing a PageOverlay. Avoid pushing the Page to the PageOverlay until after we've set up its root layer, so that the installation process can make use of that layer; clients may, for example, expect to be able to setNeedsDisplay() in the didMoveToPage callback. Avoid updateOverlayGeometry until the layer is created and we've pushed the Page down, so that e.g. bounds() will use the right Page. (WebCore::PageOverlayController::didChangeSettings): Leave a FIXME about a future improvement to didChangeSettings. (WebCore::PageOverlayController::deviceScaleFactor): (WebCore::PageOverlayController::notifyFlushRequired): Null-check Page; these can get called when tearing down the Frame. * page/PageOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.h. * platform/graphics/GraphicsLayerClient.h: Add wtf/Forward.h, because GraphicsLayerClient.h uses String. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): Inform PageOverlayController that something scrolled. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers): Make hasAnyAdditionalCompositedLayers return true if there are any page overlays, because we need to avoid falling out of compositing mode if we still have page overlays. (WebCore::RenderLayerCompositor::updateCompositingLayers): Enter compositing mode if we have page overlays. (WebCore::RenderLayerCompositor::appendOverlayLayers): Deleted. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): Rename appendOverlayLayers -> appendDocumentOverlayLayers. (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Attach/detach the view overlay root layer when attaching/detaching the normal compositing root layer. (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Add an empty ChromeClient override. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: Add an empty ChromeClient override. Canonical link: https://commits.webkit.org/155152@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-02 21:06:14 +00:00
int overlayCount() const { return m_overlayGraphicsLayers.size(); }
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 <rdar://problem/18508258> Reviewed by Anders Carlsson. * CMakeLists.txt: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebCore.exp.in: Export the new PageOverlay[Controller] symbols from WebCore. * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::documentOverlayLayerForFrame): Deleted. Add attachViewOverlayGraphicsLayer, which allows PageOverlayController to push view-relative page overlay root layers down to WebKit to be installed just inside the view. Remove documentOverlayLayerForFrame because RenderLayerCompositor can now talk directly to PageOverlayController. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): When the mouse is moved, pressed, or released, give PageOverlayController the first shot at handling the event. * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): Inform PageOverlayController that the main FrameView's size changed, so it can update the size of view-relative overlays. (WebCore::FrameView::setContentsSize): Inform PageOverlayController that the main FrameView's contents size changed, so it can update the size of document-relative overlays. (WebCore::FrameView::setFixedVisibleContentRect): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::scrollTo): (WebCore::FrameView::wheelEvent): Inform PageOverlayController that something scrolled. (WebCore::FrameView::setExposedRect): Inform PageOverlayController that the exposed rect changed, so it can push the new exposed rect down to the overlays. * page/FrameView.h: Add didChangeScrollOffset. * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: Keep one PageOverlayController per MainFrame. * page/Page.cpp: (WebCore::Page::setDeviceScaleFactor): Inform PageOverlayController that the device scale factor changed. (WebCore::Page::setSessionID): Remove a blank line. * page/PageOverlay.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp. Move PageOverlay from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere (WebCore::PageOverlay::bounds): It is possible to install an overlay before we have a FrameView. We will eventually get a view/contents size changed notification and try again. (WebCore::PageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeNames): Split copyAccessibilityAttribute into "StringValueForPoint" and "BoolValueForPoint" variants, because we don't have anything like WKTypeRef here. * page/PageOverlay.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.h. Make PageOverlay a normal RefCounted object instead of a WebKit2 API object. Leave a comment noting that we should move the PageOverlay's GraphicsLayer to PageOverlay instead of a map on PageOverlayController. * page/PageOverlayController.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.cpp. Move PageOverlayController from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere Leave a FIXME that didChangeSettings is not currently called when settings change. This is not a problem for normal use of overlays, only for dynamically changing layer border/repaint counter settings. (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): We will now lazily initialize the root layers when we first try to use them, because otherwise we try to create them before the ChromeClient's GraphicsLayerFactory is hooked up, in some cases, and that can cause us to create the wrong kind of GraphicsLayers. (WebCore::PageOverlayController::installPageOverlay): Enter compositing mode when installing a PageOverlay. Avoid pushing the Page to the PageOverlay until after we've set up its root layer, so that the installation process can make use of that layer; clients may, for example, expect to be able to setNeedsDisplay() in the didMoveToPage callback. Avoid updateOverlayGeometry until the layer is created and we've pushed the Page down, so that e.g. bounds() will use the right Page. (WebCore::PageOverlayController::didChangeSettings): Leave a FIXME about a future improvement to didChangeSettings. (WebCore::PageOverlayController::deviceScaleFactor): (WebCore::PageOverlayController::notifyFlushRequired): Null-check Page; these can get called when tearing down the Frame. * page/PageOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.h. * platform/graphics/GraphicsLayerClient.h: Add wtf/Forward.h, because GraphicsLayerClient.h uses String. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): Inform PageOverlayController that something scrolled. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers): Make hasAnyAdditionalCompositedLayers return true if there are any page overlays, because we need to avoid falling out of compositing mode if we still have page overlays. (WebCore::RenderLayerCompositor::updateCompositingLayers): Enter compositing mode if we have page overlays. (WebCore::RenderLayerCompositor::appendOverlayLayers): Deleted. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): Rename appendOverlayLayers -> appendDocumentOverlayLayers. (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Attach/detach the view overlay root layer when attaching/detaching the normal compositing root layer. (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Add an empty ChromeClient override. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: Add an empty ChromeClient override. Canonical link: https://commits.webkit.org/155152@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-02 21:06:14 +00:00
bool handleMouseEvent(const PlatformMouseEvent&);
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
Bring the state of WEBCORE_EXPORT annotations closer to what the exports file specifies. https://bugs.webkit.org/show_bug.cgi?id=136172 Reviewed by Darin Adler. * bridge/NP_jsobject.cpp: Give functions from npruntime_impl.h defined in this file default using a compiler pragma, in lieu of introducing WebCore-specific macros into that header. * bridge/npruntime.cpp: Ditto. * platform/mac/WebCoreSystemInterface.mm: Similarly for WebCoreSystemInterface.h. Added or removed WEBCORE_EXPORT in these files as necessary to match what is currently in the exports file: * Modules/mediasource/SourceBuffer.h: * bindings/js/JSDOMBinding.h: * css/CSSComputedStyleDeclaration.h: * dom/ContainerNode.h: * dom/Document.h: * dom/MouseEvent.h: * dom/Range.h: * dom/SecurityContext.h: * editing/Editor.h: * editing/mac/DictionaryLookup.h: * loader/FrameLoaderClient.h: * loader/LoaderStrategy.h: * loader/icon/IconDatabaseBase.h: * page/ChromeClient.h: * page/EventHandler.h: * page/FrameSnapshotting.h: * page/Page.h: * page/PageOverlay.h: * page/PageOverlayController.h: * page/TextIndicator.h: * page/UserContentController.h: * page/WheelEventDeltaTracker.h: * page/mac/TextIndicatorWindow.h: * platform/DatabaseStrategy.h: * platform/ScrollableArea.h: * platform/SuddenTermination.h: * platform/URL.h: * platform/animation/Animation.h: * platform/cocoa/MachSendRight.h: * platform/graphics/FloatRoundedRect.h: * platform/graphics/GraphicsContext.h: * platform/graphics/GraphicsLayer.h: * platform/graphics/Path.h: * platform/graphics/TextRun.h: * platform/graphics/ca/TileController.h: * platform/graphics/cocoa/IOSurface.h: * platform/graphics/mac/ColorMac.h: * platform/mac/SoftLinking.h: * platform/mac/WebCoreNSStringExtras.h: * platform/mock/mediasource/MockMediaPlayerMediaSource.h: * platform/network/BlobRegistry.h: * platform/network/ResourceRequestBase.h: * platform/network/ResourceResponseBase.h: * rendering/HitTestResult.h: * rendering/RenderInline.h: * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: * rendering/RenderView.h: * storage/StorageNamespaceImpl.h: * storage/StorageNamespaceProvider.h: * testing/Internals.h: Canonical link: https://commits.webkit.org/157897@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@177739 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-12-25 21:25:15 +00:00
WEBCORE_EXPORT bool copyAccessibilityAttributeStringValueForPoint(String attribute, FloatPoint, String& value);
WEBCORE_EXPORT bool copyAccessibilityAttributeBoolValueForPoint(String attribute, FloatPoint, bool& value);
WEBCORE_EXPORT Vector<String> copyAccessibilityAttributesNames(bool parameterizedNames);
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
private:
Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 <rdar://problem/18508258> Reviewed by Anders Carlsson. * CMakeLists.txt: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebCore.exp.in: Export the new PageOverlay[Controller] symbols from WebCore. * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::documentOverlayLayerForFrame): Deleted. Add attachViewOverlayGraphicsLayer, which allows PageOverlayController to push view-relative page overlay root layers down to WebKit to be installed just inside the view. Remove documentOverlayLayerForFrame because RenderLayerCompositor can now talk directly to PageOverlayController. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): When the mouse is moved, pressed, or released, give PageOverlayController the first shot at handling the event. * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): Inform PageOverlayController that the main FrameView's size changed, so it can update the size of view-relative overlays. (WebCore::FrameView::setContentsSize): Inform PageOverlayController that the main FrameView's contents size changed, so it can update the size of document-relative overlays. (WebCore::FrameView::setFixedVisibleContentRect): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::scrollTo): (WebCore::FrameView::wheelEvent): Inform PageOverlayController that something scrolled. (WebCore::FrameView::setExposedRect): Inform PageOverlayController that the exposed rect changed, so it can push the new exposed rect down to the overlays. * page/FrameView.h: Add didChangeScrollOffset. * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: Keep one PageOverlayController per MainFrame. * page/Page.cpp: (WebCore::Page::setDeviceScaleFactor): Inform PageOverlayController that the device scale factor changed. (WebCore::Page::setSessionID): Remove a blank line. * page/PageOverlay.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp. Move PageOverlay from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere (WebCore::PageOverlay::bounds): It is possible to install an overlay before we have a FrameView. We will eventually get a view/contents size changed notification and try again. (WebCore::PageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeNames): Split copyAccessibilityAttribute into "StringValueForPoint" and "BoolValueForPoint" variants, because we don't have anything like WKTypeRef here. * page/PageOverlay.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.h. Make PageOverlay a normal RefCounted object instead of a WebKit2 API object. Leave a comment noting that we should move the PageOverlay's GraphicsLayer to PageOverlay instead of a map on PageOverlayController. * page/PageOverlayController.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.cpp. Move PageOverlayController from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere Leave a FIXME that didChangeSettings is not currently called when settings change. This is not a problem for normal use of overlays, only for dynamically changing layer border/repaint counter settings. (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): We will now lazily initialize the root layers when we first try to use them, because otherwise we try to create them before the ChromeClient's GraphicsLayerFactory is hooked up, in some cases, and that can cause us to create the wrong kind of GraphicsLayers. (WebCore::PageOverlayController::installPageOverlay): Enter compositing mode when installing a PageOverlay. Avoid pushing the Page to the PageOverlay until after we've set up its root layer, so that the installation process can make use of that layer; clients may, for example, expect to be able to setNeedsDisplay() in the didMoveToPage callback. Avoid updateOverlayGeometry until the layer is created and we've pushed the Page down, so that e.g. bounds() will use the right Page. (WebCore::PageOverlayController::didChangeSettings): Leave a FIXME about a future improvement to didChangeSettings. (WebCore::PageOverlayController::deviceScaleFactor): (WebCore::PageOverlayController::notifyFlushRequired): Null-check Page; these can get called when tearing down the Frame. * page/PageOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.h. * platform/graphics/GraphicsLayerClient.h: Add wtf/Forward.h, because GraphicsLayerClient.h uses String. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): Inform PageOverlayController that something scrolled. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers): Make hasAnyAdditionalCompositedLayers return true if there are any page overlays, because we need to avoid falling out of compositing mode if we still have page overlays. (WebCore::RenderLayerCompositor::updateCompositingLayers): Enter compositing mode if we have page overlays. (WebCore::RenderLayerCompositor::appendOverlayLayers): Deleted. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): Rename appendOverlayLayers -> appendDocumentOverlayLayers. (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Attach/detach the view overlay root layer when attaching/detaching the normal compositing root layer. (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Add an empty ChromeClient override. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: Add an empty ChromeClient override. Canonical link: https://commits.webkit.org/155152@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-02 21:06:14 +00:00
void createRootLayersIfNeeded();
PageOverlayController's layers should be created lazily https://bugs.webkit.org/show_bug.cgi?id=194199 Source/WebCore: Reviewed by Tim Horton. Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays() and use them to only parent the overlay-hosting layers when necessary. For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(), which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer compositing updates that parents the layerWithDocumentOverlays(). View overlays are added to the layer tree via the DrawingArea. When we go between having none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer() on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a compositing flush (this has to be done manually because view overlay layers are outside the subtree managed by RenderLayerCompositor). Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer; there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer(). * loader/EmptyClients.h: * page/ChromeClient.h: * page/FrameView.cpp: (WebCore::FrameView::setNeedsCompositingConfigurationUpdate): These functions need to schedule a compositing flush because there may be nothing else that does. (WebCore::FrameView::setNeedsCompositingGeometryUpdate): * page/Page.cpp: (WebCore::Page::installedPageOverlaysChanged): * page/Page.h: * page/PageOverlayController.cpp: (WebCore::PageOverlayController::hasDocumentOverlays const): (WebCore::PageOverlayController::hasViewOverlays const): (WebCore::PageOverlayController::attachViewOverlayLayers): PageOverlayController has the Page so it might as well be the one to call through the ChromeClient. (WebCore::PageOverlayController::detachViewOverlayLayers): (WebCore::PageOverlayController::installPageOverlay): (WebCore::PageOverlayController::uninstallPageOverlay): * page/PageOverlayController.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): isFullUpdate is always true; remove it. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Source/WebKit: rdar://problem/46571593 Reviewed by Tim Horton. Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays() and use them to only parent the overlay-hosting layers when necessary. For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(), which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer compositing updates that parents the layerWithDocumentOverlays(). View overlays are added to the layer tree via the DrawingArea. When we go between having none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer() on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a compositing flush (this has to be done manually because view overlay layers are outside the subtree managed by RenderLayerCompositor). Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer; there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer(). * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/AcceleratedDrawingArea.cpp: (WebKit::AcceleratedDrawingArea::attachViewOverlayGraphicsLayer): * WebProcess/WebPage/AcceleratedDrawingArea.h: * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): Source/WebKitLegacy/mac: rdar://problem/46571593 Reviewed by Tim Horton. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Source/WebKitLegacy/win: rdar://problem/46571593 Reviewed by Tim Horton. Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays() and use them to only parent the overlay-hosting layers when necessary. For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(), which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer compositing updates that parents the layerWithDocumentOverlays(). View overlays are added to the layer tree via the DrawingArea. When we go between having none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer() on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a compositing flush (this has to be done manually because view overlay layers are outside the subtree managed by RenderLayerCompositor). Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer; there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer(). * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: LayoutTests: rdar://problem/46571593 Reviewed by Tim Horton. * pageoverlay/overlay-remove-reinsert-view-expected.txt: We no longer unparent the overlays on view removal, so new results. * platform/ios-wk2/TestExpectations: Unskip some iOS tests. * platform/ios-wk2/pageoverlay/overlay-installation-expected.txt: Added. * platform/ios-wk2/pageoverlay/overlay-large-document-expected.txt: Added. * platform/ios-wk2/pageoverlay/overlay-large-document-scrolled-expected.txt: Added. * platform/ios/TestExpectations: Unskip some iOS tests. Canonical link: https://commits.webkit.org/208700@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-02-04 21:16:22 +00:00
WEBCORE_EXPORT GraphicsLayer* documentOverlayRootLayer() const;
WEBCORE_EXPORT GraphicsLayer* viewOverlayRootLayer() const;
ProcessSwap.PageOverlayLayerPersistence fails on iOS and in debug builds https://bugs.webkit.org/show_bug.cgi?id=194963 Reviewed by Dean Jackson. Source/WebCore: Tested by existing failing API test. * page/Page.cpp: (WebCore::Page::installedPageOverlaysChanged): Deleted. * page/Page.h: (WebCore::Page::pageOverlayController): * page/PageOverlayController.cpp: (WebCore::PageOverlayController::installedPageOverlaysChanged): (WebCore::PageOverlayController::detachViewOverlayLayers): (WebCore::PageOverlayController::installPageOverlay): (WebCore::PageOverlayController::uninstallPageOverlay): (WebCore::PageOverlayController::willDetachRootLayer): Deleted. * page/PageOverlayController.h: As intended by r240940, move installedPageOverlaysChanged to PageOverlayController. Also, make it ignore isInWindow state; otherwise, if you install a overlay and then come into window, nothing installs the root layer. There is no need for this code to follow in-window state manually anymore since the DrawingArea and RenderLayerCompositor just hook the layers up when needed. Make some methods private, and make detachViewOverlayLayers only touch *view* overlays, so that we don't detach the document-relative root layer when you drop to having no view overlays. This maintains existing behavior because nothing was calling PageOverlayController::detachViewOverlayLayers. Now there are no callers of willDetachRootLayer, so remove it. Tools: * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: Do a `contains` check instead of `equals`, because in debug builds we put the GraphicsLayer pointer in a prefix. Canonical link: https://commits.webkit.org/209327@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241978 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-02-23 02:38:02 +00:00
void installedPageOverlaysChanged();
void attachViewOverlayLayers();
void detachViewOverlayLayers();
PageOverlayController's layers should be created lazily https://bugs.webkit.org/show_bug.cgi?id=194199 Source/WebCore: Reviewed by Tim Horton. Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays() and use them to only parent the overlay-hosting layers when necessary. For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(), which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer compositing updates that parents the layerWithDocumentOverlays(). View overlays are added to the layer tree via the DrawingArea. When we go between having none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer() on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a compositing flush (this has to be done manually because view overlay layers are outside the subtree managed by RenderLayerCompositor). Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer; there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer(). * loader/EmptyClients.h: * page/ChromeClient.h: * page/FrameView.cpp: (WebCore::FrameView::setNeedsCompositingConfigurationUpdate): These functions need to schedule a compositing flush because there may be nothing else that does. (WebCore::FrameView::setNeedsCompositingGeometryUpdate): * page/Page.cpp: (WebCore::Page::installedPageOverlaysChanged): * page/Page.h: * page/PageOverlayController.cpp: (WebCore::PageOverlayController::hasDocumentOverlays const): (WebCore::PageOverlayController::hasViewOverlays const): (WebCore::PageOverlayController::attachViewOverlayLayers): PageOverlayController has the Page so it might as well be the one to call through the ChromeClient. (WebCore::PageOverlayController::detachViewOverlayLayers): (WebCore::PageOverlayController::installPageOverlay): (WebCore::PageOverlayController::uninstallPageOverlay): * page/PageOverlayController.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): isFullUpdate is always true; remove it. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Source/WebKit: rdar://problem/46571593 Reviewed by Tim Horton. Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays() and use them to only parent the overlay-hosting layers when necessary. For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(), which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer compositing updates that parents the layerWithDocumentOverlays(). View overlays are added to the layer tree via the DrawingArea. When we go between having none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer() on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a compositing flush (this has to be done manually because view overlay layers are outside the subtree managed by RenderLayerCompositor). Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer; there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer(). * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/AcceleratedDrawingArea.cpp: (WebKit::AcceleratedDrawingArea::attachViewOverlayGraphicsLayer): * WebProcess/WebPage/AcceleratedDrawingArea.h: * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): Source/WebKitLegacy/mac: rdar://problem/46571593 Reviewed by Tim Horton. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Source/WebKitLegacy/win: rdar://problem/46571593 Reviewed by Tim Horton. Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays() and use them to only parent the overlay-hosting layers when necessary. For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(), which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer compositing updates that parents the layerWithDocumentOverlays(). View overlays are added to the layer tree via the DrawingArea. When we go between having none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer() on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a compositing flush (this has to be done manually because view overlay layers are outside the subtree managed by RenderLayerCompositor). Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer; there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer(). * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: LayoutTests: rdar://problem/46571593 Reviewed by Tim Horton. * pageoverlay/overlay-remove-reinsert-view-expected.txt: We no longer unparent the overlays on view removal, so new results. * platform/ios-wk2/TestExpectations: Unskip some iOS tests. * platform/ios-wk2/pageoverlay/overlay-installation-expected.txt: Added. * platform/ios-wk2/pageoverlay/overlay-large-document-expected.txt: Added. * platform/ios-wk2/pageoverlay/overlay-large-document-scrolled-expected.txt: Added. * platform/ios/TestExpectations: Unskip some iOS tests. Canonical link: https://commits.webkit.org/208700@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-02-04 21:16:22 +00:00
Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 <rdar://problem/18508258> Reviewed by Anders Carlsson. * CMakeLists.txt: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebCore.exp.in: Export the new PageOverlay[Controller] symbols from WebCore. * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::documentOverlayLayerForFrame): Deleted. Add attachViewOverlayGraphicsLayer, which allows PageOverlayController to push view-relative page overlay root layers down to WebKit to be installed just inside the view. Remove documentOverlayLayerForFrame because RenderLayerCompositor can now talk directly to PageOverlayController. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): When the mouse is moved, pressed, or released, give PageOverlayController the first shot at handling the event. * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): Inform PageOverlayController that the main FrameView's size changed, so it can update the size of view-relative overlays. (WebCore::FrameView::setContentsSize): Inform PageOverlayController that the main FrameView's contents size changed, so it can update the size of document-relative overlays. (WebCore::FrameView::setFixedVisibleContentRect): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::scrollTo): (WebCore::FrameView::wheelEvent): Inform PageOverlayController that something scrolled. (WebCore::FrameView::setExposedRect): Inform PageOverlayController that the exposed rect changed, so it can push the new exposed rect down to the overlays. * page/FrameView.h: Add didChangeScrollOffset. * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: Keep one PageOverlayController per MainFrame. * page/Page.cpp: (WebCore::Page::setDeviceScaleFactor): Inform PageOverlayController that the device scale factor changed. (WebCore::Page::setSessionID): Remove a blank line. * page/PageOverlay.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp. Move PageOverlay from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere (WebCore::PageOverlay::bounds): It is possible to install an overlay before we have a FrameView. We will eventually get a view/contents size changed notification and try again. (WebCore::PageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeNames): Split copyAccessibilityAttribute into "StringValueForPoint" and "BoolValueForPoint" variants, because we don't have anything like WKTypeRef here. * page/PageOverlay.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.h. Make PageOverlay a normal RefCounted object instead of a WebKit2 API object. Leave a comment noting that we should move the PageOverlay's GraphicsLayer to PageOverlay instead of a map on PageOverlayController. * page/PageOverlayController.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.cpp. Move PageOverlayController from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere Leave a FIXME that didChangeSettings is not currently called when settings change. This is not a problem for normal use of overlays, only for dynamically changing layer border/repaint counter settings. (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): We will now lazily initialize the root layers when we first try to use them, because otherwise we try to create them before the ChromeClient's GraphicsLayerFactory is hooked up, in some cases, and that can cause us to create the wrong kind of GraphicsLayers. (WebCore::PageOverlayController::installPageOverlay): Enter compositing mode when installing a PageOverlay. Avoid pushing the Page to the PageOverlay until after we've set up its root layer, so that the installation process can make use of that layer; clients may, for example, expect to be able to setNeedsDisplay() in the didMoveToPage callback. Avoid updateOverlayGeometry until the layer is created and we've pushed the Page down, so that e.g. bounds() will use the right Page. (WebCore::PageOverlayController::didChangeSettings): Leave a FIXME about a future improvement to didChangeSettings. (WebCore::PageOverlayController::deviceScaleFactor): (WebCore::PageOverlayController::notifyFlushRequired): Null-check Page; these can get called when tearing down the Frame. * page/PageOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.h. * platform/graphics/GraphicsLayerClient.h: Add wtf/Forward.h, because GraphicsLayerClient.h uses String. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): Inform PageOverlayController that something scrolled. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers): Make hasAnyAdditionalCompositedLayers return true if there are any page overlays, because we need to avoid falling out of compositing mode if we still have page overlays. (WebCore::RenderLayerCompositor::updateCompositingLayers): Enter compositing mode if we have page overlays. (WebCore::RenderLayerCompositor::appendOverlayLayers): Deleted. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): Rename appendOverlayLayers -> appendDocumentOverlayLayers. (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Attach/detach the view overlay root layer when attaching/detaching the normal compositing root layer. (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Add an empty ChromeClient override. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: Add an empty ChromeClient override. Canonical link: https://commits.webkit.org/155152@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-02 21:06:14 +00:00
void updateSettingsForLayer(GraphicsLayer&);
Support document-relative and custom-frame page overlays https://bugs.webkit.org/show_bug.cgi?id=131560 <rdar://problem/16595556> Reviewed by Simon Fraser. Add "document-relative" overlays, which attach to (and scroll with) the document, and can be given a frame rect within the document to avoid overallocation of backing store. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::mainFrame): (WebKit::WebPage::mainFrameView): (WebKit::WebPage::didChangeScrollOffsetForFrame): * WebProcess/WebPage/WebPage.h: Let the PageOverlayController know *which* frame scrolled, instead of "any frame". * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): Factor out shared code. (WebKit::FindController::willMoveToWebPage): (WebKit::FindController::drawRect): We can use clearRect() instead of a transparency layer and fillRect(). I've looked through all the other overlay clients I know of and none of them depend on having a transparency layer at the overlay level. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::create): (WebKit::PageOverlay::PageOverlay): (WebKit::PageOverlay::bounds): (WebKit::PageOverlay::frame): (WebKit::PageOverlay::setFrame): (WebKit::PageOverlay::drawRect): Add OverlayType, which allows creation of Document or View relative overlays. All overlays up to this point are View relative, so we default to that. Document-relative overlays scroll with the page instead of repainting as the page scrolls. They can also be given an explicit frame, allowing them to be smaller than the entire document. * WebProcess/WebPage/PageOverlay.h: (WebKit::PageOverlay::overlayType): (WebKit::PageOverlay::webPage): (WebKit::PageOverlay::client): Deleted. * WebProcess/WebPage/PageOverlayController.cpp: (WebKit::PageOverlayController::initialize): (WebKit::PageOverlayController::installPageOverlay): (WebKit::PageOverlayController::uninstallPageOverlay): (WebKit::PageOverlayController::updateForceSynchronousScrollLayerPositionUpdates): (WebKit::updateOverlayGeometry): (WebKit::PageOverlayController::setPageOverlayNeedsDisplay): (WebKit::PageOverlayController::didChangeViewSize): (WebKit::PageOverlayController::didChangeDocumentSize): (WebKit::PageOverlayController::didChangeDeviceScaleFactor): (WebKit::PageOverlayController::didScrollFrame): (WebKit::PageOverlayController::flushPageOverlayLayers): (WebKit::PageOverlayController::didChangeOverlayFrame): Keep two overlay root layers - one for view-relative and one for document-relative overlays. Don't force synchronous scrolling if we only have document-relative overlays. Update the overlay's position as well as its size whenever necessary. Update document-relative overlay geometry when the document size changes. Only explicitly flush view-relative overlays; document-relative ones are plugged into the WebCore layer tree and flushed along with the page. * WebProcess/WebPage/PageOverlayController.h: (WebKit::PageOverlayController::documentOverlayRootLayer): (WebKit::PageOverlayController::viewOverlayRootLayer): * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Let the PageOverlay controller know when the document size changes. When we set up compositing, push the document overlay root layer down into WebCore. * WebCore.exp.in: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::RenderLayerCompositor): (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): (WebCore::RenderLayerCompositor::setDocumentOverlayRootLayer): * rendering/RenderLayerCompositor.h: Add the concept of a document overlay layer, which is plugged in as the last child of the root content layer. Expose it to WebKit2. Canonical link: https://commits.webkit.org/149624@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167152 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-11 21:41:28 +00:00
void updateForceSynchronousScrollLayerPositionUpdates();
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 <rdar://problem/18508258> Reviewed by Anders Carlsson. * CMakeLists.txt: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebCore.exp.in: Export the new PageOverlay[Controller] symbols from WebCore. * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::documentOverlayLayerForFrame): Deleted. Add attachViewOverlayGraphicsLayer, which allows PageOverlayController to push view-relative page overlay root layers down to WebKit to be installed just inside the view. Remove documentOverlayLayerForFrame because RenderLayerCompositor can now talk directly to PageOverlayController. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): When the mouse is moved, pressed, or released, give PageOverlayController the first shot at handling the event. * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): Inform PageOverlayController that the main FrameView's size changed, so it can update the size of view-relative overlays. (WebCore::FrameView::setContentsSize): Inform PageOverlayController that the main FrameView's contents size changed, so it can update the size of document-relative overlays. (WebCore::FrameView::setFixedVisibleContentRect): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::scrollTo): (WebCore::FrameView::wheelEvent): Inform PageOverlayController that something scrolled. (WebCore::FrameView::setExposedRect): Inform PageOverlayController that the exposed rect changed, so it can push the new exposed rect down to the overlays. * page/FrameView.h: Add didChangeScrollOffset. * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: Keep one PageOverlayController per MainFrame. * page/Page.cpp: (WebCore::Page::setDeviceScaleFactor): Inform PageOverlayController that the device scale factor changed. (WebCore::Page::setSessionID): Remove a blank line. * page/PageOverlay.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp. Move PageOverlay from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere (WebCore::PageOverlay::bounds): It is possible to install an overlay before we have a FrameView. We will eventually get a view/contents size changed notification and try again. (WebCore::PageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeNames): Split copyAccessibilityAttribute into "StringValueForPoint" and "BoolValueForPoint" variants, because we don't have anything like WKTypeRef here. * page/PageOverlay.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.h. Make PageOverlay a normal RefCounted object instead of a WebKit2 API object. Leave a comment noting that we should move the PageOverlay's GraphicsLayer to PageOverlay instead of a map on PageOverlayController. * page/PageOverlayController.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.cpp. Move PageOverlayController from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere Leave a FIXME that didChangeSettings is not currently called when settings change. This is not a problem for normal use of overlays, only for dynamically changing layer border/repaint counter settings. (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): We will now lazily initialize the root layers when we first try to use them, because otherwise we try to create them before the ChromeClient's GraphicsLayerFactory is hooked up, in some cases, and that can cause us to create the wrong kind of GraphicsLayers. (WebCore::PageOverlayController::installPageOverlay): Enter compositing mode when installing a PageOverlay. Avoid pushing the Page to the PageOverlay until after we've set up its root layer, so that the installation process can make use of that layer; clients may, for example, expect to be able to setNeedsDisplay() in the didMoveToPage callback. Avoid updateOverlayGeometry until the layer is created and we've pushed the Page down, so that e.g. bounds() will use the right Page. (WebCore::PageOverlayController::didChangeSettings): Leave a FIXME about a future improvement to didChangeSettings. (WebCore::PageOverlayController::deviceScaleFactor): (WebCore::PageOverlayController::notifyFlushRequired): Null-check Page; these can get called when tearing down the Frame. * page/PageOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.h. * platform/graphics/GraphicsLayerClient.h: Add wtf/Forward.h, because GraphicsLayerClient.h uses String. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): Inform PageOverlayController that something scrolled. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers): Make hasAnyAdditionalCompositedLayers return true if there are any page overlays, because we need to avoid falling out of compositing mode if we still have page overlays. (WebCore::RenderLayerCompositor::updateCompositingLayers): Enter compositing mode if we have page overlays. (WebCore::RenderLayerCompositor::appendOverlayLayers): Deleted. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): Rename appendOverlayLayers -> appendDocumentOverlayLayers. (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Attach/detach the view overlay root layer when attaching/detaching the normal compositing root layer. (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Add an empty ChromeClient override. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: Add an empty ChromeClient override. Canonical link: https://commits.webkit.org/155152@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-02 21:06:14 +00:00
// GraphicsLayerClient
Remove throttling code from RenderLayerCompositor https://bugs.webkit.org/show_bug.cgi?id=208135 <rdar://problem/59765410> Unreviewed partial revert. Source/WebCore: Keep using the "flush" naming in GraphicsLayerClient. * page/PageOverlayController.cpp: (WebCore::PageOverlayController::notifyFlushRequired): (WebCore::PageOverlayController::notifyRenderingUpdateRequired): Deleted. * page/PageOverlayController.h: * page/linux/ResourceUsageOverlayLinux.cpp: * page/mac/ServicesOverlayController.h: * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired): (WebCore::ServicesOverlayController::Highlight::notifyRenderingUpdateRequired): Deleted. * platform/graphics/GraphicsLayerClient.h: (WebCore::GraphicsLayerClient::notifyFlushRequired): (WebCore::GraphicsLayerClient::notifyRenderingUpdateRequired): Deleted. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::notifyFlushRequired): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::notifyFlushRequired): (WebCore::RenderLayerBacking::notifyRenderingUpdateRequired): Deleted. * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::notifyFlushRequired): (WebCore::RenderLayerCompositor::notifyRenderingUpdateRequired): Deleted. * rendering/RenderLayerCompositor.h: Source/WebKit: * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp: (WebKit::CompositingCoordinator::notifyFlushRequired): (WebKit::CompositingCoordinator::notifyRenderingUpdateRequired): Deleted. * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h: Source/WebKitLegacy/win: * WebView.cpp: (WebView::notifyFlushRequired): (WebView::notifyRenderingUpdateRequired): Deleted. * WebView.h: Canonical link: https://commits.webkit.org/221182@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@257465 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-02-26 13:37:58 +00:00
void notifyFlushRequired(const GraphicsLayer*) override;
void paintContents(const GraphicsLayer*, GraphicsContext&, const FloatRect& clipRect, GraphicsLayerPaintBehavior) override;
float deviceScaleFactor() const override;
Remove duplicate LayerTreeAsText enums and use an OptionSet<> https://bugs.webkit.org/show_bug.cgi?id=229226 Reviewed by Antti Koivisto. GraphicsLayerClient had enum LayerTreeAsTextBehaviorFlags and Frame had an anonymous enum and typedef unsigned LayerTreeFlags. Clean up by adding LayerTreeAsTextOptions.h and using OptionSet<LayerTreeAsTextOptions> everywhere. * Headers.cmake: * WebCore.xcodeproj/project.pbxproj: * page/Frame.h: * page/PageOverlayController.cpp: (WebCore::PageOverlayController::shouldSkipLayerInDump const): * page/PageOverlayController.h: * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::dumpLayer const): (WebCore::dumpChildren): (WebCore::GraphicsLayer::dumpProperties const): (WebCore::GraphicsLayer::layerTreeAsText const): (showGraphicsLayerTree): * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::dumpLayer): (WebCore::GraphicsLayer::layerTreeAsText): (WebCore::GraphicsLayer::dumpAdditionalProperties const): * platform/graphics/GraphicsLayerClient.h: (WebCore::GraphicsLayerClient::shouldSkipLayerInDump const): (WebCore::GraphicsLayerClient::shouldDumpPropertyForLayer const): * platform/graphics/LayerTreeAsTextOptions.h: Added. * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::dumpAdditionalProperties const): * platform/graphics/ca/GraphicsLayerCA.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::dumpInnerLayer): (WebCore::CoordinatedGraphicsLayer::dumpAdditionalProperties const): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::shouldSkipLayerInDump const): (WebCore::RenderLayerBacking::shouldDumpPropertyForLayer const): * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::layerTreeAsText): * rendering/RenderLayerCompositor.h: * testing/Internals.cpp: (WebCore::toLayerTreeAsTextOptions): (WebCore::Internals::layerTreeAsText const): (WebCore::Internals::pageOverlayLayerTreeAsText const): (WebCore::toLayerTreeFlags): Deleted. * testing/MockPageOverlayClient.cpp: (WebCore::MockPageOverlayClient::layerTreeAsText): * testing/MockPageOverlayClient.h: Canonical link: https://commits.webkit.org/240675@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-19 15:47:35 +00:00
bool shouldSkipLayerInDump(const GraphicsLayer*, OptionSet<LayerTreeAsTextOptions>) const override;
Clean up how GraphicsLayer's "inWindow" state is set, and fix some issues with Page Overlays https://bugs.webkit.org/show_bug.cgi?id=167850 Reviewed by Tim Horton. Source/WebCore: RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants() walked the RenderLayer tree to set the GraphicsLayer's "inWindow" state. This had the problem of skipping non-primary GraphicsLayers. We also never did this work for page overlay layers. Fix by giving GraphicsLayers a recursive function that sets the inWindow state, and call that from RenderLayerCompositor::setIsInWindow() and PageOverlayController. PageOverlayController also needs to implement tiledBackingUsageChanged so that tiled backings created dynamically get the correct in-window state. Page overlays also had some serious issues in MiniBrowser, in that they disappeared on reload, and on hide/show web view. This was because the overlay root layers were re-parented, but addChild() for each overlay's layer wasn't called. Clean up by replacing willAttachRootLayer() followed by viewOverlayRootLayer()/documentOverlayRootLayer() with single calls that set up the layers, update the inWindow state, and return the layer. Make it possible to dump tile caches in page overlay tests. Make showGraphicsLayers() always dump page overlay layers (source of much confusion). Test: pageoverlay/overlay-remove-reinsert-view.html * page/PageOverlayController.cpp: (WebCore::PageOverlayController::documentOverlayRootLayer): (WebCore::PageOverlayController::viewOverlayRootLayer): (WebCore::PageOverlayController::layerWithDocumentOverlays): (WebCore::PageOverlayController::layerWithViewOverlays): (WebCore::PageOverlayController::tiledBackingUsageChanged): (WebCore::PageOverlayController::willAttachRootLayer): Deleted. * page/PageOverlayController.h: * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): (WebCore::dumpChildren): * platform/graphics/GraphicsLayer.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): (WebCore::RenderLayerCompositor::setIsInWindow): (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): (WebCore::RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants): Deleted. * rendering/RenderLayerCompositor.h: * testing/Internals.cpp: (WebCore::toLayerTreeFlags): (WebCore::Internals::layerTreeAsText): (WebCore::Internals::pageOverlayLayerTreeAsText): * testing/Internals.h: * testing/Internals.idl: * testing/MockPageOverlayClient.cpp: (WebCore::MockPageOverlayClient::layerTreeAsText): * testing/MockPageOverlayClient.h: Tools: * DumpRenderTree/TestRunner.cpp: (TestRunner::uiScriptDidComplete): Fix an assertion that fires for non-16-bit strings. LayoutTests: * pageoverlay/overlay-large-document-expected.txt: * pageoverlay/overlay-large-document-scrolled-expected.txt: * pageoverlay/overlay-remove-reinsert-view-expected.txt: Added. * pageoverlay/overlay-remove-reinsert-view.html: Added. * platform/ios-simulator-wk2/pageoverlay/overlay-remove-reinsert-view-expected.txt: Added. * platform/mac-wk1/pageoverlay/overlay-remove-reinsert-view-expected.txt: Added. * tiled-drawing/tiled-backing-in-window-expected.txt: Canonical link: https://commits.webkit.org/184886@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211683 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-05 19:18:16 +00:00
void tiledBackingUsageChanged(const GraphicsLayer*, bool) override;
Move PageOverlay[Controller] to WebCore https://bugs.webkit.org/show_bug.cgi?id=137164 <rdar://problem/18508258> Reviewed by Anders Carlsson. * CMakeLists.txt: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebCore.exp.in: Export the new PageOverlay[Controller] symbols from WebCore. * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::documentOverlayLayerForFrame): Deleted. Add attachViewOverlayGraphicsLayer, which allows PageOverlayController to push view-relative page overlay root layers down to WebKit to be installed just inside the view. Remove documentOverlayLayerForFrame because RenderLayerCompositor can now talk directly to PageOverlayController. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): When the mouse is moved, pressed, or released, give PageOverlayController the first shot at handling the event. * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): Inform PageOverlayController that the main FrameView's size changed, so it can update the size of view-relative overlays. (WebCore::FrameView::setContentsSize): Inform PageOverlayController that the main FrameView's contents size changed, so it can update the size of document-relative overlays. (WebCore::FrameView::setFixedVisibleContentRect): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::scrollTo): (WebCore::FrameView::wheelEvent): Inform PageOverlayController that something scrolled. (WebCore::FrameView::setExposedRect): Inform PageOverlayController that the exposed rect changed, so it can push the new exposed rect down to the overlays. * page/FrameView.h: Add didChangeScrollOffset. * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: Keep one PageOverlayController per MainFrame. * page/Page.cpp: (WebCore::Page::setDeviceScaleFactor): Inform PageOverlayController that the device scale factor changed. (WebCore::Page::setSessionID): Remove a blank line. * page/PageOverlay.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp. Move PageOverlay from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere (WebCore::PageOverlay::bounds): It is possible to install an overlay before we have a FrameView. We will eventually get a view/contents size changed notification and try again. (WebCore::PageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebCore::PageOverlay::copyAccessibilityAttributeNames): Split copyAccessibilityAttribute into "StringValueForPoint" and "BoolValueForPoint" variants, because we don't have anything like WKTypeRef here. * page/PageOverlay.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlay.h. Make PageOverlay a normal RefCounted object instead of a WebKit2 API object. Leave a comment noting that we should move the PageOverlay's GraphicsLayer to PageOverlay instead of a map on PageOverlayController. * page/PageOverlayController.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.cpp. Move PageOverlayController from WebKit2 to WebCore. A few overarching changes that I won't detail in each place: - references instead of pointers in many places - WebCore types instead of WebKit2 types everywhere Leave a FIXME that didChangeSettings is not currently called when settings change. This is not a problem for normal use of overlays, only for dynamically changing layer border/repaint counter settings. (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): We will now lazily initialize the root layers when we first try to use them, because otherwise we try to create them before the ChromeClient's GraphicsLayerFactory is hooked up, in some cases, and that can cause us to create the wrong kind of GraphicsLayers. (WebCore::PageOverlayController::installPageOverlay): Enter compositing mode when installing a PageOverlay. Avoid pushing the Page to the PageOverlay until after we've set up its root layer, so that the installation process can make use of that layer; clients may, for example, expect to be able to setNeedsDisplay() in the didMoveToPage callback. Avoid updateOverlayGeometry until the layer is created and we've pushed the Page down, so that e.g. bounds() will use the right Page. (WebCore::PageOverlayController::didChangeSettings): Leave a FIXME about a future improvement to didChangeSettings. (WebCore::PageOverlayController::deviceScaleFactor): (WebCore::PageOverlayController::notifyFlushRequired): Null-check Page; these can get called when tearing down the Frame. * page/PageOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/PageOverlayController.h. * platform/graphics/GraphicsLayerClient.h: Add wtf/Forward.h, because GraphicsLayerClient.h uses String. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): Inform PageOverlayController that something scrolled. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers): Make hasAnyAdditionalCompositedLayers return true if there are any page overlays, because we need to avoid falling out of compositing mode if we still have page overlays. (WebCore::RenderLayerCompositor::updateCompositingLayers): Enter compositing mode if we have page overlays. (WebCore::RenderLayerCompositor::appendOverlayLayers): Deleted. (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): Rename appendOverlayLayers -> appendDocumentOverlayLayers. (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): Attach/detach the view overlay root layer when attaching/detaching the normal compositing root layer. (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: * CMakeLists.txt: * WebKit2.xcodeproj/project.pbxproj: Make the appropriate build system changes. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Make WKBundlePageOverlayRef map to WebPageOverlay instead of PageOverlay. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlay): (WKBundlePageUninstallPageOverlay): (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): Forward PageOverlay installation/uninstallation to WebCore. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (WKBundlePageOverlayGetTypeID): (WKBundlePageOverlayCreate): (WKBundlePageOverlaySetAccessibilityClient): Use WebPageOverlay instead of PageOverlay, and references instead of pointers. We forward client callbacks through from PageOverlay::Client to WebPageOverlay::Client. (PageOverlayClientImpl::copyAccessibilityAttributeValue): (PageOverlayClientImpl::copyAccessibilityAttributeNames): Convert from wtf types to WebKit2 types. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::graphicsLayerFactory): If we don't have a drawing area, don't dereference it! (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Forward attachViewOverlayGraphicsLayer to the DrawingArea. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebInspectorClient.cpp: * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h: * WebProcess/WebPage/mac/ServicesOverlayController.mm: * WebProcess/WebPage/ServicesOverlayController.h: Mechanical changes to adopt to the fact that PageOverlay is in WebCore now. * WebProcess/WebPage/LayerTreeHost.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Remove support for WebKit2-based page overlays. Return MainFrame instead of Frame from mainFrame(). * WebProcess/WebPage/WebPageOverlay.cpp: Added. * WebProcess/WebPage/WebPageOverlay.h: Added. (WebKit::WebPageOverlay::create): (WebKit::WebPageOverlay::WebPageOverlay): (WebKit::WebPageOverlay::~WebPageOverlay): (WebKit::WebPageOverlay::setNeedsDisplay): (WebKit::WebPageOverlay::clear): (WebKit::WebPageOverlay::pageOverlayDestroyed): (WebKit::WebPageOverlay::willMoveToPage): (WebKit::WebPageOverlay::didMoveToPage): (WebKit::WebPageOverlay::drawRect): (WebKit::WebPageOverlay::mouseEvent): (WebKit::WebPageOverlay::didScrollFrame): (WebKit::WebPageOverlay::copyAccessibilityAttributeStringValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeBoolValueForPoint): (WebKit::WebPageOverlay::copyAccessibilityAttributeNames): WebPageOverlay exists to be our API object, but forwards everything to its WebCore::PageOverlay, and implements WebCore::PageOverlay::Client, and forwards client callbacks to its WebPageOverlay::Client (which WKBundlePageOverlay implements). * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Forward the three AX properties that PageOverlays are ever queried for to the appropriate PageOverlayController function. * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer): If we attach/detach the view-relative page overlay root layer, reattach the root compositing layer's children. (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): Ditto for the root compositing layer. (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): (WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers): Factor updateRootLayers out of setRootCompositingLayer. (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): Make use of updateRootLayers when we attach/detach root compositing layer/view overlay layer. (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): (WebKit::TiledCoreAnimationDrawingArea::flushLayers): (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Informing PageOverlayController of exposed rect/document size changes is now WebCore's job. * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::attachViewOverlayGraphicsLayer): * Shared/WebRenderLayer.cpp: * Shared/WebRenderObject.cpp: * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: * WebProcess/WebProcess.cpp: Include MainFrame.h because WebPage::mainFrame returns a MainFrame now. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::attachViewOverlayGraphicsLayer): Add an empty ChromeClient override. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::attachViewOverlayGraphicsLayer): * WebCoreSupport/WebChromeClient.h: Add an empty ChromeClient override. Canonical link: https://commits.webkit.org/155152@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-02 21:06:14 +00:00
Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings https://bugs.webkit.org/show_bug.cgi?id=189521 Reviewed by Tim Horton. Source/WebCore: Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>. RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>. All the other changes are just to adapt to the new ownership patterns. I verified that no GraphicsLayers were leaked or abandoned after this change. No behavior change. * page/PageOverlayController.cpp: (WebCore::PageOverlayController::layerWithDocumentOverlays): (WebCore::PageOverlayController::layerWithViewOverlays): (WebCore::PageOverlayController::installPageOverlay): (WebCore::PageOverlayController::uninstallPageOverlay): (WebCore::PageOverlayController::setPageOverlayNeedsDisplay): (WebCore::PageOverlayController::didChangeViewSize): (WebCore::PageOverlayController::didChangeDocumentSize): (WebCore::PageOverlayController::didChangeSettings): (WebCore::PageOverlayController::paintContents): (WebCore::PageOverlayController::didChangeOverlayFrame): (WebCore::PageOverlayController::didChangeOverlayBackgroundColor): * page/PageOverlayController.h: * page/mac/ServicesOverlayController.h: (WebCore::ServicesOverlayController::Highlight::layer const): * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::Highlight::Highlight): (WebCore::ServicesOverlayController::Highlight::invalidate): (WebCore::ServicesOverlayController::Highlight::fadeIn): (WebCore::ServicesOverlayController::Highlight::fadeOut): (WebCore::ServicesOverlayController::Highlight::didFinishFadeOutAnimation): (WebCore::ServicesOverlayController::determineActiveHighlight): * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::GraphicsLayer): (WebCore::GraphicsLayer::willBeDestroyed): (WebCore::GraphicsLayer::setChildren): (WebCore::GraphicsLayer::addChild): (WebCore::GraphicsLayer::addChildAtIndex): (WebCore::GraphicsLayer::addChildBelow): (WebCore::GraphicsLayer::addChildAbove): (WebCore::GraphicsLayer::replaceChild): (WebCore::GraphicsLayer::removeAllChildren): (WebCore::GraphicsLayer::removeFromParent): (WebCore::GraphicsLayer::setMaskLayer): (WebCore::GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants): (WebCore::GraphicsLayer::distributeOpacity): (WebCore::GraphicsLayer::traverse): (WebCore::dumpChildren): * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::children const): (WebCore::GraphicsLayer::children): (WebCore::GraphicsLayer::maskLayer const): (WebCore::GraphicsLayer::replicaLayer const): (WebCore::GraphicsLayer::beingDestroyed const): (WebCore::GraphicsLayer:: const): Deleted. * platform/graphics/GraphicsLayerFactory.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayer::create): (WebCore::GraphicsLayerCA::setChildren): (WebCore::GraphicsLayerCA::addChild): (WebCore::GraphicsLayerCA::addChildAtIndex): (WebCore::GraphicsLayerCA::addChildBelow): (WebCore::GraphicsLayerCA::addChildAbove): (WebCore::GraphicsLayerCA::replaceChild): (WebCore::GraphicsLayerCA::setMaskLayer): (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush const): (WebCore::GraphicsLayerCA::recursiveCommitChanges): (WebCore::GraphicsLayerCA::updateSublayerList): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): * platform/graphics/ca/GraphicsLayerCA.h: * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: (WebCore::GraphicsLayer::create): (WebCore::GraphicsLayerTextureMapper::setChildren): (WebCore::GraphicsLayerTextureMapper::addChild): (WebCore::GraphicsLayerTextureMapper::addChildAtIndex): (WebCore::GraphicsLayerTextureMapper::addChildAbove): (WebCore::GraphicsLayerTextureMapper::addChildBelow): (WebCore::GraphicsLayerTextureMapper::replaceChild): (WebCore::GraphicsLayerTextureMapper::setMaskLayer): (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIncludingSubLayers): * platform/graphics/texmap/GraphicsLayerTextureMapper.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::GraphicsLayer::create): (WebCore::CoordinatedGraphicsLayer::setShouldUpdateVisibleRect): (WebCore::CoordinatedGraphicsLayer::addChild): (WebCore::CoordinatedGraphicsLayer::addChildAtIndex): (WebCore::CoordinatedGraphicsLayer::addChildAbove): (WebCore::CoordinatedGraphicsLayer::addChildBelow): (WebCore::CoordinatedGraphicsLayer::replaceChild): (WebCore::CoordinatedGraphicsLayer::setMaskLayer): (WebCore::CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers): (WebCore::CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers): (WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: * platform/graphics/win/GraphicsLayerDirect2D.cpp: (WebCore::GraphicsLayer::create): (WebCore::GraphicsLayerDirect2D::GraphicsLayerDirect2D): Deleted. (WebCore::GraphicsLayerDirect2D::initialize): Deleted. (WebCore::GraphicsLayerDirect2D::~GraphicsLayerDirect2D): Deleted. (WebCore::GraphicsLayerDirect2D::setNeedsDisplay): Deleted. (WebCore::GraphicsLayerDirect2D::setNeedsDisplayInRect): Deleted. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::createGraphicsLayer): (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer): (WebCore::RenderLayerBacking::updateConfiguration): (WebCore::RenderLayerBacking::updateInternalHierarchy): (WebCore::RenderLayerBacking::updateMaskingLayer): (WebCore::RenderLayerBacking::updateChildClippingStrategy): (WebCore::RenderLayerBacking::updateScrollingLayers): * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): (WebCore::RenderLayerCompositor::setCompositingParent): (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): (WebCore::RenderLayerCompositor::parentFrameContentLayers): (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea): (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea): (WebCore::RenderLayerCompositor::updateLayerForHeader): (WebCore::RenderLayerCompositor::updateLayerForFooter): (WebCore::RenderLayerCompositor::updateOverflowControlsLayers): (WebCore::RenderLayerCompositor::ensureRootLayer): (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: Source/WebKit: Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>. RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>. Added some helper functions to null out a RefPtr<GraphicsLayer> after removing from the tree, clearing the client. GraphicsLayer.m_client becomes a pointer, so it can be set to point to a singleton empty client when a GraphicsLayer gets detached from its owner. More explicit layer unparenting, and removed some unnecessary parent checks, and redundant unparenting. Other changes are just to adapt to the new ownership patterns. I verified that no GraphicsLayers were leaked or abandoned after this change. * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::~WebInspectorClient): (WebKit::WebInspectorClient::showPaintRect): (WebKit::WebInspectorClient::animationEndedForLayer): * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::createGraphicsLayer): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): Canonical link: https://commits.webkit.org/204596@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-14 19:49:46 +00:00
Page& m_page;
RefPtr<GraphicsLayer> m_documentOverlayRootLayer;
RefPtr<GraphicsLayer> m_viewOverlayRootLayer;
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings https://bugs.webkit.org/show_bug.cgi?id=189521 Reviewed by Tim Horton. Source/WebCore: Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>. RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>. All the other changes are just to adapt to the new ownership patterns. I verified that no GraphicsLayers were leaked or abandoned after this change. No behavior change. * page/PageOverlayController.cpp: (WebCore::PageOverlayController::layerWithDocumentOverlays): (WebCore::PageOverlayController::layerWithViewOverlays): (WebCore::PageOverlayController::installPageOverlay): (WebCore::PageOverlayController::uninstallPageOverlay): (WebCore::PageOverlayController::setPageOverlayNeedsDisplay): (WebCore::PageOverlayController::didChangeViewSize): (WebCore::PageOverlayController::didChangeDocumentSize): (WebCore::PageOverlayController::didChangeSettings): (WebCore::PageOverlayController::paintContents): (WebCore::PageOverlayController::didChangeOverlayFrame): (WebCore::PageOverlayController::didChangeOverlayBackgroundColor): * page/PageOverlayController.h: * page/mac/ServicesOverlayController.h: (WebCore::ServicesOverlayController::Highlight::layer const): * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::Highlight::Highlight): (WebCore::ServicesOverlayController::Highlight::invalidate): (WebCore::ServicesOverlayController::Highlight::fadeIn): (WebCore::ServicesOverlayController::Highlight::fadeOut): (WebCore::ServicesOverlayController::Highlight::didFinishFadeOutAnimation): (WebCore::ServicesOverlayController::determineActiveHighlight): * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::GraphicsLayer): (WebCore::GraphicsLayer::willBeDestroyed): (WebCore::GraphicsLayer::setChildren): (WebCore::GraphicsLayer::addChild): (WebCore::GraphicsLayer::addChildAtIndex): (WebCore::GraphicsLayer::addChildBelow): (WebCore::GraphicsLayer::addChildAbove): (WebCore::GraphicsLayer::replaceChild): (WebCore::GraphicsLayer::removeAllChildren): (WebCore::GraphicsLayer::removeFromParent): (WebCore::GraphicsLayer::setMaskLayer): (WebCore::GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants): (WebCore::GraphicsLayer::distributeOpacity): (WebCore::GraphicsLayer::traverse): (WebCore::dumpChildren): * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::children const): (WebCore::GraphicsLayer::children): (WebCore::GraphicsLayer::maskLayer const): (WebCore::GraphicsLayer::replicaLayer const): (WebCore::GraphicsLayer::beingDestroyed const): (WebCore::GraphicsLayer:: const): Deleted. * platform/graphics/GraphicsLayerFactory.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayer::create): (WebCore::GraphicsLayerCA::setChildren): (WebCore::GraphicsLayerCA::addChild): (WebCore::GraphicsLayerCA::addChildAtIndex): (WebCore::GraphicsLayerCA::addChildBelow): (WebCore::GraphicsLayerCA::addChildAbove): (WebCore::GraphicsLayerCA::replaceChild): (WebCore::GraphicsLayerCA::setMaskLayer): (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush const): (WebCore::GraphicsLayerCA::recursiveCommitChanges): (WebCore::GraphicsLayerCA::updateSublayerList): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): * platform/graphics/ca/GraphicsLayerCA.h: * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: (WebCore::GraphicsLayer::create): (WebCore::GraphicsLayerTextureMapper::setChildren): (WebCore::GraphicsLayerTextureMapper::addChild): (WebCore::GraphicsLayerTextureMapper::addChildAtIndex): (WebCore::GraphicsLayerTextureMapper::addChildAbove): (WebCore::GraphicsLayerTextureMapper::addChildBelow): (WebCore::GraphicsLayerTextureMapper::replaceChild): (WebCore::GraphicsLayerTextureMapper::setMaskLayer): (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIncludingSubLayers): * platform/graphics/texmap/GraphicsLayerTextureMapper.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::GraphicsLayer::create): (WebCore::CoordinatedGraphicsLayer::setShouldUpdateVisibleRect): (WebCore::CoordinatedGraphicsLayer::addChild): (WebCore::CoordinatedGraphicsLayer::addChildAtIndex): (WebCore::CoordinatedGraphicsLayer::addChildAbove): (WebCore::CoordinatedGraphicsLayer::addChildBelow): (WebCore::CoordinatedGraphicsLayer::replaceChild): (WebCore::CoordinatedGraphicsLayer::setMaskLayer): (WebCore::CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers): (WebCore::CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers): (WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: * platform/graphics/win/GraphicsLayerDirect2D.cpp: (WebCore::GraphicsLayer::create): (WebCore::GraphicsLayerDirect2D::GraphicsLayerDirect2D): Deleted. (WebCore::GraphicsLayerDirect2D::initialize): Deleted. (WebCore::GraphicsLayerDirect2D::~GraphicsLayerDirect2D): Deleted. (WebCore::GraphicsLayerDirect2D::setNeedsDisplay): Deleted. (WebCore::GraphicsLayerDirect2D::setNeedsDisplayInRect): Deleted. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::createGraphicsLayer): (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer): (WebCore::RenderLayerBacking::updateConfiguration): (WebCore::RenderLayerBacking::updateInternalHierarchy): (WebCore::RenderLayerBacking::updateMaskingLayer): (WebCore::RenderLayerBacking::updateChildClippingStrategy): (WebCore::RenderLayerBacking::updateScrollingLayers): * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): (WebCore::RenderLayerCompositor::setCompositingParent): (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): (WebCore::RenderLayerCompositor::parentFrameContentLayers): (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea): (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea): (WebCore::RenderLayerCompositor::updateLayerForHeader): (WebCore::RenderLayerCompositor::updateLayerForFooter): (WebCore::RenderLayerCompositor::updateOverflowControlsLayers): (WebCore::RenderLayerCompositor::ensureRootLayer): (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: Source/WebKit: Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>. RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>. Added some helper functions to null out a RefPtr<GraphicsLayer> after removing from the tree, clearing the client. GraphicsLayer.m_client becomes a pointer, so it can be set to point to a singleton empty client when a GraphicsLayer gets detached from its owner. More explicit layer unparenting, and removed some unnecessary parent checks, and redundant unparenting. Other changes are just to adapt to the new ownership patterns. I verified that no GraphicsLayers were leaked or abandoned after this change. * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::~WebInspectorClient): (WebKit::WebInspectorClient::showPaintRect): (WebKit::WebInspectorClient::animationEndedForLayer): * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::createGraphicsLayer): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): Canonical link: https://commits.webkit.org/204596@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-14 19:49:46 +00:00
HashMap<PageOverlay*, Ref<GraphicsLayer>> m_overlayGraphicsLayers;
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
Vector<RefPtr<PageOverlay>> m_pageOverlays;
Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings https://bugs.webkit.org/show_bug.cgi?id=189521 Reviewed by Tim Horton. Source/WebCore: Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>. RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>. All the other changes are just to adapt to the new ownership patterns. I verified that no GraphicsLayers were leaked or abandoned after this change. No behavior change. * page/PageOverlayController.cpp: (WebCore::PageOverlayController::layerWithDocumentOverlays): (WebCore::PageOverlayController::layerWithViewOverlays): (WebCore::PageOverlayController::installPageOverlay): (WebCore::PageOverlayController::uninstallPageOverlay): (WebCore::PageOverlayController::setPageOverlayNeedsDisplay): (WebCore::PageOverlayController::didChangeViewSize): (WebCore::PageOverlayController::didChangeDocumentSize): (WebCore::PageOverlayController::didChangeSettings): (WebCore::PageOverlayController::paintContents): (WebCore::PageOverlayController::didChangeOverlayFrame): (WebCore::PageOverlayController::didChangeOverlayBackgroundColor): * page/PageOverlayController.h: * page/mac/ServicesOverlayController.h: (WebCore::ServicesOverlayController::Highlight::layer const): * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::Highlight::Highlight): (WebCore::ServicesOverlayController::Highlight::invalidate): (WebCore::ServicesOverlayController::Highlight::fadeIn): (WebCore::ServicesOverlayController::Highlight::fadeOut): (WebCore::ServicesOverlayController::Highlight::didFinishFadeOutAnimation): (WebCore::ServicesOverlayController::determineActiveHighlight): * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::GraphicsLayer): (WebCore::GraphicsLayer::willBeDestroyed): (WebCore::GraphicsLayer::setChildren): (WebCore::GraphicsLayer::addChild): (WebCore::GraphicsLayer::addChildAtIndex): (WebCore::GraphicsLayer::addChildBelow): (WebCore::GraphicsLayer::addChildAbove): (WebCore::GraphicsLayer::replaceChild): (WebCore::GraphicsLayer::removeAllChildren): (WebCore::GraphicsLayer::removeFromParent): (WebCore::GraphicsLayer::setMaskLayer): (WebCore::GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants): (WebCore::GraphicsLayer::distributeOpacity): (WebCore::GraphicsLayer::traverse): (WebCore::dumpChildren): * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::children const): (WebCore::GraphicsLayer::children): (WebCore::GraphicsLayer::maskLayer const): (WebCore::GraphicsLayer::replicaLayer const): (WebCore::GraphicsLayer::beingDestroyed const): (WebCore::GraphicsLayer:: const): Deleted. * platform/graphics/GraphicsLayerFactory.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayer::create): (WebCore::GraphicsLayerCA::setChildren): (WebCore::GraphicsLayerCA::addChild): (WebCore::GraphicsLayerCA::addChildAtIndex): (WebCore::GraphicsLayerCA::addChildBelow): (WebCore::GraphicsLayerCA::addChildAbove): (WebCore::GraphicsLayerCA::replaceChild): (WebCore::GraphicsLayerCA::setMaskLayer): (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush const): (WebCore::GraphicsLayerCA::recursiveCommitChanges): (WebCore::GraphicsLayerCA::updateSublayerList): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): * platform/graphics/ca/GraphicsLayerCA.h: * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: (WebCore::GraphicsLayer::create): (WebCore::GraphicsLayerTextureMapper::setChildren): (WebCore::GraphicsLayerTextureMapper::addChild): (WebCore::GraphicsLayerTextureMapper::addChildAtIndex): (WebCore::GraphicsLayerTextureMapper::addChildAbove): (WebCore::GraphicsLayerTextureMapper::addChildBelow): (WebCore::GraphicsLayerTextureMapper::replaceChild): (WebCore::GraphicsLayerTextureMapper::setMaskLayer): (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIncludingSubLayers): * platform/graphics/texmap/GraphicsLayerTextureMapper.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::GraphicsLayer::create): (WebCore::CoordinatedGraphicsLayer::setShouldUpdateVisibleRect): (WebCore::CoordinatedGraphicsLayer::addChild): (WebCore::CoordinatedGraphicsLayer::addChildAtIndex): (WebCore::CoordinatedGraphicsLayer::addChildAbove): (WebCore::CoordinatedGraphicsLayer::addChildBelow): (WebCore::CoordinatedGraphicsLayer::replaceChild): (WebCore::CoordinatedGraphicsLayer::setMaskLayer): (WebCore::CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers): (WebCore::CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers): (WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: * platform/graphics/win/GraphicsLayerDirect2D.cpp: (WebCore::GraphicsLayer::create): (WebCore::GraphicsLayerDirect2D::GraphicsLayerDirect2D): Deleted. (WebCore::GraphicsLayerDirect2D::initialize): Deleted. (WebCore::GraphicsLayerDirect2D::~GraphicsLayerDirect2D): Deleted. (WebCore::GraphicsLayerDirect2D::setNeedsDisplay): Deleted. (WebCore::GraphicsLayerDirect2D::setNeedsDisplayInRect): Deleted. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::createGraphicsLayer): (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer): (WebCore::RenderLayerBacking::updateConfiguration): (WebCore::RenderLayerBacking::updateInternalHierarchy): (WebCore::RenderLayerBacking::updateMaskingLayer): (WebCore::RenderLayerBacking::updateChildClippingStrategy): (WebCore::RenderLayerBacking::updateScrollingLayers): * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): (WebCore::RenderLayerCompositor::setCompositingParent): (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): (WebCore::RenderLayerCompositor::parentFrameContentLayers): (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea): (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea): (WebCore::RenderLayerCompositor::updateLayerForHeader): (WebCore::RenderLayerCompositor::updateLayerForFooter): (WebCore::RenderLayerCompositor::updateOverflowControlsLayers): (WebCore::RenderLayerCompositor::ensureRootLayer): (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderLayerCompositor.h: Source/WebKit: Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>. RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>. Added some helper functions to null out a RefPtr<GraphicsLayer> after removing from the tree, clearing the client. GraphicsLayer.m_client becomes a pointer, so it can be set to point to a singleton empty client when a GraphicsLayer gets detached from its owner. More explicit layer unparenting, and removed some unnecessary parent checks, and redundant unparenting. Other changes are just to adapt to the new ownership patterns. I verified that no GraphicsLayers were leaked or abandoned after this change. * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::~WebInspectorClient): (WebKit::WebInspectorClient::showPaintRect): (WebKit::WebInspectorClient::animationEndedForLayer): * WebProcess/WebCoreSupport/WebInspectorClient.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::createGraphicsLayer): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers): (WebKit::RemoteLayerTreeDrawingArea::flushLayers): Canonical link: https://commits.webkit.org/204596@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-14 19:49:46 +00:00
bool m_initialized { false };
Unify and factor out page overlay implementations https://bugs.webkit.org/show_bug.cgi?id=131353 Reviewed by Anders Carlsson. Bring all of the PageOverlay code together in a single cross-platform PageOverlayController, including hit-testing code from WebPage and painting and layer-tree manipulation code from the DrawingArea. This also makes all PageOverlays a single GraphicsLayer tree which can be flushed and plugged into any DrawingArea in a straightforward manner. We no longer have to watch for individual layers flipping into/out of tiling, because they're hidden underneath the root PageOverlay GraphicsLayer. Additionally, because GraphicsLayer is cross-platform, we can share all of the fairly trivial but oft-repeated overlay management code. * WebKit2.xcodeproj/project.pbxproj: * WebProcess/WebPage/PageOverlayController.cpp: Added. * WebProcess/WebPage/PageOverlayController.h: Added. (WebKit::PageOverlayController::rootLayer): Add PageOverlayController. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: Remove PageOverlay-related code from the DrawingAreas. * WebProcess/WebPage/PageOverlay.cpp: (WebKit::PageOverlay::setNeedsDisplay): (WebKit::PageOverlay::fadeAnimationTimerFired): (WebKit::PageOverlay::clear): * WebProcess/WebPage/PageOverlay.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::didChangeScrollOffset): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): Use PageOverlayController instead of the DrawingArea/WebPage to manipulate page overlays. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageOverlayController): Remove PageOverlay-related code from WebPage. * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded): Deleted. (WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved): Deleted. (WebKit::RemoteLayerTreeContext::flushOutOfTreeLayers): Deleted. Remove the no-longer-necessary out-of-tree layer code. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageInstallPageOverlayWithAnimation): (WKBundlePageUninstallPageOverlayWithAnimation): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): (WebKit::WebInspectorClient::hideHighlight): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::hideFindUI): * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: (WebKit::TelephoneNumberOverlayController::createOverlayIfNeeded): (WebKit::TelephoneNumberOverlayController::destroyOverlay): Make use of the FadeMode enum. Canonical link: https://commits.webkit.org/149460@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-08 23:09:52 +00:00
};
} // namespace WebKit