Changeset 245317 in webkit


Ignore:
Timestamp:
May 14, 2019 9:57:56 PM (5 years ago)
Author:
Wenson Hsieh
Message:

Missing cursor/caret showing in search field on google.com
https://bugs.webkit.org/show_bug.cgi?id=197862
<rdar://problem/50291989>

Reviewed by Simon Fraser.

Source/WebCore:

In this bug, the search field is inside of a fixed position container, which is inside of an empty "overflow:
hidden" form element (the new layout test demonstrates a simple version of this). The layer of the fixed
position container's renderer has an overflow clipping layer of itself, and its clipping rect is non-empty, so
the heuristic initially identifies the layer as not fully clipped. However, as the heuristic ascends the
RenderLayer tree, it then finds the layer for the "overflow: hidden" form element's renderer; this layer is
completely clipped, which causes the heuristic to incorrectly believe that the editable element is completely
clipped.

To fix the bug, this patch reworks the clipping portion of the heuristic, such that we no longer need to ascend
the layer tree. Instead of computing the clip rect relative to the nearest ancestor that has an overflow clip
and then walking up the layer tree repeating this process, simply compute the clip rect relative to RenderView's
layer, and then walk up to the parent frame and repeat if necessary.

Test: editing/selection/ios/do-not-hide-selection-in-visible-field.html

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::isTransparentOrFullyClippedRespectingParentFrames const):

LayoutTests:

Add a new layout test that represents a reduced test case version of google.com's search field.

  • editing/selection/ios/do-not-hide-selection-in-visible-field.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r245316 r245317  
     12019-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Missing cursor/caret showing in search field on google.com
     4        https://bugs.webkit.org/show_bug.cgi?id=197862
     5        <rdar://problem/50291989>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add a new layout test that represents a reduced test case version of google.com's search field.
     10
     11        * editing/selection/ios/do-not-hide-selection-in-visible-field.html: Added.
     12
    1132019-05-14  Megan Gardner  <megan_gardner@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r245314 r245317  
     12019-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Missing cursor/caret showing in search field on google.com
     4        https://bugs.webkit.org/show_bug.cgi?id=197862
     5        <rdar://problem/50291989>
     6
     7        Reviewed by Simon Fraser.
     8
     9        In this bug, the search field is inside of a fixed position container, which is inside of an empty "overflow:
     10        hidden" form element (the new layout test demonstrates a simple version of this). The layer of the fixed
     11        position container's renderer has an overflow clipping layer of itself, and its clipping rect is non-empty, so
     12        the heuristic initially identifies the layer as not fully clipped. However, as the heuristic ascends the
     13        RenderLayer tree, it then finds the layer for the "overflow: hidden" form element's renderer; this layer is
     14        completely clipped, which causes the heuristic to incorrectly believe that the editable element is completely
     15        clipped.
     16
     17        To fix the bug, this patch reworks the clipping portion of the heuristic, such that we no longer need to ascend
     18        the layer tree. Instead of computing the clip rect relative to the nearest ancestor that has an overflow clip
     19        and then walking up the layer tree repeating this process, simply compute the clip rect relative to RenderView's
     20        layer, and then walk up to the parent frame and repeat if necessary.
     21
     22        Test: editing/selection/ios/do-not-hide-selection-in-visible-field.html
     23
     24        * rendering/RenderLayer.cpp:
     25        (WebCore::RenderLayer::isTransparentOrFullyClippedRespectingParentFrames const):
     26
    1272019-05-14  Andy Estes  <aestes@apple.com>
    228
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r245293 r245317  
    68026802    }
    68036803
    6804     RenderLayer* enclosingClipLayer = nullptr;
    6805     for (auto* layer = this; layer; layer = enclosingClipLayer ? enclosingClipLayer->parent() : enclosingFrameRenderLayer(*layer)) {
    6806         enclosingClipLayer = layer->enclosingOverflowClipLayer(IncludeSelfOrNot::IncludeSelf);
    6807         if (!enclosingClipLayer)
    6808             continue;
     6804    auto hasEmptyClipRect = [] (const RenderLayer& layer) -> bool {
     6805        auto* frameView = layer.renderer().document().view();
     6806        if (!frameView)
     6807            return false;
     6808
     6809        auto* renderView = frameView->renderView();
     6810        if (!renderView)
     6811            return false;
     6812
     6813        auto* renderViewLayer = renderView->layer();
     6814        if (!renderViewLayer)
     6815            return false;
    68096816
    68106817        LayoutRect layerBounds;
    68116818        ClipRect backgroundRect;
    68126819        ClipRect foregroundRect;
    6813         layer->calculateRects({ enclosingClipLayer, TemporaryClipRects }, LayoutRect::infiniteRect(), layerBounds, backgroundRect, foregroundRect, layer->offsetFromAncestor(enclosingClipLayer));
    6814         if (backgroundRect.isEmpty())
     6820        layer.calculateRects({ renderViewLayer, TemporaryClipRects }, LayoutRect::infiniteRect(), layerBounds, backgroundRect, foregroundRect, layer.offsetFromAncestor(renderViewLayer));
     6821        return backgroundRect.isEmpty();
     6822    };
     6823
     6824    for (auto* layer = this; layer; layer = enclosingFrameRenderLayer(*layer)) {
     6825        if (hasEmptyClipRect(*layer))
    68156826            return true;
    68166827    }
Note: See TracChangeset for help on using the changeset viewer.