Title: [166929] trunk
Revision
166929
Author
za...@apple.com
Date
2014-04-08 09:19:56 -0700 (Tue, 08 Apr 2014)

Log Message

Subpixel rendering: Slow paint path for inlines should snap to device pixels.
https://bugs.webkit.org/show_bug.cgi?id=131259

Reviewed by Simon Fraser.

InlineTextBox::paint needs to round to the same device pixel position as SimpleLineLayout does.

Source/WebCore:

Test: fast/inline/hidpi-slow-path-text-on-subpixel-position.html

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paint):
* rendering/TextPainter.h: Cleanup. No reason to have them as references here.

LayoutTests:

* fast/inline/hidpi-slow-path-text-on-subpixel-position-expected.html: Added.
* fast/inline/hidpi-slow-path-text-on-subpixel-position.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (166928 => 166929)


--- trunk/LayoutTests/ChangeLog	2014-04-08 16:09:29 UTC (rev 166928)
+++ trunk/LayoutTests/ChangeLog	2014-04-08 16:19:56 UTC (rev 166929)
@@ -1,5 +1,17 @@
 2014-04-08  Zalan Bujtas  <za...@apple.com>
 
+        Subpixel rendering: Slow paint path for inlines should snap to device pixels.
+        https://bugs.webkit.org/show_bug.cgi?id=131259
+
+        Reviewed by Simon Fraser.
+
+        InlineTextBox::paint needs to round to the same device pixel position as SimpleLineLayout does.
+
+        * fast/inline/hidpi-slow-path-text-on-subpixel-position-expected.html: Added.
+        * fast/inline/hidpi-slow-path-text-on-subpixel-position.html: Added.
+
+2014-04-08  Zalan Bujtas  <za...@apple.com>
+
         Subpixel rendering: Paint the filter effect result image on device pixel position.
         https://bugs.webkit.org/show_bug.cgi?id=131255
 

Added: trunk/LayoutTests/fast/inline/hidpi-slow-path-text-on-subpixel-position-expected.html (0 => 166929)


--- trunk/LayoutTests/fast/inline/hidpi-slow-path-text-on-subpixel-position-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/hidpi-slow-path-text-on-subpixel-position-expected.html	2014-04-08 16:19:56 UTC (rev 166929)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+  .outer {
+    display: -webkit-flex;
+    -webkit-align-items: center;
+    box-sizing: border-box;
+    padding-top: 1px;
+    height: 25px;
+  }
+  .inner {
+    font: -webkit-small-control;
+    font-size: 9px;
+}
+</style>
+</head>
+<body>
+  <div class=outer>
+    <div class=inner>This tests that slow paint for inlines draws the text on the same position as fast path.</div>
+  </div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/inline/hidpi-slow-path-text-on-subpixel-position.html (0 => 166929)


--- trunk/LayoutTests/fast/inline/hidpi-slow-path-text-on-subpixel-position.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/hidpi-slow-path-text-on-subpixel-position.html	2014-04-08 16:19:56 UTC (rev 166929)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+  .outer {
+    display: -webkit-flex;
+    -webkit-align-items: center;
+    box-sizing: border-box;
+    padding-top: 1px;
+    height: 25px;
+  }
+  .inner {
+    font: -webkit-small-control;
+    font-size: 9px;
+    -webkit-transform: translateX(0);
+}
+</style>
+</head>
+<body>
+  <div class=outer>
+    <div class=inner>This tests that slow paint for inlines draws the text on the same position as fast path.</div>
+  </div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (166928 => 166929)


--- trunk/Source/WebCore/ChangeLog	2014-04-08 16:09:29 UTC (rev 166928)
+++ trunk/Source/WebCore/ChangeLog	2014-04-08 16:19:56 UTC (rev 166929)
@@ -1,3 +1,18 @@
+2014-04-08  Zalan Bujtas  <za...@apple.com>
+
+        Subpixel rendering: Slow paint path for inlines should snap to device pixels.
+        https://bugs.webkit.org/show_bug.cgi?id=131259
+
+        Reviewed by Simon Fraser.
+
+        InlineTextBox::paint needs to round to the same device pixel position as SimpleLineLayout does.
+
+        Test: fast/inline/hidpi-slow-path-text-on-subpixel-position.html
+
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paint):
+        * rendering/TextPainter.h: Cleanup. No reason to have them as references here.
+
 2014-04-07  Brent Fulgham  <bfulg...@apple.com>
 
         Keep 'webkitClosedCaptionsVisible' API in sync with captions display preferences

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (166928 => 166929)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2014-04-08 16:09:29 UTC (rev 166928)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2014-04-08 16:19:56 UTC (rev 166929)
@@ -517,7 +517,7 @@
     LayoutUnit paintEnd = isHorizontal() ? paintInfo.rect.maxX() : paintInfo.rect.maxY();
     LayoutUnit paintStart = isHorizontal() ? paintInfo.rect.x() : paintInfo.rect.y();
     
-    LayoutPoint adjustedPaintOffset = roundedIntPoint(paintOffset);
+    FloatPoint adjustedPaintOffset = roundedForPainting(paintOffset, renderer().document().deviceScaleFactor());
     
     if (logicalStart >= paintEnd || logicalStart + logicalExtent <= paintStart)
         return;

Modified: trunk/Source/WebCore/rendering/TextPainter.h (166928 => 166929)


--- trunk/Source/WebCore/rendering/TextPainter.h	2014-04-08 16:09:29 UTC (rev 166928)
+++ trunk/Source/WebCore/rendering/TextPainter.h	2014-04-08 16:19:56 UTC (rev 166929)
@@ -80,8 +80,8 @@
     const AtomicString& m_emphasisMark;
     RenderCombineText* m_combinedText;
     TextRun& m_textRun;
-    FloatRect& m_boxRect;
-    FloatPoint& m_textOrigin;
+    FloatRect m_boxRect;
+    FloatPoint m_textOrigin;
     int m_emphasisMarkOffset;
     bool m_textBoxIsHorizontal;
     SavedDrawingStateForMask m_savedDrawingStateForMask;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to