Title: [199516] trunk
- Revision
- 199516
- Author
- [email protected]
- Date
- 2016-04-13 15:11:46 -0700 (Wed, 13 Apr 2016)
Log Message
Text on compositing layer with negative letter-spacing is truncated.
https://bugs.webkit.org/show_bug.cgi?id=156550
<rdar://problem/24212140>
Reviewed by Antti Koivisto.
Negative letter-spacing affects the right edge of content's visual overflow (for both RTL and LTR).
This is similar to how normal line layout adjusts it at InlineFlowBox::addTextBoxVisualOverflow().
Source/WebCore:
Test: fast/text/negative-letter-spacing-visual-overflow.html
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::computeOverflow):
(WebCore::SimpleLineLayout::paintFlow):
(WebCore::SimpleLineLayout::collectFlowOverflow):
LayoutTests:
* fast/text/negative-letter-spacing-visual-overflow-expected.html: Added.
* fast/text/negative-letter-spacing-visual-overflow.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (199515 => 199516)
--- trunk/LayoutTests/ChangeLog 2016-04-13 22:09:43 UTC (rev 199515)
+++ trunk/LayoutTests/ChangeLog 2016-04-13 22:11:46 UTC (rev 199516)
@@ -1,3 +1,17 @@
+2016-04-13 Zalan Bujtas <[email protected]>
+
+ Text on compositing layer with negative letter-spacing is truncated.
+ https://bugs.webkit.org/show_bug.cgi?id=156550
+ <rdar://problem/24212140>
+
+ Reviewed by Antti Koivisto.
+
+ Negative letter-spacing affects the right edge of content's visual overflow (for both RTL and LTR).
+ This is similar to how normal line layout adjusts it at InlineFlowBox::addTextBoxVisualOverflow().
+
+ * fast/text/negative-letter-spacing-visual-overflow-expected.html: Added.
+ * fast/text/negative-letter-spacing-visual-overflow.html: Added.
+
2016-04-13 Eric Carlson <[email protected]>
[iOS] remote command should be considered user events
Added: trunk/LayoutTests/fast/text/negative-letter-spacing-visual-overflow-expected.html (0 => 199516)
--- trunk/LayoutTests/fast/text/negative-letter-spacing-visual-overflow-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/negative-letter-spacing-visual-overflow-expected.html 2016-04-13 22:11:46 UTC (rev 199516)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we compute the visual overflow rect for negative letter spacing properly.</title>
+<style>
+div {
+ position: absolute;
+ font-family: ahem;
+ font-size: 20px;
+ -webkit-transform: translateZ(0);
+}
+</style>
+</head>
+<body>
+<script>
+if (window.internals)
+ internals.settings.setSimpleLineLayoutEnabled(false);
+var letterSpacing = 0;
+var topPosition = 0;
+for (var i = 0; i < 20; ++i, topPosition += 25, letterSpacing -= 1) {
+ var element = document.createElement("div");
+ element.style.letterSpacing = letterSpacing + "px";
+ element.style.top = topPosition + "px";
+ element.innerText = "foo";
+ document.body.appendChild(element);
+}
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/negative-letter-spacing-visual-overflow.html (0 => 199516)
--- trunk/LayoutTests/fast/text/negative-letter-spacing-visual-overflow.html (rev 0)
+++ trunk/LayoutTests/fast/text/negative-letter-spacing-visual-overflow.html 2016-04-13 22:11:46 UTC (rev 199516)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we compute the visual overflow rect for negative letter spacing properly.</title>
+<style>
+div {
+ position: absolute;
+ font-family: ahem;
+ font-size: 20px;
+ -webkit-transform: translateZ(0);
+}
+</style>
+</head>
+<body>
+<script>
+var letterSpacing = 0;
+var topPosition = 0;
+for (var i = 0; i < 20; ++i, topPosition += 25, letterSpacing -= 1) {
+ var element = document.createElement("div");
+ element.style.letterSpacing = letterSpacing + "px";
+ element.style.top = topPosition + "px";
+ element.innerText = "foo";
+ document.body.appendChild(element);
+}
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (199515 => 199516)
--- trunk/Source/WebCore/ChangeLog 2016-04-13 22:09:43 UTC (rev 199515)
+++ trunk/Source/WebCore/ChangeLog 2016-04-13 22:11:46 UTC (rev 199516)
@@ -1,3 +1,21 @@
+2016-04-13 Zalan Bujtas <[email protected]>
+
+ Text on compositing layer with negative letter-spacing is truncated.
+ https://bugs.webkit.org/show_bug.cgi?id=156550
+ <rdar://problem/24212140>
+
+ Reviewed by Antti Koivisto.
+
+ Negative letter-spacing affects the right edge of content's visual overflow (for both RTL and LTR).
+ This is similar to how normal line layout adjusts it at InlineFlowBox::addTextBoxVisualOverflow().
+
+ Test: fast/text/negative-letter-spacing-visual-overflow.html
+
+ * rendering/SimpleLineLayoutFunctions.cpp:
+ (WebCore::SimpleLineLayout::computeOverflow):
+ (WebCore::SimpleLineLayout::paintFlow):
+ (WebCore::SimpleLineLayout::collectFlowOverflow):
+
2016-04-13 Eric Carlson <[email protected]>
[iOS] remote command should be considered user events
Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (199515 => 199516)
--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp 2016-04-13 22:09:43 UTC (rev 199515)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp 2016-04-13 22:11:46 UTC (rev 199516)
@@ -65,6 +65,20 @@
context.drawRect(snappedRect);
}
+static FloatRect computeOverflow(const RenderBlockFlow& flow, const FloatRect& layoutRect)
+{
+ auto overflowRect = layoutRect;
+ auto strokeOverflow = std::ceil(flow.style().textStrokeWidth());
+ overflowRect.inflate(strokeOverflow);
+
+ auto letterSpacing = flow.style().fontCascade().letterSpacing();
+ if (letterSpacing >= 0)
+ return overflowRect;
+ // Last letter's negative spacing shrinks layout rect. Push it to visual overflow.
+ overflowRect.expand(-letterSpacing, 0);
+ return overflowRect;
+}
+
void paintFlow(const RenderBlockFlow& flow, const Layout& layout, PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (paintInfo.phase != PaintPhaseForeground)
@@ -94,15 +108,13 @@
paintRect.moveBy(-paintOffset);
auto resolver = runResolver(flow, layout);
- float strokeOverflow = std::ceil(flow.style().textStrokeWidth());
float deviceScaleFactor = flow.document().deviceScaleFactor();
for (auto run : resolver.rangeForRect(paintRect)) {
if (run.start() == run.end())
continue;
FloatRect rect = run.rect();
- FloatRect visualOverflowRect = rect;
- visualOverflowRect.inflate(strokeOverflow);
+ FloatRect visualOverflowRect = computeOverflow(flow, rect);
if (paintRect.y() > visualOverflowRect.maxY() || paintRect.maxY() < visualOverflowRect.y())
continue;
@@ -151,12 +163,10 @@
void collectFlowOverflow(RenderBlockFlow& flow, const Layout& layout)
{
- float strokeOverflow = std::ceil(flow.style().textStrokeWidth());
- for (FloatRect lineRect : lineResolver(flow, layout)) {
- LayoutRect inflatedLineRect(lineRect);
- inflatedLineRect.inflate(strokeOverflow);
- flow.addLayoutOverflow(inflatedLineRect);
- flow.addVisualOverflow(inflatedLineRect);
+ for (auto lineRect : lineResolver(flow, layout)) {
+ LayoutRect visualOverflowRect = LayoutRect(computeOverflow(flow, lineRect));
+ flow.addLayoutOverflow(LayoutRect(lineRect));
+ flow.addVisualOverflow(visualOverflowRect);
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes