Title: [100322] branches/subpixellayout/Source/WebCore
Revision
100322
Author
le...@chromium.org
Date
2011-11-15 14:22:40 -0800 (Tue, 15 Nov 2011)

Log Message

Properly bounding CSS lengths to AppUnit's bounds. Rounding instead of truncating offset values.

Modified Paths

Diff

Modified: branches/subpixellayout/Source/WebCore/css/CSSPrimitiveValue.cpp (100321 => 100322)


--- branches/subpixellayout/Source/WebCore/css/CSSPrimitiveValue.cpp	2011-11-15 22:21:46 UTC (rev 100321)
+++ branches/subpixellayout/Source/WebCore/css/CSSPrimitiveValue.cpp	2011-11-15 22:22:40 UTC (rev 100322)
@@ -345,7 +345,7 @@
 template<> Length CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize)
 {
     // FIXME: Length.h no longer expects 28 bit integers, so these bounds should be INT_MAX and INT_MIN
-    return Length(roundForImpreciseConversion<int, intMaxForLength, intMinForLength>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);
+    return Length(roundForImpreciseConversion<int, intMaxForAppUnit, intMinForAppUnit>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);
 }
 
 template<> short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize)

Modified: branches/subpixellayout/Source/WebCore/platform/AppUnit.h (100321 => 100322)


--- branches/subpixellayout/Source/WebCore/platform/AppUnit.h	2011-11-15 22:21:46 UTC (rev 100321)
+++ branches/subpixellayout/Source/WebCore/platform/AppUnit.h	2011-11-15 22:22:40 UTC (rev 100322)
@@ -32,6 +32,8 @@
 namespace WebCore {
 
 static const int kFixedPointDenominator = 60;
+const int intMaxForAppUnit = INT_MAX / kFixedPointDenominator;
+const int intMinForAppUnit = -intMaxForAppUnit;
 
 class AppUnit {
 public:

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBox.h (100321 => 100322)


--- branches/subpixellayout/Source/WebCore/rendering/RenderBox.h	2011-11-15 22:21:46 UTC (rev 100321)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBox.h	2011-11-15 22:22:40 UTC (rev 100322)
@@ -51,6 +51,9 @@
     LayoutUnit width() const { return m_frameRect.width(); }
     LayoutUnit height() const { return m_frameRect.height(); }
 
+    int pixelSnappedWidth() const { return pixelSnappedIntRect(m_frameRect).width(); }
+    int pixelSnappedHeight() const { return pixelSnappedIntRect(m_frameRect).height(); }
+
     // These represent your location relative to your container as a physical offset.
     // In layout related methods you almost always want the logical location (e.g. x() and y()).
     LayoutUnit top() const { return topLeftLocation().y(); }
@@ -180,8 +183,8 @@
 
     // IE extensions. Used to calculate offsetWidth/Height.  Overridden by inlines (RenderFlow)
     // to return the remaining width on a given line (and the height of a single line).
-    virtual int offsetWidth() const { return width(); }
-    virtual int offsetHeight() const { return height(); }
+    virtual int offsetWidth() const { return pixelSnappedWidth(); }
+    virtual int offsetHeight() const { return pixelSnappedHeight(); }
 
     // More IE extensions.  clientWidth and clientHeight represent the interior of an object
     // excluding border and scrollbar.  clientLeft/Top are just the borderLeftWidth and borderTopWidth.

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderInline.h (100321 => 100322)


--- branches/subpixellayout/Source/WebCore/rendering/RenderInline.h	2011-11-15 22:21:46 UTC (rev 100321)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderInline.h	2011-11-15 22:22:40 UTC (rev 100322)
@@ -123,8 +123,8 @@
 
     virtual int offsetLeft() const;
     virtual int offsetTop() const;
-    virtual int offsetWidth() const { return linesBoundingBox().width(); }
-    virtual int offsetHeight() const { return linesBoundingBox().height(); }
+    virtual int offsetWidth() const { return linesBoundingBox().width().ceil(); }
+    virtual int offsetHeight() const { return linesBoundingBox().height().ceil(); }
 
     virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
     virtual LayoutRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, LayoutUnit outlineWidth) const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to