commit | d26e73f2549ef25bed02798115887d2e5444d75d | [log] [tgz] |
---|---|---|
author | dbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Tue Jun 30 19:05:40 2020 +0000 |
committer | dbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Tue Jun 30 19:05:40 2020 +0000 |
tree | b786837449d1c78b42a3839bc3798f7878488899 | |
parent | 61519cf4ebdb258a5cd2da729649197f46bf6208 [diff] |
[iOS] Editable regions causes ~1% slowdown in PLT5 https://bugs.webkit.org/show_bug.cgi?id=213659 <rdar://problem/64361390> Reviewed by Simon Fraser. Source/WebCore: Fix the slowdown by only enabling editable region when Page::editableElementsInRect is called. There are two parts that make computing the editable region expensive: 1. Requires traversing descendents during painting when a normal paint may be able to avoid this. 2. Can cause more event region invalidations because it extends the invalidation criterion to include changes to element editability. Tests: editing/editable-region/hit-test-basic-without-editable-region.html editing/editable-region/iframe-without-editable-region.html editing/editable-region/text-field-basic-without-editable-region.html Tests: editing/editable-region/hit-test-basic-without-editable-region.html editing/editable-region/iframe-without-editable-region.html editing/editable-region/text-field-basic-without-editable-region.html * page/Frame.cpp: (WebCore::Frame::invalidateContentEventRegionsIfNeeded): Check if editable region is enabled. If it is then do what we do now. Otherwise, don't invalidate the region unless we were going to do so anyway. * page/Page.cpp: (WebCore::Page::setEditableRegionEnabled): Added. Update state and then invalidate the event region in all layers. (WebCore::Page::shouldBuildEditableRegion const): Added. Returns whether to build the editable region: either when Page::isEditableRegionEnabled() is true or the editable region debug overlay is enabled. (WebCore::Page::didFinishLoad): Turn off editable region as it may not be needed on the new page. * page/Page.h: (WebCore::Page::isEditableRegionEnabled const): Added. * rendering/EventRegion.cpp: (WebCore::EventRegion::unite): (WebCore::EventRegion::translate): (WebCore::EventRegion::containsEditableElementsInRect const): (WebCore::EventRegion::dump const): * rendering/EventRegion.h: (WebCore::EventRegion::hasEditableRegion const): (WebCore::EventRegion::rectsForEditableElements const): (WebCore::EventRegion::decode): (WebCore::EventRegion::ensureEditableRegion): The editable region is now an Optional<>. There will only be one if ensureEditableRegion was called, which is only when Page::isEditableRegionEnabled() returns true. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintObject): * rendering/RenderElement.cpp: (WebCore::RenderElement::styleWillChange): * rendering/RenderLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::maintainsEventRegion const): Only do what we do now if Page::shouldBuildEditableRegion() returns true. (WebCore::RenderLayerBacking::updateEventRegion): Instantiate the editable region, if needed. Painting will then populate it. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::applyToCompositedLayerIncludingDescendants): Added. (WebCore::RenderLayerCompositor::invalidateEventRegionForAllLayers): Added. (WebCore::RenderLayerCompositor::clearBackingForAllLayers): Wrote in terms of applyToCompositedLayerIncludingDescendants. (WebCore::RenderLayerCompositor::clearBackingForLayerIncludingDescendants): Deleted. * rendering/RenderLayerCompositor.h: * testing/InternalSettings.cpp: (WebCore::InternalSettings::setEditableRegionEnabled): * testing/InternalSettings.h: * testing/InternalSettings.idl: Add a new internal setting for testing purposes to toggle enabling/disabling editable region. Source/WebKit: Fix up RemoteLayerTreeViews now that the editable region is an Optional<>. Have the UI process message the web process to enable editable region on the first invocation of _requestTextInputContextsInRect, which is good indicator that there would be benefit to computing it as a typical client that calls it will call it many times. * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (WebKit::mayContainEditableElementsInRect): Fix up the logic now that there may be not be an editable region sent over in the last event region update. If there isn't one then we don't know if there are editable elements in the rect of not. So, return true, which could turn out to be a false positive if there aren't any editable elements in the rect. The caller will have to message the web process to find out the real answer if they want it. Just to clarify, it's OK for this function to have false positives, but it must never have false negatives. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::textInputContextsInRect): Enable editable region. If it's already enabled then doing so again does nothing. LayoutTests: Add some tests to ensure the new setting works and the feature can be disabled. Note that the setting is enabled by default to keep the current behavior. See the WebCore ChangeLog entry for more details. Update existings tests that need the editable region enabled to enable it now that it must be explicitly enabled. * editing/editable-region/fixed-and-absolute-contenteditable-scrolled.html: * editing/editable-region/float-contenteditable.html: * editing/editable-region/hit-test-basic-without-editable-region-expected.txt: Added. * editing/editable-region/hit-test-basic-without-editable-region.html: Copied from LayoutTests/editing/editable-region/hit-test-basic.html. * editing/editable-region/hit-test-basic.html: * editing/editable-region/hit-test-editable-document-element.html: * editing/editable-region/hit-test-fixed.html: * editing/editable-region/hit-test-overlap.html: * editing/editable-region/hit-test-textarea-empty-space.html: * editing/editable-region/iframe-without-editable-region-expected.txt: Added. * editing/editable-region/iframe-without-editable-region.html: Copied from LayoutTests/editing/editable-region/iframe.html. * editing/editable-region/iframe.html: * editing/editable-region/out-hanging-child-of-contenteditable.html: * editing/editable-region/overflow-scroll-text-field-and-contenteditable.html: * editing/editable-region/relative-inside-fixed-contenteditable-scrolled.html: * editing/editable-region/relative-inside-transformed-contenteditable.html: * editing/editable-region/search-field-basic.html: * editing/editable-region/text-field-basic-without-editable-region-expected.txt: Added. * editing/editable-region/text-field-basic-without-editable-region.html: Copied from LayoutTests/editing/editable-region/text-field-basic.html. * editing/editable-region/text-field-basic.html: * editing/editable-region/text-field-inside-composited-negative-z-index-layer.html: * editing/editable-region/textarea-basic.html: * editing/editable-region/transformed-scrolled-on-top-of-fixed-contenteditables.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@263762 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://git.webkit.org/WebKit.git WebKit
or
git clone https://git.webkit.org/git/WebKit.git WebKit
If you want to be able to commit changes to the repository, or just want to check out branches that aren’t contained in WebKit.git, you will need track WebKit's Subversion repository. You can run the following command to configure this and other options of the new Git clone for WebKit development.
Tools/Scripts/webkit-patch setup-git-clone
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.
The first time after you install a new Xcode, you will need to run the following command to enable Xcode to build command line tools for iOS Simulator:
sudo Tools/Scripts/configure-xcode-for-ios-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 iOS:
Tools/Scripts/build-webkit --debug --ios-simulator
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.