Title: [114470] trunk/Source/WebCore
Revision
114470
Author
[email protected]
Date
2012-04-17 17:30:04 -0700 (Tue, 17 Apr 2012)

Log Message

 2012-04-17  Levi Weintraub  <[email protected]>

Clean up outstanding LayoutUnit misuse in WebCore
https://bugs.webkit.org/show_bug.cgi?id=84209

Reviewed by Eric Seidel.

Small changes to a handful of files to prepare trunk for FractionalLayoutUnits.
For more details, see https://trac.webkit.org/wiki/LayoutUnit

No new tests. No change in behavior.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): minimumValueForLength preserves
sub-pixel precision, so we should avoid unnecessarily using integers.
* platform/graphics/FractionalLayoutPoint.h:
(WebCore::FractionalLayoutPoint::FractionalLayoutPoint): Adding an explicit constructor from
FractionalLayoutSizes. This mirrors a method in IntPoint.
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintBorder): The rects that change come from roundedRects,
which are already pixel-snapped.
* rendering/RenderBoxModelObject.h: Removing a comment that is no longer applicable.
* rendering/RenderTable.cpp:
(WebCore::RenderTable::computeLogicalWidth): Since we layout tables using integers, we
need to explicitly calculate the width to be integral as well to avoid pushing the next element
over by a pixel that we won't later paint with our own box decorations.
* rendering/RenderText.h:
(RenderText): Correcting an unfortunate mismatch between in the return value of linesBoundingBox
between the header and implementation.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::getRoundedBorderFor): We were incorrectly not using the snapped border
rect to pass to calcRadiiFor (which takes an IntRect). Correcting this.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (114469 => 114470)


--- trunk/Source/WebCore/ChangeLog	2012-04-18 00:29:24 UTC (rev 114469)
+++ trunk/Source/WebCore/ChangeLog	2012-04-18 00:30:04 UTC (rev 114470)
@@ -1,3 +1,36 @@
+ 2012-04-17  Levi Weintraub  <[email protected]>
+
+        Clean up outstanding LayoutUnit misuse in WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=84209
+
+        Reviewed by Eric Seidel.
+
+        Small changes to a handful of files to prepare trunk for FractionalLayoutUnits.
+        For more details, see https://trac.webkit.org/wiki/LayoutUnit
+
+        No new tests. No change in behavior.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): minimumValueForLength preserves
+        sub-pixel precision, so we should avoid unnecessarily using integers.
+        * platform/graphics/FractionalLayoutPoint.h:
+        (WebCore::FractionalLayoutPoint::FractionalLayoutPoint): Adding an explicit constructor from
+        FractionalLayoutSizes. This mirrors a method in IntPoint.
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintBorder): The rects that change come from roundedRects,
+        which are already pixel-snapped.
+        * rendering/RenderBoxModelObject.h: Removing a comment that is no longer applicable.
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::computeLogicalWidth): Since we layout tables using integers, we
+        need to explicitly calculate the width to be integral as well to avoid pushing the next element
+        over by a pixel that we won't later paint with our own box decorations.
+        * rendering/RenderText.h:
+        (RenderText): Correcting an unfortunate mismatch between in the return value of linesBoundingBox
+        between the header and implementation.
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::getRoundedBorderFor): We were incorrectly not using the snapped border
+        rect to pass to calcRadiiFor (which takes an IntRect). Correcting this.
+
 2012-04-17  Luke Macpherson  <[email protected]>
 
         Ensure CSSParser member variables are initialized.

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (114469 => 114470)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-04-18 00:29:24 UTC (rev 114469)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-04-18 00:30:04 UTC (rev 114470)
@@ -2240,7 +2240,7 @@
         case CSSPropertyWebkitTransformOrigin: {
             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
             if (renderer) {
-                IntRect box = sizingBox(renderer);
+                LayoutRect box = sizingBox(renderer);
                 RenderView* renderView = m_node->document()->renderView();
                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width(), renderView), style.get()));
                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height(), renderView), style.get()));

Modified: trunk/Source/WebCore/platform/graphics/FractionalLayoutPoint.h (114469 => 114470)


--- trunk/Source/WebCore/platform/graphics/FractionalLayoutPoint.h	2012-04-18 00:29:24 UTC (rev 114469)
+++ trunk/Source/WebCore/platform/graphics/FractionalLayoutPoint.h	2012-04-18 00:30:04 UTC (rev 114470)
@@ -43,6 +43,7 @@
     FractionalLayoutPoint(FractionalLayoutUnit x, FractionalLayoutUnit y) : m_x(x), m_y(y) { }
     FractionalLayoutPoint(const IntPoint& point) : m_x(point.x()), m_y(point.y()) { }
     explicit FractionalLayoutPoint(const FloatPoint& size) : m_x(size.x()), m_y(size.y()) { }
+    explicit FractionalLayoutPoint(const FractionalLayoutSize& size) : m_x(size.width()), m_y(size.height()) { }
 
     static FractionalLayoutPoint zero() { return FractionalLayoutPoint(); }
 

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (114469 => 114470)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2012-04-18 00:29:24 UTC (rev 114469)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2012-04-18 00:30:04 UTC (rev 114470)
@@ -1910,8 +1910,8 @@
                 path.addRect(outerBorder.rect());
 
             if (haveAllDoubleEdges) {
-                LayoutRect innerThirdRect = outerBorder.rect();
-                LayoutRect outerThirdRect = outerBorder.rect();
+                IntRect innerThirdRect = outerBorder.rect();
+                IntRect outerThirdRect = outerBorder.rect();
                 for (int side = BSTop; side <= BSLeft; ++side) {
                     int outerWidth;
                     int innerWidth;

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (114469 => 114470)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2012-04-18 00:29:24 UTC (rev 114469)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2012-04-18 00:30:04 UTC (rev 114470)
@@ -72,7 +72,6 @@
 
     int pixelSnappedOffsetLeft() const { return roundToInt(offsetLeft()); }
     int pixelSnappedOffsetTop() const { return roundToInt(offsetTop()); }
-    // FIXME: The implementation for these functions will change once we move to subpixel layout. See bug 60318.
     int pixelSnappedOffsetWidth() const;
     int pixelSnappedOffsetHeight() const;
 

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (114469 => 114470)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2012-04-18 00:29:24 UTC (rev 114469)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2012-04-18 00:30:04 UTC (rev 114470)
@@ -240,16 +240,16 @@
         }
 
         // Ensure we aren't bigger than our available width.
-        setLogicalWidth(min(availableContentLogicalWidth, maxPreferredLogicalWidth()));
+        setLogicalWidth(min<int>(availableContentLogicalWidth, maxPreferredLogicalWidth()));
     }
 
     // Ensure we aren't smaller than our min preferred width.
-    setLogicalWidth(max(logicalWidth(), minPreferredLogicalWidth()));
+    setLogicalWidth(max<int>(logicalWidth(), minPreferredLogicalWidth()));
 
     // Ensure we aren't smaller than our min-width style.
     Length styleMinLogicalWidth = style()->logicalMinWidth();
     if (styleMinLogicalWidth.isSpecified() && styleMinLogicalWidth.isPositive())
-        setLogicalWidth(max(logicalWidth(), convertStyleLogicalWidthToComputedWidth(styleMinLogicalWidth, availableLogicalWidth)));
+        setLogicalWidth(max<int>(logicalWidth(), convertStyleLogicalWidthToComputedWidth(styleMinLogicalWidth, availableLogicalWidth)));
 
     // Finally, with our true width determined, compute our margins for real.
     setMarginStart(0);

Modified: trunk/Source/WebCore/rendering/RenderText.h (114469 => 114470)


--- trunk/Source/WebCore/rendering/RenderText.h	2012-04-18 00:29:24 UTC (rev 114469)
+++ trunk/Source/WebCore/rendering/RenderText.h	2012-04-18 00:30:04 UTC (rev 114470)
@@ -83,7 +83,7 @@
                            float& beginMaxW, float& endMaxW,
                            float& minW, float& maxW, bool& stripFrontSpaces);
 
-    virtual LayoutRect linesBoundingBox() const;
+    virtual IntRect linesBoundingBox() const;
     LayoutRect linesVisualOverflowBoundingBox() const;
 
     FloatPoint firstRunOrigin() const;

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (114469 => 114470)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2012-04-18 00:29:24 UTC (rev 114469)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2012-04-18 00:30:04 UTC (rev 114470)
@@ -930,7 +930,7 @@
     IntRect snappedBorderRect(pixelSnappedIntRect(borderRect));
     RoundedRect roundedRect(snappedBorderRect);
     if (hasBorderRadius()) {
-        RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size(), renderView);
+        RoundedRect::Radii radii = calcRadiiFor(surround->border, snappedBorderRect.size(), renderView);
         radii.scale(calcConstraintScaleFor(snappedBorderRect, radii));
         roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to