Title: [262892] trunk
- Revision
- 262892
- Author
- [email protected]
- Date
- 2020-06-10 20:01:49 -0700 (Wed, 10 Jun 2020)
Log Message
[Line clamp] Do not apply the special anchor handling when the anchor content is visible after clamping
https://bugs.webkit.org/show_bug.cgi?id=213052
<rdar://problem/59739131>
Reviewed by Simon Fraser.
Source/WebCore:
Line clamping tries to preserve the anchor text if it is at the bottom of the paragraph to support cases like "... Read more", where the "read more" is an actual link.
This patch makes sure that we only apply the special case handling if the anchor text get clamped.
Test: fast/flexbox/line-clamp-with-anchor-content-only.html
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
LayoutTests:
* fast/flexbox/line-clamp-with-anchor-content-only-expected.html: Added.
* fast/flexbox/line-clamp-with-anchor-content-only.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (262891 => 262892)
--- trunk/LayoutTests/ChangeLog 2020-06-11 02:40:43 UTC (rev 262891)
+++ trunk/LayoutTests/ChangeLog 2020-06-11 03:01:49 UTC (rev 262892)
@@ -1,3 +1,14 @@
+2020-06-10 Zalan Bujtas <[email protected]>
+
+ [Line clamp] Do not apply the special anchor handling when the anchor content is visible after clamping
+ https://bugs.webkit.org/show_bug.cgi?id=213052
+ <rdar://problem/59739131>
+
+ Reviewed by Simon Fraser.
+
+ * fast/flexbox/line-clamp-with-anchor-content-only-expected.html: Added.
+ * fast/flexbox/line-clamp-with-anchor-content-only.html: Added.
+
2020-06-10 Hiro (mzp) Mizuno <[email protected]>
[iOS] Option + Forward Delete should delete next word
Added: trunk/LayoutTests/fast/flexbox/line-clamp-with-anchor-content-only-expected.html (0 => 262892)
--- trunk/LayoutTests/fast/flexbox/line-clamp-with-anchor-content-only-expected.html (rev 0)
+++ trunk/LayoutTests/fast/flexbox/line-clamp-with-anchor-content-only-expected.html 2020-06-11 03:01:49 UTC (rev 262892)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<style>
+a {
+ font-size: 20px;
+ text-decoration: none;
+ color: green;
+}
+
+div {
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ width: 200px;
+}
+</style><div><a href="" id=clamp>pass if this text conten</a><br><a href="" visible</a></div>
+
Added: trunk/LayoutTests/fast/flexbox/line-clamp-with-anchor-content-only.html (0 => 262892)
--- trunk/LayoutTests/fast/flexbox/line-clamp-with-anchor-content-only.html (rev 0)
+++ trunk/LayoutTests/fast/flexbox/line-clamp-with-anchor-content-only.html 2020-06-11 03:01:49 UTC (rev 262892)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<style>
+a {
+ font-size: 20px;
+ text-decoration: none;
+ color: green;
+}
+
+div {
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 1;
+ width: 200px;
+}
+</style><div><a href="" id=clamp>pass if this text content is visible</a></div>
+<div style="position: relative; top: -20px; left: 179px; width: 100px; height: 100px; background-color: white;"></div><script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+setTimeout(function() {
+ clamp.style.color = "green";
+ if (window.testRunner)
+ testRunner.notifyDone();
+}, 0);
+</script>
Modified: trunk/LayoutTests/platform/win/TestExpectations (262891 => 262892)
--- trunk/LayoutTests/platform/win/TestExpectations 2020-06-11 02:40:43 UTC (rev 262891)
+++ trunk/LayoutTests/platform/win/TestExpectations 2020-06-11 03:01:49 UTC (rev 262892)
@@ -3605,6 +3605,7 @@
fast/css/paint-order-shadow.html [ ImageOnlyFailure ]
fast/flexbox/aspect-ratio-intrinsic-adjust.html [ ImageOnlyFailure ]
fast/flexbox/image-percent-max-height.html [ ImageOnlyFailure ]
+fast/flexbox/line-clamp-with-anchor-content-only.html [ ImageOnlyFailure ]
fast/forms/baseline-of-number-inputs.html [ ImageOnlyFailure ]
fast/images/image-subsampling.html [ ImageOnlyFailure ]
fast/multicol/flexbox-rows.html [ ImageOnlyFailure ]
Modified: trunk/Source/WebCore/ChangeLog (262891 => 262892)
--- trunk/Source/WebCore/ChangeLog 2020-06-11 02:40:43 UTC (rev 262891)
+++ trunk/Source/WebCore/ChangeLog 2020-06-11 03:01:49 UTC (rev 262892)
@@ -1,3 +1,19 @@
+2020-06-10 Zalan Bujtas <[email protected]>
+
+ [Line clamp] Do not apply the special anchor handling when the anchor content is visible after clamping
+ https://bugs.webkit.org/show_bug.cgi?id=213052
+ <rdar://problem/59739131>
+
+ Reviewed by Simon Fraser.
+
+ Line clamping tries to preserve the anchor text if it is at the bottom of the paragraph to support cases like "... Read more", where the "read more" is an actual link.
+ This patch makes sure that we only apply the special case handling if the anchor text get clamped.
+
+ Test: fast/flexbox/line-clamp-with-anchor-content-only.html
+
+ * rendering/RenderDeprecatedFlexibleBox.cpp:
+ (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
+
2020-06-10 Jer Noble <[email protected]>
[Cocoa] CRASH: imported/w3c/web-platform-tests/remote-playback/watch-availability-initial-callback.html is flaky crashing
Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (262891 => 262892)
--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp 2020-06-11 02:40:43 UTC (rev 262891)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp 2020-06-11 03:01:49 UTC (rev 262892)
@@ -987,7 +987,7 @@
continue;
RootInlineBox* lastVisibleLine = blockChild.lineAtIndex(numVisibleLines - 1);
- if (!lastVisibleLine)
+ if (!lastVisibleLine || !lastVisibleLine->firstChild())
continue;
const UChar ellipsisAndSpace[2] = { horizontalEllipsis, ' ' };
@@ -999,7 +999,9 @@
// Get ellipsis width, and if the last child is an anchor, it will go after the ellipsis, so add in a space and the anchor width too
LayoutUnit totalWidth;
InlineBox* anchorBox = lastLine->lastChild();
- if (anchorBox && anchorBox->renderer().style().isLink())
+ auto& anchorRenderer = anchorBox->renderer();
+ auto& lastVisibleRenderer = lastVisibleLine->firstChild()->renderer();
+ if (anchorBox && anchorBox->renderer().style().isLink() && &lastVisibleRenderer != &anchorRenderer)
totalWidth = anchorBox->logicalWidth() + font.width(constructTextRun(ellipsisAndSpace, 2, style()));
else {
anchorBox = nullptr;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes