Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Unified Diff: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc

Issue 2847823002: Make leading OOF objects to be handled by block layout in LayoutNG (Closed)
Patch Set: fix NGBlockNodeForTest Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
index d99a083a6a3f9d68818c176646be1dbe5b9c46a6..9f18afb05aa2ce6601febc4d27578ade89012369 100644
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
@@ -66,13 +66,26 @@ NGInlineLayoutAlgorithm::NGInlineLayoutAlgorithm(
is_bidi_reordered_(false)
#endif
{
+ container_builder_.MutableUnpositionedFloats() = space->UnpositionedFloats();
+
+ // TODO(crbug.com/716930): We may be an empty LayoutInline due to splitting.
+ // Only resolve our BFC offset if we know that we are non-empty as we may
+ // need to pass through our margin strut.
+ if (!inline_node->Items().IsEmpty()) {
+ NGLogicalOffset bfc_offset = ConstraintSpace().BfcOffset();
+ bfc_offset.block_offset += ConstraintSpace().MarginStrut().Sum();
+ MaybeUpdateFragmentBfcOffset(ConstraintSpace(), bfc_offset,
+ &container_builder_);
+ PositionPendingFloats(bfc_offset.block_offset, &container_builder_,
+ MutableConstraintSpace());
+ }
+
if (!is_horizontal_writing_mode_)
baseline_type_ = FontBaseline::kIdeographicBaseline;
if (break_token)
Initialize(break_token->ItemIndex(), break_token->TextOffset());
else
Initialize(0, 0);
- container_builder_.MutableUnpositionedFloats() = space->UnpositionedFloats();
}
bool NGInlineLayoutAlgorithm::IsFirstLine() const {
@@ -243,18 +256,6 @@ bool NGInlineLayoutAlgorithm::CreateLine() {
bool NGInlineLayoutAlgorithm::CreateLineUpToLastBreakOpportunity() {
const Vector<NGInlineItem>& items = Node()->Items();
- // TODO(crbug.com/716930): We may be an empty LayoutInline due to splitting.
- // Only resolve our BFC offset if we know that we are non-empty as we may
- // need to pass through our margin strut.
- if (!items.IsEmpty()) {
- NGLogicalOffset bfc_offset = ConstraintSpace().BfcOffset();
- bfc_offset.block_offset += ConstraintSpace().MarginStrut().Sum();
- MaybeUpdateFragmentBfcOffset(ConstraintSpace(), bfc_offset,
- &container_builder_);
- PositionPendingFloats(bfc_offset.block_offset, &container_builder_,
- MutableConstraintSpace());
- }
-
// Create a list of LineItemChunk from |start| and |last_break_opportunity|.
// TODO(kojii): Consider refactoring LineItemChunk once NGLineBuilder's public
// API is more finalized. It does not fit well with the current API.
@@ -551,6 +552,8 @@ LayoutUnit NGInlineLayoutAlgorithm::PlaceAtomicInline(
void NGInlineLayoutAlgorithm::FindNextLayoutOpportunity() {
NGLogicalOffset iter_offset = ConstraintSpace().BfcOffset();
+ if (container_builder_.BfcOffset())
+ iter_offset = ContainerBfcOffset();
iter_offset.block_offset += content_size_;
auto* iter = MutableConstraintSpace()->LayoutOpportunityIterator(iter_offset);
NGLayoutOpportunity opportunity = iter->Next();

Powered by Google App Engine
This is Rietveld 408576698