Title: [153068] trunk/Source/WebCore
Revision
153068
Author
[email protected]
Date
2013-07-23 16:46:33 -0700 (Tue, 23 Jul 2013)

Log Message

Pixel-snap the unavailable plugin indicator arrow for maximum sharpness
https://bugs.webkit.org/show_bug.cgi?id=119024
<rdar://problem/14523331>

Reviewed by Anders Carlsson.

* rendering/RenderEmbeddedObject.cpp:
(WebCore::addReplacementArrowPath):
(WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
Pixel-snap the unavailable plugin indicator arrow. Snapping directions
were chosen by eye/symmetry to look best on 1x and 2x devices at
1x and 2x page scale.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (153067 => 153068)


--- trunk/Source/WebCore/ChangeLog	2013-07-23 23:42:16 UTC (rev 153067)
+++ trunk/Source/WebCore/ChangeLog	2013-07-23 23:46:33 UTC (rev 153068)
@@ -1,3 +1,18 @@
+2013-07-23  Tim Horton  <[email protected]>
+
+        Pixel-snap the unavailable plugin indicator arrow for maximum sharpness
+        https://bugs.webkit.org/show_bug.cgi?id=119024
+        <rdar://problem/14523331>
+
+        Reviewed by Anders Carlsson.
+
+        * rendering/RenderEmbeddedObject.cpp:
+        (WebCore::addReplacementArrowPath):
+        (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
+        Pixel-snap the unavailable plugin indicator arrow. Snapping directions
+        were chosen by eye/symmetry to look best on 1x and 2x devices at
+        1x and 2x page scale.
+
 2013-07-19  Ryosuke Niwa  <[email protected]>
 
         The computed values of fix length padding should be subpixel precision like margin

Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (153067 => 153068)


--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2013-07-23 23:42:16 UTC (rev 153067)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2013-07-23 23:46:33 UTC (rev 153068)
@@ -280,21 +280,21 @@
 
 static void addReplacementArrowPath(Path& path, const FloatRect& insideRect)
 {
-    FloatRect insideRectWithMargin(insideRect);
-    insideRectWithMargin.inflate(-replacementArrowPadding);
+    FloatRect rect(insideRect);
+    rect.inflate(-replacementArrowPadding);
 
-    FloatPoint center = insideRectWithMargin.center();
-    FloatSize arrowEdge(insideRectWithMargin.width() / 2, insideRectWithMargin.height() / 3);
+    FloatPoint center = rect.center();
+    FloatSize arrowEdge(rect.width() / 2, rect.height() / 3);
     FloatSize arrowHorizontalEdge(arrowEdge.width(), 0);
     FloatSize arrowVerticalEdge(0, arrowEdge.height());
 
-    path.moveTo(FloatPoint(center.x(), insideRectWithMargin.y()));
-    path.addLineTo(path.currentPoint() + arrowVerticalEdge);
-    path.addLineTo(path.currentPoint() - arrowHorizontalEdge);
-    path.addLineTo(path.currentPoint() + arrowVerticalEdge);
-    path.addLineTo(path.currentPoint() + arrowHorizontalEdge);
-    path.addLineTo(path.currentPoint() + arrowVerticalEdge);
-    path.addLineTo(center + arrowHorizontalEdge);
+    path.moveTo(FloatPoint(floorf(center.x()), floorf(rect.y())));
+    path.addLineTo(FloatPoint(floorf(center.x()), floorf(rect.y() + arrowEdge.height())));
+    path.addLineTo(FloatPoint(ceilf(center.x() - arrowEdge.width()), floorf(rect.y() + arrowEdge.height())));
+    path.addLineTo(FloatPoint(ceilf(center.x() - arrowEdge.width()), ceilf(rect.y() + arrowEdge.height() + arrowEdge.height())));
+    path.addLineTo(FloatPoint(floorf(center.x()), ceilf(rect.y() + arrowEdge.height() + arrowEdge.height())));
+    path.addLineTo(FloatPoint(floorf(center.x()), ceilf(rect.y() + arrowEdge.height() + arrowEdge.height() + arrowEdge.height())));
+    path.addLineTo(FloatPoint(ceilf(center.x() + arrowEdge.width()), center.y()));
     path.closeSubpath();
 }
 
@@ -329,8 +329,9 @@
 
     if (shouldUnavailablePluginMessageBeButton(document(), m_pluginUnavailabilityReason)) {
         arrowRect = path.boundingRect();
-        arrowRect.setX(arrowRect.maxX() + replacementArrowLeftMargin);
+        arrowRect.setX(ceilf(arrowRect.maxX() + replacementArrowLeftMargin));
         arrowRect.setWidth(arrowRect.height());
+        arrowRect.inflate(-0.5);
         path.addEllipse(arrowRect);
         addReplacementArrowPath(path, arrowRect);
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to