<!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>[177678] 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/177678">177678</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-12-22 23:15:54 -0800 (Mon, 22 Dec 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/177658">r177658</a>.
https://bugs.webkit.org/show_bug.cgi?id=139900
Caused many assertion failures (Requested by ap on #webkit).
Reverted changeset:
"Incorrect dashed and dotted border painting."
https://bugs.webkit.org/show_bug.cgi?id=139872
http://trac.webkit.org/changeset/177658</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgGraphicsContextCGcpp">trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderObjectcpp">trunk/Source/WebCore/rendering/RenderObject.cpp</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastbordersborderpaintingcorrectnessdashedexpectedhtml">trunk/LayoutTests/fast/borders/border-painting-correctness-dashed-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastbordersborderpaintingcorrectnessdashedhtml">trunk/LayoutTests/fast/borders/border-painting-correctness-dashed.html</a></li>
<li><a href="#trunkLayoutTestsfastbordersborderpaintingcorrectnessdottedexpectedhtml">trunk/LayoutTests/fast/borders/border-painting-correctness-dotted-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastbordersborderpaintingcorrectnessdottedhtml">trunk/LayoutTests/fast/borders/border-painting-correctness-dotted.html</a></li>
<li><a href="#trunkLayoutTestsfastbordersresourcesborderpaintingcorrectnessdashedexpectedpng">trunk/LayoutTests/fast/borders/resources/border-painting-correctness-dashed-expected.png</a></li>
<li><a href="#trunkLayoutTestsfastbordersresourcesborderpaintingcorrectnessdottedexpectedpng">trunk/LayoutTests/fast/borders/resources/border-painting-correctness-dotted-expected.png</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (177677 => 177678)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-12-23 03:24:06 UTC (rev 177677)
+++ trunk/LayoutTests/ChangeLog        2014-12-23 07:15:54 UTC (rev 177678)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-12-22 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r177658.
+ https://bugs.webkit.org/show_bug.cgi?id=139900
+
+ Caused many assertion failures (Requested by ap on #webkit).
+
+ Reverted changeset:
+
+ "Incorrect dashed and dotted border painting."
+ https://bugs.webkit.org/show_bug.cgi?id=139872
+ http://trac.webkit.org/changeset/177658
+
</ins><span class="cx"> 2014-12-22 Benjamin Poulain <bpoulain@apple.com>
</span><span class="cx">
</span><span class="cx"> Form elements should match :valid and :invalid based on their associated elements
</span></span></pre></div>
<a id="trunkLayoutTestsfastbordersborderpaintingcorrectnessdashedexpectedhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/borders/border-painting-correctness-dashed-expected.html (177677 => 177678)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/borders/border-painting-correctness-dashed-expected.html        2014-12-23 03:24:06 UTC (rev 177677)
+++ trunk/LayoutTests/fast/borders/border-painting-correctness-dashed-expected.html        2014-12-23 07:15:54 UTC (rev 177678)
</span><span class="lines">@@ -1,14 +0,0 @@
</span><del>-<DOCTYPE html>
-<html>
-<head>
-<title>This tests that dashed borders look ok.</title>
-<style>
- body {
- margin: 0px;
- }
-</style>
-</head>
-<body>
-<img src="./resources/border-painting-correctness-dashed-expected.png" />
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsfastbordersborderpaintingcorrectnessdashedhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/borders/border-painting-correctness-dashed.html (177677 => 177678)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/borders/border-painting-correctness-dashed.html        2014-12-23 03:24:06 UTC (rev 177677)
+++ trunk/LayoutTests/fast/borders/border-painting-correctness-dashed.html        2014-12-23 07:15:54 UTC (rev 177678)
</span><span class="lines">@@ -1,35 +0,0 @@
</span><del>-<DOCTYPE html>
-<html>
-<head>
-<title>This tests that dashed borders look ok.</title>
-<style>
- div {
- position: absolute;
- border: 1px dashed green;
- }
-</style>
-</head>
-<body>
-<pre id=container></pre>
-<script>
- var cont = document.getElementById("container");
- var borderWidth = 1;
- for (h = 0; h < 500; h += 180) {
- for (v = 0; v < 500; v += 180) {
- width = 0;
- for (i = 90; i >= 0; i -= 2 * borderWidth) {
- var element = document.createElement("div");
- element.style.top = h + i + "px";
- element.style.left = v + i + "px";
- element.style.width = width + "px";
- element.style.height = width + "px";
- element.style.borderWidth = borderWidth;
- cont.appendChild(element);
- width += 4 * borderWidth;
- }
- borderWidth += 1;
- }
- }
-</script>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsfastbordersborderpaintingcorrectnessdottedexpectedhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/borders/border-painting-correctness-dotted-expected.html (177677 => 177678)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/borders/border-painting-correctness-dotted-expected.html        2014-12-23 03:24:06 UTC (rev 177677)
+++ trunk/LayoutTests/fast/borders/border-painting-correctness-dotted-expected.html        2014-12-23 07:15:54 UTC (rev 177678)
</span><span class="lines">@@ -1,14 +0,0 @@
</span><del>-<DOCTYPE html>
-<html>
-<head>
-<title>This tests that dotted borders look ok.</title>
-<style>
- body {
- margin: 0px;
- }
-</style>
-</head>
-<body>
-<img src="./resources/border-painting-correctness-dotted-expected.png" />
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsfastbordersborderpaintingcorrectnessdottedhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/borders/border-painting-correctness-dotted.html (177677 => 177678)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/borders/border-painting-correctness-dotted.html        2014-12-23 03:24:06 UTC (rev 177677)
+++ trunk/LayoutTests/fast/borders/border-painting-correctness-dotted.html        2014-12-23 07:15:54 UTC (rev 177678)
</span><span class="lines">@@ -1,35 +0,0 @@
</span><del>-<DOCTYPE html>
-<html>
-<head>
-<title>This tests that dotted borders look ok.</title>
-<style>
- div {
- position: absolute;
- border: 1px dotted green;
- }
-</style>
-</head>
-<body>
-<pre id=container></pre>
-<script>
- var cont = document.getElementById("container");
- var borderWidth = 1;
- for (h = 0; h < 500; h += 180) {
- for (v = 0; v < 500; v += 180) {
- width = 0;
- for (i = 90; i >= 0; i -= 2 * borderWidth) {
- var element = document.createElement("div");
- element.style.top = h + i + "px";
- element.style.left = v + i + "px";
- element.style.width = width + "px";
- element.style.height = width + "px";
- element.style.borderWidth = borderWidth;
- cont.appendChild(element);
- width += 4 * borderWidth;
- }
- borderWidth += 1;
- }
- }
-</script>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsfastbordersresourcesborderpaintingcorrectnessdashedexpectedpng"></a>
<div class="binary"><h4>Deleted: trunk/LayoutTests/fast/borders/resources/border-painting-correctness-dashed-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestsfastbordersresourcesborderpaintingcorrectnessdottedexpectedpng"></a>
<div class="binary"><h4>Deleted: trunk/LayoutTests/fast/borders/resources/border-painting-correctness-dotted-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (177677 => 177678)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-23 03:24:06 UTC (rev 177677)
+++ trunk/Source/WebCore/ChangeLog        2014-12-23 07:15:54 UTC (rev 177678)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-12-22 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r177658.
+ https://bugs.webkit.org/show_bug.cgi?id=139900
+
+ Caused many assertion failures (Requested by ap on #webkit).
+
+ Reverted changeset:
+
+ "Incorrect dashed and dotted border painting."
+ https://bugs.webkit.org/show_bug.cgi?id=139872
+ http://trac.webkit.org/changeset/177658
+
</ins><span class="cx"> 2014-12-22 Jaehun Lim <ljaehun.lim@samsung.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed build fix after r177661 and r177662
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgGraphicsContextCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (177677 => 177678)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp        2014-12-23 03:24:06 UTC (rev 177677)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp        2014-12-23 07:15:54 UTC (rev 177678)
</span><span class="lines">@@ -285,80 +285,119 @@
</span><span class="cx"> if (strokeStyle() == NoStroke)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- CGContextRef context = platformContext();
- float thickness = strokeThickness();
- ASSERT(thickness);
- bool isVerticalLine = (point1.x() + thickness == point2.x());
- StrokeStyle strokeStyle = this->strokeStyle();
- float strokeWidth = isVerticalLine ? point2.y() - point1.y() : point2.x() - point1.x();
- ASSERT(strokeWidth);
- float cornerWidth = 0;
</del><ins>+ float width = strokeThickness();
</ins><span class="cx">
</span><del>- if (strokeStyle == DottedStroke || strokeStyle == DashedStroke) {
- // Figure out end points to ensure we always paint corners.
- cornerWidth = strokeStyle == DottedStroke ? thickness : std::min(2 * thickness, std::max(thickness, strokeWidth / 3));
- CGContextSaveGState(context);
- setCGFillColor(context, strokeColor(), strokeColorSpace());
</del><ins>+ FloatPoint p1 = point1;
+ FloatPoint p2 = point2;
+ bool isVerticalLine = (p1.x() == p2.x());
+
+ // For odd widths, we add in 0.5 to the appropriate x/y so that the float arithmetic
+ // works out. For example, with a border width of 3, KHTML will pass us (y1+y2)/2, e.g.,
+ // (50+53)/2 = 103/2 = 51 when we want 51.5. It is always true that an even width gave
+ // us a perfect position, but an odd width gave us a position that is off by exactly 0.5.
+ if (strokeStyle() == DottedStroke || strokeStyle() == DashedStroke) {
</ins><span class="cx"> if (isVerticalLine) {
</span><del>- CGContextFillRect(context, FloatRect(point1.x(), point1.y(), thickness, cornerWidth));
- CGContextFillRect(context, FloatRect(point1.x(), point2.y() - cornerWidth, thickness, cornerWidth));
</del><ins>+ p1.move(0, width);
+ p2.move(0, -width);
</ins><span class="cx"> } else {
</span><del>- CGContextFillRect(context, FloatRect(point1.x(), point1.y(), cornerWidth, thickness));
- CGContextFillRect(context, FloatRect(point2.x() - cornerWidth, point1.y(), cornerWidth, thickness));
</del><ins>+ p1.move(width, 0);
+ p2.move(-width, 0);
</ins><span class="cx"> }
</span><del>- CGContextRestoreGState(context);
- strokeWidth -= 2 * cornerWidth;
- float patternWidth = strokeStyle == DottedStroke ? thickness : std::min(3 * thickness, std::max(thickness, strokeWidth / 3));
- // Check if corner drawing sufficiently covers the line.
- if (strokeWidth <= patternWidth + 1)
- return;
-
- // Pattern starts with full fill and ends with the empty fill.
- // 1. Let's start with the empty phase after the corner.
- // 2. Check if we've got odd or even number of patterns and whether they fully cover the line.
- // 3. In case of even number of patterns and/or remainder, move the pattern start position
- // so that the pattern is balanced between the corners.
- float patternOffset = patternWidth;
- int numberOfSegments = floorf(strokeWidth / patternWidth);
- bool oddNumberOfSegments = numberOfSegments % 2;
- float remainder = strokeWidth - (numberOfSegments * patternWidth);
- if (oddNumberOfSegments && remainder)
- patternOffset -= remainder / 2;
- else if (!oddNumberOfSegments) {
- if (remainder)
- patternOffset += patternOffset - (patternWidth + remainder) / 2;
- else
- patternOffset += patternWidth / 2;
</del><ins>+ }
+
+ if (((int)width) % 2) {
+ if (isVerticalLine) {
+ // We're a vertical line. Adjust our x.
+ p1.move(0.5f, 0.0f);
+ p2.move(0.5f, 0.0f);
+ } else {
+ // We're a horizontal line. Adjust our y.
+ p1.move(0.0f, 0.5f);
+ p2.move(0.0f, 0.5f);
</ins><span class="cx"> }
</span><del>- const CGFloat dashedLine[2] = { static_cast<CGFloat>(patternWidth), static_cast<CGFloat>(patternWidth) };
- CGContextSetLineDash(context, patternOffset, dashedLine, 2);
</del><span class="cx"> }
</span><del>-
- FloatPoint p1 = point1;
- FloatPoint p2 = point2;
- // Center line and cut off corners for pattern patining.
- if (isVerticalLine) {
- float centerOffset = (p2.x() - p1.x()) / 2;
- p1.move(centerOffset, cornerWidth);
- p2.move(-centerOffset, -cornerWidth);
- } else {
- float centerOffset = (p2.y() - p1.y()) / 2;
- p1.move(cornerWidth, centerOffset);
- p2.move(-cornerWidth, -centerOffset);
</del><ins>+
+ int patWidth = 0;
+ switch (strokeStyle()) {
+ case NoStroke:
+ case SolidStroke:
+ case DoubleStroke:
+ case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=94112 - Needs platform support.
+ break;
+ case DottedStroke:
+ patWidth = (int)width;
+ break;
+ case DashedStroke:
+ patWidth = 3 * (int)width;
+ break;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ CGContextRef context = platformContext();
+
</ins><span class="cx"> if (shouldAntialias()) {
</span><ins>+ bool willAntialias = false;
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> // Force antialiasing on for line patterns as they don't look good with it turned off (<rdar://problem/5459772>).
</span><del>- CGContextSetShouldAntialias(context, strokeStyle == DottedStroke || strokeStyle == DashedStroke);
-#else
- CGContextSetShouldAntialias(context, false);
</del><ins>+ willAntialias = patWidth;
</ins><span class="cx"> #endif
</span><ins>+ CGContextSetShouldAntialias(context, willAntialias);
</ins><span class="cx"> }
</span><ins>+
+ if (patWidth) {
+ CGContextSaveGState(context);
+
+ // Do a rect fill of our endpoints. This ensures we always have the
+ // appearance of being a border. We then draw the actual dotted/dashed line.
+ setCGFillColor(context, strokeColor(), strokeColorSpace()); // The save/restore make it safe to mutate the fill color here without setting it back to the old color.
+ if (isVerticalLine) {
+ CGContextFillRect(context, FloatRect(p1.x() - width / 2, p1.y() - width, width, width));
+ CGContextFillRect(context, FloatRect(p2.x() - width / 2, p2.y(), width, width));
+ } else {
+ CGContextFillRect(context, FloatRect(p1.x() - width, p1.y() - width / 2, width, width));
+ CGContextFillRect(context, FloatRect(p2.x(), p2.y() - width / 2, width, width));
+ }
+
+ // Example: 80 pixels with a width of 30 pixels.
+ // Remainder is 20. The maximum pixels of line we could paint
+ // will be 50 pixels.
+ int distance = (isVerticalLine ? (int)(point2.y() - point1.y()) : (point2.x() - point1.x())) - 2*(int)width;
+ int remainder = distance % patWidth;
+ int coverage = distance - remainder;
+ int numSegments = coverage / patWidth;
+
+ float patternOffset = 0.0f;
+ // Special case 1px dotted borders for speed.
+ if (patWidth == 1)
+ patternOffset = 1.0f;
+ else {
+ bool evenNumberOfSegments = !(numSegments % 2);
+ if (remainder)
+ evenNumberOfSegments = !evenNumberOfSegments;
+ if (evenNumberOfSegments) {
+ if (remainder) {
+ patternOffset += patWidth - remainder;
+ patternOffset += remainder / 2;
+ } else
+ patternOffset = patWidth / 2;
+ } else {
+ if (remainder)
+ patternOffset = (patWidth - remainder)/2;
+ }
+ }
+
+ const CGFloat dottedLine[2] = { static_cast<CGFloat>(patWidth), static_cast<CGFloat>(patWidth) };
+ CGContextSetLineDash(context, patternOffset, dottedLine, 2);
+ }
+
</ins><span class="cx"> CGContextBeginPath(context);
</span><span class="cx"> CGContextMoveToPoint(context, p1.x(), p1.y());
</span><span class="cx"> CGContextAddLineToPoint(context, p2.x(), p2.y());
</span><ins>+
</ins><span class="cx"> CGContextStrokePath(context);
</span><ins>+
+ if (patWidth)
+ CGContextRestoreGState(context);
+
</ins><span class="cx"> if (shouldAntialias())
</span><span class="cx"> CGContextSetShouldAntialias(context, true);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (177677 => 177678)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderObject.cpp        2014-12-23 03:24:06 UTC (rev 177677)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp        2014-12-23 07:15:54 UTC (rev 177678)
</span><span class="lines">@@ -733,15 +733,31 @@
</span><span class="cx"> return;
</span><span class="cx"> case DOTTED:
</span><span class="cx"> case DASHED: {
</span><del>- bool wasAntialiased = graphicsContext->shouldAntialias();
- StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle();
- graphicsContext->setShouldAntialias(antialias);
- graphicsContext->setStrokeColor(color, style.colorSpace());
- graphicsContext->setStrokeThickness(thickness);
- graphicsContext->setStrokeStyle(borderStyle == DASHED ? DashedStroke : DottedStroke);
- graphicsContext->drawLine(roundPointToDevicePixels(LayoutPoint(x1, y1), deviceScaleFactor), roundPointToDevicePixels(LayoutPoint(x2, y2), deviceScaleFactor));
- graphicsContext->setShouldAntialias(wasAntialiased);
- graphicsContext->setStrokeStyle(oldStrokeStyle);
</del><ins>+ if (thickness > 0) {
+ bool wasAntialiased = graphicsContext->shouldAntialias();
+ StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle();
+ graphicsContext->setShouldAntialias(antialias);
+ graphicsContext->setStrokeColor(color, style.colorSpace());
+ graphicsContext->setStrokeThickness(thickness);
+ graphicsContext->setStrokeStyle(borderStyle == DASHED ? DashedStroke : DottedStroke);
+
+ // FIXME: There's some odd adjustment in GraphicsContext::drawLine() that disables device pixel precision line drawing.
+ int adjustedX = floorToInt((x1 + x2) / 2);
+ int adjustedY = floorToInt((y1 + y2) / 2);
+
+ switch (side) {
+ case BSBottom:
+ case BSTop:
+ graphicsContext->drawLine(FloatPoint(x1, adjustedY), FloatPoint(x2, adjustedY));
+ break;
+ case BSRight:
+ case BSLeft:
+ graphicsContext->drawLine(FloatPoint(adjustedX, y1), FloatPoint(adjustedX, y2));
+ break;
+ }
+ graphicsContext->setShouldAntialias(wasAntialiased);
+ graphicsContext->setStrokeStyle(oldStrokeStyle);
+ }
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> case DOUBLE: {
</span></span></pre>
</div>
</div>
</body>
</html>