Commit c9b557f2 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

[LayoutNG] Handle inline continuations in PositionForPoint()

When calling PositionForPoint() on an inline element with continuation,
we need to find the correct block flow to enter. Legacy has such
handling, but NG currently doesn't.

As NG currently doesn't build its own tree, which means continuation
info is only available in legacy layout tree, this patch makes NG
PositionForPoint() reuse the legacy handling code to find the correct
block flow.

Bug: 811502
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: I7155d09cc4f820580b2f72d316fabc345dd4d848
Reviewed-on: https://chromium-review.googlesource.com/1087826
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565111}
parent 17f876a0
...@@ -147,7 +147,6 @@ crbug.com/591099 editing/selection/4960137.html [ Failure ] ...@@ -147,7 +147,6 @@ crbug.com/591099 editing/selection/4960137.html [ Failure ]
crbug.com/591099 editing/selection/5232159.html [ Failure ] crbug.com/591099 editing/selection/5232159.html [ Failure ]
crbug.com/591099 editing/selection/5354455-2.html [ Failure ] crbug.com/591099 editing/selection/5354455-2.html [ Failure ]
crbug.com/591099 editing/selection/continuations-with-move-caret-to-boundary.html [ Failure ] crbug.com/591099 editing/selection/continuations-with-move-caret-to-boundary.html [ Failure ]
crbug.com/591099 editing/selection/continuations-without-move-caret-to-boundary.html [ Failure ]
crbug.com/591099 editing/selection/extend-inside-transforms-backward.html [ Failure ] crbug.com/591099 editing/selection/extend-inside-transforms-backward.html [ Failure ]
crbug.com/591099 editing/selection/extend-inside-transforms-forward.html [ Failure ] crbug.com/591099 editing/selection/extend-inside-transforms-forward.html [ Failure ]
crbug.com/591099 editing/selection/paint-hyphen.html [ Failure ] crbug.com/591099 editing/selection/paint-hyphen.html [ Failure ]
......
...@@ -975,15 +975,12 @@ bool LayoutInline::HitTestCulledInline( ...@@ -975,15 +975,12 @@ bool LayoutInline::HitTestCulledInline(
PositionWithAffinity LayoutInline::PositionForPoint( PositionWithAffinity LayoutInline::PositionForPoint(
const LayoutPoint& point) const { const LayoutPoint& point) const {
if (const LayoutBlockFlow* ng_block_flow = EnclosingNGBlockFlow())
return ng_block_flow->PositionForPoint(point);
DCHECK(CanUseInlineBox(*this));
// FIXME: Does not deal with relative positioned inlines (should it?) // FIXME: Does not deal with relative positioned inlines (should it?)
// If there are continuations, test them first because our containing block // If there are continuations, test them first because our containing block
// will not check them. // will not check them.
// TODO(layout-dev): Handle continuation with NG structures when NG has its
// own tree building.
LayoutBoxModelObject* continuation = Continuation(); LayoutBoxModelObject* continuation = Continuation();
while (continuation) { while (continuation) {
if (continuation->IsInline() || continuation->SlowFirstChild()) if (continuation->IsInline() || continuation->SlowFirstChild())
...@@ -991,6 +988,11 @@ PositionWithAffinity LayoutInline::PositionForPoint( ...@@ -991,6 +988,11 @@ PositionWithAffinity LayoutInline::PositionForPoint(
continuation = ToLayoutBlockFlow(continuation)->InlineElementContinuation(); continuation = ToLayoutBlockFlow(continuation)->InlineElementContinuation();
} }
if (const LayoutBlockFlow* ng_block_flow = EnclosingNGBlockFlow())
return ng_block_flow->PositionForPoint(point);
DCHECK(CanUseInlineBox(*this));
if (FirstLineBoxIncludingCulling()) { if (FirstLineBoxIncludingCulling()) {
// This inline actually has a line box. We must have clicked in the // This inline actually has a line box. We must have clicked in the
// border/padding of one of these boxes. We // border/padding of one of these boxes. We
......
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