Changeset 276503 in webkit
- Timestamp:
- Apr 23, 2021, 10:04:53 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-611-branch/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp
r270878 r276503 88 88 } 89 89 90 static inline bool isWrappingAllowed(const RenderStyle& style)90 static inline bool isWrappingAllowed(const InlineItem& inlineItem) 91 91 { 92 92 // Do not try to wrap overflown 'pre' and 'no-wrap' content to next line. 93 return style.whiteSpace() != WhiteSpace::Pre && style.whiteSpace() != WhiteSpace::NoWrap; 93 auto& styleToUse = inlineItem.isBox() ? inlineItem.layoutBox().parent().style() : inlineItem.layoutBox().style(); 94 return styleToUse.whiteSpace() != WhiteSpace::Pre && styleToUse.whiteSpace() != WhiteSpace::NoWrap; 94 95 } 95 96 … … 103 104 ASSERT(!runList.isEmpty()); 104 105 auto lastItemIndex = runList.size() - 1; 105 return isWrappingAllowed(runList[lastItemIndex].inlineItem .style()) ? makeOptional(lastItemIndex) : WTF::nullopt;106 return isWrappingAllowed(runList[lastItemIndex].inlineItem) ? makeOptional(lastItemIndex) : WTF::nullopt; 106 107 } 107 108 … … 227 228 // While the inline-block has pre-wrap which allows wrapping, the content lives in a nowrap context. 228 229 if (lastInlineItem.isBox() || lastInlineItem.isInlineBoxStart() || lastInlineItem.isInlineBoxEnd()) 229 return isWrappingAllowed(lastInlineItem .layoutBox().parent().style());230 return isWrappingAllowed(lastInlineItem); 230 231 if (lastInlineItem.isText()) { 231 232 if (runs.size() == 1) { 232 233 // Fast path for the most common case of an individual text item. 233 return isWrappingAllowed(lastInlineItem .layoutBox().style());234 return isWrappingAllowed(lastInlineItem); 234 235 } 235 236 for (auto& run : WTF::makeReversedRange(runs)) { 236 237 auto& inlineItem = run.inlineItem; 237 238 if (inlineItem.isInlineBoxStart() || inlineItem.isInlineBoxStart()) 238 return isWrappingAllowed(inlineItem .layoutBox().parent().style());239 return isWrappingAllowed(inlineItem); 239 240 ASSERT(!inlineItem.isBox()); 240 241 } 241 242 // This must be a set of individual text runs. We could just check the last item. 242 return isWrappingAllowed(lastInlineItem .layoutBox().style());243 return isWrappingAllowed(lastInlineItem); 243 244 } 244 245 ASSERT_NOT_REACHED(); … … 262 263 } 263 264 // Check if this text run needs to stay on the current line. 264 return isWrappingAllowed(run.inlineItem .style());265 return isWrappingAllowed(run.inlineItem); 265 266 }; 266 267
Note:
See TracChangeset
for help on using the changeset viewer.