Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(768)

Unified Diff: Source/core/testing/Internals.cpp

Issue 1158033007: Fix flaky fast/events/touch/compositor-touch-hit-rects-scroll.html (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/testing/Internals.cpp
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index 7fbc89d67dfcf5d943216bb5d87024fda3c2792d..8bad94e59d9b9af32137dfe8bcbd49ef4a7d8ac9 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -1163,12 +1163,35 @@ static DeprecatedPaintLayer* findLayerForGraphicsLayer(DeprecatedPaintLayer* sea
{
*layerOffset = IntSize();
if (searchRoot->hasCompositedDeprecatedPaintLayerMapping() && graphicsLayer == searchRoot->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()) {
+ // If the |graphicsLayer| sets the scrollingContent layer as its
+ // scroll parent, consider it belongs to the scrolling layer and
+ // mark the layer type as "scrolling".
+ if (!searchRoot->layoutObject()->hasTransformRelatedProperty() && searchRoot->scrollParent() && searchRoot->parent() == searchRoot->scrollParent()) {
+ *layerType = "scrolling";
+ // For hit-test rect visualization to work, the hit-test rect should
+ // be relative to the scrolling layer and in this case the hit-test
+ // rect is relative to the element's own GraphicsLayer. So we will have
+ // to adjust the rect to be relative to the scrolling layer here.
+ // Only when the element's offsetParent == scroller's offsetParent we
+ // can compute the element's relative position to the scrolling content
+ // in this way.
+ if (searchRoot->layoutObject()->offsetParent() == searchRoot->parent()->layoutObject()->offsetParent()) {
+ LayoutBoxModelObject* current = searchRoot->layoutObject();
+ LayoutBoxModelObject* parent = searchRoot->parent()->layoutObject();
+ layerOffset->setWidth((parent->offsetLeft() - current->offsetLeft()).toInt());
+ layerOffset->setHeight((parent->offsetTop() - current->offsetTop()).toInt());
+ return searchRoot->parent();
+ }
+ }
+
LayoutRect rect;
DeprecatedPaintLayer::mapRectToPaintBackingCoordinates(searchRoot->layoutObject(), rect);
*layerOffset = IntSize(rect.x(), rect.y());
return searchRoot;
}
+ // If the |graphicsLayer| is a scroller's scrollingContent layer,
+ // consider this is a scrolling layer.
GraphicsLayer* layerForScrolling = searchRoot->scrollableArea() ? searchRoot->scrollableArea()->layerForScrolling() : 0;
if (graphicsLayer == layerForScrolling) {
*layerType = "scrolling";
« no previous file with comments | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698