⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 259762 in webkit


Ignore:
Timestamp:
Apr 8, 2020, 3:41:44 PM (6 years ago)
Author:
dbates@webkit.org
Message:

Track editable elements on screen
https://bugs.webkit.org/show_bug.cgi?id=209888
<rdar://problem/61196886>

Reviewed by Simon Fraser.

Source/JavaScriptCore:

Add feature define to track editable elements on screen (enabled by default on iOS and iOS Simulator).

  • Configurations/FeatureDefines.xcconfig:

Source/WebCore:

Amend EventRegion to store a region of all the hit test visible rects of editable elements
on the page. This data will be sent over to the UI process so that it can quickly determine
if a search rect would intersect any editable elements.

An element is considered editable if it has CSS -webkit-user-modify value that isn't read-only.
Note that the value of the HTML content attribute contenteditable is internally converted to
its -webkit-user-modify equivalent (e.g. contenteditable="true" <=> "-webkit-user-modify: read-write").

Tests: editing/editable-region/fixed-and-absolute-contenteditable-scrolled.html

editing/editable-region/float-contenteditable.html
editing/editable-region/hit-test-basic.html
editing/editable-region/hit-test-fixed.html
editing/editable-region/hit-test-overlap.html
editing/editable-region/iframe.html
editing/editable-region/input-basic.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/transformed-scrolled-on-top-of-fixed-contenteditables.html

  • Configurations/FeatureDefines.xcconfig: Add feature define to track editable elements on

screen (enabled by default on iOS and iOS Simulator).

  • dom/Document.h:

(WebCore::Document::mayHaveEditableElements const):
(WebCore::Document::setMayHaveEditableElements):
Add some state to each document to track whether it may have an editable element or not. This
value represents a "maybe" because it is only set and never unset. It is set if the style resolver
saw an element with an editable style. This flag is used as a performance optimization to avoid
creating an event region if there are no editable elements on the page.

  • page/Frame.cpp:

(WebCore::Frame::invalidateContentEventRegionsIfNeeded): Check if there are any editable elements.
If so, invalidate the event region.

  • rendering/EventRegion.cpp:

(WebCore::EventRegion::operator== const): Update for editable region.
(WebCore::EventRegion::unite): If the specified style has a writable CSS user-modify value then
unite the region with the editable region.
(WebCore::EventRegion::translate): Update for editable region.
(WebCore::EventRegion::containsEditableElementsInRect const): Added. Check if the specified rect
intersects the editable region. If it does then that means there are one or more editable elements
whose bounds intersect that rect. Otherwise, there are none.
(WebCore::EventRegion::dump const): Update for editable region.

  • rendering/EventRegion.h:

(WebCore::EventRegion::intersects const): Added.
(WebCore::EventRegion::rectsForEditableElements const): Return the rects in the editable region.
(WebCore::EventRegion::encode const): Encode the editable region.
(WebCore::EventRegion::decode): Decode the editable region.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::paintObject): Traverse descendants if the page has any editable elements
so that we find all of them.

  • rendering/RenderElement.cpp:

(WebCore::RenderElement::styleWillChange): Amend the event region invalidation criterion to look
for a change in writability. If there was a change (e.g. read-only to read-write) then invalidate
the event region to force a re-computation of it.

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::invalidateEventRegion): If the document has editable elements then we need
to create an event region.

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::updateEventRegion): Update the region if there are editable elements.
(WebCore::RenderLayerBacking::paintDebugOverlays): Paint the editable elements in the debug overlay.
For now, I piggybacked (like was done for touch-action regions) on the non-fast scrollable region
flag (not shown in the patch). I will look to add a dedicated debug overlay flag in a follow up patch.

  • style/StyleTreeResolver.cpp:

(WebCore::Style::TreeResolver::resolveElement): Mark the document as having an editable element if
the style for the element being resolved is writable.

Source/WebCore/PAL:

Add feature define to track editable elements on screen (enabled by default on iOS and iOS Simulator).

  • Configurations/FeatureDefines.xcconfig:

Source/WebKit:

Speed up -_requestTextInputContextsInRect when the rect does not intersect any editable
elements by over 4450 times on reddit.com! Another way of saying this is that it reduces
the time from an average of 303.252ms to 0.0680625ms in a Production build.

This speed up is accomplished by having the web process track the rects of the editable
elements on the page and send this information as a region data structure over to the UI
process as part of the EventRegion object. This region is used to determine if there
*may* be an editable element inside the rectangele. It never reports a false negative,
but it can report a false positive: a rectangle is over an editable element when it
actually isn't, (e.g. there is a non-composited element with a higher z-order than the
editable element that intersects the search rect).

  • Configurations/FeatureDefines.xcconfig: Add feature define to track editable elements on

screen (enabled by default on iOS and iOS Simulator).

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _mayContainEditableElementsInRect:]): Added.
(-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Checks if the search
rects hits an editable element in a RemoteLayerTree node's editable region. If it does
not hit any then we know there are no editable elements and return immediately. If it
does hit something then we still need to ask the web process to perform a hit test to
find the actual elements, respecting z-ordering (which is lost when these elements' rects
are united to form the editable region).

  • UIProcess/API/Cocoa/WKWebViewPrivate.h:
  • UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
  • UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:

(WebKit::collectDescendantViewsInRect): Added.
(WebKit::mayContainEditableElementsInRect): Added.

Source/WebKitLegacy/mac:

Add feature define to track editable elements on screen (enabled by default on iOS and iOS Simulator).

  • Configurations/FeatureDefines.xcconfig:

Tools:

Add more unit tests for -_requestTextInputContextsInRect. Also add test infrastructure to
be able to verify that WebKit::mayContainEditableElementsInRect() works.

  • TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
  • TestRunnerShared/UIScriptContext/UIScriptController.h:

(WTR::UIScriptController::mayContainEditableElementsInRect):
Expose an internal function to test WebKit::mayContainEditableElementsInRect().

  • TestWebKitAPI/Configurations/FeatureDefines.xcconfig: Add feature define.
  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm:

(webViewLoadHTMLStringAndWaitForAllFramesToPaint): Renamed; formerly webViewLoadHTMLStringAndWaitForDOMLoadEvent.
Also make it wait for the next presentation update after we paint.
(TEST):
(squareCenteredAtPoint): Added.
(webViewLoadHTMLStringAndWaitForDOMLoadEvent): Deleted; renamed webViewLoadHTMLStringAndWaitForAllFramesToPaint().

  • TestWebKitAPI/Tests/WebKitCocoa/editable-region-composited-and-non-composited-overlap.html: Added.
  • TestWebKitAPI/ios/editable-region-composited-and-non-composited-overlap.html: Added.
  • WebKitTestRunner/ios/UIScriptControllerIOS.h:
  • WebKitTestRunner/ios/UIScriptControllerIOS.mm:

(WTR::UIScriptControllerIOS::mayContainEditableElementsInRect): Added.

LayoutTests:

Add some tests. Some of these tests were derived from a torture test page written by Simon Fraser.

  • TestExpectations: Skip directory editing/editable-region everywhere. I will unskip this in the iOS TestExpectations file.
  • editing/editable-region/fixed-and-absolute-contenteditable-scrolled-expected.txt: Added.
  • editing/editable-region/fixed-and-absolute-contenteditable-scrolled.html: Added.
  • editing/editable-region/float-contenteditable-expected.txt: Added.
  • editing/editable-region/float-contenteditable.html: Added.
  • editing/editable-region/hit-test-basic-expected.txt: Added.
  • editing/editable-region/hit-test-basic.html: Added.
  • editing/editable-region/hit-test-fixed-expected.txt: Added.
  • editing/editable-region/hit-test-fixed.html: Added.
  • editing/editable-region/hit-test-overlap-expected.txt: Added.
  • editing/editable-region/hit-test-overlap.html: Added.
  • editing/editable-region/iframe-expected.txt: Added.
  • editing/editable-region/iframe.html: Added.
  • editing/editable-region/input-basic-expected.txt: Added.
  • editing/editable-region/input-basic.html: Added.
  • editing/editable-region/out-hanging-child-of-contenteditable-expected.txt: Added.
  • editing/editable-region/out-hanging-child-of-contenteditable.html: Added.
  • editing/editable-region/overflow-scroll-text-field-and-contenteditable-expected.txt: Added.
  • editing/editable-region/overflow-scroll-text-field-and-contenteditable.html: Added.
  • editing/editable-region/relative-inside-fixed-contenteditable-scrolled-expected.txt: Added.
  • editing/editable-region/relative-inside-fixed-contenteditable-scrolled.html: Added.
  • editing/editable-region/relative-inside-transformed-contenteditable-expected.txt: Added.
  • editing/editable-region/relative-inside-transformed-contenteditable.html: Added.
  • editing/editable-region/resources/hit-test-utilities.js: Added.

(async shouldHaveEditableElementsInRect):
(async shouldNotHaveEditableElementsInRect):
(shouldNotHaveEditableElementsInRectForElement):

  • editing/editable-region/transformed-scrolled-on-top-of-fixed-contenteditables-expected.txt: Added.
  • editing/editable-region/transformed-scrolled-on-top-of-fixed-contenteditables.html: Added.
  • platform/ios/TestExpectations: Unskip editing/editable-region.
  • resources/ui-helper.js:

(window.UIHelper.mayContainEditableElementsInRect): Added. Convenience function that turns around
and calls the UIScriptController function of the same name and returns a boolean instead of a string.

Location:
trunk
Files:
29 added
35 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r259761 r259762  
     12020-04-08  Daniel Bates  <dabates@apple.com>
     2
     3        Track editable elements on screen
     4        https://bugs.webkit.org/show_bug.cgi?id=209888
     5        <rdar://problem/61196886>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add some tests. Some of these tests were derived from a torture test page written by Simon Fraser.
     10
     11        * TestExpectations: Skip directory editing/editable-region everywhere. I will unskip this in the iOS TestExpectations file.
     12        * editing/editable-region/fixed-and-absolute-contenteditable-scrolled-expected.txt: Added.
     13        * editing/editable-region/fixed-and-absolute-contenteditable-scrolled.html: Added.
     14        * editing/editable-region/float-contenteditable-expected.txt: Added.
     15        * editing/editable-region/float-contenteditable.html: Added.
     16        * editing/editable-region/hit-test-basic-expected.txt: Added.
     17        * editing/editable-region/hit-test-basic.html: Added.
     18        * editing/editable-region/hit-test-fixed-expected.txt: Added.
     19        * editing/editable-region/hit-test-fixed.html: Added.
     20        * editing/editable-region/hit-test-overlap-expected.txt: Added.
     21        * editing/editable-region/hit-test-overlap.html: Added.
     22        * editing/editable-region/iframe-expected.txt: Added.
     23        * editing/editable-region/iframe.html: Added.
     24        * editing/editable-region/input-basic-expected.txt: Added.
     25        * editing/editable-region/input-basic.html: Added.
     26        * editing/editable-region/out-hanging-child-of-contenteditable-expected.txt: Added.
     27        * editing/editable-region/out-hanging-child-of-contenteditable.html: Added.
     28        * editing/editable-region/overflow-scroll-text-field-and-contenteditable-expected.txt: Added.
     29        * editing/editable-region/overflow-scroll-text-field-and-contenteditable.html: Added.
     30        * editing/editable-region/relative-inside-fixed-contenteditable-scrolled-expected.txt: Added.
     31        * editing/editable-region/relative-inside-fixed-contenteditable-scrolled.html: Added.
     32        * editing/editable-region/relative-inside-transformed-contenteditable-expected.txt: Added.
     33        * editing/editable-region/relative-inside-transformed-contenteditable.html: Added.
     34        * editing/editable-region/resources/hit-test-utilities.js: Added.
     35        (async shouldHaveEditableElementsInRect):
     36        (async shouldNotHaveEditableElementsInRect):
     37        (shouldNotHaveEditableElementsInRectForElement):
     38        * editing/editable-region/transformed-scrolled-on-top-of-fixed-contenteditables-expected.txt: Added.
     39        * editing/editable-region/transformed-scrolled-on-top-of-fixed-contenteditables.html: Added.
     40        * platform/ios/TestExpectations: Unskip editing/editable-region.
     41        * resources/ui-helper.js:
     42        (window.UIHelper.mayContainEditableElementsInRect): Added. Convenience function that turns around
     43        and calls the UIScriptController function of the same name and returns a boolean instead of a string.
     44
    1452020-04-08  Daniel Bates  <dabates@apple.com>
    246
  • trunk/LayoutTests/TestExpectations

    r259703 r259762  
    1818editing/mac [ Skip ]
    1919editing/caret/ios [ Skip ]
     20editing/editable-region [ Skip ]
    2021editing/input/ios [ Skip ]
    2122editing/find [ Skip ]
  • trunk/LayoutTests/platform/ios/TestExpectations

    r259702 r259762  
    99accessibility/ios-simulator [ Pass ]
    1010displaylists [ Pass ]
     11editing/editable-region [ Pass ]
    1112editing/deleting/ios [ Pass ]
    1213http/tests/quicklook [ Pass ]
  • trunk/LayoutTests/resources/ui-helper.js

    r259669 r259762  
    11681168                    uiController.singleTapAtPoint(${x}, ${y}, incrementProgress);
    11691169                })();`, resolve);
     1170        });
     1171    }
     1172
     1173    static mayContainEditableElementsInRect(x, y, width, height)
     1174    {
     1175        if (!this.isWebKit2() || !this.isIOSFamily())
     1176            return Promise.resolve(false);
     1177
     1178        return new Promise(resolve => {
     1179            testRunner.runUIScript(`
     1180                (function() {
     1181                    uiController.doAfterPresentationUpdate(function() {
     1182                        uiController.uiScriptComplete(uiController.mayContainEditableElementsInRect(${x}, ${y}, ${width}, ${height}));
     1183                    })
     1184                })();`, result => resolve(result === "true"));
    11701185        });
    11711186    }
  • trunk/Source/JavaScriptCore/ChangeLog

    r259747 r259762  
     12020-04-08  Daniel Bates  <dabates@apple.com>
     2
     3        Track editable elements on screen
     4        https://bugs.webkit.org/show_bug.cgi?id=209888
     5        <rdar://problem/61196886>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add feature define to track editable elements on screen (enabled by default on iOS and iOS Simulator).
     10
     11        * Configurations/FeatureDefines.xcconfig:
     12
    1132020-04-08  Yusuke Suzuki  <ysuzuki@apple.com>
    214
  • trunk/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig

    r258772 r259762  
    146146ENABLE_DRAG_SUPPORT_maccatalyst = ENABLE_DRAG_SUPPORT;
    147147
     148ENABLE_EDITABLE_REGION = $(ENABLE_EDITABLE_REGION_$(WK_PLATFORM_NAME));
     149ENABLE_EDITABLE_REGION_iphoneos = ENABLE_EDITABLE_REGION;
     150ENABLE_EDITABLE_REGION_iphonesimulator = ENABLE_EDITABLE_REGION;
     151
    148152ENABLE_ENCRYPTED_MEDIA = $(ENABLE_ENCRYPTED_MEDIA_$(WK_PLATFORM_NAME));
    149153ENABLE_ENCRYPTED_MEDIA_iphoneos = ENABLE_ENCRYPTED_MEDIA;
     
    418422ENABLE_XSLT = ENABLE_XSLT;
    419423
    420 FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCESSIBILITY_ISOLATED_TREE) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLE_PAY_SESSION_V9) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_CONIC_GRADIENTS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_PAINTING_API) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CSS_TYPED_OM) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_C_LOOP) $(ENABLE_DARK_MODE_CSS) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FULLSCREEN_API) $(ENABLE_PICTURE_IN_PICTURE_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_GPU_PROCESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) $(ENABLE_INSPECTOR_TELEMETRY) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_MEMORY_SAMPLER) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NETWORK_CACHE_SPECULATIVE_REVALIDATION) $(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFSCREEN_CANVAS) $(ENABLE_OVERFLOW_SCROLLING_TOUCH) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESIZE_OBSERVER) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_LOAD_STATISTICS) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SANDBOX_EXTENSIONS) $(ENABLE_SERVER_PRECONNECT) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SHAREABLE_RESOURCE) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USERSELECT_ALL) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS) $(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS) $(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WEBXR) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_CRYPTO) $(ENABLE_WEB_RTC) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT);
     424FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCESSIBILITY_ISOLATED_TREE) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLE_PAY_SESSION_V9) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_CONIC_GRADIENTS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_PAINTING_API) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CSS_TYPED_OM) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_C_LOOP) $(ENABLE_DARK_MODE_CSS) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_EDITABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FULLSCREEN_API) $(ENABLE_PICTURE_IN_PICTURE_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_GPU_PROCESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) $(ENABLE_INSPECTOR_TELEMETRY) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_MEMORY_SAMPLER) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NETWORK_CACHE_SPECULATIVE_REVALIDATION) $(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFSCREEN_CANVAS) $(ENABLE_OVERFLOW_SCROLLING_TOUCH) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESIZE_OBSERVER) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_LOAD_STATISTICS) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SANDBOX_EXTENSIONS) $(ENABLE_SERVER_PRECONNECT) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SHAREABLE_RESOURCE) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USERSELECT_ALL) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS) $(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS) $(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WEBXR) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_CRYPTO) $(ENABLE_WEB_RTC) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT);
  • trunk/Source/WebCore/ChangeLog

    r259761 r259762  
     12020-04-08  Daniel Bates  <dabates@apple.com>
     2
     3        Track editable elements on screen
     4        https://bugs.webkit.org/show_bug.cgi?id=209888
     5        <rdar://problem/61196886>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Amend EventRegion to store a region of all the hit test visible rects of editable elements
     10        on the page. This data will be sent over to the UI process so that it can quickly determine
     11        if a search rect would intersect any editable elements.
     12
     13        An element is considered editable if it has CSS -webkit-user-modify value that isn't read-only.
     14        Note that the value of the HTML content attribute contenteditable is internally converted to
     15        its -webkit-user-modify equivalent (e.g. contenteditable="true" <=> "-webkit-user-modify: read-write").
     16
     17        Tests: editing/editable-region/fixed-and-absolute-contenteditable-scrolled.html
     18               editing/editable-region/float-contenteditable.html
     19               editing/editable-region/hit-test-basic.html
     20               editing/editable-region/hit-test-fixed.html
     21               editing/editable-region/hit-test-overlap.html
     22               editing/editable-region/iframe.html
     23               editing/editable-region/input-basic.html
     24               editing/editable-region/out-hanging-child-of-contenteditable.html
     25               editing/editable-region/overflow-scroll-text-field-and-contenteditable.html
     26               editing/editable-region/relative-inside-fixed-contenteditable-scrolled.html
     27               editing/editable-region/relative-inside-transformed-contenteditable.html
     28               editing/editable-region/transformed-scrolled-on-top-of-fixed-contenteditables.html
     29
     30        * Configurations/FeatureDefines.xcconfig: Add feature define to track editable elements on
     31        screen (enabled by default on iOS and iOS Simulator).
     32        * dom/Document.h:
     33        (WebCore::Document::mayHaveEditableElements const):
     34        (WebCore::Document::setMayHaveEditableElements):
     35        Add some state to each document to track whether it may have an editable element or not. This
     36        value represents a "maybe" because it is only set and never unset. It is set if the style resolver
     37        saw an element with an editable style. This flag is used as a performance optimization to avoid
     38        creating an event region if there are no editable elements on the page.
     39
     40        * page/Frame.cpp:
     41        (WebCore::Frame::invalidateContentEventRegionsIfNeeded): Check if there are any editable elements.
     42        If so, invalidate the event region.
     43        * rendering/EventRegion.cpp:
     44        (WebCore::EventRegion::operator== const): Update for editable region.
     45        (WebCore::EventRegion::unite): If the specified style has a writable CSS user-modify value then
     46        unite the region with the editable region.
     47        (WebCore::EventRegion::translate): Update for editable region.
     48        (WebCore::EventRegion::containsEditableElementsInRect const): Added. Check if the specified rect
     49        intersects the editable region. If it does then that means there are one or more editable elements
     50        whose bounds intersect that rect. Otherwise, there are none.
     51        (WebCore::EventRegion::dump const): Update for editable region.
     52        * rendering/EventRegion.h:
     53        (WebCore::EventRegion::intersects const): Added.
     54        (WebCore::EventRegion::rectsForEditableElements const): Return the rects in the editable region.
     55        (WebCore::EventRegion::encode const): Encode the editable region.
     56        (WebCore::EventRegion::decode): Decode the editable region.
     57        * rendering/RenderBlock.cpp:
     58        (WebCore::RenderBlock::paintObject): Traverse descendants if the page has any editable elements
     59        so that we find all of them.
     60        * rendering/RenderElement.cpp:
     61        (WebCore::RenderElement::styleWillChange): Amend the event region invalidation criterion to look
     62        for a change in writability. If there was a change (e.g. read-only to read-write) then invalidate
     63        the event region to force a re-computation of it.
     64        * rendering/RenderLayer.cpp:
     65        (WebCore::RenderLayer::invalidateEventRegion): If the document has editable elements then we need
     66        to create an event region.
     67        * rendering/RenderLayerBacking.cpp:
     68        (WebCore::RenderLayerBacking::updateEventRegion): Update the region if there are editable elements.
     69        (WebCore::RenderLayerBacking::paintDebugOverlays): Paint the editable elements in the debug overlay.
     70        For now, I piggybacked (like was done for touch-action regions) on the non-fast scrollable region
     71        flag (not shown in the patch). I will look to add a dedicated debug overlay flag in a follow up patch.
     72        * style/StyleTreeResolver.cpp:
     73        (WebCore::Style::TreeResolver::resolveElement): Mark the document as having an editable element if
     74        the style for the element being resolved is writable.
     75
    1762020-04-08  Daniel Bates  <dabates@apple.com>
    277
  • trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig

    r258772 r259762  
    146146ENABLE_DRAG_SUPPORT_maccatalyst = ENABLE_DRAG_SUPPORT;
    147147
     148ENABLE_EDITABLE_REGION = $(ENABLE_EDITABLE_REGION_$(WK_PLATFORM_NAME));
     149ENABLE_EDITABLE_REGION_iphoneos = ENABLE_EDITABLE_REGION;
     150ENABLE_EDITABLE_REGION_iphonesimulator = ENABLE_EDITABLE_REGION;
     151
    148152ENABLE_ENCRYPTED_MEDIA = $(ENABLE_ENCRYPTED_MEDIA_$(WK_PLATFORM_NAME));
    149153ENABLE_ENCRYPTED_MEDIA_iphoneos = ENABLE_ENCRYPTED_MEDIA;
     
    418422ENABLE_XSLT = ENABLE_XSLT;
    419423
    420 FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCESSIBILITY_ISOLATED_TREE) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLE_PAY_SESSION_V9) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_CONIC_GRADIENTS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_PAINTING_API) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CSS_TYPED_OM) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_C_LOOP) $(ENABLE_DARK_MODE_CSS) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FULLSCREEN_API) $(ENABLE_PICTURE_IN_PICTURE_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_GPU_PROCESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) $(ENABLE_INSPECTOR_TELEMETRY) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_MEMORY_SAMPLER) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NETWORK_CACHE_SPECULATIVE_REVALIDATION) $(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFSCREEN_CANVAS) $(ENABLE_OVERFLOW_SCROLLING_TOUCH) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESIZE_OBSERVER) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_LOAD_STATISTICS) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SANDBOX_EXTENSIONS) $(ENABLE_SERVER_PRECONNECT) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SHAREABLE_RESOURCE) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USERSELECT_ALL) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS) $(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS) $(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WEBXR) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_CRYPTO) $(ENABLE_WEB_RTC) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT);
     424FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCESSIBILITY_ISOLATED_TREE) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLE_PAY_SESSION_V9) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_CONIC_GRADIENTS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_PAINTING_API) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CSS_TYPED_OM) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_C_LOOP) $(ENABLE_DARK_MODE_CSS) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_EDITABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FULLSCREEN_API) $(ENABLE_PICTURE_IN_PICTURE_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_GPU_PROCESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) $(ENABLE_INSPECTOR_TELEMETRY) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_MEMORY_SAMPLER) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NETWORK_CACHE_SPECULATIVE_REVALIDATION) $(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFSCREEN_CANVAS) $(ENABLE_OVERFLOW_SCROLLING_TOUCH) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESIZE_OBSERVER) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_LOAD_STATISTICS) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SANDBOX_EXTENSIONS) $(ENABLE_SERVER_PRECONNECT) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SHAREABLE_RESOURCE) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USERSELECT_ALL) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS) $(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS) $(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WEBXR) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_CRYPTO) $(ENABLE_WEB_RTC) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT);
  • trunk/Source/WebCore/PAL/ChangeLog

    r259754 r259762  
     12020-04-08  Daniel Bates  <dabates@apple.com>
     2
     3        Track editable elements on screen
     4        https://bugs.webkit.org/show_bug.cgi?id=209888
     5        <rdar://problem/61196886>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add feature define to track editable elements on screen (enabled by default on iOS and iOS Simulator).
     10
     11        * Configurations/FeatureDefines.xcconfig:
     12
    1132020-04-08  Adrian Perez de Castro  <aperez@igalia.com>
    214
  • trunk/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig

    r258772 r259762  
    146146ENABLE_DRAG_SUPPORT_maccatalyst = ENABLE_DRAG_SUPPORT;
    147147
     148ENABLE_EDITABLE_REGION = $(ENABLE_EDITABLE_REGION_$(WK_PLATFORM_NAME));
     149ENABLE_EDITABLE_REGION_iphoneos = ENABLE_EDITABLE_REGION;
     150ENABLE_EDITABLE_REGION_iphonesimulator = ENABLE_EDITABLE_REGION;
     151
    148152ENABLE_ENCRYPTED_MEDIA = $(ENABLE_ENCRYPTED_MEDIA_$(WK_PLATFORM_NAME));
    149153ENABLE_ENCRYPTED_MEDIA_iphoneos = ENABLE_ENCRYPTED_MEDIA;
     
    418422ENABLE_XSLT = ENABLE_XSLT;
    419423
    420 FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCESSIBILITY_ISOLATED_TREE) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLE_PAY_SESSION_V9) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_CONIC_GRADIENTS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_PAINTING_API) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CSS_TYPED_OM) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_C_LOOP) $(ENABLE_DARK_MODE_CSS) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FULLSCREEN_API) $(ENABLE_PICTURE_IN_PICTURE_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_GPU_PROCESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) $(ENABLE_INSPECTOR_TELEMETRY) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_MEMORY_SAMPLER) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NETWORK_CACHE_SPECULATIVE_REVALIDATION) $(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFSCREEN_CANVAS) $(ENABLE_OVERFLOW_SCROLLING_TOUCH) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESIZE_OBSERVER) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_LOAD_STATISTICS) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SANDBOX_EXTENSIONS) $(ENABLE_SERVER_PRECONNECT) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SHAREABLE_RESOURCE) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USERSELECT_ALL) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS) $(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS) $(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WEBXR) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_CRYPTO) $(ENABLE_WEB_RTC) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT);
     424FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCESSIBILITY_ISOLATED_TREE) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLE_PAY_SESSION_V9) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_CONIC_GRADIENTS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_PAINTING_API) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CSS_TYPED_OM) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_C_LOOP) $(ENABLE_DARK_MODE_CSS) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_EDITABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FULLSCREEN_API) $(ENABLE_PICTURE_IN_PICTURE_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_GPU_PROCESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) $(ENABLE_INSPECTOR_TELEMETRY) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_MEMORY_SAMPLER) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NETWORK_CACHE_SPECULATIVE_REVALIDATION) $(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFSCREEN_CANVAS) $(ENABLE_OVERFLOW_SCROLLING_TOUCH) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESIZE_OBSERVER) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_LOAD_STATISTICS) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SANDBOX_EXTENSIONS) $(ENABLE_SERVER_PRECONNECT) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SHAREABLE_RESOURCE) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USERSELECT_ALL) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS) $(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS) $(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WEBXR) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_CRYPTO) $(ENABLE_WEB_RTC) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT);
  • trunk/Source/WebCore/dom/Document.h

    r259761 r259762  
    12521252    void setMayHaveElementsWithNonAutoTouchAction() { m_mayHaveElementsWithNonAutoTouchAction = true; }
    12531253#endif
     1254#if ENABLE(EDITABLE_REGION)
     1255    bool mayHaveEditableElements() const { return m_mayHaveEditableElements; }
     1256    void setMayHaveEditableElements() { m_mayHaveEditableElements = true; }
     1257#endif
    12541258
    12551259    void didAddTouchEventHandler(Node&);
     
    18641868    bool m_mayHaveElementsWithNonAutoTouchAction { false };
    18651869#endif
     1870#if ENABLE(EDITABLE_REGION)
     1871    bool m_mayHaveEditableElements { false };
     1872#endif
    18661873    std::unique_ptr<EventTargetSet> m_wheelEventTargets;
    18671874
  • trunk/Source/WebCore/page/Frame.cpp

    r259761 r259762  
    310310    if (!m_page || !m_doc || !m_doc->renderView())
    311311        return;
     312    bool hasTouchActionElements = false;
     313    bool hasEditableElements = false;
    312314#if PLATFORM(IOS)
    313     if (!m_doc->mayHaveElementsWithNonAutoTouchAction())
    314         return;
     315    hasTouchActionElements = m_doc->mayHaveElementsWithNonAutoTouchAction();
    315316#endif
     317#if ENABLE(EDITABLE_REGION)
     318    hasEditableElements = m_doc->mayHaveEditableElements();
     319#endif
     320    if (!hasTouchActionElements && !hasEditableElements)
     321        return;
    316322    if (!m_doc->renderView()->compositor().viewNeedsToInvalidateEventRegionOfEnclosingCompositingLayerForRepaint())
    317323        return;
  • trunk/Source/WebCore/rendering/EventRegion.cpp

    r258539 r259762  
    101101    if (m_touchActionRegions != other.m_touchActionRegions)
    102102        return false;
     103#if ENABLE(EDITABLE_REGION)
     104    if (m_editableRegion != other.m_editableRegion)
     105        return false;
     106#endif
    103107    return m_region == other.m_region;
    104108}
     
    109113
    110114    uniteTouchActions(region, style.effectiveTouchActions());
     115
     116#if ENABLE(EDITABLE_REGION)
     117    if (style.userModify() != UserModify::ReadOnly)
     118        m_editableRegion.unite(region);
     119#endif
    111120}
    112121
     
    117126    for (auto& touchActionRegion : m_touchActionRegions)
    118127        touchActionRegion.translate(offset);
     128
     129#if ENABLE(EDITABLE_REGION)
     130    m_editableRegion.translate(offset);
     131#endif
    119132}
    120133
     
    206219}
    207220
     221#if ENABLE(EDITABLE_REGION)
     222
     223bool EventRegion::containsEditableElementsInRect(const IntRect& rect) const
     224{
     225    return m_editableRegion.intersects(rect);
     226}
     227
     228#endif
     229
    208230void EventRegion::dump(TextStream& ts) const
    209231{
     
    223245        ts << indent << ")\n";
    224246    }
     247
     248#if ENABLE(EDITABLE_REGION)
     249    if (!m_editableRegion.isEmpty()) {
     250        ts << indent << "(editable region" << m_editableRegion;
     251        ts << indent << ")\n";
     252    }
     253#endif
    225254}
    226255
  • trunk/Source/WebCore/rendering/EventRegion.h

    r258539 r259762  
    7171    bool contains(const IntPoint& point) const { return m_region.contains(point); }
    7272    bool contains(const IntRect& rect) const { return m_region.contains(rect); }
     73    bool intersects(const IntRect& rect) const { return m_region.intersects(rect); }
    7374
    7475    const Region& region() const { return m_region; }
     
    7879
    7980    const Region* regionForTouchAction(TouchAction) const;
     81
     82#if ENABLE(EDITABLE_REGION)
     83    WEBCORE_EXPORT bool containsEditableElementsInRect(const IntRect&) const;
     84    Vector<IntRect, 1> rectsForEditableElements() const { return m_editableRegion.rects(); }
     85#endif
    8086
    8187    template<class Encoder> void encode(Encoder&) const;
     
    9197    Region m_region;
    9298    Vector<Region> m_touchActionRegions;
     99#if ENABLE(EDITABLE_REGION)
     100    Region m_editableRegion;
     101#endif
    93102};
    94103
     
    100109    encoder << m_region;
    101110    encoder << m_touchActionRegions;
     111#if ENABLE(EDITABLE_REGION)
     112    encoder << m_editableRegion;
     113#endif
    102114}
    103115
     
    120132    eventRegion.m_touchActionRegions = WTFMove(*touchActionRegions);
    121133
     134#if ENABLE(EDITABLE_REGION)
     135    Optional<Region> editableRegion;
     136    decoder >> editableRegion;
     137    if (!editableRegion)
     138        return WTF::nullopt;
     139    eventRegion.m_editableRegion = WTFMove(*editableRegion);
     140#endif
     141
    122142    return eventRegion;
    123143}
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r259761 r259762  
    12581258        bool needsTraverseDescendants = hasVisualOverflow() || containsFloats() || !paintInfo.eventRegionContext->contains(enclosingIntRect(borderRect)) || view().needsEventRegionUpdateForNonCompositedFrame();
    12591259#if PLATFORM(IOS_FAMILY)
    1260         needsTraverseDescendants = needsTraverseDescendants || document().mayHaveElementsWithNonAutoTouchAction();
     1260        needsTraverseDescendants |= document().mayHaveElementsWithNonAutoTouchAction();
     1261#endif
     1262#if ENABLE(EDITABLE_REGION)
     1263        needsTraverseDescendants |= document().mayHaveEditableElements();
    12611264#endif
    12621265        if (!needsTraverseDescendants)
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r259761 r259762  
    740740            if (m_style.effectiveTouchActions() != newStyle.effectiveTouchActions())
    741741                return true;
     742#if ENABLE(EDITABLE_REGION)
     743            bool wasEditable = m_style.userModify() != UserModify::ReadOnly;
     744            bool isEditable = newStyle.userModify() != UserModify::ReadOnly;
     745            if (wasEditable != isEditable)
     746                return true;
     747#endif
    742748            return false;
    743749        };
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r259761 r259762  
    70217021        if (renderer().document().mayHaveElementsWithNonAutoTouchAction())
    70227022            return true;
     7023#if ENABLE(EDITABLE_REGION)
     7024        // UI side editable elements resolution.
     7025        if (renderer().document().mayHaveEditableElements())
     7026            return true;
     7027#endif
    70237028        return false;
    70247029    };
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r259761 r259762  
    16211621    bool needsEventRegionUpdateForNonCompositedFrame = renderer().view().needsEventRegionUpdateForNonCompositedFrame();
    16221622    bool hasTouchActionElements = false;
     1623    bool hasEditableElements = false;
    16231624#if PLATFORM(IOS_FAMILY)
    16241625    hasTouchActionElements = renderer().document().mayHaveElementsWithNonAutoTouchAction();
    16251626#endif
    1626     if (!hasTouchActionElements && !needsEventRegionUpdateForNonCompositedFrame) {
     1627#if ENABLE(EDITABLE_REGION)
     1628    hasEditableElements = renderer().document().mayHaveEditableElements();
     1629#endif
     1630    if (!hasTouchActionElements && !hasEditableElements && !needsEventRegionUpdateForNonCompositedFrame) {
    16271631        if (m_owningLayer.isRenderViewLayer())
    16281632            return;
     
    30693073
    30703074    // The interactive part.
     3075    // Paint rects for touch action.
    30713076    auto& eventRegion = graphicsLayer->eventRegion();
    30723077    Color regionColor(0, 0, 255, 50);
     
    30963101            context.fillRect(rect);
    30973102    }
     3103
     3104#if ENABLE(EDITABLE_REGION)
     3105    // Paint rects for editable elements.
     3106    context.setFillColor({ 128, 0, 128, 50 });
     3107    for (auto rect : eventRegion.rectsForEditableElements())
     3108        context.fillRect(rect);
     3109#endif
    30983110}
    30993111
  • trunk/Source/WebCore/style/StyleTreeResolver.cpp

    r258148 r259762  
    250250        m_document.setMayHaveElementsWithNonAutoTouchAction();
    251251#endif
     252#if ENABLE(EDITABLE_REGION)
     253    if (update.style->userModify() != UserModify::ReadOnly)
     254        m_document.setMayHaveEditableElements();
     255#endif
    252256
    253257    return { WTFMove(update), descendantsToResolve, WTFMove(beforeUpdate), WTFMove(afterUpdate) };
  • trunk/Source/WebKit/ChangeLog

    r259761 r259762  
     12020-04-08  Daniel Bates  <dabates@apple.com>
     2
     3        Track editable elements on screen
     4        https://bugs.webkit.org/show_bug.cgi?id=209888
     5        <rdar://problem/61196886>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Speed up -_requestTextInputContextsInRect when the rect does not intersect any editable
     10        elements by over 4450 times on reddit.com! Another way of saying this is that it reduces
     11        the time from an average of 303.252ms to 0.0680625ms in a Production build.
     12
     13        This speed up is accomplished by having the web process track the rects of the editable
     14        elements on the page and send this information as a region data structure over to the UI
     15        process as part of the EventRegion object. This region is used to determine if there
     16        *may* be an editable element inside the rectangele. It never reports a false negative,
     17        but it can report a false positive: a rectangle is over an editable element when it
     18        actually isn't, (e.g. there is a non-composited element with a higher z-order than the
     19        editable element that intersects the search rect).
     20
     21        * Configurations/FeatureDefines.xcconfig: Add feature define to track editable elements on
     22        screen (enabled by default on iOS and iOS Simulator).
     23        * UIProcess/API/Cocoa/WKWebView.mm:
     24        (-[WKWebView _mayContainEditableElementsInRect:]): Added.
     25        (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Checks if the search
     26        rects hits an editable element in a RemoteLayerTree node's editable region. If it does
     27        not hit any then we know there are no editable elements and return immediately. If it
     28        does hit something then we still need to ask the web process to perform a hit test to
     29        find the actual elements, respecting z-ordering (which is lost when these elements' rects
     30        are united to form the editable region).
     31        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
     32        * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
     33        * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
     34        (WebKit::collectDescendantViewsInRect): Added.
     35        (WebKit::mayContainEditableElementsInRect): Added.
     36
    1372020-04-08  Daniel Bates  <dabates@apple.com>
    238
  • trunk/Source/WebKit/Configurations/FeatureDefines.xcconfig

    r258772 r259762  
    146146ENABLE_DRAG_SUPPORT_maccatalyst = ENABLE_DRAG_SUPPORT;
    147147
     148ENABLE_EDITABLE_REGION = $(ENABLE_EDITABLE_REGION_$(WK_PLATFORM_NAME));
     149ENABLE_EDITABLE_REGION_iphoneos = ENABLE_EDITABLE_REGION;
     150ENABLE_EDITABLE_REGION_iphonesimulator = ENABLE_EDITABLE_REGION;
     151
    148152ENABLE_ENCRYPTED_MEDIA = $(ENABLE_ENCRYPTED_MEDIA_$(WK_PLATFORM_NAME));
    149153ENABLE_ENCRYPTED_MEDIA_iphoneos = ENABLE_ENCRYPTED_MEDIA;
     
    418422ENABLE_XSLT = ENABLE_XSLT;
    419423
    420 FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCESSIBILITY_ISOLATED_TREE) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLE_PAY_SESSION_V9) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_CONIC_GRADIENTS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_PAINTING_API) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CSS_TYPED_OM) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_C_LOOP) $(ENABLE_DARK_MODE_CSS) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FULLSCREEN_API) $(ENABLE_PICTURE_IN_PICTURE_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_GPU_PROCESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) $(ENABLE_INSPECTOR_TELEMETRY) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_MEMORY_SAMPLER) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NETWORK_CACHE_SPECULATIVE_REVALIDATION) $(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFSCREEN_CANVAS) $(ENABLE_OVERFLOW_SCROLLING_TOUCH) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESIZE_OBSERVER) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_LOAD_STATISTICS) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SANDBOX_EXTENSIONS) $(ENABLE_SERVER_PRECONNECT) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SHAREABLE_RESOURCE) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USERSELECT_ALL) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS) $(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS) $(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WEBXR) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_CRYPTO) $(ENABLE_WEB_RTC) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT);
     424FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCESSIBILITY_ISOLATED_TREE) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLE_PAY_SESSION_V9) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_CONIC_GRADIENTS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_PAINTING_API) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CSS_TYPED_OM) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_C_LOOP) $(ENABLE_DARK_MODE_CSS) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_EDITABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FULLSCREEN_API) $(ENABLE_PICTURE_IN_PICTURE_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_GPU_PROCESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) $(ENABLE_INSPECTOR_TELEMETRY) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_MEMORY_SAMPLER) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NETWORK_CACHE_SPECULATIVE_REVALIDATION) $(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFSCREEN_CANVAS) $(ENABLE_OVERFLOW_SCROLLING_TOUCH) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESIZE_OBSERVER) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_LOAD_STATISTICS) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SANDBOX_EXTENSIONS) $(ENABLE_SERVER_PRECONNECT) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SHAREABLE_RESOURCE) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USERSELECT_ALL) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS) $(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS) $(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WEBXR) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_CRYPTO) $(ENABLE_WEB_RTC) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT);
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r259523 r259762  
    150150#if PLATFORM(IOS_FAMILY)
    151151#import "RemoteLayerTreeDrawingAreaProxy.h"
     152#import "RemoteLayerTreeViews.h"
    152153#import "RemoteScrollingCoordinatorProxy.h"
    153154#import "UIKitSPI.h"
     
    20922093}
    20932094
     2095- (BOOL)_mayContainEditableElementsInRect:(CGRect)rect
     2096{
     2097#if ENABLE(EDITABLE_REGION)
     2098#if PLATFORM(IOS_FAMILY)
     2099    if (![self usesStandardContentView])
     2100        return NO;
     2101#endif
     2102    CGRect rectInRootViewCoordinates = [self _convertRectToRootViewCoordinates:rect];
     2103    return WebKit::mayContainEditableElementsInRect(_contentView.get(), rectInRootViewCoordinates);
     2104#else
     2105    return NO;
     2106#endif
     2107}
     2108
    20942109- (void)_requestTextInputContextsInRect:(CGRect)rectInWebViewCoordinates completionHandler:(void(^)(NSArray<_WKTextInputContext *> *))completionHandler
    20952110{
     
    21002115    }
    21012116#endif
     2117#if ENABLE(EDITABLE_REGION)
     2118    if (![self _mayContainEditableElementsInRect:rectInWebViewCoordinates]) {
     2119        completionHandler(@[]);
     2120        return;
     2121    }
     2122#endif
    21022123
    21032124    CGRect rectInRootViewCoordinates = [self _convertRectToRootViewCoordinates:rectInWebViewCoordinates];
     2125
    21042126    auto weakSelf = WeakObjCPtr<WKWebView>(self);
    21052127    _page->textInputContextsInRect(rectInRootViewCoordinates, [weakSelf, capturedCompletionHandler = makeBlockPtr(completionHandler)] (const Vector<WebCore::ElementContext>& contexts) {
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h

    r259523 r259762  
    336336- (void)_closeAllMediaPresentations;
    337337
     338- (BOOL)_mayContainEditableElementsInRect:(CGRect)rect;
    338339- (void)_requestTextInputContextsInRect:(CGRect)rect completionHandler:(void(^)(NSArray<_WKTextInputContext *> *))completionHandler WK_API_AVAILABLE(macos(10.15), ios(13.0));
    339340- (void)_focusTextInputContext:(_WKTextInputContext *)textInputElement completionHandler:(void(^)(BOOL))completionHandler WK_API_AVAILABLE(macos(10.15), ios(13.0));
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h

    r258148 r259762  
    8282UIScrollView *findActingScrollParent(UIScrollView *, const RemoteLayerTreeHost&);
    8383
     84#if ENABLE(EDITABLE_REGION)
     85bool mayContainEditableElementsInRect(UIView *rootView, const WebCore::FloatRect&);
     86#endif
     87
    8488}
    8589
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm

    r258772 r259762  
    7777}
    7878
     79#if ENABLE(EDITABLE_REGION)
     80
     81static void collectDescendantViewsInRect(Vector<UIView *, 16>& viewsInRect, UIView *parent, CGRect rect)
     82{
     83    if (parent.clipsToBounds && !CGRectIntersectsRect(parent.bounds, rect))
     84        return;
     85
     86    for (UIView *view in parent.subviews) {
     87        CGRect subviewRect = [view convertRect:rect fromView:parent];
     88
     89        auto intersectsRect = [&] {
     90            // FIXME: isUserInteractionEnabled is mostly redundant with event regions for web content layers.
     91            //        It is currently only needed for scroll views.
     92            if (!view.isUserInteractionEnabled)
     93                return false;
     94
     95            if (CGRectIsEmpty(view.frame))
     96                return false;
     97
     98            if (!CGRectIntersectsRect(subviewRect, view.bounds))
     99                return false;
     100
     101            if (![view isKindOfClass:WKCompositingView.class])
     102                return true;
     103            auto* node = RemoteLayerTreeNode::forCALayer(view.layer);
     104            return node->eventRegion().intersects(WebCore::IntRect { subviewRect });
     105        }();
     106
     107        if (intersectsRect)
     108            viewsInRect.append(view);
     109
     110        if (!view.subviews)
     111            return;
     112
     113        collectDescendantViewsInRect(viewsInRect, view, subviewRect);
     114    };
     115}
     116
     117bool mayContainEditableElementsInRect(UIView *rootView, const WebCore::FloatRect& rect)
     118{
     119    Vector<UIView *, 16> viewsInRect;
     120    collectDescendantViewsInRect(viewsInRect, rootView, rect);
     121    if (viewsInRect.isEmpty())
     122        return false;
     123    for (auto *view : WTF::makeReversedRange(viewsInRect)) {
     124        if (![view isKindOfClass:WKCompositingView.class])
     125            continue;
     126        WebCore::IntRect rectToTest { [view convertRect:rect fromView:rootView] };
     127        if (auto* node = RemoteLayerTreeNode::forCALayer(view.layer); node && node->eventRegion().containsEditableElementsInRect(rectToTest))
     128            return true;
     129    }
     130    return false;
     131}
     132
     133#endif // ENABLE(EDITABLE_REGION)
     134
    79135static bool isScrolledBy(WKChildScrollView* scrollView, UIView *hitView)
    80136{
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r259726 r259762  
     12020-04-08  Daniel Bates  <dabates@apple.com>
     2
     3        Track editable elements on screen
     4        https://bugs.webkit.org/show_bug.cgi?id=209888
     5        <rdar://problem/61196886>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add feature define to track editable elements on screen (enabled by default on iOS and iOS Simulator).
     10
     11        * Configurations/FeatureDefines.xcconfig:
     12
    1132020-04-08  Truitt Savell  <tsavell@apple.com>
    214
  • trunk/Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig

    r258772 r259762  
    146146ENABLE_DRAG_SUPPORT_maccatalyst = ENABLE_DRAG_SUPPORT;
    147147
     148ENABLE_EDITABLE_REGION = $(ENABLE_EDITABLE_REGION_$(WK_PLATFORM_NAME));
     149ENABLE_EDITABLE_REGION_iphoneos = ENABLE_EDITABLE_REGION;
     150ENABLE_EDITABLE_REGION_iphonesimulator = ENABLE_EDITABLE_REGION;
     151
    148152ENABLE_ENCRYPTED_MEDIA = $(ENABLE_ENCRYPTED_MEDIA_$(WK_PLATFORM_NAME));
    149153ENABLE_ENCRYPTED_MEDIA_iphoneos = ENABLE_ENCRYPTED_MEDIA;
     
    418422ENABLE_XSLT = ENABLE_XSLT;
    419423
    420 FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCESSIBILITY_ISOLATED_TREE) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLE_PAY_SESSION_V9) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_CONIC_GRADIENTS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_PAINTING_API) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CSS_TYPED_OM) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_C_LOOP) $(ENABLE_DARK_MODE_CSS) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FULLSCREEN_API) $(ENABLE_PICTURE_IN_PICTURE_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_GPU_PROCESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) $(ENABLE_INSPECTOR_TELEMETRY) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_MEMORY_SAMPLER) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NETWORK_CACHE_SPECULATIVE_REVALIDATION) $(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFSCREEN_CANVAS) $(ENABLE_OVERFLOW_SCROLLING_TOUCH) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESIZE_OBSERVER) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_LOAD_STATISTICS) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SANDBOX_EXTENSIONS) $(ENABLE_SERVER_PRECONNECT) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SHAREABLE_RESOURCE) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USERSELECT_ALL) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS) $(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS) $(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WEBXR) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_CRYPTO) $(ENABLE_WEB_RTC) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT);
     424FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCESSIBILITY_ISOLATED_TREE) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLE_PAY_SESSION_V9) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_CONIC_GRADIENTS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_PAINTING_API) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CSS_TYPED_OM) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_C_LOOP) $(ENABLE_DARK_MODE_CSS) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_EDITABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FULLSCREEN_API) $(ENABLE_PICTURE_IN_PICTURE_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_GPU_PROCESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) $(ENABLE_INSPECTOR_TELEMETRY) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_MEMORY_SAMPLER) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NETWORK_CACHE_SPECULATIVE_REVALIDATION) $(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFSCREEN_CANVAS) $(ENABLE_OVERFLOW_SCROLLING_TOUCH) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESIZE_OBSERVER) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_LOAD_STATISTICS) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SANDBOX_EXTENSIONS) $(ENABLE_SERVER_PRECONNECT) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SHAREABLE_RESOURCE) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USERSELECT_ALL) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS) $(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS) $(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WEBXR) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_CRYPTO) $(ENABLE_WEB_RTC) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT);
  • trunk/Tools/ChangeLog

    r259746 r259762  
     12020-04-08  Daniel Bates  <dabates@apple.com>
     2
     3        Track editable elements on screen
     4        https://bugs.webkit.org/show_bug.cgi?id=209888
     5        <rdar://problem/61196886>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add more unit tests for -_requestTextInputContextsInRect. Also add test infrastructure to
     10        be able to verify that WebKit::mayContainEditableElementsInRect() works.
     11
     12        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
     13        * TestRunnerShared/UIScriptContext/UIScriptController.h:
     14        (WTR::UIScriptController::mayContainEditableElementsInRect):
     15        Expose an internal function to test WebKit::mayContainEditableElementsInRect().
     16
     17        * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: Add feature define.
     18        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     19        * TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm:
     20        (webViewLoadHTMLStringAndWaitForAllFramesToPaint): Renamed; formerly webViewLoadHTMLStringAndWaitForDOMLoadEvent.
     21        Also make it wait for the next presentation update after we paint.
     22        (TEST):
     23        (squareCenteredAtPoint): Added.
     24        (webViewLoadHTMLStringAndWaitForDOMLoadEvent): Deleted; renamed webViewLoadHTMLStringAndWaitForAllFramesToPaint().
     25        * TestWebKitAPI/Tests/WebKitCocoa/editable-region-composited-and-non-composited-overlap.html: Added.
     26        * TestWebKitAPI/ios/editable-region-composited-and-non-composited-overlap.html: Added.
     27        * WebKitTestRunner/ios/UIScriptControllerIOS.h:
     28        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
     29        (WTR::UIScriptControllerIOS::mayContainEditableElementsInRect): Added.
     30
    1312020-04-08  Wenson Hsieh  <wenson_hsieh@apple.com>
    232
  • trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl

    r259669 r259762  
    309309    readonly attribute DOMString scrollingTreeAsText;
    310310
     311    boolean mayContainEditableElementsInRect(unsigned long x, unsigned long y, unsigned long width, unsigned long height);
     312
    311313    object propertiesOfLayerWithID(unsigned long long layerID);
    312314
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h

    r259669 r259762  
    120120    virtual void installTapGestureOnWindow(JSValueRef) { notImplemented(); }
    121121
     122    // Editable region
     123
     124    virtual bool mayContainEditableElementsInRect(unsigned, unsigned, unsigned, unsigned) { notImplemented(); return false; }
     125
    122126    // Compositing
    123127
  • trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig

    r258772 r259762  
    146146ENABLE_DRAG_SUPPORT_maccatalyst = ENABLE_DRAG_SUPPORT;
    147147
     148ENABLE_EDITABLE_REGION = $(ENABLE_EDITABLE_REGION_$(WK_PLATFORM_NAME));
     149ENABLE_EDITABLE_REGION_iphoneos = ENABLE_EDITABLE_REGION;
     150ENABLE_EDITABLE_REGION_iphonesimulator = ENABLE_EDITABLE_REGION;
     151
    148152ENABLE_ENCRYPTED_MEDIA = $(ENABLE_ENCRYPTED_MEDIA_$(WK_PLATFORM_NAME));
    149153ENABLE_ENCRYPTED_MEDIA_iphoneos = ENABLE_ENCRYPTED_MEDIA;
     
    418422ENABLE_XSLT = ENABLE_XSLT;
    419423
    420 FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCESSIBILITY_ISOLATED_TREE) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLE_PAY_SESSION_V9) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_CONIC_GRADIENTS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_PAINTING_API) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CSS_TYPED_OM) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_C_LOOP) $(ENABLE_DARK_MODE_CSS) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FULLSCREEN_API) $(ENABLE_PICTURE_IN_PICTURE_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_GPU_PROCESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) $(ENABLE_INSPECTOR_TELEMETRY) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_MEMORY_SAMPLER) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NETWORK_CACHE_SPECULATIVE_REVALIDATION) $(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFSCREEN_CANVAS) $(ENABLE_OVERFLOW_SCROLLING_TOUCH) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESIZE_OBSERVER) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_LOAD_STATISTICS) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SANDBOX_EXTENSIONS) $(ENABLE_SERVER_PRECONNECT) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SHAREABLE_RESOURCE) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USERSELECT_ALL) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS) $(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS) $(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WEBXR) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_CRYPTO) $(ENABLE_WEB_RTC) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT);
     424FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCESSIBILITY_ISOLATED_TREE) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLE_PAY_SESSION_V9) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_CONIC_GRADIENTS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_PAINTING_API) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CSS_TYPED_OM) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_C_LOOP) $(ENABLE_DARK_MODE_CSS) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_EDITABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FULLSCREEN_API) $(ENABLE_PICTURE_IN_PICTURE_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_GPU_PROCESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) $(ENABLE_INSPECTOR_TELEMETRY) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_MEMORY_SAMPLER) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NETWORK_CACHE_SPECULATIVE_REVALIDATION) $(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFSCREEN_CANVAS) $(ENABLE_OVERFLOW_SCROLLING_TOUCH) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESIZE_OBSERVER) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_LOAD_STATISTICS) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SANDBOX_EXTENSIONS) $(ENABLE_SERVER_PRECONNECT) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SHAREABLE_RESOURCE) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USERSELECT_ALL) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS) $(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS) $(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WEBXR) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_CRYPTO) $(ENABLE_WEB_RTC) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT);
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r259622 r259762  
    10021002                CEBCA13A1E3A807A00C73293 /* page-without-csp.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEBCA1371E3A803400C73293 /* page-without-csp.html */; };
    10031003                CEBCA13B1E3A807A00C73293 /* page-without-csp-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEBCA1361E3A803400C73293 /* page-without-csp-iframe.html */; };
     1004                CEDA12412437C9FB00C28A9E /* editable-region-composited-and-non-composited-overlap.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEDA12402437C9EA00C28A9E /* editable-region-composited-and-non-composited-overlap.html */; };
    10041005                D34E08761E4E42E1005FF14A /* WKWebViewGetContents.mm in Sources */ = {isa = PBXBuildFile; fileRef = D3BE5E341E4CE85E00FD563A /* WKWebViewGetContents.mm */; };
    10051006                DF4B273921A47728009BD1CA /* WKNSDictionaryEmptyDictionaryCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = DF4B273821A47727009BD1CA /* WKNSDictionaryEmptyDictionaryCrash.mm */; };
     
    12991300                                9984FACE1CFFB090008D198C /* editable-body.html in Copy Resources */,
    13001301                                F4D9818F2196B920008230FC /* editable-nested-lists.html in Copy Resources */,
     1302                                CEDA12412437C9FB00C28A9E /* editable-region-composited-and-non-composited-overlap.html in Copy Resources */,
    13011303                                F44D06451F395C26001A0E29 /* editor-state-test-harness.html in Copy Resources */,
    13021304                                51C8E1A91F27F49600BF731B /* EmptyGrandfatheredResourceLoadStatistics.plist in Copy Resources */,
     
    26112613                CEBCA1361E3A803400C73293 /* page-without-csp-iframe.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "page-without-csp-iframe.html"; sourceTree = "<group>"; };
    26122614                CEBCA1371E3A803400C73293 /* page-without-csp.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "page-without-csp.html"; sourceTree = "<group>"; };
     2615                CEDA12402437C9EA00C28A9E /* editable-region-composited-and-non-composited-overlap.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = "editable-region-composited-and-non-composited-overlap.html"; path = "ios/editable-region-composited-and-non-composited-overlap.html"; sourceTree = SOURCE_ROOT; };
    26132616                D3BE5E341E4CE85E00FD563A /* WKWebViewGetContents.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewGetContents.mm; sourceTree = "<group>"; };
    26142617                DC69AA621CF77C6500C6272F /* ScopedLambda.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScopedLambda.cpp; sourceTree = "<group>"; };
     
    36953698                        children = (
    36963699                                0F16BED72304A1D100B4A167 /* composited.html */,
     3700                                CEDA12402437C9EA00C28A9E /* editable-region-composited-and-non-composited-overlap.html */,
    36973701                                CE6D0EE22426B8ED002AD901 /* insert-text.html */,
    36983702                                0F340777230382540060A1A0 /* overflow-scroll.html */,
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm

    r259551 r259762  
    11/*
    2  * Copyright (C) 2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2019-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    152152
    153153// Consider moving this to TestWKWebView if it could be useful to other tests.
    154 static void webViewLoadHTMLStringAndWaitForDOMLoadEvent(TestWKWebView *webView, NSString *htmlString)
     154static void webViewLoadHTMLStringAndWaitForAllFramesToPaint(TestWKWebView *webView, NSString *htmlString)
    155155{
    156156    ASSERT(webView); // Make passing a nil web view a more obvious failure than a hang.
     
    159159    [webView loadHTMLString:htmlString baseURL:nil];
    160160    TestWebKitAPI::Util::run(&didFireDOMLoadEvent);
     161    [webView waitForNextPresentationUpdate];
    161162}
    162163
     
    168169    NSArray<_WKTextInputContext *> *contexts;
    169170
    170     webViewLoadHTMLStringAndWaitForDOMLoadEvent(webView.get(), applyIframe(@"<input type='text' style='width: 50px; height: 50px;'>"));
     171    webViewLoadHTMLStringAndWaitForAllFramesToPaint(webView.get(), applyIframe(@"<input type='text' style='width: 50px; height: 50px;'>"));
    171172    contexts = [webView synchronouslyRequestTextInputContextsInRect:[webView bounds]];
    172173    EXPECT_EQ(1UL, contexts.count);
    173174    EXPECT_EQ(CGRectMake(0, 200, 50, 50), contexts[0].boundingRect);
    174175
    175     webViewLoadHTMLStringAndWaitForDOMLoadEvent(webView.get(), applyIframe(@"<textarea style='width: 100px; height: 100px;'></textarea>"));
     176    webViewLoadHTMLStringAndWaitForAllFramesToPaint(webView.get(), applyIframe(@"<textarea style='width: 100px; height: 100px;'></textarea>"));
    176177    contexts = [webView synchronouslyRequestTextInputContextsInRect:[webView bounds]];
    177178    EXPECT_EQ(1UL, contexts.count);
    178179    EXPECT_EQ(CGRectMake(0, 200, 100, 100), contexts[0].boundingRect);
    179180
    180     webViewLoadHTMLStringAndWaitForDOMLoadEvent(webView.get(), applyIframe(@"<div contenteditable style='width: 100px; height: 100px;'></div>"));
     181    webViewLoadHTMLStringAndWaitForAllFramesToPaint(webView.get(), applyIframe(@"<div contenteditable style='width: 100px; height: 100px;'></div>"));
    181182    contexts = [webView synchronouslyRequestTextInputContextsInRect:[webView bounds]];
    182183    EXPECT_EQ(1UL, contexts.count);
    183184    EXPECT_EQ(CGRectMake(0, 200, 100, 100), contexts[0].boundingRect);
     185}
     186
     187static CGRect squareCenteredAtPoint(float x, float y, float length)
     188{
     189    return CGRectMake(x - length / 2, y - length / 2, length, length);
     190}
     191
     192TEST(RequestTextInputContext, NonCompositedOverlap)
     193{
     194    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
     195    RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
     196
     197    NSArray<_WKTextInputContext *> *contexts;
     198
     199    [webView synchronouslyLoadTestPageNamed:@"editable-region-composited-and-non-composited-overlap"];
     200
     201    // Search rect fully contained in non-composited <div>.
     202    contexts = [webView synchronouslyRequestTextInputContextsInRect:CGRectMake(270, 150, 10, 10)];
     203    EXPECT_EQ(0UL, contexts.count);
     204    contexts = [webView synchronouslyRequestTextInputContextsInRect:CGRectMake(170, 150, 10, 10)];
     205    EXPECT_EQ(0UL, contexts.count);
     206
     207    // Search rect overlaps both the non-composited <div> and the editable element.
     208    contexts = [webView synchronouslyRequestTextInputContextsInRect:squareCenteredAtPoint(270, 150, 200)];
     209    EXPECT_EQ(1UL, contexts.count);
     210}
     211
     212TEST(RequestTextInputContext, CompositedOverlap)
     213{
     214    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
     215    RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
     216
     217    NSArray<_WKTextInputContext *> *contexts;
     218
     219    [webView synchronouslyLoadTestPageNamed:@"editable-region-composited-and-non-composited-overlap"];
     220
     221    // Search rect fully contained in composited <div>.
     222    contexts = [webView synchronouslyRequestTextInputContextsInRect:CGRectMake(270, 400, 10, 10)];
     223    EXPECT_EQ(0UL, contexts.count);
     224    contexts = [webView synchronouslyRequestTextInputContextsInRect:CGRectMake(170, 400, 10, 10)];
     225    EXPECT_EQ(0UL, contexts.count);
     226
     227    // Search rect overlaps both the composited <div> and the editable element.
     228    contexts = [webView synchronouslyRequestTextInputContextsInRect:squareCenteredAtPoint(270, 400, 200)];
     229    EXPECT_EQ(1UL, contexts.count);
    184230}
    185231
  • trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h

    r259669 r259762  
    143143    void installTapGestureOnWindow(JSValueRef) override;
    144144
     145    bool mayContainEditableElementsInRect(unsigned x, unsigned y, unsigned width, unsigned height) override;
     146
    145147    void setDidStartFormControlInteractionCallback(JSValueRef) override;
    146148    void setDidEndFormControlInteractionCallback(JSValueRef) override;
  • trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm

    r259669 r259762  
    837837}
    838838
     839bool UIScriptControllerIOS::mayContainEditableElementsInRect(unsigned x, unsigned y, unsigned width, unsigned height)
     840{
     841    return [webView() _mayContainEditableElementsInRect:CGRectMake(x, y, width, height)];
     842}
     843
    839844static UIDeviceOrientation toUIDeviceOrientation(DeviceOrientation* orientation)
    840845{
Note: See TracChangeset for help on using the changeset viewer.