Commit 632a8dca authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

[LayoutNG] Fix NG self hit testing condition for blocks

For normal boxes, self hit test is done when HitTestAction is kHitTestForeground.
However, for blocks, it's done only when HitTestAction is kHitTestBlockBackground
or kHitTestChildBlockBackground (see LayoutBlock::IsInSelfHitTestingPhase()).

Our NG hit test implementation doesn't consider the latter case, which is fixed
in this patch.

This patch adds 200+ passes to NG layout test.

Bug: 812470
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_layout_ng;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I03f92444eb431151942eb582305ef63419090a35
Reviewed-on: https://chromium-review.googlesource.com/920687
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537488}
parent 7d872374
......@@ -15,6 +15,10 @@ crbug.com/707656 fast/css/readwrite-contenteditable-recalc.html [ Crash ]
crbug.com/789878 fast/css/readwrite-contenteditable.html [ Failure ]
crbug.com/789878 fast/inline/inline-focus-ring.html [ Failure ]
# NGPhysicalFragment has stale style.
crbug.com/812981 scrollbars/scrollbar-pointer-events.html [ Failure ]
crbug.com/812981 scrollbars/scrollbar-visibility-hidden.html [ Failure ]
# Non-interoperable behavior not worth to fix.
crbug.com/591099 fast/text/apply-start-width-after-skipped-text.html [ Skip ]
......@@ -3179,7 +3183,7 @@ crbug.com/714962 fast/events/pointerevents/mouse-pointer-boundary-events-for-sha
crbug.com/591099 fast/events/pointerevents/mouse-pointer-capture-transition-events.html [ Timeout ]
crbug.com/591099 fast/events/pointerevents/mouse-pointer-capture.html [ Failure ]
crbug.com/591099 fast/events/pointerevents/mouse-pointer-event-properties.html [ Timeout ]
crbug.com/591099 fast/events/pointerevents/mouse-pointer-preventdefault.html [ Failure ]
crbug.com/591099 fast/events/pointerevents/mouse-pointer-preventdefault.html [ Failure Timeout ]
crbug.com/714962 fast/events/pointerevents/mouse-pointer-transition-events.html [ Failure ]
crbug.com/714962 fast/events/pointerevents/mouse-pointer-updown-events.html [ Failure ]
crbug.com/591099 fast/events/pointerevents/multi-pointer-preventdefault.html [ Failure ]
......@@ -3795,7 +3799,6 @@ crbug.com/591099 fast/loader/local-CSS-from-local.html [ Failure ]
crbug.com/591099 fast/loader/local-JavaScript-from-local.html [ Failure ]
crbug.com/591099 fast/loader/local-iFrame-source-from-local.html [ Failure ]
crbug.com/591099 fast/loader/local-image-from-local.html [ Failure ]
crbug.com/591099 fast/loader/navigation-scheduler-user-gesture.html [ Timeout ]
crbug.com/591099 fast/loader/opaque-base-url.html [ Failure ]
crbug.com/591099 fast/loader/text-document-wrapping.html [ Failure ]
crbug.com/591099 fast/masking/clip-path-selection.html [ Failure ]
......@@ -6163,7 +6166,7 @@ crbug.com/591099 storage/indexeddb/mozilla/indexes.html [ Timeout ]
crbug.com/591099 storage/indexeddb/mozilla/test_objectStore_openKeyCursor.html [ Timeout ]
crbug.com/591099 storage/indexeddb/objectstore-cursor.html [ Timeout ]
crbug.com/591099 storage/indexeddb/objectstore-keycursor.html [ Timeout ]
crbug.com/591099 storage/indexeddb/structured-clone.html [ Failure ]
crbug.com/591099 storage/indexeddb/structured-clone.html [ Failure Timeout ]
crbug.com/714962 svg/W3C-SVG-1.1-SE/filters-image-03-f.svg [ Failure ]
crbug.com/714962 svg/W3C-SVG-1.1-SE/filters-image-05-f.svg [ Failure ]
crbug.com/714962 svg/W3C-SVG-1.1-SE/painting-marker-05-f.svg [ Failure ]
......@@ -6882,7 +6885,7 @@ crbug.com/714962 virtual/mouseevent_fractional/fast/events/pointerevents/mouse-n
crbug.com/714962 virtual/mouseevent_fractional/fast/events/pointerevents/mouse-pointer-boundary-events-for-shadowdom.html [ Failure ]
crbug.com/591099 virtual/mouseevent_fractional/fast/events/pointerevents/mouse-pointer-capture-transition-events.html [ Timeout ]
crbug.com/591099 virtual/mouseevent_fractional/fast/events/pointerevents/mouse-pointer-capture.html [ Failure ]
crbug.com/591099 virtual/mouseevent_fractional/fast/events/pointerevents/mouse-pointer-preventdefault.html [ Failure ]
crbug.com/591099 virtual/mouseevent_fractional/fast/events/pointerevents/mouse-pointer-preventdefault.html [ Failure Timeout ]
crbug.com/714962 virtual/mouseevent_fractional/fast/events/pointerevents/mouse-pointer-transition-events.html [ Failure ]
crbug.com/714962 virtual/mouseevent_fractional/fast/events/pointerevents/mouse-pointer-updown-events.html [ Failure ]
crbug.com/591099 virtual/mouseevent_fractional/fast/events/pointerevents/multi-pointer-preventdefault.html [ Failure ]
......
Check that the NavigationScheduler correctly tracks user gestures.
PASS: only one window opened
click me
......@@ -660,6 +660,11 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
void UpdateLayout() override;
void Paint(const PaintInfo&, const LayoutPoint&) const override;
virtual bool IsInSelfHitTestingPhase(HitTestAction hit_test_action) const {
return hit_test_action == kHitTestForeground;
}
bool NodeAtPoint(HitTestResult&,
const HitTestLocation& location_in_container,
const LayoutPoint& accumulated_offset,
......@@ -1583,10 +1588,6 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
void LocationChanged();
void SizeChanged();
virtual bool IsInSelfHitTestingPhase(HitTestAction hit_test_action) const {
return hit_test_action == kHitTestForeground;
}
void UpdateBackgroundAttachmentFixedStatusAfterStyleChange();
void InflateVisualRectForFilter(TransformState&) const;
......
......@@ -736,6 +736,15 @@ void NGBoxFragmentPainter::PaintBackground(
geometry, bleed_avoidance);
}
bool NGBoxFragmentPainter::IsInSelfHitTestingPhase(HitTestAction action) const {
// TODO(layout-dev): We should set an IsContainingBlock flag on
// NGPhysicalBoxFragment, instead of routing back to LayoutObject.
const LayoutObject* layout_object = box_fragment_.GetLayoutObject();
if (layout_object->IsBox())
return ToLayoutBox(layout_object)->IsInSelfHitTestingPhase(action);
return action == kHitTestForeground;
}
bool NGBoxFragmentPainter::NodeAtPoint(
HitTestResult& result,
const HitTestLocation& location_in_container,
......@@ -748,7 +757,7 @@ bool NGBoxFragmentPainter::NodeAtPoint(
LayoutSize size(box_fragment_.Size().width, box_fragment_.Size().height);
const ComputedStyle& style = box_fragment_.Style();
bool hit_test_self = action == kHitTestForeground;
bool hit_test_self = IsInSelfHitTestingPhase(action);
// TODO(layout-dev): Add support for hit testing overflow controls once we
// overflow has been implemented.
......
......@@ -109,6 +109,7 @@ class NGBoxFragmentPainter : public BoxPainterBase {
const Color& background_color,
BackgroundBleedAvoidance = kBackgroundBleedNone);
bool IsInSelfHitTestingPhase(HitTestAction) const;
bool VisibleToHitTestRequest(const HitTestRequest&) const;
bool HitTestChildren(HitTestResult&,
const Vector<std::unique_ptr<NGPaintFragment>>&,
......
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