Changeset 270839 in webkit
- Timestamp:
- Dec 15, 2020, 7:07:04 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r270838 r270839 1 2020-12-15 Zalan Bujtas <zalan@apple.com> 2 3 REGRESSION: apple.com sign-in page footer does not wrap, "Site Map" option renders offscreen. 4 https://bugs.webkit.org/show_bug.cgi?id=219880 5 <rdar://problem/72128221> 6 7 Reviewed by Antti Koivisto. 8 9 * fast/inline/inline-block-no-wrap-expected.html: Added. 10 * fast/inline/inline-block-no-wrap.html: Added. 11 1 12 2020-12-15 Martin Robinson <mrobinson@webkit.org> 2 13 -
trunk/Source/WebCore/ChangeLog
r270838 r270839 1 2020-12-15 Zalan Bujtas <zalan@apple.com> 2 3 REGRESSION: apple.com sign-in page footer does not wrap, "Site Map" option renders offscreen. 4 https://bugs.webkit.org/show_bug.cgi?id=219880 5 <rdar://problem/72128221> 6 7 Reviewed by Antti Koivisto. 8 9 Do not check the inline-block's style for wrapping. It's the parent's style that drives the content wrapping. 10 11 E.g. <div style="white-space: nowrap">some text<div style="display: inline-block; white-space: pre-wrap"></div></div>. 12 While the inline-block has pre-wrap which allows wrapping, the content lives in a nowrap context. 13 14 Test: fast/inline/inline-block-no-wrap.html 15 16 * layout/inlineformatting/InlineContentBreaker.cpp: 17 (WebCore::Layout::InlineContentBreaker::processOverflowingContent const): 18 (WebCore::Layout::lastContentRunIndex): Deleted. 19 (WebCore::Layout::InlineContentBreaker::isContentWrappingAllowed const): Deleted. 20 * layout/inlineformatting/InlineContentBreaker.h: 21 1 22 2020-12-15 Martin Robinson <mrobinson@webkit.org> 2 23 -
trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp
r270715 r270839 88 88 } 89 89 90 static inline Optional<size_t> lastContentRunIndex(const InlineContentBreaker::ContinuousContent& continuousContent)91 {92 auto& runs = continuousContent.runs();93 for (auto index = runs.size(); index--;) {94 if (runs[index].inlineItem.isText() || runs[index].inlineItem.isBox())95 return index;96 }97 return { };98 }99 100 90 static inline bool isWrappingAllowed(const RenderStyle& style) 101 91 { … … 114 104 auto lastItemIndex = runList.size() - 1; 115 105 return isWrappingAllowed(runList[lastItemIndex].inlineItem.style()) ? makeOptional(lastItemIndex) : WTF::nullopt; 116 }117 118 bool InlineContentBreaker::isContentWrappingAllowed(const ContinuousContent& continuousContent) const119 {120 // Use the last inline item with content (where we would be wrapping) to decide if content wrapping is allowed.121 auto& continuousRuns = continuousContent.runs();122 auto runIndex = lastContentRunIndex(continuousContent).valueOr(continuousRuns.size() - 1);123 return isWrappingAllowed(continuousRuns[runIndex].inlineItem.style());124 106 } 125 107 … … 236 218 return { Result::Action::Keep, IsEndOfLine::No }; 237 219 } 238 // Now either wrap here or at an earlier position, or not wrap at all. 239 if (isContentWrappingAllowed(continuousContent)) 220 // Now either wrap this content over to the next line or revert back to an earlier wrapping opportunity, or not wrap at all. 221 auto shouldWrapThisContentToNextLine = [&] { 222 // The individual runs in this continuous content don't break, let's check if we are allowed to wrap this content to next line (e.g. pre would prevent us from wrapping). 223 auto& runs = continuousContent.runs(); 224 auto& lastInlineItem = runs.last().inlineItem; 225 // Parent style drives the wrapping behavior here. 226 // e.g. <div style="white-space: nowrap">some text<div style="display: inline-block; white-space: pre-wrap"></div></div>. 227 // While the inline-block has pre-wrap which allows wrapping, the content lives in a nowrap context. 228 if (lastInlineItem.isBox() || lastInlineItem.isInlineBoxStart() || lastInlineItem.isInlineBoxStart()) 229 return isWrappingAllowed(lastInlineItem.layoutBox().parent().style()); 230 if (lastInlineItem.isText()) { 231 if (runs.size() == 1) { 232 // Fast path for the most common case of an individual text item. 233 return isWrappingAllowed(lastInlineItem.layoutBox().style()); 234 } 235 for (auto& run : WTF::makeReversedRange(runs)) { 236 auto& inlineItem = run.inlineItem; 237 if (inlineItem.isInlineBoxStart() || inlineItem.isInlineBoxStart()) 238 return isWrappingAllowed(inlineItem.layoutBox().parent().style()); 239 ASSERT(!inlineItem.isBox()); 240 } 241 // This must be a set of individual text runs. We could just check the last item. 242 return isWrappingAllowed(lastInlineItem.layoutBox().style()); 243 } 244 ASSERT_NOT_REACHED(); 245 return true; 246 }; 247 if (shouldWrapThisContentToNextLine()) 240 248 return { Result::Action::Wrap, IsEndOfLine::Yes }; 241 249 if (m_hasWrapOpportunityAtPreviousPosition) -
trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.h
r270153 r270839 129 129 WordBreakRule wordBreakBehavior(const RenderStyle&) const; 130 130 bool shouldKeepEndOfLineWhitespace(const ContinuousContent&) const; 131 bool isContentWrappingAllowed(const ContinuousContent&) const;132 131 133 132 bool n_hyphenationIsDisabled { false };
Note:
See TracChangeset
for help on using the changeset viewer.