<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[180795] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/180795">180795</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2015-02-27 16:23:15 -0800 (Fri, 27 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Subpixel] Subpixelize RenderListMarker
https://bugs.webkit.org/show_bug.cgi?id=142093

Reviewed by Zalan Bujtas.

Source/WebCore:

Use floats instead of ints.

Test: fast/lists/rtl-marker.html

* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::paint):
(WebCore::RenderListMarker::updateContent):
(WebCore::RenderListMarker::getRelativeMarkerRect):
* rendering/RenderListMarker.h:

LayoutTests:

* platform/mac/TestExpectations: Unskip fast/lists/rtl-marker.html</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderListMarkercpp">trunk/Source/WebCore/rendering/RenderListMarker.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderListMarkerh">trunk/Source/WebCore/rendering/RenderListMarker.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (180794 => 180795)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-02-28 00:09:09 UTC (rev 180794)
+++ trunk/LayoutTests/ChangeLog        2015-02-28 00:23:15 UTC (rev 180795)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2015-02-27  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        [Subpixel] Subpixelize RenderListMarker
+        https://bugs.webkit.org/show_bug.cgi?id=142093
+
+        Reviewed by Zalan Bujtas.
+
+        * platform/mac/TestExpectations: Unskip fast/lists/rtl-marker.html
+
</ins><span class="cx"> 2015-02-27  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Test gardening, unmark now passing tests.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (180794 => 180795)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations        2015-02-28 00:09:09 UTC (rev 180794)
+++ trunk/LayoutTests/platform/mac/TestExpectations        2015-02-28 00:23:15 UTC (rev 180795)
</span><span class="lines">@@ -1224,7 +1224,6 @@
</span><span class="cx"> webkit.org/b/139968 fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-inherit.html [ ImageOnlyFailure ]
</span><span class="cx"> webkit.org/b/139968 fast/inline/hidpi-pixel-gap-between-adjacent-selection-inlines.html [ ImageOnlyFailure ]
</span><span class="cx"> webkit.org/b/139968 fast/inline/hidpi-select-inline-on-subpixel-position.html [ ImageOnlyFailure ]
</span><del>-webkit.org/b/139968 fast/lists/rtl-marker.html [ ImageOnlyFailure ]
</del><span class="cx"> webkit.org/b/139968 fast/multicol/cell-shrinkback.html [ ImageOnlyFailure ]
</span><span class="cx"> webkit.org/b/139968 fast/multicol/newmulticol/breaks-3-columns-3.html [ ImageOnlyFailure ]
</span><span class="cx"> webkit.org/b/139968 fast/regions/last-region-border-radius.html [ ImageOnlyFailure ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180794 => 180795)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-28 00:09:09 UTC (rev 180794)
+++ trunk/Source/WebCore/ChangeLog        2015-02-28 00:23:15 UTC (rev 180795)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2015-02-27  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        [Subpixel] Subpixelize RenderListMarker
+        https://bugs.webkit.org/show_bug.cgi?id=142093
+
+        Reviewed by Zalan Bujtas.
+
+        Use floats instead of ints.
+
+        Test: fast/lists/rtl-marker.html
+
+        * rendering/RenderListMarker.cpp:
+        (WebCore::RenderListMarker::paint):
+        (WebCore::RenderListMarker::updateContent):
+        (WebCore::RenderListMarker::getRelativeMarkerRect):
+        * rendering/RenderListMarker.h:
+
</ins><span class="cx"> 2015-02-27  Timothy Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;attachment&gt; should be selected immediately upon click, and be drag/copyable upon click
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderListMarkercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderListMarker.cpp (180794 => 180795)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderListMarker.cpp        2015-02-28 00:09:09 UTC (rev 180794)
+++ trunk/Source/WebCore/rendering/RenderListMarker.cpp        2015-02-28 00:23:15 UTC (rev 180795)
</span><span class="lines">@@ -1186,13 +1186,13 @@
</span><span class="cx">     overflowRect.moveBy(boxOrigin);
</span><span class="cx">     overflowRect.inflate(maximalOutlineSize(paintInfo.phase));
</span><span class="cx"> 
</span><del>-    if (!paintInfo.rect.intersects(snappedIntRect(overflowRect)))
</del><ins>+    if (!paintInfo.rect.intersects(overflowRect))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     LayoutRect box(boxOrigin, size());
</span><span class="cx">     
</span><del>-    IntRect marker = getRelativeMarkerRect();
-    marker.moveBy(roundedIntPoint(boxOrigin));
</del><ins>+    FloatRect marker = getRelativeMarkerRect();
+    marker.moveBy(boxOrigin);
</ins><span class="cx"> 
</span><span class="cx">     GraphicsContext* context = paintInfo.context;
</span><span class="cx"> 
</span><span class="lines">@@ -1319,47 +1319,51 @@
</span><span class="cx"> 
</span><span class="cx">     GraphicsContextStateSaver stateSaver(*context, false);
</span><span class="cx">     if (!style().isHorizontalWritingMode()) {
</span><del>-        marker.moveBy(roundedIntPoint(-boxOrigin));
</del><ins>+        marker.moveBy(-boxOrigin);
</ins><span class="cx">         marker = marker.transposedRect();
</span><del>-        marker.moveBy(IntPoint(roundToInt(box.x()), roundToInt(box.y() - logicalHeight())));
</del><ins>+        marker.moveBy(FloatPoint(box.x(), box.y() - logicalHeight()));
</ins><span class="cx">         stateSaver.save();
</span><span class="cx">         context-&gt;translate(marker.x(), marker.maxY());
</span><span class="cx">         context-&gt;rotate(static_cast&lt;float&gt;(deg2rad(90.)));
</span><span class="cx">         context-&gt;translate(-marker.x(), -marker.maxY());
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    IntPoint textOrigin = IntPoint(marker.x(), marker.y() + style().fontMetrics().ascent());
</del><ins>+    FloatPoint textOrigin = FloatPoint(marker.x(), marker.y() + style().fontMetrics().ascent());
+    textOrigin = roundPointToDevicePixels(LayoutPoint(textOrigin), document().deviceScaleFactor(), style().isLeftToRightDirection());
</ins><span class="cx"> 
</span><span class="cx">     if (type == Asterisks || type == Footnotes)
</span><span class="cx">         context-&gt;drawText(font, textRun, textOrigin);
</span><span class="cx">     else {
</span><ins>+        const UChar suffix = listMarkerSuffix(type, m_listItem.value());
+
</ins><span class="cx">         // Text is not arbitrary. We can judge whether it's RTL from the first character,
</span><span class="cx">         // and we only need to handle the direction U_RIGHT_TO_LEFT for now.
</span><span class="cx">         bool textNeedsReversing = u_charDirection(m_text[0]) == U_RIGHT_TO_LEFT;
</span><del>-        String reversedText;
</del><ins>+        String toDraw;
</ins><span class="cx">         if (textNeedsReversing) {
</span><span class="cx">             unsigned length = m_text.length();
</span><span class="cx">             StringBuilder buffer;
</span><del>-            buffer.reserveCapacity(length);
</del><ins>+            buffer.reserveCapacity(length + 2);
+            if (!style().isLeftToRightDirection()) {
+                buffer.append(space);
+                buffer.append(suffix);
+            }
</ins><span class="cx">             for (unsigned i = 0; i &lt; length; ++i)
</span><span class="cx">                 buffer.append(m_text[length - i - 1]);
</span><del>-            reversedText = buffer.toString();
-            textRun.setText(StringView(reversedText));
</del><ins>+            if (style().isLeftToRightDirection()) {
+                buffer.append(suffix);
+                buffer.append(space);
+            }
+            toDraw = buffer.toString();
+        } else {
+            if (style().isLeftToRightDirection())
+                toDraw = m_text + String(&amp;suffix, 1) + String(&amp;space, 1);
+            else
+                toDraw = String(&amp;space, 1) + String(&amp;suffix, 1) + m_text;
</ins><span class="cx">         }
</span><ins>+        textRun.setText(StringView(toDraw));
</ins><span class="cx"> 
</span><del>-        const UChar suffix = listMarkerSuffix(type, m_listItem.value());
-        if (style().isLeftToRightDirection()) {
-            int width = font.width(textRun);
-            context-&gt;drawText(font, textRun, textOrigin);
-            UChar suffixSpace[2] = { suffix, ' ' };
-            context-&gt;drawText(font, RenderBlock::constructTextRun(this, font, suffixSpace, 2, style()), textOrigin + IntSize(width, 0));
-        } else {
-            UChar spaceSuffix[2] = { ' ', suffix };
-            TextRun spaceSuffixRun = RenderBlock::constructTextRun(this, font, spaceSuffix, 2, style());
-            int width = font.width(spaceSuffixRun);
-            context-&gt;drawText(font, spaceSuffixRun, textOrigin);
-            context-&gt;drawText(font, textRun, textOrigin + IntSize(width, 0));
-        }
</del><ins>+        context-&gt;drawText(font, textRun, textOrigin);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1421,7 +1425,7 @@
</span><span class="cx">         // FIXME: This is a somewhat arbitrary width.  Generated images for markers really won't become particularly useful
</span><span class="cx">         // until we support the CSS3 marker pseudoclass to allow control over the width and height of the marker box.
</span><span class="cx">         int bulletWidth = style().fontMetrics().ascent() / 2;
</span><del>-        m_image-&gt;setContainerSizeForRenderer(this, IntSize(bulletWidth, bulletWidth), style().effectiveZoom());
</del><ins>+        m_image-&gt;setContainerSizeForRenderer(this, FloatSize(bulletWidth, bulletWidth), style().effectiveZoom());
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1747,19 +1751,19 @@
</span><span class="cx">     return m_listItem.notInList() || style().listStylePosition() == INSIDE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IntRect RenderListMarker::getRelativeMarkerRect()
</del><ins>+FloatRect RenderListMarker::getRelativeMarkerRect()
</ins><span class="cx"> {
</span><span class="cx">     if (isImage())
</span><del>-        return IntRect(0, 0, m_image-&gt;imageSize(this, style().effectiveZoom()).width(), m_image-&gt;imageSize(this, style().effectiveZoom()).height());
</del><ins>+        return FloatRect(0, 0, m_image-&gt;imageSize(this, style().effectiveZoom()).width(), m_image-&gt;imageSize(this, style().effectiveZoom()).height());
</ins><span class="cx">     
</span><del>-    IntRect relativeRect;
</del><ins>+    FloatRect relativeRect;
</ins><span class="cx">     EListStyleType type = style().listStyleType();
</span><span class="cx">     switch (type) {
</span><span class="cx">         case Asterisks:
</span><span class="cx">         case Footnotes: {
</span><span class="cx">             const FontCascade&amp; font = style().fontCascade();
</span><span class="cx">             TextRun run = RenderBlock::constructTextRun(this, font, m_text, style(), TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion, DefaultTextRunFlags);
</span><del>-            relativeRect = IntRect(0, 0, font.width(run), font.fontMetrics().height());
</del><ins>+            relativeRect = FloatRect(0, 0, font.width(run), font.fontMetrics().height());
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case Disc:
</span><span class="lines">@@ -1769,11 +1773,11 @@
</span><span class="cx">             const FontMetrics&amp; fontMetrics = style().fontMetrics();
</span><span class="cx">             int ascent = fontMetrics.ascent();
</span><span class="cx">             int bulletWidth = (ascent * 2 / 3 + 1) / 2;
</span><del>-            relativeRect = IntRect(1, 3 * (ascent - ascent * 2 / 3) / 2, bulletWidth, bulletWidth);
</del><ins>+            relativeRect = FloatRect(1, 3 * (ascent - ascent * 2 / 3) / 2, bulletWidth, bulletWidth);
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case NoneListStyle:
</span><del>-            return IntRect();
</del><ins>+            return FloatRect();
</ins><span class="cx">         case Afar:
</span><span class="cx">         case Amharic:
</span><span class="cx">         case AmharicAbegede:
</span><span class="lines">@@ -1850,13 +1854,13 @@
</span><span class="cx">         case UpperRoman:
</span><span class="cx">         case Urdu:
</span><span class="cx">             if (m_text.isEmpty())
</span><del>-                return IntRect();
</del><ins>+                return FloatRect();
</ins><span class="cx">             const FontCascade&amp; font = style().fontCascade();
</span><span class="cx">             TextRun run = RenderBlock::constructTextRun(this, font, m_text, style(), TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion, DefaultTextRunFlags);
</span><del>-            int itemWidth = font.width(run);
</del><ins>+            float itemWidth = font.width(run);
</ins><span class="cx">             UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem.value()), ' ' };
</span><del>-            int suffixSpaceWidth = font.width(RenderBlock::constructTextRun(this, font, suffixSpace, 2, style()));
-            relativeRect = IntRect(0, 0, itemWidth + suffixSpaceWidth, font.fontMetrics().height());
</del><ins>+            float suffixSpaceWidth = font.width(RenderBlock::constructTextRun(this, font, suffixSpace, 2, style()));
+            relativeRect = FloatRect(0, 0, itemWidth + suffixSpaceWidth, font.fontMetrics().height());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!style().isHorizontalWritingMode()) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderListMarkerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderListMarker.h (180794 => 180795)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderListMarker.h        2015-02-28 00:09:09 UTC (rev 180794)
+++ trunk/Source/WebCore/rendering/RenderListMarker.h        2015-02-28 00:23:15 UTC (rev 180795)
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
</span><span class="cx"> 
</span><del>-    IntRect getRelativeMarkerRect();
</del><ins>+    FloatRect getRelativeMarkerRect();
</ins><span class="cx">     LayoutRect localSelectionRect();
</span><span class="cx"> 
</span><span class="cx">     String m_text;
</span></span></pre>
</div>
</div>

</body>
</html>