Commit 5cb68722 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

[LayoutNG] Implement hit testing on list marker

When hit testing a list marker, we should hit the corresponding list
item element. This patch implements the same behavior in LayoutNG.

Bug: 855279
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng;luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I4d191098a444cf276b917451ae1f9ab4a0df2d88
Reviewed-on: https://chromium-review.googlesource.com/1111270Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Reviewed-by: default avatarcathie chen <cathiechen@tencent.com>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569735}
parent 86181d1a
...@@ -451,7 +451,6 @@ crbug.com/591099 fast/dynamic/text-combine.html [ Failure ] ...@@ -451,7 +451,6 @@ crbug.com/591099 fast/dynamic/text-combine.html [ Failure ]
crbug.com/591099 fast/encoding/utf-16-big-endian.html [ Failure ] crbug.com/591099 fast/encoding/utf-16-big-endian.html [ Failure ]
crbug.com/591099 fast/encoding/utf-16-little-endian.html [ Failure ] crbug.com/591099 fast/encoding/utf-16-little-endian.html [ Failure ]
crbug.com/591099 fast/events/mouse-relative-position.html [ Failure ] crbug.com/591099 fast/events/mouse-relative-position.html [ Failure ]
crbug.com/591099 fast/events/onclick-list-marker.html [ Failure ]
crbug.com/591099 fast/events/select-element.html [ Failure ] crbug.com/591099 fast/events/select-element.html [ Failure ]
crbug.com/591099 fast/events/sequential-focus-navigation-starting-point.html [ Failure ] crbug.com/591099 fast/events/sequential-focus-navigation-starting-point.html [ Failure ]
crbug.com/591099 fast/events/touch/compositor-touch-hit-rects.html [ Failure ] crbug.com/591099 fast/events/touch/compositor-touch-hit-rects.html [ Failure ]
...@@ -874,7 +873,6 @@ crbug.com/591099 virtual/layout_ng/ [ Skip ] ...@@ -874,7 +873,6 @@ crbug.com/591099 virtual/layout_ng/ [ Skip ]
crbug.com/824918 virtual/layout_ng_experimental/ [ Skip ] crbug.com/824918 virtual/layout_ng_experimental/ [ Skip ]
crbug.com/591099 virtual/mojo-blob-urls/external/wpt/FileAPI/url/sandboxed-iframe.html [ Pass ] crbug.com/591099 virtual/mojo-blob-urls/external/wpt/FileAPI/url/sandboxed-iframe.html [ Pass ]
crbug.com/591099 virtual/mouseevent_fractional/fast/events/mouse-relative-position.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/mouse-relative-position.html [ Failure ]
crbug.com/591099 virtual/mouseevent_fractional/fast/events/onclick-list-marker.html [ Failure ]
crbug.com/591099 virtual/mouseevent_fractional/fast/events/select-element.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/select-element.html [ Failure ]
crbug.com/591099 virtual/mouseevent_fractional/fast/events/sequential-focus-navigation-starting-point.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/sequential-focus-navigation-starting-point.html [ Failure ]
crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects.html [ Failure ]
...@@ -897,7 +895,6 @@ crbug.com/591099 virtual/user-activation-v2/fast/dom/Window/window-lookup-preced ...@@ -897,7 +895,6 @@ crbug.com/591099 virtual/user-activation-v2/fast/dom/Window/window-lookup-preced
crbug.com/591099 virtual/user-activation-v2/fast/events/event-on-culled_inline.html [ Failure Pass ] crbug.com/591099 virtual/user-activation-v2/fast/events/event-on-culled_inline.html [ Failure Pass ]
crbug.com/591099 virtual/user-activation-v2/fast/events/mouse-cursor.html [ Failure ] crbug.com/591099 virtual/user-activation-v2/fast/events/mouse-cursor.html [ Failure ]
crbug.com/591099 virtual/user-activation-v2/fast/events/mouse-relative-position.html [ Failure ] crbug.com/591099 virtual/user-activation-v2/fast/events/mouse-relative-position.html [ Failure ]
crbug.com/591099 virtual/user-activation-v2/fast/events/onclick-list-marker.html [ Failure ]
crbug.com/591099 virtual/user-activation-v2/fast/events/select-element.html [ Failure ] crbug.com/591099 virtual/user-activation-v2/fast/events/select-element.html [ Failure ]
crbug.com/591099 virtual/user-activation-v2/fast/events/sequential-focus-navigation-starting-point.html [ Failure ] crbug.com/591099 virtual/user-activation-v2/fast/events/sequential-focus-navigation-starting-point.html [ Failure ]
crbug.com/591099 virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects.html [ Failure ] crbug.com/591099 virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects.html [ Failure ]
......
...@@ -40,10 +40,10 @@ class CORE_EXPORT LayoutNGListMarker final ...@@ -40,10 +40,10 @@ class CORE_EXPORT LayoutNGListMarker final
const char* GetName() const override { return "LayoutNGListMarker"; } const char* GetName() const override { return "LayoutNGListMarker"; }
LayoutNGListItem* ListItem() const;
private: private:
bool IsOfType(LayoutObjectType) const override; bool IsOfType(LayoutObjectType) const override;
LayoutNGListItem* ListItem() const;
}; };
DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutNGListMarker, IsLayoutNGListMarker()); DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutNGListMarker, IsLayoutNGListMarker());
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include "third_party/blink/renderer/core/layout/ng/inline/ng_physical_line_box_fragment.h" #include "third_party/blink/renderer/core/layout/ng/inline/ng_physical_line_box_fragment.h"
#include "third_party/blink/renderer/core/layout/ng/inline/ng_physical_text_fragment.h" #include "third_party/blink/renderer/core/layout/ng/inline/ng_physical_text_fragment.h"
#include "third_party/blink/renderer/core/layout/ng/layout_ng_block_flow.h" #include "third_party/blink/renderer/core/layout/ng/layout_ng_block_flow.h"
#include "third_party/blink/renderer/core/layout/ng/list/layout_ng_list_item.h"
#include "third_party/blink/renderer/core/layout/ng/list/layout_ng_list_marker.h"
#include "third_party/blink/renderer/core/layout/ng/ng_fragment.h" #include "third_party/blink/renderer/core/layout/ng/ng_fragment.h"
#include "third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h" #include "third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h"
#include "third_party/blink/renderer/core/layout/ng/ng_physical_container_fragment.h" #include "third_party/blink/renderer/core/layout/ng/ng_physical_container_fragment.h"
...@@ -617,15 +619,25 @@ Node* NGPaintFragment::NodeForHitTest() const { ...@@ -617,15 +619,25 @@ Node* NGPaintFragment::NodeForHitTest() const {
if (PhysicalFragment().IsLineBox()) if (PhysicalFragment().IsLineBox())
return Parent()->NodeForHitTest(); return Parent()->NodeForHitTest();
// When the fragment is inside a ::first-letter, ::before or ::after pseudo // When the fragment is a list marker, return the list item.
// node, return the pseudo node. if (GetLayoutObject() && GetLayoutObject()->IsLayoutNGListMarker())
return ToLayoutNGListMarker(GetLayoutObject())->ListItem()->GetNode();
for (const NGPaintFragment* runner = Parent(); runner; for (const NGPaintFragment* runner = Parent(); runner;
runner = runner->Parent()) { runner = runner->Parent()) {
// When the fragment is inside a ::first-letter, ::before or ::after pseudo
// node, return the pseudo node.
if (Node* node = runner->GetNode()) { if (Node* node = runner->GetNode()) {
if (CanBeHitTestTargetPseudoNode(*node)) if (CanBeHitTestTargetPseudoNode(*node))
return node; return node;
return nullptr; return nullptr;
} }
// When the fragment is inside a list marker, return the list item.
if (runner->GetLayoutObject() &&
runner->GetLayoutObject()->IsLayoutNGListMarker()) {
return runner->NodeForHitTest();
}
} }
return nullptr; return nullptr;
......
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