Title: [113159] branches/subpixellayout/Source/WebCore
Revision
113159
Author
[email protected]
Date
2012-04-04 03:26:47 -0700 (Wed, 04 Apr 2012)

Log Message

Coalesce extra pixel snapping in getRoundedBorderFor into a local variable, remove LayoutUnit flavors of adjustForAsboluteZoom, and use pixel snapped values throughout Element's DOM accessors.

Modified Paths

Diff

Modified: branches/subpixellayout/Source/WebCore/dom/Element.cpp (113158 => 113159)


--- branches/subpixellayout/Source/WebCore/dom/Element.cpp	2012-04-04 10:13:16 UTC (rev 113158)
+++ branches/subpixellayout/Source/WebCore/dom/Element.cpp	2012-04-04 10:26:47 UTC (rev 113159)
@@ -346,7 +346,7 @@
 {
     document()->updateLayoutIgnorePendingStylesheets();
     if (RenderBoxModelObject* rend = renderBoxModelObject())
-        return adjustForAbsoluteZoom(rend->offsetWidth(), rend);
+        return adjustForAbsoluteZoom(rend->pixelSnappedOffsetWidth(), rend);
     return 0;
 }
 
@@ -354,7 +354,7 @@
 {
     document()->updateLayoutIgnorePendingStylesheets();
     if (RenderBoxModelObject* rend = renderBoxModelObject())
-        return adjustForAbsoluteZoom(rend->offsetHeight(), rend);
+        return adjustForAbsoluteZoom(rend->pixelSnappedOffsetHeight(), rend);
     return 0;
 }
 
@@ -372,7 +372,7 @@
     document()->updateLayoutIgnorePendingStylesheets();
 
     if (RenderBox* rend = renderBox())
-        return adjustForAbsoluteZoom(rend->clientLeft(), rend);
+        return adjustForAbsoluteZoom(roundToInt(rend->clientLeft()), rend);
     return 0;
 }
 
@@ -381,7 +381,7 @@
     document()->updateLayoutIgnorePendingStylesheets();
 
     if (RenderBox* rend = renderBox())
-        return adjustForAbsoluteZoom(rend->clientTop(), rend);
+        return adjustForAbsoluteZoom(roundToInt(rend->clientTop()), rend);
     return 0;
 }
 
@@ -401,7 +401,7 @@
     }
     
     if (RenderBox* rend = renderBox())
-        return adjustForAbsoluteZoom(rend->clientWidth(), rend);
+        return adjustForAbsoluteZoom(rend->pixelSnappedClientWidth(), rend);
     return 0;
 }
 
@@ -422,7 +422,7 @@
     }
     
     if (RenderBox* rend = renderBox())
-        return adjustForAbsoluteZoom(rend->clientHeight(), rend);
+        return adjustForAbsoluteZoom(rend->pixelSnappedClientHeight(), rend);
     return 0;
 }
 

Modified: branches/subpixellayout/Source/WebCore/html/HTMLImageElement.cpp (113158 => 113159)


--- branches/subpixellayout/Source/WebCore/html/HTMLImageElement.cpp	2012-04-04 10:13:16 UTC (rev 113158)
+++ branches/subpixellayout/Source/WebCore/html/HTMLImageElement.cpp	2012-04-04 10:26:47 UTC (rev 113159)
@@ -222,7 +222,7 @@
         document()->updateLayout();
 
     RenderBox* box = renderBox();
-    return box ? adjustForAbsoluteZoom(box->contentWidth(), box) : 0;
+    return box ? adjustForAbsoluteZoom(box->contentBoxRect().pixelSnappedWidth(), box) : 0;
 }
 
 int HTMLImageElement::height(bool ignorePendingStylesheets)
@@ -245,7 +245,7 @@
         document()->updateLayout();
 
     RenderBox* box = renderBox();
-    return box ? adjustForAbsoluteZoom(box->contentHeight(), box) : 0;
+    return box ? adjustForAbsoluteZoom(box->contentBoxRect().pixelSnappedHeight(), box) : 0;
 }
 
 int HTMLImageElement::naturalWidth() const

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderObject.h (113158 => 113159)


--- branches/subpixellayout/Source/WebCore/rendering/RenderObject.h	2012-04-04 10:13:16 UTC (rev 113158)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderObject.h	2012-04-04 10:26:47 UTC (rev 113159)
@@ -1149,11 +1149,6 @@
     return adjustForAbsoluteZoom(value, renderer->style());
 }
 
-inline int adjustForAbsoluteZoom(FractionalLayoutUnit value, RenderObject* renderer)
-{
-    return adjustForAbsoluteZoom(value.floor(), renderer->style());
-}
-
 inline void adjustFloatQuadForAbsoluteZoom(FloatQuad& quad, RenderObject* renderer)
 {
     float zoom = renderer->style()->effectiveZoom();

Modified: branches/subpixellayout/Source/WebCore/rendering/style/RenderStyle.cpp (113158 => 113159)


--- branches/subpixellayout/Source/WebCore/rendering/style/RenderStyle.cpp	2012-04-04 10:13:16 UTC (rev 113158)
+++ branches/subpixellayout/Source/WebCore/rendering/style/RenderStyle.cpp	2012-04-04 10:26:47 UTC (rev 113159)
@@ -880,7 +880,7 @@
     rareData->m_boxShadow = shadowData;
 }
 
-static RoundedRect::Radii calcRadiiFor(const BorderData& border, LayoutSize size, RenderView* renderView)
+static RoundedRect::Radii calcRadiiFor(const BorderData& border, IntSize size, RenderView* renderView)
 {
     return RoundedRect::Radii(
         IntSize(valueForLength(border.topLeft().width(), size.width(), renderView), 
@@ -927,10 +927,11 @@
 
 RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, RenderView* renderView, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
 {
-    RoundedRect roundedRect(pixelSnappedIntRect(borderRect));
+    IntRect snappedBorderRect(pixelSnappedIntRect(borderRect));
+    RoundedRect roundedRect(snappedBorderRect);
     if (hasBorderRadius()) {
-        RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size(), renderView);
-        radii.scale(calcConstraintScaleFor(pixelSnappedIntRect(borderRect), radii));
+        RoundedRect::Radii radii = calcRadiiFor(surround->border, snappedBorderRect.size(), renderView);
+        radii.scale(calcConstraintScaleFor(snappedBorderRect, radii));
         roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
     }
     return roundedRect;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to