Commit 3ad9090b authored by yigu's avatar yigu Committed by Commit bot

Fix touch event flag may not be updated correctly by transform which causes no layout

BUG=673102
TEST=third_party/WebKit/LayoutTests/fast/events/touch/compositor-touch-hit-rects-geometry-change-as-touch-notified-by-nolayout.html
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2600593002
Cr-Commit-Position: refs/heads/master@{#443580}
parent 3b491f68
......@@ -589,6 +589,7 @@ Bug(none) fast/events/touch/compositor-touch-hit-rects-non-composited-scroll.htm
Bug(none) fast/events/touch/compositor-touch-hit-rects-scroll.html [ Failure ]
Bug(none) fast/events/touch/compositor-touch-hit-rects-squashing.html [ Failure ]
Bug(none) fast/events/touch/compositor-touch-hit-rects-trigger-commit.html [ Failure ]
Bug(none) fast/events/touch/compositor-touch-hit-rects-transform-changed-nolayout.html [ Failure ]
Bug(none) fast/events/touch/compositor-touch-hit-rects.html [ Failure ]
Bug(none) fast/events/touch/gesture/gesture-scroll-by-page.html [ Failure ]
Bug(none) fast/events/touch/gesture/gesture-scroll-by-pixel.html [ Failure ]
......
This test verifies the touch event target rects are updated correctly when an element transfroms without causing layout.
[object HTMLDivElement]: #document (100, 100, 50, 50)
[object HTMLDivElement]: #document (150, 100, 50, 50)
<!DOCTYPE html>
<style>
#box {
position: absolute;
top: 100px;
left: 100px;
width: 50px;
height: 50px;
background-color: blue;
}
</style>
<p id="description">
This test verifies the touch event target rects are updated correctly when
an element transfroms without causing layout.
</p>
<div id="tests">
<div id="box"></div>
</div>
<div id="console" style="display:none;"></div>
<script src="resources/compositor-touch-hit-rects.js"></script>
<script>
const box = document.getElementById("box");
box.addEventListener("touchstart", () => {}, false);
internals.forceCompositingUpdate(document);
logRects(box, true);
// The box should be able to translate to a new location
box.style.transform = "translate(50px,0px)";
internals.forceCompositingUpdate(document);
logRects(box, true);
document.getElementById("console").style.display = "block";
</script>
......@@ -55,6 +55,7 @@
#include "core/layout/shapes/ShapeOutsideInfo.h"
#include "core/page/AutoscrollController.h"
#include "core/page/Page.h"
#include "core/page/scrolling/ScrollingCoordinator.h"
#include "core/page/scrolling/SnapCoordinator.h"
#include "core/paint/BackgroundImageGeometry.h"
#include "core/paint/BoxPaintInvalidator.h"
......@@ -335,6 +336,11 @@ void LayoutBox::styleDidChange(StyleDifference diff,
}
}
if (diff.transformChanged()) {
if (ScrollingCoordinator* scrollingCoordinator =
document().frame()->page()->scrollingCoordinator())
scrollingCoordinator->notifyTransformChanged(*this);
}
// Non-atomic inlines should be LayoutInline or LayoutText, not LayoutBox.
DCHECK(!isInline() || isAtomicInlineLevel());
}
......
......@@ -128,6 +128,18 @@ void ScrollingCoordinator::notifyGeometryChanged() {
m_shouldScrollOnMainThreadDirty = true;
}
void ScrollingCoordinator::notifyTransformChanged(const LayoutBox& box) {
if (m_page->deprecatedLocalMainFrame()->view()->needsLayout())
return;
for (PaintLayer* layer = box.enclosingLayer(); layer;
layer = layer->parent()) {
if (m_layersWithTouchRects.contains(layer)) {
m_touchEventTargetRectsAreDirty = true;
return;
}
}
}
void ScrollingCoordinator::notifyOverflowUpdated() {
m_scrollGestureRegionIsDirty = true;
}
......
......@@ -41,6 +41,7 @@ using MainThreadScrollingReasons = uint32_t;
class CompositorAnimationHost;
class CompositorAnimationTimeline;
class LayoutBox;
class LocalFrame;
class FrameView;
class GraphicsLayer;
......@@ -74,6 +75,8 @@ class CORE_EXPORT ScrollingCoordinator final
void notifyGeometryChanged();
// Called when any frame recalculates its overflows after style change.
void notifyOverflowUpdated();
// Called when any layoutBox has transform changed
void notifyTransformChanged(const LayoutBox&);
void updateAfterCompositingChangeIfNeeded();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment