commit | 6f274104179b5fafd70ef00ca2f521c3098fb496 | [log] [tgz] |
---|---|---|
author | zimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Sun Jan 17 00:26:19 2021 +0000 |
committer | zimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Sun Jan 17 00:26:19 2021 +0000 |
tree | cc4cc4b38d55dc2623b12758c8ec973d47d3b092 | |
parent | 8f6a533422134ba24acfad7779cf58e7e8941f81 [diff] |
Separate scrolling code out of RenderLayer https://bugs.webkit.org/show_bug.cgi?id=60305 Reviewed by Simon Fraser. Move all scrolling/overflow handling out of RenderLayer, to streamline its interface and make it re-usable for layer types that do not need nor support scrolling/overflow. Many variables tracking scrolling/overflow state were migrated to RenderLayerScrollableArea, which is only created if the renderer corresponding to the layer has a CSS 'resize' property != 'none', has potentially scrollable overflow content or <marquee>. For the common case (no scrollable overflow), the RenderLayer overhead is reduced: less memory, less state tracking. Covered by existing tests. * WebCore.xcodeproj/project.pbxproj: Make RenderLayerScrollableArea.h include work in WebKit project. * accessibility/AccessibilityRenderObject.cpp: Adapt to the fact that RenderLayer is no longer a ScrollableArea. (WebCore::AccessibilityRenderObject::getScrollableAreaIfScrollable const): * html/TextFieldInputType.cpp: Adapt to the fact that RenderLayer is no longer a ScrollableArea. (WebCore::TextFieldInputType::elementDidBlur): * page/EventHandler.cpp: Ditto. (WebCore::EventHandler::enclosingScrollableArea): (WebCore::EventHandler::handleWheelEventInAppropriateEnclosingBox): * page/FrameView.cpp: Ditto. (WebCore::FrameView::enclosingScrollableArea const): * page/ios/FrameIOS.mm: Ditto. (WebCore::Frame::overflowScrollPositionChangedForNode): * page/mac/EventHandlerMac.mm: (WebCore::scrollableAreaForBox): * rendering/RenderBox.cpp: (WebCore::RenderBox::requiresLayerWithScrollableArea const): Decides whether a RenderLayer needs a RenderLayerScrollableArea. The presence of resize/marquee/overflow triggers creation of a RenderLayerScrollableArea object. * rendering/RenderBox.h: * rendering/RenderLayer.cpp: Move all overflow/resize/marquee/scroll handling to RenderLayerScrollableArea and adapt the affected code. (WebCore::RenderLayer::RenderLayer): (WebCore::RenderLayer::~RenderLayer): (WebCore::RenderLayer::currentScrollType const): (WebCore::RenderLayer::scrollAnimator const): (WebCore::RenderLayer::scrollOffset const): (WebCore::RenderLayer::scrollToOffset): (WebCore::RenderLayer::scrollToXPosition): (WebCore::RenderLayer::scrollToYPosition): (WebCore::RenderLayer::setScrollPosition): (WebCore::RenderLayer::scrollByRecursively): (WebCore::RenderLayer::setRequiresScrollPositionReconciliation): (WebCore::RenderLayer::setAdjustForIOSCaretWhenScrolling): (WebCore::RenderLayer::setScrollShouldClearLatchedState): (WebCore::RenderLayer::shouldPlaceBlockDirectionScrollbarOnLeft const): (WebCore::RenderLayer::containsDirtyOverlayScrollbars const): (WebCore::RenderLayer::hasScrollableOrRubberbandableAncestor): (WebCore::RenderLayer::marquee const): (WebCore::RenderLayer::updateLayerPositionsAfterDocumentScroll): (WebCore::RenderLayer::hitTestOverflowControls): (WebCore::RenderLayer::paintOverflowControls): (WebCore::RenderLayer::paintResizer): (WebCore::RenderLayer::paintScrollCorner): (WebCore::RenderLayer::paintOverlayScrollbars): (WebCore::RenderLayer::reachableTotalContentsSize const): (WebCore::RenderLayer::horizontalScrollbarHiddenByStyle const): (WebCore::RenderLayer::verticalScrollbarHiddenByStyle const): (WebCore::RenderLayer::setPostLayoutScrollPosition): (WebCore::RenderLayer::panScrollFromPoint): (WebCore::RenderLayer::scrollPosition const): (WebCore::RenderLayer::layerForHorizontalScrollbar const): (WebCore::RenderLayer::layerForVerticalScrollbar const): (WebCore::RenderLayer::horizontalScrollbar const): (WebCore::RenderLayer::verticalScrollbar const): (WebCore::RenderLayer::scrollingMayRevealBackground const): (WebCore::RenderLayer::hasScrollableHorizontalOverflow const): (WebCore::RenderLayer::hasScrollableVerticalOverflow const): (WebCore::RenderLayer::verticalScrollbarWidth const): (WebCore::RenderLayer::horizontalScrollbarHeight const): (WebCore::RenderLayer::scroll): (WebCore::RenderLayer::setConstrainsScrollingToContentEdge): (WebCore::RenderLayer::updateLayerPositions): (WebCore::RenderLayer::updateLayerPositionsAfterScroll): (WebCore::RenderLayer::updateLayerPosition): (WebCore::RenderLayer::enclosingFrameRenderLayer const): (WebCore::RenderLayer::enclosingContainingBlockLayer const): (WebCore::RenderLayer::enclosingScrollableLayer const): (WebCore::frameElementAndViewPermitScroll): (WebCore::RenderLayer::allowsCurrentScroll const): (WebCore::RenderLayer::scrollRectToVisible): (WebCore::RenderLayer::resize): (WebCore::RenderLayer::visibleSize const): (WebCore::RenderLayer::overflowControlsRects const): (WebCore::RenderLayer::debugDescription const): (WebCore::RenderLayer::offsetFromResizeCorner const): (WebCore::RenderLayer::scrollWidth const): (WebCore::RenderLayer::scrollHeight const): (WebCore::RenderLayer::updateScrollInfoAfterLayout): (WebCore::RenderLayer::canUseCompositedScrolling const): (WebCore::RenderLayer::hasCompositedScrollableOverflow const): (WebCore::RenderLayer::hasOverlayScrollbars const): (WebCore::RenderLayer::usesCompositedScrolling const): (WebCore::RenderLayer::isPointInResizeControl const): (WebCore::RenderLayer::paintLayerContents): (WebCore::RenderLayer::paintOverflowControlsForFragments): (WebCore::RenderLayer::hitTest): (WebCore::RenderLayer::hitTestLayer): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: Ditto. (WebCore::RenderLayer::hasScrollbars const): (WebCore::RenderLayer::hasHorizontalScrollbar const): (WebCore::RenderLayer::hasVerticalScrollbar const): (WebCore::RenderLayer::scrollToXOffset): (WebCore::RenderLayer::scrollToYOffset): * rendering/RenderLayerBacking.cpp: Adapt to the fact that RenderLayer is no longer a ScrollableArea. (WebCore::RenderLayerBacking::updateOverflowControlsLayers): * rendering/RenderLayerCompositor.cpp: Adapt to the fact that RenderLayer is no longer a ScrollableArea. (WebCore::RenderLayerCompositor::parentRelativeScrollableRect const): (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole): (WebCore::RenderLayerCompositor::scrollableAreaForScrollingNodeID const): * rendering/RenderLayerModelObject.cpp: Adapt to the fact that RenderLayer is no longer a ScrollableArea. (WebCore::RenderLayerModelObject::styleDidChange): * rendering/RenderLayerScrollableArea.cpp: Mostly moved from RenderLayer. (WebCore::RenderLayerScrollableArea::RenderLayerScrollableArea): (WebCore::RenderLayerScrollableArea::~RenderLayerScrollableArea): (WebCore::RenderLayerScrollableArea::storeScrollPosition): (WebCore::RenderLayerScrollableArea::handleTouchEvent): (WebCore::RenderLayerScrollableArea::registerAsTouchEventListenerForScrolling): (WebCore::RenderLayerScrollableArea::unregisterAsTouchEventListenerForScrolling): (WebCore::RenderLayerScrollableArea::scrollableAreaBoundingBox const): (WebCore::RenderLayerScrollableArea::isUserScrollInProgress const): (WebCore::RenderLayerScrollableArea::isRubberBandInProgress const): (WebCore::RenderLayerScrollableArea::forceUpdateScrollbarsOnMainThreadForPerformanceTesting const): (WebCore::RenderLayerScrollableArea::usesAsyncScrolling const): (WebCore::RenderLayerScrollableArea::setPostLayoutScrollPosition): (WebCore::RenderLayerScrollableArea::applyPostLayoutScrollPositionIfNeeded): (WebCore::RenderLayerScrollableArea::scrollToXPosition): (WebCore::RenderLayerScrollableArea::scrollToYPosition): (WebCore::RenderLayerScrollableArea::setScrollPosition): (WebCore::RenderLayerScrollableArea::clampScrollOffset const): (WebCore::RenderLayerScrollableArea::requestScrollPositionUpdate): (WebCore::RenderLayerScrollableArea::scrollToOffset): (WebCore::RenderLayerScrollableArea::scrollTo): (WebCore::RenderLayerScrollableArea::updateCompositingLayersAfterScroll): (WebCore::RenderLayerScrollableArea::scrollWidth const): (WebCore::RenderLayerScrollableArea::scrollHeight const): (WebCore::RenderLayerScrollableArea::updateMarqueePosition): (WebCore::RenderLayerScrollableArea::createOrDestroyMarquee): (WebCore::RenderLayerScrollableArea::scrollsOverflow const): (WebCore::RenderLayerScrollableArea::canUseCompositedScrolling const): (WebCore::RenderLayerScrollableArea::setScrollOffset): (WebCore::RenderLayerScrollableArea::scrollingNodeID const): (WebCore::RenderLayerScrollableArea::handleWheelEventForScrolling): (WebCore::RenderLayerScrollableArea::visibleContentRectInternal const): (WebCore::RenderLayerScrollableArea::overhangAmount const): (WebCore::RenderLayerScrollableArea::scrollCornerRect const): (WebCore::RenderLayerScrollableArea::isScrollCornerVisible const): (WebCore::RenderLayerScrollableArea::convertFromScrollbarToContainingView const): (WebCore::RenderLayerScrollableArea::convertFromContainingViewToScrollbar const): (WebCore::RenderLayerScrollableArea::visibleSize const): (WebCore::RenderLayerScrollableArea::contentsSize const): (WebCore::RenderLayerScrollableArea::reachableTotalContentsSize const): (WebCore::RenderLayerScrollableArea::availableContentSizeChanged): (WebCore::RenderLayerScrollableArea::shouldSuspendScrollAnimations const): (WebCore::RenderLayerScrollableArea::didStartScroll): (WebCore::RenderLayerScrollableArea::didEndScroll): (WebCore::RenderLayerScrollableArea::didUpdateScroll): (WebCore::RenderLayerScrollableArea::overflowControlsRects const): (WebCore::RenderLayerScrollableArea::scrollbarOffset const): (WebCore::RenderLayerScrollableArea::invalidateScrollbarRect): (WebCore::RenderLayerScrollableArea::invalidateScrollCornerRect): (WebCore::scrollbarHiddenByStyle): (WebCore::RenderLayerScrollableArea::horizontalScrollbarHiddenByStyle const): (WebCore::RenderLayerScrollableArea::verticalScrollbarHiddenByStyle const): (WebCore::rendererForScrollbar): (WebCore::RenderLayerScrollableArea::createScrollbar): (WebCore::RenderLayerScrollableArea::destroyScrollbar): (WebCore::RenderLayerScrollableArea::setHasHorizontalScrollbar): (WebCore::RenderLayerScrollableArea::setHasVerticalScrollbar): (WebCore::RenderLayerScrollableArea::enclosingScrollableArea const): (WebCore::RenderLayerScrollableArea::isScrollableOrRubberbandable): (WebCore::RenderLayerScrollableArea::hasScrollableOrRubberbandableAncestor): (WebCore::RenderLayerScrollableArea::verticalScrollbarWidth const): (WebCore::RenderLayerScrollableArea::horizontalScrollbarHeight const): (WebCore::RenderLayerScrollableArea::hasOverflowControls const): (WebCore::RenderLayerScrollableArea::positionOverflowControls): (WebCore::RenderLayerScrollableArea::overflowTop const): (WebCore::RenderLayerScrollableArea::overflowBottom const): (WebCore::RenderLayerScrollableArea::overflowLeft const): (WebCore::RenderLayerScrollableArea::overflowRight const): (WebCore::RenderLayerScrollableArea::computeScrollDimensions): (WebCore::RenderLayerScrollableArea::computeHasCompositedScrollableOverflow): (WebCore::RenderLayerScrollableArea::hasScrollableHorizontalOverflow const): (WebCore::RenderLayerScrollableArea::hasScrollableVerticalOverflow const): (WebCore::RenderLayerScrollableArea::hasHorizontalOverflow const): (WebCore::RenderLayerScrollableArea::hasVerticalOverflow const): (WebCore::styleRequiresScrollbar): (WebCore::styleDefinesAutomaticScrollbar): (WebCore::RenderLayerScrollableArea::updateScrollbarsAfterLayout): (WebCore::RenderLayerScrollableArea::updateScrollInfoAfterLayout): (WebCore::RenderLayerScrollableArea::overflowControlsIntersectRect const): (WebCore::RenderLayerScrollableArea::showsOverflowControls const): (WebCore::RenderLayerScrollableArea::paintOverflowControls): (WebCore::RenderLayerScrollableArea::paintScrollCorner): (WebCore::RenderLayerScrollableArea::drawPlatformResizerImage): (WebCore::RenderLayerScrollableArea::paintResizer): (WebCore::RenderLayerScrollableArea::hitTestOverflowControls): (WebCore::RenderLayerScrollableArea::scroll): (WebCore::RenderLayerScrollableArea::isActive const): (WebCore::RenderLayerScrollableArea::lastKnownMousePositionInView const): (WebCore::RenderLayerScrollableArea::isHandlingWheelEvent const): (WebCore::RenderLayerScrollableArea::useDarkAppearance const): (WebCore::RenderLayerScrollableArea::updateSnapOffsets): (WebCore::RenderLayerScrollableArea::isScrollSnapInProgress const): (WebCore::RenderLayerScrollableArea::paintOverlayScrollbars): (WebCore::RenderLayerScrollableArea::hitTestResizerInFragments const): (WebCore::RenderLayerScrollableArea::layerForHorizontalScrollbar const): (WebCore::RenderLayerScrollableArea::layerForVerticalScrollbar const): (WebCore::RenderLayerScrollableArea::layerForScrollCorner const): (WebCore::RenderLayerScrollableArea::scrollingMayRevealBackground const): (WebCore::RenderLayerScrollableArea::updateScrollbarsAfterStyleChange): (WebCore::RenderLayerScrollableArea::updateScrollableAreaSet): (WebCore::RenderLayerScrollableArea::updateScrollCornerStyle): (WebCore::RenderLayerScrollableArea::clearScrollCorner): (WebCore::RenderLayerScrollableArea::updateResizerStyle): (WebCore::RenderLayerScrollableArea::clearResizer): (WebCore::RenderLayerScrollableArea::updateAllScrollbarRelatedStyle): (WebCore::RenderLayerScrollableArea::usesCompositedScrolling const): (WebCore::adjustedScrollDelta): (WebCore::RenderLayerScrollableArea::panScrollFromPoint): (WebCore::RenderLayerScrollableArea::updateScrollPosition): (WebCore::RenderLayerScrollableArea::scrollByRecursively): (WebCore::RenderLayerScrollableArea::updateLayerPositionsAfterDocumentScroll): (WebCore::RenderLayerScrollableArea::updateLayerPositionsAfterOverflowScroll): (WebCore::RenderLayerScrollableArea::usesMockScrollAnimator const): (WebCore::RenderLayerScrollableArea::logMockScrollAnimatorMessage const): (WebCore::RenderLayerScrollableArea::debugDescription const): * rendering/RenderLayerScrollableArea.h: * rendering/RenderListBox.cpp: Adapt to the fact that RenderLayer is no longer a ScrollableArea. (WebCore::RenderListBox::enclosingScrollableArea const): * rendering/RenderObject.cpp: Add 'S' state in debug output, indicating whether the RenderLayer has a RenderLayerScrollableArea. (WebCore::outputRenderTreeLegend): (WebCore::RenderObject::outputRenderObject const): * rendering/RenderObject.h: Add friendship with RenderLayerScrollableArea. * testing/Internals.cpp: Adapt to the fact that RenderLayer is no longer a ScrollableArea. (WebCore::Internals::scrollBySimulatingWheelEvent): (WebCore:: const): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@271559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit is a cross-platform web browser engine. On iOS and macOS, it powers Safari, Mail, iBooks, and many other applications.
Visit WebKit Feature Status page to see which Web API has been implemented, in development, or under consideration.
On macOS, download Safari Technology Preview to test the latest version of WebKit. On Linux, download Epiphany Technology Preview. On Windows, you'll have to build it yourself.
Once your bug is filed, you will receive email when it is updated at each stage in the bug life cycle. After the bug is considered fixed, you may be asked to download the latest nightly and confirm that the fix works for you.
On Windows, follow the instructions on our website.
Run the following command to clone WebKit's Git SVN repository:
git clone git@github.com:WebKit/WebKit.git WebKit
or
git clone https://github.com/WebKit/WebKit.git WebKit
If you want to be able to track Subversion revision from your git checkout, you can run the following command to do so:
Tools/Scripts/git-webkit setup-git-svn
For information about this, and other aspects of using Git with WebKit, read the wiki page.
If you don‘t want to use Git, run the following command to check out WebKit’s Subversion repository:
svn checkout https://svn.webkit.org/repository/webkit/trunk WebKit
Install Xcode and its command line tools if you haven't done so already:
xcode-select --install
Run the following command to build a debug build with debugging symbols and assertions:
Tools/Scripts/build-webkit --debug
For performance testing, and other purposes, use --release
instead.
You can open WebKit.xcworkspace
to build and debug WebKit within Xcode.
If you don't use a custom build location in Xcode preferences, you have to update the workspace settings to use WebKitBuild
directory. In menu bar, choose File > Workspace Settings, then click the Advanced button, select “Custom”, “Relative to Workspace”, and enter WebKitBuild
for both Products and Intermediates.
iOS, tvOS and watchOS are all considered embedded builds. The first time after you install a new Xcode, you will need to run:
sudo Tools/Scripts/configure-xcode-for-embedded-development
Without this step, you will see the error message: “target specifies product type ‘com.apple.product-type.tool’, but there’s no such product type for the ‘iphonesimulator’ platform.
” when building target JSCLLIntOffsetsExtractor
of project JavaScriptCore
.
Run the following command to build a debug build with debugging symbols and assertions for embededded simulators:
Tools/Scripts/build-webkit --debug --<platform>-simulator
or embedded devices:
Tools/Scripts/build-webkit --debug --<platform>-device
where platform
is ios
, tvos
or watchos
.
For production builds:
cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/gtk/install-dependencies Tools/Scripts/update-webkitgtk-libs Tools/Scripts/build-webkit --gtk --debug
For more information on building WebKitGTK+, see the wiki page.
For production builds:
cmake -DPORT=WPE -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/wpe/install-dependencies Tools/Scripts/update-webkitwpe-libs Tools/Scripts/build-webkit --wpe --debug
For building WebKit on Windows, see the wiki page.
Run the following command to launch Safari with your local build of WebKit:
Tools/Scripts/run-safari --debug
The run-safari
script sets the DYLD_FRAMEWORK_PATH
environment variable to point to your build products, and then launches /Applications/Safari.app
. DYLD_FRAMEWORK_PATH
tells the system loader to prefer your build products over the frameworks installed in /System/Library/Frameworks
.
To run other applications with your local build of WebKit, run the following command:
Tools/Scripts/run-webkit-app <application-path>
Run the following command to launch iOS simulator with your local build of WebKit:
run-safari --debug --ios-simulator
In both cases, if you have built release builds instead, use --release
instead of --debug
.
If you have a development build, you can use the run-minibrowser script, e.g.:
run-minibrowser --debug --wpe
Pass one of --gtk
, --jsc-only
, or --wpe
to indicate the port to use.
Congratulations! You’re up and running. Now you can begin coding in WebKit and contribute your fixes and new features to the project. For details on submitting your code to the project, read Contributing Code.