Commit 67598c39 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

Stop calling LayoutObjectFromPosition in RenderedPosition

LayoutObjectFromPosition() is a hacky utility function to set
|RenderedPosition::layout_object_| when |inline_box_| is nullptr.

With previous refactoring, there is no usage of |layout_object_| when
|inline_box_| is nullptr, so we no longer need to set a non-null
|layout_object_| for null |inline_box_|.

Hence, this patch removes the call sites in RenderedPosition.

Note: the function cannot be removed because it is still indirectly
called by AX via LayoutObjectContainsPosition(). A follow-up patch
will move it to AX.

Bug: 822575
Change-Id: I720193c9926212153c56552115b5be9619ea20bc
Reviewed-on: https://chromium-review.googlesource.com/1025034Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552996}
parent 2d463f55
...@@ -92,11 +92,10 @@ RenderedPosition::RenderedPosition(const Position& position, ...@@ -92,11 +92,10 @@ RenderedPosition::RenderedPosition(const Position& position,
ComputeInlineBoxPosition(PositionWithAffinity(position, affinity)); ComputeInlineBoxPosition(PositionWithAffinity(position, affinity));
inline_box_ = box_position.inline_box; inline_box_ = box_position.inline_box;
offset_ = box_position.offset_in_box; offset_ = box_position.offset_in_box;
if (inline_box_) if (inline_box_) {
layout_object_ = layout_object_ =
LineLayoutAPIShim::LayoutObjectFrom(inline_box_->GetLineLayoutItem()); LineLayoutAPIShim::LayoutObjectFrom(inline_box_->GetLineLayoutItem());
else }
layout_object_ = LayoutObjectFromPosition(position);
} }
RenderedPosition::RenderedPosition(const PositionInFlatTree& position, RenderedPosition::RenderedPosition(const PositionInFlatTree& position,
...@@ -108,11 +107,10 @@ RenderedPosition::RenderedPosition(const PositionInFlatTree& position, ...@@ -108,11 +107,10 @@ RenderedPosition::RenderedPosition(const PositionInFlatTree& position,
PositionInFlatTreeWithAffinity(position, affinity)); PositionInFlatTreeWithAffinity(position, affinity));
inline_box_ = box_position.inline_box; inline_box_ = box_position.inline_box;
offset_ = box_position.offset_in_box; offset_ = box_position.offset_in_box;
if (inline_box_) if (inline_box_) {
layout_object_ = layout_object_ =
LineLayoutAPIShim::LayoutObjectFrom(inline_box_->GetLineLayoutItem()); LineLayoutAPIShim::LayoutObjectFrom(inline_box_->GetLineLayoutItem());
else }
layout_object_ = LayoutObjectFromPosition(position);
} }
const InlineBox* RenderedPosition::PrevLeafChild() const { const InlineBox* RenderedPosition::PrevLeafChild() const {
......
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