Commit e36384f5 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[LayoutNG] Change how LayoutInline determines in NG context

This patch changes LayoutInline to use
|IsInLayoutNGInlineFormattingContext()| to determine whether
it's in LayoutNG inline formatting context or not.

This was revealed in crrev.com/c/1333588, tests will fail
with the CL without this fix.

Bug: 636993
Change-Id: I6ae4fb3bcaf18afceb4ab3486618a031b4a895c9
Reviewed-on: https://chromium-review.googlesource.com/c/1337212Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608287}
parent fac49554
...@@ -724,8 +724,11 @@ void LayoutInline::Paint(const PaintInfo& paint_info) const { ...@@ -724,8 +724,11 @@ void LayoutInline::Paint(const PaintInfo& paint_info) const {
template <typename GeneratorContext> template <typename GeneratorContext>
void LayoutInline::GenerateLineBoxRects(GeneratorContext& yield) const { void LayoutInline::GenerateLineBoxRects(GeneratorContext& yield) const {
if (const NGPhysicalBoxFragment* box_fragment = if (IsInLayoutNGInlineFormattingContext()) {
ContainingBlockFlowFragmentOf(*this)) { const NGPhysicalBoxFragment* box_fragment =
ContainingBlockFlowFragmentOf(*this);
if (!box_fragment)
return;
const auto& descendants = const auto& descendants =
NGInlineFragmentTraversal::SelfFragmentsOf(*box_fragment, this); NGInlineFragmentTraversal::SelfFragmentsOf(*box_fragment, this);
const LayoutBlock* block_for_flipping = nullptr; const LayoutBlock* block_for_flipping = nullptr;
...@@ -929,8 +932,11 @@ LayoutPoint LayoutInline::FirstLineBoxTopLeft() const { ...@@ -929,8 +932,11 @@ LayoutPoint LayoutInline::FirstLineBoxTopLeft() const {
// hand, sets the block-axis coordinate relatively to the block-start border // hand, sets the block-axis coordinate relatively to the block-start border
// edge, which means that offsetLeft will be wrong when writing-mode is // edge, which means that offsetLeft will be wrong when writing-mode is
// vertical-rl. // vertical-rl.
if (const NGPhysicalBoxFragment* box_fragment = if (IsInLayoutNGInlineFormattingContext()) {
ContainingBlockFlowFragmentOf(*this)) { const NGPhysicalBoxFragment* box_fragment =
ContainingBlockFlowFragmentOf(*this);
if (!box_fragment)
return LayoutPoint();
const auto& fragments = const auto& fragments =
NGInlineFragmentTraversal::SelfFragmentsOf(*box_fragment, this); NGInlineFragmentTraversal::SelfFragmentsOf(*box_fragment, this);
if (fragments.IsEmpty()) if (fragments.IsEmpty())
...@@ -1124,8 +1130,11 @@ class LinesBoundingBoxGeneratorContext { ...@@ -1124,8 +1130,11 @@ class LinesBoundingBoxGeneratorContext {
} // unnamed namespace } // unnamed namespace
LayoutRect LayoutInline::LinesBoundingBox() const { LayoutRect LayoutInline::LinesBoundingBox() const {
if (const NGPhysicalBoxFragment* box_fragment = if (IsInLayoutNGInlineFormattingContext()) {
ContainingBlockFlowFragmentOf(*this)) { const NGPhysicalBoxFragment* box_fragment =
ContainingBlockFlowFragmentOf(*this);
if (!box_fragment)
return LayoutRect();
NGPhysicalOffsetRect bounding_box; NGPhysicalOffsetRect bounding_box;
auto children = auto children =
NGInlineFragmentTraversal::SelfFragmentsOf(*box_fragment, this); NGInlineFragmentTraversal::SelfFragmentsOf(*box_fragment, this);
...@@ -1269,8 +1278,11 @@ LayoutRect LayoutInline::CulledInlineVisualOverflowBoundingBox() const { ...@@ -1269,8 +1278,11 @@ LayoutRect LayoutInline::CulledInlineVisualOverflowBoundingBox() const {
} }
LayoutRect LayoutInline::LinesVisualOverflowBoundingBox() const { LayoutRect LayoutInline::LinesVisualOverflowBoundingBox() const {
if (const NGPhysicalBoxFragment* box_fragment = if (IsInLayoutNGInlineFormattingContext()) {
ContainingBlockFlowFragmentOf(*this)) { const NGPhysicalBoxFragment* box_fragment =
ContainingBlockFlowFragmentOf(*this);
if (!box_fragment)
return LayoutRect();
NGPhysicalOffsetRect result; NGPhysicalOffsetRect result;
auto children = auto children =
NGInlineFragmentTraversal::SelfFragmentsOf(*box_fragment, this); NGInlineFragmentTraversal::SelfFragmentsOf(*box_fragment, this);
......
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