Title: [108708] branches/subpixellayout/Source/WebCore

Diff

Modified: branches/subpixellayout/Source/WebCore/accessibility/AccessibilityObject.cpp (108707 => 108708)


--- branches/subpixellayout/Source/WebCore/accessibility/AccessibilityObject.cpp	2012-02-24 01:48:00 UTC (rev 108707)
+++ branches/subpixellayout/Source/WebCore/accessibility/AccessibilityObject.cpp	2012-02-24 01:56:24 UTC (rev 108708)
@@ -507,7 +507,7 @@
     
     LayoutRect result;
     for (size_t i = 0; i < count; ++i) {
-        LayoutRect r = quads[i].enclosingBoundingBox();
+        IntRect r = quads[i].enclosingBoundingBox();
         if (!r.isEmpty()) {
             if (obj->style()->hasAppearance())
                 obj->theme()->adjustRepaintRect(obj, r);

Modified: branches/subpixellayout/Source/WebCore/platform/mac/ThemeMac.mm (108707 => 108708)


--- branches/subpixellayout/Source/WebCore/platform/mac/ThemeMac.mm	2012-02-24 01:48:00 UTC (rev 108707)
+++ branches/subpixellayout/Source/WebCore/platform/mac/ThemeMac.mm	2012-02-24 01:56:24 UTC (rev 108708)
@@ -211,13 +211,13 @@
     return kThemeStateActive;
 }
 
-static FractionalLayoutRect inflateRect(const WebCore::FractionalLayoutRect& zoomedRect, const WebCore::FractionalLayoutSize& zoomedSize, const int* margins, float zoomFactor)
+static IntRect inflateRect(const WebCore::IntRect& zoomedRect, const WebCore::IntSize& zoomedSize, const int* margins, float zoomFactor)
 {
     // Only do the inflation if the available width/height are too small.  Otherwise try to
     // fit the glow/check space into the available box's width/height.
-    LayoutUnit widthDelta = zoomedRect.width() - (zoomedSize.width() + margins[leftMargin] * zoomFactor + margins[rightMargin] * zoomFactor);
-    LayoutUnit heightDelta = zoomedRect.height() - (zoomedSize.height() + margins[topMargin] * zoomFactor + margins[bottomMargin] * zoomFactor);
-    WebCore::FractionalLayoutRect result(zoomedRect);
+    int widthDelta = zoomedRect.width() - (zoomedSize.width() + margins[leftMargin] * zoomFactor + margins[rightMargin] * zoomFactor);
+    int heightDelta = zoomedRect.height() - (zoomedSize.height() + margins[topMargin] * zoomFactor + margins[bottomMargin] * zoomFactor);
+    WebCore::IntRect result(zoomedRect);
     if (widthDelta < 0) {
         result.setX(result.x() - margins[leftMargin] * zoomFactor);
         result.setWidth(result.width() - widthDelta);
@@ -702,7 +702,7 @@
     }
 }
 
-void ThemeMac::inflateControlPaintRect(ControlPart part, ControlStates states, WebCore::FractionalLayoutRect& zoomedRect, float zoomFactor) const
+void ThemeMac::inflateControlPaintRect(ControlPart part, ControlStates states, WebCore::IntRect& zoomedRect, float zoomFactor) const
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
     switch (part) {
@@ -711,7 +711,7 @@
             // shadow" and the check.  We don't consider this part of the bounds of the control in WebKit.
             NSCell *cell = checkbox(states, zoomedRect, zoomFactor);
             NSControlSize controlSize = [cell controlSize];
-            WebCore::FractionalLayoutSize zoomedSize = checkboxSizes()[controlSize];
+            WebCore::IntSize zoomedSize = checkboxSizes()[controlSize];
             zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
             zoomedSize.setWidth(zoomedSize.width() * zoomFactor);
             zoomedRect = inflateRect(zoomedRect, zoomedSize, checkboxMargins(controlSize), zoomFactor);
@@ -722,7 +722,7 @@
             // shadow".  We don't consider this part of the bounds of the control in WebKit.
             NSCell *cell = radio(states, zoomedRect, zoomFactor);
             NSControlSize controlSize = [cell controlSize];
-            WebCore::FractionalLayoutSize zoomedSize = radioSizes()[controlSize];
+            WebCore::IntSize zoomedSize = radioSizes()[controlSize];
             zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
             zoomedSize.setWidth(zoomedSize.width() * zoomFactor);
             zoomedRect = inflateRect(zoomedRect, zoomedSize, radioMargins(controlSize), zoomFactor);
@@ -736,7 +736,7 @@
 
             // We inflate the rect as needed to account for the Aqua button's shadow.
             if ([cell bezelStyle] == NSRoundedBezelStyle) {
-                WebCore::FractionalLayoutSize zoomedSize = buttonSizes()[controlSize];
+                WebCore::IntSize zoomedSize = buttonSizes()[controlSize];
                 zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
                 zoomedSize.setWidth(zoomedRect.width()); // Buttons don't ever constrain width, so the zoomed width can just be honored.
                 zoomedRect = inflateRect(zoomedRect, zoomedSize, buttonMargins(controlSize), zoomFactor);
@@ -746,7 +746,7 @@
         case InnerSpinButtonPart: {
             static const int stepperMargin[4] = { 0, 0, 0, 0 };
             ControlSize controlSize = controlSizeFromPixelSize(stepperSizes(), zoomedRect.size(), zoomFactor);
-            WebCore::FractionalLayoutSize zoomedSize = stepperSizes()[controlSize];
+            WebCore::IntSize zoomedSize = stepperSizes()[controlSize];
             zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
             zoomedSize.setWidth(zoomedSize.width() * zoomFactor);
             zoomedRect = inflateRect(zoomedRect, zoomedSize, stepperMargin, zoomFactor);

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp (108707 => 108708)


--- branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp	2012-02-24 01:48:00 UTC (rev 108707)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp	2012-02-24 01:56:24 UTC (rev 108708)
@@ -1633,7 +1633,7 @@
     if (!style()->hasAppearance())
         return;
 
-    LayoutRect inflatedRect = borderBoxRect();
+    IntRect inflatedRect = pixelSnappedBorderBoxRect();
     theme()->adjustRepaintRect(this, inflatedRect);
     addVisualOverflow(inflatedRect);
 }

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBox.h (108707 => 108708)


--- branches/subpixellayout/Source/WebCore/rendering/RenderBox.h	2012-02-24 01:48:00 UTC (rev 108707)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBox.h	2012-02-24 01:56:24 UTC (rev 108708)
@@ -126,7 +126,9 @@
     LayoutRect frameRect() const { return m_frameRect; }
     void setFrameRect(const LayoutRect& rect) { m_frameRect = rect; }
 
+    // FIXME: We shouldn't be returning this as a LayoutRect, since it loses its position and won't properly pixel snap.
     LayoutRect borderBoxRect() const { return LayoutRect(0, 0, width(), height()); }
+    IntRect pixelSnappedBorderBoxRect() { return IntRect(IntPoint(), IntSize(m_frameRect.pixelSnappedWidth(), m_frameRect.pixelSnappedHeight())); }
     virtual LayoutRect borderBoundingBox() const { return borderBoxRect(); } 
 
     // The content area of the box (excludes padding and border).

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderLayer.cpp (108707 => 108708)


--- branches/subpixellayout/Source/WebCore/rendering/RenderLayer.cpp	2012-02-24 01:48:00 UTC (rev 108707)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderLayer.cpp	2012-02-24 01:56:24 UTC (rev 108708)
@@ -1867,7 +1867,7 @@
     bool hasVerticalBar = verticalScrollbar();
     bool hasResizer = renderer()->style()->resize() != RESIZE_NONE;
     if ((hasHorizontalBar && hasVerticalBar) || (hasResizer && (hasHorizontalBar || hasVerticalBar)))
-        return cornerRect(this, pixelSnappedIntRect(renderBox()->borderBoxRect()));
+        return cornerRect(this, renderBox()->pixelSnappedBorderBoxRect());
     return IntRect();
 }
 
@@ -2171,7 +2171,7 @@
     if (!box)
         return;
 
-    const IntRect borderBox = pixelSnappedIntRect(box->borderBoxRect());
+    const IntRect borderBox = box->pixelSnappedBorderBoxRect();
     const IntRect& scrollCorner = scrollCornerRect();
     IntRect absBounds(borderBox.location() + offsetFromLayer, borderBox.size());
     if (m_vBar)
@@ -2533,7 +2533,7 @@
     RenderBox* box = renderBox();
     ASSERT(box);
 
-    IntRect absRect = resizerCornerRect(this, pixelSnappedIntRect(box->borderBoxRect()));
+    IntRect absRect = resizerCornerRect(this, box->pixelSnappedBorderBoxRect());
     absRect.moveBy(paintOffset);
     if (!absRect.intersects(damageRect))
         return;
@@ -2588,7 +2588,7 @@
     
     IntRect resizeControlRect;
     if (renderer()->style()->resize() != RESIZE_NONE) {
-        resizeControlRect = resizerCornerRect(this, pixelSnappedIntRect(box->borderBoxRect()));
+        resizeControlRect = resizerCornerRect(this, box->pixelSnappedBorderBoxRect());
         if (resizeControlRect.contains(localPoint))
             return true;
     }

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderLayerBacking.cpp (108707 => 108708)


--- branches/subpixellayout/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-02-24 01:48:00 UTC (rev 108707)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-02-24 01:56:24 UTC (rev 108708)
@@ -488,7 +488,7 @@
     }
     
     if (m_owningLayer->hasTransform()) {
-        const IntRect borderBox = pixelSnappedIntRect(toRenderBox(renderer())->borderBoxRect());
+        const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBoxRect();
 
         // Get layout bounds in the coords of compAncestor to match relativeCompositingBounds.
         IntRect layerBounds = IntRect(delta, borderBox.size());
@@ -1243,7 +1243,7 @@
     bool didAnimateFilter = false;
 #endif
     
-    if (hasTransform && m_graphicsLayer->addAnimation(transformVector, pixelSnappedIntRect(toRenderBox(renderer())->borderBoxRect()).size(), anim, keyframes.animationName(), timeOffset)) {
+    if (hasTransform && m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(), anim, keyframes.animationName(), timeOffset)) {
         didAnimateTransform = true;
         compositor()->didStartAcceleratedAnimation(CSSPropertyWebkitTransform);
     }
@@ -1308,7 +1308,7 @@
             KeyframeValueList transformVector(AnimatedPropertyWebkitTransform);
             transformVector.insert(new TransformAnimationValue(0, &fromStyle->transform()));
             transformVector.insert(new TransformAnimationValue(1, &toStyle->transform()));
-            if (m_graphicsLayer->addAnimation(transformVector, pixelSnappedIntRect(toRenderBox(renderer())->borderBoxRect()).size(), transformAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitTransform), timeOffset)) {
+            if (m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(), transformAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitTransform), timeOffset)) {
                 // To ensure that the correct transform is visible when the animation ends, also set the final transform.
                 updateLayerTransform(toStyle);
                 didAnimateTransform = true;

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderObject.cpp (108707 => 108708)


--- branches/subpixellayout/Source/WebCore/rendering/RenderObject.cpp	2012-02-24 01:48:00 UTC (rev 108707)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderObject.cpp	2012-02-24 01:56:24 UTC (rev 108708)
@@ -1442,10 +1442,10 @@
         LayoutUnit borderRight = isBox() ? toRenderBox(this)->borderRight() : zeroLayoutUnit;
         LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : zeroLayoutUnit;
         LayoutUnit borderWidth = max<LayoutUnit>(-outlineStyle->outlineOffset(), max(borderRight, max<LayoutUnit>(style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max(ow, shadowRight);
-        LayoutRect rightRect(newOutlineBox.x() + min<LayoutUnit>(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth,
+        LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth,
             newOutlineBox.y(),
             width + borderWidth,
-            max<LayoutUnit>(newOutlineBox.height(), oldOutlineBox.height()));
+            max(newOutlineBox.height(), oldOutlineBox.height()));
         LayoutUnit right = min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX());
         if (rightRect.x() < right) {
             rightRect.setWidth(min(rightRect.width(), right - rightRect.x()));
@@ -1462,10 +1462,10 @@
         LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : zeroLayoutUnit;
         LayoutUnit borderHeight = max<LayoutUnit>(-outlineStyle->outlineOffset(), max(borderBottom, max<LayoutUnit>(style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max(ow, shadowBottom);
         LayoutRect bottomRect(newOutlineBox.x(),
-            min<LayoutUnit>(newOutlineBox.maxY(), oldOutlineBox.maxY()) - borderHeight,
-            max<LayoutUnit>(newOutlineBox.width(), oldOutlineBox.width()),
+            min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - borderHeight,
+            max(newOutlineBox.width(), oldOutlineBox.width()),
             height + borderHeight);
-        LayoutUnit bottom = min<LayoutUnit>(newBounds.maxY(), oldBounds.maxY());
+        LayoutUnit bottom = min(newBounds.maxY(), oldBounds.maxY());
         if (bottomRect.y() < bottom) {
             bottomRect.setHeight(min(bottomRect.height(), bottom - bottomRect.y()));
             repaintUsingContainer(repaintContainer, bottomRect);

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderTheme.cpp (108707 => 108708)


--- branches/subpixellayout/Source/WebCore/rendering/RenderTheme.cpp	2012-02-24 01:48:00 UTC (rev 108707)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderTheme.cpp	2012-02-24 01:56:24 UTC (rev 108708)
@@ -664,11 +664,10 @@
     }
 }
 
-void RenderTheme::adjustRepaintRect(const RenderObject* o, LayoutRect& r)
+void RenderTheme::adjustRepaintRect(const RenderObject* o, IntRect& r)
 {
 #if USE(NEW_THEME)
-    IntRect pixelSnappedRect = pixelSnappedIntRect(r);
-    m_theme->inflateControlPaintRect(o->style()->appearance(), controlStatesForRenderer(o), pixelSnappedRect, o->style()->effectiveZoom());
+    m_theme->inflateControlPaintRect(o->style()->appearance(), controlStatesForRenderer(o), r, o->style()->effectiveZoom());
 #endif
 }
 

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderTheme.h (108707 => 108708)


--- branches/subpixellayout/Source/WebCore/rendering/RenderTheme.h	2012-02-24 01:48:00 UTC (rev 108707)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderTheme.h	2012-02-24 01:56:24 UTC (rev 108708)
@@ -114,7 +114,7 @@
 
     // Some controls may spill out of their containers (e.g., the check on an OS X checkbox).  When these controls repaint,
     // the theme needs to communicate this inflated rect to the engine so that it can invalidate the whole control.
-    virtual void adjustRepaintRect(const RenderObject*, LayoutRect&);
+    virtual void adjustRepaintRect(const RenderObject*, IntRect&);
 
     // This method is called whenever a relevant state changes on a particular themed object, e.g., the mouse becomes pressed
     // or a control becomes disabled.

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderThemeMac.h (108707 => 108708)


--- branches/subpixellayout/Source/WebCore/rendering/RenderThemeMac.h	2012-02-24 01:48:00 UTC (rev 108707)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderThemeMac.h	2012-02-24 01:56:24 UTC (rev 108708)
@@ -45,7 +45,7 @@
     // A general method asking if any control tinting is supported at all.
     virtual bool supportsControlTints() const { return true; }
 
-    virtual void adjustRepaintRect(const RenderObject*, LayoutRect&);
+    virtual void adjustRepaintRect(const RenderObject*, IntRect&);
 
     virtual bool isControlStyled(const RenderStyle*, const BorderData&,
                                  const FillLayer&, const Color& backgroundColor) const;
@@ -177,7 +177,7 @@
 private:
     virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width, bool multipleFilesAllowed) const;
 
-    LayoutRect inflateRect(const LayoutRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const;
+    IntRect inflateRect(const IntRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const;
 
     FloatRect convertToPaintingRect(const RenderObject* inputRenderer, const RenderObject* partRenderer, const FloatRect& inputRect, const IntRect& r) const;
     

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderThemeMac.mm (108707 => 108708)


--- branches/subpixellayout/Source/WebCore/rendering/RenderThemeMac.mm	2012-02-24 01:48:00 UTC (rev 108707)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderThemeMac.mm	2012-02-24 01:56:24 UTC (rev 108708)
@@ -500,7 +500,7 @@
     return RenderTheme::isControlStyled(style, border, background, backgroundColor);
 }
 
-void RenderThemeMac::adjustRepaintRect(const RenderObject* o, LayoutRect& r)
+void RenderThemeMac::adjustRepaintRect(const RenderObject* o, IntRect& r)
 {
     ControlPart part = o->style()->appearance();
     
@@ -531,13 +531,13 @@
     }
 }
 
-LayoutRect RenderThemeMac::inflateRect(const LayoutRect& r, const IntSize& size, const int* margins, float zoomLevel) const
+IntRect RenderThemeMac::inflateRect(const IntRect& r, const IntSize& size, const int* margins, float zoomLevel) const
 {
     // Only do the inflation if the available width/height are too small.  Otherwise try to
     // fit the glow/check space into the available box's width/height.
-    LayoutUnit widthDelta = r.width() - (size.width() + margins[leftMargin] * zoomLevel + margins[rightMargin] * zoomLevel);
-    LayoutUnit heightDelta = r.height() - (size.height() + margins[topMargin] * zoomLevel + margins[bottomMargin] * zoomLevel);
-    LayoutRect result(r);
+    int widthDelta = r.width() - (size.width() + margins[leftMargin] * zoomLevel + margins[rightMargin] * zoomLevel);
+    int heightDelta = r.height() - (size.height() + margins[topMargin] * zoomLevel + margins[bottomMargin] * zoomLevel);
+    IntRect result(r);
     if (widthDelta < 0) {
         result.setX(result.x() - margins[leftMargin] * zoomLevel);
         result.setWidth(result.width() - widthDelta);
@@ -970,7 +970,7 @@
     // Now inflate it to account for the shadow.
     IntRect inflatedRect = rect;
     if (rect.height() <= minimumProgressBarHeight(renderObject->style()))
-        inflatedRect = enclosingIntRect(inflateRect(inflatedRect, size, progressBarMargins(controlSize), zoomLevel));
+        inflatedRect = inflateRect(inflatedRect, size, progressBarMargins(controlSize), zoomLevel);
     
     RenderProgress* renderProgress = toRenderProgress(renderObject);
     HIThemeTrackDrawInfo trackInfo;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to