Changeset 238400 in webkit
- Timestamp:
- Nov 20, 2018 7:51:00 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r238399 r238400 1 2018-11-20 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Move detaching rules from InlineFormattingState to InlineItem 4 https://bugs.webkit.org/show_bug.cgi?id=191838 5 6 Reviewed by Antti Koivisto. 7 8 This is in preparation for adding more context to InlineItem. In addition to 9 detaching rules it will also hold non-breakable start/end information. 10 11 * layout/inlineformatting/InlineFormattingContext.cpp: 12 (WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const): 13 (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const): 14 * layout/inlineformatting/InlineFormattingState.cpp: 15 (WebCore::Layout::InlineFormattingState::addDetachingRule): Deleted. 16 (WebCore::Layout::InlineFormattingState::detachingRules const): Deleted. 17 * layout/inlineformatting/InlineFormattingState.h: 18 (WebCore::Layout::InlineFormattingState::setDetachingRules): Deleted. 19 * layout/inlineformatting/InlineItem.h: 20 (WebCore::Layout::InlineItem::addDetachingRule): 21 (WebCore::Layout::InlineItem::detachingRules const): 22 1 23 2018-11-20 Zalan Bujjtas <zalan@apple.com> 2 24 -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp
r238399 r238400 173 173 // 3. Break at the end of the inline element -> commit what we've got so far including the current element. 174 174 // 4. Break before/after -> requires dedicated run -> commit what we've got so far and also commit the current inline element as a separate inline run. 175 auto detachingRules = inline FormattingState().detachingRules(inlineItem.layoutBox());175 auto detachingRules = inlineItem.detachingRules(); 176 176 177 177 // #1 … … 195 195 196 196 // #2 197 if (detachingRules == Inline FormattingState::DetachingRule::BreakAtStart) {197 if (detachingRules == InlineItem::DetachingRule::BreakAtStart) { 198 198 commit(); 199 199 firstUncommittedInlineItem = &inlineItem; … … 203 203 204 204 // #3 205 if (detachingRules == Inline FormattingState::DetachingRule::BreakAtEnd) {205 if (detachingRules == InlineItem::DetachingRule::BreakAtEnd) { 206 206 ASSERT(firstUncommittedInlineItem); 207 207 uncommittedLength += currentLength(); … … 461 461 if (root.establishesFormattingContext() && &root != &(this->root())) { 462 462 createAndAppendInlineItem(); 463 inlineFormattingState.inlineContent().last()->addDetachingRule({ InlineItem::DetachingRule::BreakAtStart, InlineItem::DetachingRule::BreakAtEnd }); 463 464 // Skip formatting root subtree. They are not part of this inline formatting context. 464 inlineFormattingState.setDetachingRules(root, { InlineFormattingState::DetachingRule::BreakAtStart, InlineFormattingState::DetachingRule::BreakAtEnd });465 465 return; 466 466 } … … 505 505 506 506 ASSERT(firstDescendantInlineBox); 507 inlineFormattingState.addDetachingRule(firstDescendantInlineBox->layoutBox(), InlineFormattingState::DetachingRule::BreakAtStart);507 firstDescendantInlineBox->addDetachingRule(InlineItem::DetachingRule::BreakAtStart); 508 508 } 509 509 510 510 if (rootBreaksAtEnd()) 511 inlineFormattingState.addDetachingRule(lastDescendantInlineBox->layoutBox(), InlineFormattingState::DetachingRule::BreakAtEnd);511 lastDescendantInlineBox->addDetachingRule(InlineItem::DetachingRule::BreakAtEnd); 512 512 } 513 513 -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.cpp
r238349 r238400 51 51 } 52 52 53 void InlineFormattingState::addDetachingRule(const Box& layoutBox, DetachingRule detachingRule)54 {55 m_detachingRules.add(&layoutBox, DetachingRule { }).iterator->value.add(detachingRule);56 }57 58 OptionSet<InlineFormattingState::DetachingRule> InlineFormattingState::detachingRules(const Box& layoutBox) const59 {60 auto detachingRules = m_detachingRules.get(&layoutBox);61 if (!detachingRules)62 return { };63 64 return detachingRules;65 }66 67 53 } 68 54 } -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h
r238349 r238400 49 49 InlineItem* lastInlineItem() const { return m_inlineContent.isEmpty() ? nullptr : m_inlineContent.last().get(); } 50 50 51 // DetachingRule indicates whether the inline element needs to be wrapped in a dediceted run or break from previous/next runs.52 // <span>start</span><span style="position: relative;"> middle </span><span>end</span>53 // input to line breaking -> <start middle end>54 // output of line breaking (considering infinite constraint) -> <start middle end>55 // due to the in-flow positioning, the final runs are: <start>< middle ><end>56 // "start" -> n/a57 // " middle " -> BreakAtStart and BreakAtEnd58 // "end" -> n/a59 //60 // <span>parent </span><span style="padding: 10px;">start<span> middle </span>end</span><span> parent</span>61 // input to line breaking -> <parent start middle end parent>62 // output of line breaking (considering infinite constraint) -> <parent start middle end parent>63 // due to padding, final runs -> <parent><start middle end><parent>64 // "parent" -> n/a65 // "start" -> BreakAtStart66 // " middle " -> n/a67 // "end" -> BreakAtEnd68 // "parent" -> n/a69 enum class DetachingRule {70 BreakAtStart = 1 << 0,71 BreakAtEnd = 1 << 172 };73 void addDetachingRule(const Box& layoutBox, DetachingRule);74 75 OptionSet<DetachingRule> detachingRules(const Box& layoutBox) const;76 void setDetachingRules(const Box& layoutBox, OptionSet<DetachingRule> detachingRules) { m_detachingRules.set(&layoutBox, detachingRules); }77 78 51 // Temp 79 52 InlineRuns& inlineRuns() { return m_inlineRuns; } … … 81 54 82 55 private: 83 using DetachingRulesForInlineItems = HashMap<const Box*, OptionSet<DetachingRule>>;84 85 56 InlineContent m_inlineContent; 86 57 InlineRuns m_inlineRuns; 87 DetachingRulesForInlineItems m_detachingRules;88 58 }; 89 59 -
trunk/Source/WebCore/layout/inlineformatting/InlineItem.h
r237286 r238400 44 44 const RenderStyle& style() const { return m_layoutBox.style(); } 45 45 String textContent() const; 46 // DetachingRule indicates whether the inline element needs to be wrapped in a dediceted run or break from previous/next runs. 47 // <span>start</span><span style="position: relative;"> middle </span><span>end</span> 48 // input to line breaking -> <start middle end> 49 // output of line breaking (considering infinite constraint) -> <start middle end> 50 // due to the in-flow positioning, the final runs are: <start>< middle ><end> 51 // "start" -> n/a 52 // " middle " -> BreakAtStart and BreakAtEnd 53 // "end" -> n/a 54 // 55 // <span>parent </span><span style="padding: 10px;">start<span> middle </span>end</span><span> parent</span> 56 // input to line breaking -> <parent start middle end parent> 57 // output of line breaking (considering infinite constraint) -> <parent start middle end parent> 58 // due to padding, final runs -> <parent><start middle end><parent> 59 // "parent" -> n/a 60 // "start" -> BreakAtStart 61 // " middle " -> n/a 62 // "end" -> BreakAtEnd 63 // "parent" -> n/a 64 enum class DetachingRule { 65 BreakAtStart = 1 << 0, 66 BreakAtEnd = 1 << 1 67 }; 68 void addDetachingRule(OptionSet<DetachingRule> detachingRule) { m_detachingRules.add(detachingRule); } 69 OptionSet<DetachingRule> detachingRules() const { return m_detachingRules; } 46 70 47 71 private: 48 72 const Box& m_layoutBox; 73 OptionSet<DetachingRule> m_detachingRules; 49 74 }; 50 75
Note: See TracChangeset
for help on using the changeset viewer.