Changeset 238401 in webkit
- Timestamp:
- Nov 20, 2018 7:52:28 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r238400 r238401 1 2018-11-20 Zalan Butjas <zalan@apple.com> 2 3 [LFC][IFC] Introduce InlineItem::nonBreakableStart/End 4 https://bugs.webkit.org/show_bug.cgi?id=191839 5 6 Reviewed by Antti Koivisto. 7 8 Non-breakable start/end marks margin/padding/border space (even when it does not directly come from the associated layout box) 9 10 <span style="padding: 5px"><span>nested content with padding parent</span</span> 11 <nested content with padding parent> <- inline run has 5px non-breakable start/end. 12 13 <span style="border: 5px solid green"><span style="padding-right: 10px; margin-right: 1px">1</span>2</span><span> 3</span> 14 <1> <- inline run has 5px non-breakable start and 11px non-breakable end. 15 <2> <- inline run has 0px non-breakable start and 5px non-breakable end. 16 <3> <- no non-breakable values. 17 18 This is what the runs look like (input to line breaking) 19 < 1 2 > 20 < > (whitespace) 21 <3> 22 The line breaking treats the paddding/border etc space as part of the run and as non-breaking opportunity. 23 With the given runs the first position where we can break the line is at the whitespace. 24 25 * layout/inlineformatting/InlineFormattingContext.cpp: 26 (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const): 27 * layout/inlineformatting/InlineItem.h: 28 (WebCore::Layout::InlineItem::nonBreakableStart const): 29 (WebCore::Layout::InlineItem::nonBreakableEnd const): 30 (WebCore::Layout::InlineItem::addNonBreakableStart): 31 (WebCore::Layout::InlineItem::addNonBreakableEnd): 32 1 33 2018-11-20 Zalan Bujtas <zalan@apple.com> 2 34 -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp
r238400 r238401 478 478 } 479 479 480 // FIXME: Revisit this when we figured out how inline boxes fit the display tree. 481 auto padding = Geometry::computedPadding(layoutState(), root); 480 482 // Setup breaking boundaries for this subtree. 481 483 auto* lastDescendantInlineBox = inlineFormattingState.lastInlineItem(); … … 486 488 auto rootBreaksAtStart = [&] { 487 489 // FIXME: add padding-inline-start, margin-inline-start etc. 490 if (padding && padding->horizontal.left) 491 return true; 488 492 return root.isPositioned(); 489 493 }; … … 491 495 auto rootBreaksAtEnd = [&] { 492 496 // FIXME: add padding-inline-end, margin-inline-end etc. 497 if (padding && padding->horizontal.right) 498 return true; 493 499 return root.isPositioned(); 494 500 }; … … 506 512 ASSERT(firstDescendantInlineBox); 507 513 firstDescendantInlineBox->addDetachingRule(InlineItem::DetachingRule::BreakAtStart); 508 } 509 510 if (rootBreaksAtEnd()) 514 if (padding && padding->horizontal.left) 515 firstDescendantInlineBox->addNonBreakableStart(padding->horizontal.left); 516 } 517 518 if (rootBreaksAtEnd()) { 511 519 lastDescendantInlineBox->addDetachingRule(InlineItem::DetachingRule::BreakAtEnd); 520 if (padding && padding->horizontal.right) 521 lastDescendantInlineBox->addNonBreakableEnd(padding->horizontal.right); 522 } 512 523 } 513 524 -
trunk/Source/WebCore/layout/inlineformatting/InlineItem.h
r238400 r238401 69 69 OptionSet<DetachingRule> detachingRules() const { return m_detachingRules; } 70 70 71 // Non-breakable start/end marks margin/padding/border space (even when it does not directly come from the associated layout box) 72 // <span style="padding: 5px"><span>nested content with padding parent</span</span> 73 // <nested content with padding parent> inline run has 5px non-breakable start/end. 74 LayoutUnit nonBreakableStart() const { return m_nonBreakableStart; } 75 LayoutUnit nonBreakableEnd() const { return m_nonBreakableEnd; } 76 void addNonBreakableStart(LayoutUnit value) { m_nonBreakableStart += value; } 77 void addNonBreakableEnd(LayoutUnit value) { m_nonBreakableEnd += value; } 78 71 79 private: 72 80 const Box& m_layoutBox; 73 81 OptionSet<DetachingRule> m_detachingRules; 82 LayoutUnit m_nonBreakableStart; 83 LayoutUnit m_nonBreakableEnd; 74 84 }; 75 85
Note: See TracChangeset
for help on using the changeset viewer.