Changeset 251642 in webkit
- Timestamp:
- Oct 27, 2019, 10:18:58 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
layout/inlineformatting/InlineLine.cpp (modified) (2 diffs)
-
layout/inlineformatting/InlineLine.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r251640 r251642 1 2019-10-27 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Do not expand runs with collapsed trailing whitespace 4 https://bugs.webkit.org/show_bug.cgi?id=203468 5 <rdar://problem/56653689> 6 7 Reviewed by Antti Koivisto. 8 9 Runs are supposed to be a continuous chunk of content. Runs with trailing 10 collapsed whitespace can't accommodate additional trailing content. 11 12 * layout/inlineformatting/InlineLine.cpp: 13 (WebCore::Layout::Line::close): 14 (WebCore::Layout::Line::Run::isWhitespace const): Deleted. 15 (WebCore::Layout::Line::Run::canBeExtended const): Deleted. 16 * layout/inlineformatting/InlineLine.h: 17 (WebCore::Layout::Line::Run::expand): 18 (WebCore::Layout::Line::Run::isWhitespace const): 19 (WebCore::Layout::Line::Run::setIsCollapsed): 20 (WebCore::Layout::Line::Run::canBeExtended const): 21 (WebCore::Layout::Line::Run::setCollapsesToZeroAdvanceWidth): 22 1 23 2019-10-27 Zalan Bujtas <zalan@apple.com> 2 24 -
trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp
r251633 r251642 44 44 } 45 45 46 bool Line::Run::isWhitespace() const47 {48 if (!isText())49 return false;50 return downcast<InlineTextItem>(m_inlineItem).isWhitespace();51 }52 53 bool Line::Run::canBeExtended() const54 {55 if (!isText())56 return false;57 // Non-collapsed text runs can be merged into one continuous run.58 if (isCollapsedToZeroAdvanceWidth())59 return false;60 return !isCollapsed();61 }62 63 46 Line::Line(const InlineFormattingContext& inlineFormattingContext, const InitialConstraints& initialConstraints, Optional<TextAlignMode> horizontalAlignment, SkipAlignment skipAlignment) 64 47 : m_inlineFormattingContext(inlineFormattingContext) … … 139 122 } 140 123 auto& currentRun = m_runList[index]; 141 if (!currentRun->isText() || ¤tRun->layoutBox() != &previousRun->layoutBox()) { 142 // Do not merge runs from different boxes (<span>foo</span><span>bar</span>) 143 // or within the same layout box but with preserved \n 144 // (<span>text\n<span <- both the "text" and "\" belong to the same layout box) 124 // Do not merge runs from different boxes (<span>foo</span><span>bar</span>) 125 // or within the same layout box but with preserved \n 126 // (<span>text\n<span <- both the "text" and "\" belong to the same layout box) 127 auto canAppendToPreviousRun = currentRun->isText() && ¤tRun->layoutBox() == &previousRun->layoutBox(); 128 if (!canAppendToPreviousRun) { 145 129 ++index; 146 130 continue; -
trunk/Source/WebCore/layout/inlineformatting/InlineLine.h
r251633 r251642 91 91 void expand(const Run&); 92 92 93 void setIsCollapsed() { m_isCollapsed = true; }93 void setIsCollapsed(); 94 94 void setCollapsesToZeroAdvanceWidth(); 95 95 … … 101 101 bool m_isCollapsed { false }; 102 102 bool m_collapsedToZeroAdvanceWidth { false }; 103 bool m_hasTrailingCollapsedContent { false }; 103 104 }; 104 105 using RunList = Vector<std::unique_ptr<Run>>; … … 156 157 ASSERT(other.isText()); 157 158 ASSERT(!isCollapsedToZeroAdvanceWidth()); 159 ASSERT(!m_hasTrailingCollapsedContent); 158 160 159 161 auto& otherDisplayRun = other.displayRun(); 160 162 m_displayRun.expandHorizontally(otherDisplayRun.logicalWidth()); 161 163 m_displayRun.textContext()->expand(*otherDisplayRun.textContext()); 164 m_hasTrailingCollapsedContent = other.isCollapsed(); 165 } 166 167 inline bool Line::Run::isWhitespace() const 168 { 169 return isText() && downcast<InlineTextItem>(m_inlineItem).isWhitespace(); 170 } 171 172 inline void Line::Run::setIsCollapsed() 173 { 174 ASSERT(isWhitespace()); 175 m_isCollapsed = true; 176 m_hasTrailingCollapsedContent = true; 177 } 178 179 inline bool Line::Run::canBeExtended() const 180 { 181 return isText() && !m_hasTrailingCollapsedContent; 162 182 } 163 183 … … 170 190 inline void Line::Run::setCollapsesToZeroAdvanceWidth() 171 191 { 192 setIsCollapsed(); 172 193 m_collapsedToZeroAdvanceWidth = true; 173 m_isCollapsed = true;174 194 m_displayRun.setLogicalWidth({ }); 175 195 }
Note:
See TracChangeset
for help on using the changeset viewer.