Title: [270839] trunk
- Revision
- 270839
- Author
- [email protected]
- Date
- 2020-12-15 07:07:04 -0800 (Tue, 15 Dec 2020)
Log Message
REGRESSION: apple.com sign-in page footer does not wrap, "Site Map" option renders offscreen.
https://bugs.webkit.org/show_bug.cgi?id=219880
<rdar://problem/72128221>
Reviewed by Antti Koivisto.
Source/WebCore:
Do not check the inline-block's style for wrapping. It's the parent's style that drives the content wrapping.
E.g. <div style="white-space: nowrap">some text<div style="display: inline-block; white-space: pre-wrap"></div></div>.
While the inline-block has pre-wrap which allows wrapping, the content lives in a nowrap context.
Test: fast/inline/inline-block-no-wrap.html
* layout/inlineformatting/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::processOverflowingContent const):
(WebCore::Layout::lastContentRunIndex): Deleted.
(WebCore::Layout::InlineContentBreaker::isContentWrappingAllowed const): Deleted.
* layout/inlineformatting/InlineContentBreaker.h:
LayoutTests:
* fast/inline/inline-block-no-wrap-expected.html: Added.
* fast/inline/inline-block-no-wrap.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (270838 => 270839)
--- trunk/LayoutTests/ChangeLog 2020-12-15 14:34:27 UTC (rev 270838)
+++ trunk/LayoutTests/ChangeLog 2020-12-15 15:07:04 UTC (rev 270839)
@@ -1,3 +1,14 @@
+2020-12-15 Zalan Bujtas <[email protected]>
+
+ REGRESSION: apple.com sign-in page footer does not wrap, "Site Map" option renders offscreen.
+ https://bugs.webkit.org/show_bug.cgi?id=219880
+ <rdar://problem/72128221>
+
+ Reviewed by Antti Koivisto.
+
+ * fast/inline/inline-block-no-wrap-expected.html: Added.
+ * fast/inline/inline-block-no-wrap.html: Added.
+
2020-12-15 Martin Robinson <[email protected]>
CSS Scroll Snap is not in effect when the user scrolls via the keyboard
Added: trunk/LayoutTests/fast/inline/inline-block-no-wrap-expected.html (0 => 270839)
--- trunk/LayoutTests/fast/inline/inline-block-no-wrap-expected.html (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-block-no-wrap-expected.html 2020-12-15 15:07:04 UTC (rev 270839)
@@ -0,0 +1,6 @@
+<style>
+body {
+ font-size: 20px;
+}
+</style>
+PASS<br>if<br>this<br>content<br>does<br>wrap
\ No newline at end of file
Added: trunk/LayoutTests/fast/inline/inline-block-no-wrap.html (0 => 270839)
--- trunk/LayoutTests/fast/inline/inline-block-no-wrap.html (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-block-no-wrap.html 2020-12-15 15:07:04 UTC (rev 270839)
@@ -0,0 +1,13 @@
+<style>
+div {
+ display: inline-block;
+ white-space: nowrap;
+ font-size: 20px;
+}
+
+.container {
+ width: 0px;
+ white-space: pre-wrap;
+}
+</style>
+<div class=container><div>PASS</div><div>if</div><div>this</div><div>content</div><div>does</div><div>wrap</div></div>
Modified: trunk/Source/WebCore/ChangeLog (270838 => 270839)
--- trunk/Source/WebCore/ChangeLog 2020-12-15 14:34:27 UTC (rev 270838)
+++ trunk/Source/WebCore/ChangeLog 2020-12-15 15:07:04 UTC (rev 270839)
@@ -1,3 +1,24 @@
+2020-12-15 Zalan Bujtas <[email protected]>
+
+ REGRESSION: apple.com sign-in page footer does not wrap, "Site Map" option renders offscreen.
+ https://bugs.webkit.org/show_bug.cgi?id=219880
+ <rdar://problem/72128221>
+
+ Reviewed by Antti Koivisto.
+
+ Do not check the inline-block's style for wrapping. It's the parent's style that drives the content wrapping.
+
+ E.g. <div style="white-space: nowrap">some text<div style="display: inline-block; white-space: pre-wrap"></div></div>.
+ While the inline-block has pre-wrap which allows wrapping, the content lives in a nowrap context.
+
+ Test: fast/inline/inline-block-no-wrap.html
+
+ * layout/inlineformatting/InlineContentBreaker.cpp:
+ (WebCore::Layout::InlineContentBreaker::processOverflowingContent const):
+ (WebCore::Layout::lastContentRunIndex): Deleted.
+ (WebCore::Layout::InlineContentBreaker::isContentWrappingAllowed const): Deleted.
+ * layout/inlineformatting/InlineContentBreaker.h:
+
2020-12-15 Martin Robinson <[email protected]>
CSS Scroll Snap is not in effect when the user scrolls via the keyboard
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp (270838 => 270839)
--- trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp 2020-12-15 14:34:27 UTC (rev 270838)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp 2020-12-15 15:07:04 UTC (rev 270839)
@@ -87,16 +87,6 @@
return { };
}
-static inline Optional<size_t> lastContentRunIndex(const InlineContentBreaker::ContinuousContent& continuousContent)
-{
- auto& runs = continuousContent.runs();
- for (auto index = runs.size(); index--;) {
- if (runs[index].inlineItem.isText() || runs[index].inlineItem.isBox())
- return index;
- }
- return { };
-}
-
static inline bool isWrappingAllowed(const RenderStyle& style)
{
// Do not try to wrap overflown 'pre' and 'no-wrap' content to next line.
@@ -115,14 +105,6 @@
return isWrappingAllowed(runList[lastItemIndex].inlineItem.style()) ? makeOptional(lastItemIndex) : WTF::nullopt;
}
-bool InlineContentBreaker::isContentWrappingAllowed(const ContinuousContent& continuousContent) const
-{
- // Use the last inline item with content (where we would be wrapping) to decide if content wrapping is allowed.
- auto& continuousRuns = continuousContent.runs();
- auto runIndex = lastContentRunIndex(continuousContent).valueOr(continuousRuns.size() - 1);
- return isWrappingAllowed(continuousRuns[runIndex].inlineItem.style());
-}
-
bool InlineContentBreaker::shouldKeepEndOfLineWhitespace(const ContinuousContent& continuousContent) const
{
// Grab the style and check for white-space property to decide whether we should let this whitespace content overflow the current line.
@@ -235,8 +217,34 @@
ASSERT(!m_hasWrapOpportunityAtPreviousPosition);
return { Result::Action::Keep, IsEndOfLine::No };
}
- // Now either wrap here or at an earlier position, or not wrap at all.
- if (isContentWrappingAllowed(continuousContent))
+ // Now either wrap this content over to the next line or revert back to an earlier wrapping opportunity, or not wrap at all.
+ auto shouldWrapThisContentToNextLine = [&] {
+ // 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).
+ auto& runs = continuousContent.runs();
+ auto& lastInlineItem = runs.last().inlineItem;
+ // Parent style drives the wrapping behavior here.
+ // e.g. <div style="white-space: nowrap">some text<div style="display: inline-block; white-space: pre-wrap"></div></div>.
+ // While the inline-block has pre-wrap which allows wrapping, the content lives in a nowrap context.
+ if (lastInlineItem.isBox() || lastInlineItem.isInlineBoxStart() || lastInlineItem.isInlineBoxStart())
+ return isWrappingAllowed(lastInlineItem.layoutBox().parent().style());
+ if (lastInlineItem.isText()) {
+ if (runs.size() == 1) {
+ // Fast path for the most common case of an individual text item.
+ return isWrappingAllowed(lastInlineItem.layoutBox().style());
+ }
+ for (auto& run : WTF::makeReversedRange(runs)) {
+ auto& inlineItem = run.inlineItem;
+ if (inlineItem.isInlineBoxStart() || inlineItem.isInlineBoxStart())
+ return isWrappingAllowed(inlineItem.layoutBox().parent().style());
+ ASSERT(!inlineItem.isBox());
+ }
+ // This must be a set of individual text runs. We could just check the last item.
+ return isWrappingAllowed(lastInlineItem.layoutBox().style());
+ }
+ ASSERT_NOT_REACHED();
+ return true;
+ };
+ if (shouldWrapThisContentToNextLine())
return { Result::Action::Wrap, IsEndOfLine::Yes };
if (m_hasWrapOpportunityAtPreviousPosition)
return { Result::Action::RevertToLastWrapOpportunity, IsEndOfLine::Yes };
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.h (270838 => 270839)
--- trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.h 2020-12-15 14:34:27 UTC (rev 270838)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.h 2020-12-15 15:07:04 UTC (rev 270839)
@@ -128,7 +128,6 @@
};
WordBreakRule wordBreakBehavior(const RenderStyle&) const;
bool shouldKeepEndOfLineWhitespace(const ContinuousContent&) const;
- bool isContentWrappingAllowed(const ContinuousContent&) const;
bool n_hyphenationIsDisabled { false };
bool m_hasWrapOpportunityAtPreviousPosition { false };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes