Title: [169928] trunk
Revision
169928
Author
[email protected]
Date
2014-06-12 20:58:46 -0700 (Thu, 12 Jun 2014)

Log Message

Subpixel rendering: Make <input type=> and <button> elements' decoration subpixel aware.
https://bugs.webkit.org/show_bug.cgi?id=133812
<rdar://problem/17286309>

Reviewed by Simon Fraser.

Enable <input type=> and <button> decoration painting on subpixel positions.
The theme size is still integral, but its position is snapped to device pixels.
Theme's label, the InlineTextBox is already subpixel position aware.
webkit.org/b/132005 tracks the rest of the themes.

Source/WebCore:
Not testable.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::boundingBoxForQuads): Keep integral snapping for now.
* platform/Theme.h:
(WebCore::Theme::paint):
(WebCore::Theme::inflateControlPaintRect):
* platform/mac/ThemeMac.h:
* platform/mac/ThemeMac.mm:
(WebCore::inflateRect):
(WebCore::configureToggleButton):
(WebCore::sharedRadioCell):
(WebCore::sharedCheckboxCell):
(WebCore::paintToggleButton):
(WebCore::setUpButtonCell):
(WebCore::button):
(WebCore::paintButton):
(WebCore::paintStepper):
(WebCore::ThemeMac::inflateControlPaintRect):
(WebCore::ThemeMac::paint):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addVisualOverflowFromTheme): Keep integral snapping for now.
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::addRegionsVisualOverflowFromTheme): Keep integral snapping for now.
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::paint):
(WebCore::RenderTheme::adjustRepaintRect):
* rendering/RenderTheme.h:
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::adjustRepaintRect):

LayoutTests:
* platform/mac-mountainlion/compositing/contents-opaque/control-layer-expected.txt:
* platform/mac/compositing/contents-opaque/control-layer-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (169927 => 169928)


--- trunk/LayoutTests/ChangeLog	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/LayoutTests/ChangeLog	2014-06-13 03:58:46 UTC (rev 169928)
@@ -1,3 +1,19 @@
+2014-06-12  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: Make <input type=> and <button> elements' decoration subpixel aware.
+        https://bugs.webkit.org/show_bug.cgi?id=133812
+        <rdar://problem/17286309>
+
+        Reviewed by Simon Fraser.
+
+        Enable <input type=> and <button> decoration painting on subpixel positions.
+        The theme size is still integral, but its position is snapped to device pixels.
+        Theme's label, the InlineTextBox is already subpixel position aware.
+        webkit.org/b/132005 tracks the rest of the themes.
+
+        * platform/mac-mountainlion/compositing/contents-opaque/control-layer-expected.txt:
+        * platform/mac/compositing/contents-opaque/control-layer-expected.txt:
+
 2014-06-12  Carlos Alberto Lopez Perez  <[email protected]>
 
         [GTK] Unreviewed GTK gardening.

Modified: trunk/LayoutTests/platform/mac/compositing/contents-opaque/control-layer-expected.txt (169927 => 169928)


--- trunk/LayoutTests/platform/mac/compositing/contents-opaque/control-layer-expected.txt	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/LayoutTests/platform/mac/compositing/contents-opaque/control-layer-expected.txt	2014-06-13 03:58:46 UTC (rev 169928)
@@ -10,7 +10,7 @@
         (GraphicsLayer
           (position 5.00 6.00)
           (anchor 0.50 0.46)
-          (bounds 128.00 28.00)
+          (bounds 127.00 28.00)
           (drawsContent 1)
         )
       )

Modified: trunk/LayoutTests/platform/mac-mountainlion/compositing/contents-opaque/control-layer-expected.txt (169927 => 169928)


--- trunk/LayoutTests/platform/mac-mountainlion/compositing/contents-opaque/control-layer-expected.txt	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/LayoutTests/platform/mac-mountainlion/compositing/contents-opaque/control-layer-expected.txt	2014-06-13 03:58:46 UTC (rev 169928)
@@ -10,7 +10,7 @@
         (GraphicsLayer
           (position 5.00 6.00)
           (anchor 0.50 0.46)
-          (bounds 129.00 28.00)
+          (bounds 128.00 28.00)
           (drawsContent 1)
         )
       )

Modified: trunk/Source/WebCore/ChangeLog (169927 => 169928)


--- trunk/Source/WebCore/ChangeLog	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/Source/WebCore/ChangeLog	2014-06-13 03:58:46 UTC (rev 169928)
@@ -1,3 +1,48 @@
+2014-06-12  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: Make <input type=> and <button> elements' decoration subpixel aware.
+        https://bugs.webkit.org/show_bug.cgi?id=133812
+        <rdar://problem/17286309>
+
+        Reviewed by Simon Fraser.
+
+        Enable <input type=> and <button> decoration painting on subpixel positions.
+        The theme size is still integral, but its position is snapped to device pixels.
+        Theme's label, the InlineTextBox is already subpixel position aware.
+        webkit.org/b/132005 tracks the rest of the themes.
+
+        Not testable.
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::boundingBoxForQuads): Keep integral snapping for now.
+        * platform/Theme.h:
+        (WebCore::Theme::paint):
+        (WebCore::Theme::inflateControlPaintRect):
+        * platform/mac/ThemeMac.h:
+        * platform/mac/ThemeMac.mm:
+        (WebCore::inflateRect):
+        (WebCore::configureToggleButton):
+        (WebCore::sharedRadioCell):
+        (WebCore::sharedCheckboxCell):
+        (WebCore::paintToggleButton):
+        (WebCore::setUpButtonCell):
+        (WebCore::button):
+        (WebCore::paintButton):
+        (WebCore::paintStepper):
+        (WebCore::ThemeMac::inflateControlPaintRect):
+        (WebCore::ThemeMac::paint):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::addVisualOverflowFromTheme): Keep integral snapping for now.
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::addRegionsVisualOverflowFromTheme): Keep integral snapping for now.
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::paint):
+        (WebCore::RenderTheme::adjustRepaintRect):
+        * rendering/RenderTheme.h:
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::adjustRepaintRect):
+
 2014-06-12  Brent Fulgham  <[email protected]>
 
         [Win] Avoid fork bomb during build

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (169927 => 169928)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2014-06-13 03:58:46 UTC (rev 169928)
@@ -726,16 +726,16 @@
     if (!obj)
         return IntRect();
     
-    IntRect result;
+    FloatRect result;
     for (const auto& quad : quads) {
-        IntRect r = quad.enclosingBoundingBox();
+        FloatRect r = quad.enclosingBoundingBox();
         if (!r.isEmpty()) {
             if (obj->style().hasAppearance())
                 obj->theme().adjustRepaintRect(*obj, r);
             result.unite(r);
         }
     }
-    return result;
+    return pixelSnappedIntRect(LayoutRect(result));
 }
     
 bool AccessibilityObject::press()

Modified: trunk/Source/WebCore/platform/Theme.h (169927 => 169928)


--- trunk/Source/WebCore/platform/Theme.h	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/Source/WebCore/platform/Theme.h	2014-06-13 03:58:46 UTC (rev 169928)
@@ -98,13 +98,13 @@
     virtual bool controlRequiresPreWhiteSpace(ControlPart) const { return false; }
 
     // Method for painting a control. The rect is in zoomed coordinates.
-    virtual void paint(ControlPart, ControlStates*, GraphicsContext*, const IntRect& /*zoomedRect*/, float /*zoomFactor*/, ScrollView*) { }
+    virtual void paint(ControlPart, ControlStates*, GraphicsContext*, const FloatRect& /*zoomedRect*/, float /*zoomFactor*/, ScrollView*) { }
 
     // 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.
     // The rect passed in is in zoomed coordinates, so the inflation should take that into account and make sure the inflation
     // amount is also scaled by the zoomFactor.
-    virtual void inflateControlPaintRect(ControlPart, const ControlStates*, IntRect& /*zoomedRect*/, float /*zoomFactor*/) const { }
+    virtual void inflateControlPaintRect(ControlPart, const ControlStates*, FloatRect& /*zoomedRect*/, float /*zoomFactor*/) const { }
     
     // This method is called once, from RenderTheme::adjustDefaultStyleSheet(), to let each platform adjust
     // the default CSS rules in html.css.

Modified: trunk/Source/WebCore/platform/gtk/RenderThemeGtk.h (169927 => 169928)


--- trunk/Source/WebCore/platform/gtk/RenderThemeGtk.h	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/Source/WebCore/platform/gtk/RenderThemeGtk.h	2014-06-13 03:58:46 UTC (rev 169928)
@@ -55,7 +55,7 @@
     // A general method asking if any control tinting is supported at all.
     virtual bool supportsControlTints() const override { return true; }
 
-    virtual void adjustRepaintRect(const RenderObject&, IntRect&) override;
+    virtual void adjustRepaintRect(const RenderObject&, FloatRect&) override;
 
     // A method to obtain the baseline position for a "leaf" control.  This will only be used if a baseline
     // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of

Modified: trunk/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp (169927 => 169928)


--- trunk/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp	2014-06-13 03:58:46 UTC (rev 169928)
@@ -97,7 +97,7 @@
 }
 #endif
 
-static void adjustRectForFocus(GtkWidget* widget, IntRect& rect, bool ignoreInteriorFocusProperty = false)
+static void adjustRectForFocus(GtkWidget* widget, FloatRect& rect, bool ignoreInteriorFocusProperty = false)
 {
     gint focusWidth, focusPad;
     gboolean interiorFocus = 0;
@@ -110,7 +110,7 @@
     rect.inflate(focusWidth + focusPad);
 }
 
-void RenderThemeGtk::adjustRepaintRect(const RenderObject& renderObject, IntRect& rect)
+void RenderThemeGtk::adjustRepaintRect(const RenderObject& renderObject, FloatRect& rect)
 {
     ControlPart part = renderObject.style().appearance();
     switch (part) {
@@ -187,9 +187,10 @@
     }
 
     if (theme->isFocused(renderObject)) {
-        IntRect focusRect(buttonRect);
+        FloatRect focusRect(buttonRect);
         adjustRectForFocus(widget, focusRect, true);
-        widgetContext.gtkPaintFocus(focusRect, widget, toggleState, detail);
+        // FIXME: adopt device pixel positioned themes.
+        widgetContext.gtkPaintFocus(IntRect(focusRect), widget, toggleState, detail);
     }
 }
 

Modified: trunk/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp (169927 => 169928)


--- trunk/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp	2014-06-13 03:58:46 UTC (rev 169928)
@@ -148,7 +148,7 @@
 }
 #endif
 
-static void adjustRectForFocus(GtkStyleContext* context, IntRect& rect)
+static void adjustRectForFocus(GtkStyleContext* context, FloatRect& rect)
 {
     gint focusWidth, focusPad;
     gtk_style_context_get_style(context,
@@ -157,7 +157,7 @@
     rect.inflate(focusWidth + focusPad);
 }
 
-void RenderThemeGtk::adjustRepaintRect(const RenderObject& renderObject, IntRect& rect)
+void RenderThemeGtk::adjustRepaintRect(const RenderObject& renderObject, FloatRect& rect)
 {
     GtkStyleContext* context = 0;
     bool checkInteriorFocus = false;

Modified: trunk/Source/WebCore/platform/mac/ThemeMac.h (169927 => 169928)


--- trunk/Source/WebCore/platform/mac/ThemeMac.h	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.h	2014-06-13 03:58:46 UTC (rev 169928)
@@ -51,8 +51,8 @@
 
     virtual bool controlRequiresPreWhiteSpace(ControlPart part) const { return part == PushButtonPart; }
 
-    virtual void paint(ControlPart, ControlStates*, GraphicsContext*, const IntRect&, float zoomFactor, ScrollView*) override;
-    virtual void inflateControlPaintRect(ControlPart, const ControlStates*, IntRect&, float zoomFactor) const;
+    virtual void paint(ControlPart, ControlStates*, GraphicsContext*, const FloatRect&, float zoomFactor, ScrollView*) override;
+    virtual void inflateControlPaintRect(ControlPart, const ControlStates*, FloatRect&, float zoomFactor) const;
 
     // FIXME: Once RenderThemeMac is converted over to use Theme then this can be internal to ThemeMac.
     static NSView* ensuredView(ScrollView*, const ControlStates*);

Modified: trunk/Source/WebCore/platform/mac/ThemeMac.mm (169927 => 169928)


--- trunk/Source/WebCore/platform/mac/ThemeMac.mm	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.mm	2014-06-13 03:58:46 UTC (rev 169928)
@@ -252,13 +252,13 @@
     return kThemeStateActive;
 }
 
-static IntRect inflateRect(const IntRect& zoomedRect, const IntSize& zoomedSize, const int* margins, float zoomFactor)
+static FloatRect inflateRect(const FloatRect& zoomedRect, const 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.
     int widthDelta = zoomedRect.width() - (zoomedSize.width() + margins[leftMargin] * zoomFactor + margins[rightMargin] * zoomFactor);
     int heightDelta = zoomedRect.height() - (zoomedSize.height() + margins[topMargin] * zoomFactor + margins[bottomMargin] * zoomFactor);
-    IntRect result(zoomedRect);
+    FloatRect result(zoomedRect);
     if (widthDelta < 0) {
         result.setX(result.x() - margins[leftMargin] * zoomFactor);
         result.setWidth(result.width() - widthDelta);
@@ -350,10 +350,10 @@
     return sizeFromFont(font, zoomedSize, zoomFactor, radioSizes());
 }
     
-static void configureToggleButton(NSCell* cell, ControlPart buttonType, const ControlStates* states, const IntRect& zoomedRect, float zoomFactor, bool isStateChange)
+static void configureToggleButton(NSCell* cell, ControlPart buttonType, const ControlStates* states, const IntSize& zoomedSize, float zoomFactor, bool isStateChange)
 {
     // Set the control size based off the rectangle we're painting into.
-    setControlSize(cell, buttonType == CheckboxPart ? checkboxSizes() : radioSizes(), zoomedRect.size(), zoomFactor);
+    setControlSize(cell, buttonType == CheckboxPart ? checkboxSizes() : radioSizes(), zoomedSize, zoomFactor);
 
     // Update the various states we respond to.
     updateStates(cell, states, isStateChange);
@@ -376,23 +376,23 @@
     return toggleButtonCell;
 }
     
-static NSButtonCell *sharedRadioCell(const ControlStates* states, const IntRect& zoomedRect, float zoomFactor)
+static NSButtonCell *sharedRadioCell(const ControlStates* states, const IntSize& zoomedSize, float zoomFactor)
 {
     static NSButtonCell *radioCell;
     if (!radioCell)
         radioCell = createToggleButtonCell(RadioPart);
 
-    configureToggleButton(radioCell, RadioPart, states, zoomedRect, zoomFactor, false);
+    configureToggleButton(radioCell, RadioPart, states, zoomedSize, zoomFactor, false);
     return radioCell;
 }
     
-static NSButtonCell *sharedCheckboxCell(const ControlStates* states, const IntRect& zoomedRect, float zoomFactor)
+static NSButtonCell *sharedCheckboxCell(const ControlStates* states, const IntSize& zoomedSize, float zoomFactor)
 {
     static NSButtonCell *checkboxCell;
     if (!checkboxCell)
         checkboxCell = createToggleButtonCell(CheckboxPart);
 
-    configureToggleButton(checkboxCell, CheckboxPart, states, zoomedRect, zoomFactor, false);
+    configureToggleButton(checkboxCell, CheckboxPart, states, zoomedSize, zoomFactor, false);
     return checkboxCell;
 }
 
@@ -402,26 +402,27 @@
     return false;
 }
 
-static void paintToggleButton(ControlPart buttonType, ControlStates* controlStates, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView)
+static void paintToggleButton(ControlPart buttonType, ControlStates* controlStates, GraphicsContext* context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
 
     NSButtonCell *toggleButtonCell = static_cast<NSButtonCell*>(controlStates->platformControl());
+    IntSize zoomedRectSize = IntSize(zoomedRect.size());
 
     if (controlStates->isDirty()) {
         if (!toggleButtonCell)
             toggleButtonCell = createToggleButtonCell(buttonType);
-        configureToggleButton(toggleButtonCell, buttonType, controlStates, zoomedRect, zoomFactor, true);
+        configureToggleButton(toggleButtonCell, buttonType, controlStates, zoomedRectSize, zoomFactor, true);
     } else {
         if (!toggleButtonCell) {
             if (buttonType == CheckboxPart)
-                toggleButtonCell = sharedCheckboxCell(controlStates, zoomedRect, zoomFactor);
+                toggleButtonCell = sharedCheckboxCell(controlStates, zoomedRectSize, zoomFactor);
             else {
                 ASSERT(buttonType == RadioPart);
-                toggleButtonCell = sharedRadioCell(controlStates, zoomedRect, zoomFactor);
+                toggleButtonCell = sharedRadioCell(controlStates, zoomedRectSize, zoomFactor);
             }
         }
-        configureToggleButton(toggleButtonCell, buttonType, controlStates, zoomedRect, zoomFactor, false);
+        configureToggleButton(toggleButtonCell, buttonType, controlStates, zoomedRectSize, zoomFactor, false);
     }
     controlStates->setDirty(false);
 
@@ -432,7 +433,7 @@
     zoomedSize.setWidth(zoomedSize.width() * zoomFactor);
     zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
     const int* controlMargins = buttonType == CheckboxPart ? checkboxMargins(controlSize) : radioMargins(controlSize);
-    IntRect inflatedRect = inflateRect(zoomedRect, zoomedSize, controlMargins, zoomFactor);
+    FloatRect inflatedRect = inflateRect(zoomedRect, zoomedSize, controlMargins, zoomFactor);
 
     if (zoomFactor != 1.0f) {
         inflatedRect.setWidth(inflatedRect.width() / zoomFactor);
@@ -509,24 +510,24 @@
     return cell;
 }
 
-static void setUpButtonCell(NSButtonCell *cell, ControlPart part, const ControlStates* states, const IntRect& zoomedRect, float zoomFactor)
+static void setUpButtonCell(NSButtonCell *cell, ControlPart part, const ControlStates* states, const IntSize& zoomedSize, float zoomFactor)
 {
     // Set the control size based off the rectangle we're painting into.
     const std::array<IntSize, 3>& sizes = buttonSizes();
-    if (part == SquareButtonPart || zoomedRect.height() > buttonSizes()[NSRegularControlSize].height() * zoomFactor) {
+    if (part == SquareButtonPart || zoomedSize.height() > buttonSizes()[NSRegularControlSize].height() * zoomFactor) {
         // Use the square button
         if ([cell bezelStyle] != NSShadowlessSquareBezelStyle)
             [cell setBezelStyle:NSShadowlessSquareBezelStyle];
     } else if ([cell bezelStyle] != NSRoundedBezelStyle)
         [cell setBezelStyle:NSRoundedBezelStyle];
 
-    setControlSize(cell, sizes, zoomedRect.size(), zoomFactor);
+    setControlSize(cell, sizes, zoomedSize, zoomFactor);
 
     // Update the various states we respond to.
     updateStates(cell, states);
 }
 
-static NSButtonCell *button(ControlPart part, const ControlStates* controlStates, const IntRect& zoomedRect, float zoomFactor)
+static NSButtonCell *button(ControlPart part, const ControlStates* controlStates, const IntSize& zoomedSize, float zoomFactor)
 {
     ControlStates::States states = controlStates->states();
     NSButtonCell *cell;
@@ -537,24 +538,24 @@
         static NSButtonCell *normalCell = leakButtonCell(NormalButtonCell);
         cell = normalCell;
     }
-    setUpButtonCell(cell, part, controlStates, zoomedRect, zoomFactor);
+    setUpButtonCell(cell, part, controlStates, zoomedSize, zoomFactor);
     return cell;
 }
 
-static void paintButton(ControlPart part, ControlStates* controlStates, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView)
+static void paintButton(ControlPart part, ControlStates* controlStates, GraphicsContext* context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
     
     // Determine the width and height needed for the control and prepare the cell for painting.
     ControlStates::States states = controlStates->states();
-    NSButtonCell *buttonCell = button(part, controlStates, zoomedRect, zoomFactor);
+    NSButtonCell *buttonCell = button(part, controlStates, IntSize(zoomedRect.size()), zoomFactor);
     GraphicsContextStateSaver stateSaver(*context);
 
     NSControlSize controlSize = [buttonCell controlSize];
     IntSize zoomedSize = buttonSizes()[controlSize];
     zoomedSize.setWidth(zoomedRect.width()); // Buttons don't ever constrain width, so the zoomed width can just be honored.
     zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
-    IntRect inflatedRect = zoomedRect;
+    FloatRect inflatedRect = zoomedRect;
     if ([buttonCell bezelStyle] == NSRoundedBezelStyle) {
         // Center the button within the available space.
         if (inflatedRect.height() > zoomedSize.height()) {
@@ -620,7 +621,7 @@
     return NSMiniControlSize;
 }
 
-static void paintStepper(ControlStates* states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView*)
+static void paintStepper(ControlStates* states, GraphicsContext* context, const FloatRect& zoomedRect, float zoomFactor, ScrollView*)
 {
     // We don't use NSStepperCell because there are no ways to draw an
     // NSStepperCell with the up button highlighted.
@@ -629,7 +630,7 @@
     drawInfo.version = 0;
     drawInfo.state = convertControlStatesToThemeDrawState(kThemeIncDecButton, states);
     drawInfo.adornment = kThemeAdornmentDefault;
-    ControlSize controlSize = controlSizeFromPixelSize(stepperSizes(), zoomedRect.size(), zoomFactor);
+    ControlSize controlSize = controlSizeFromPixelSize(stepperSizes(), IntSize(zoomedRect.size()), zoomFactor);
     if (controlSize == NSSmallControlSize)
         drawInfo.kind = kThemeIncDecButtonSmall;
     else if (controlSize == NSMiniControlSize)
@@ -774,14 +775,15 @@
     }
 }
 
-void ThemeMac::inflateControlPaintRect(ControlPart part, const ControlStates* states, IntRect& zoomedRect, float zoomFactor) const
+void ThemeMac::inflateControlPaintRect(ControlPart part, const ControlStates* states, FloatRect& zoomedRect, float zoomFactor) const
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
+    IntSize zoomRectSize = IntSize(zoomedRect.size());
     switch (part) {
         case CheckboxPart: {
             // We inflate the rect as needed to account for padding included in the cell to accommodate the checkbox
             // shadow" and the check.  We don't consider this part of the bounds of the control in WebKit.
-            NSCell *cell = sharedCheckboxCell(states, zoomedRect, zoomFactor);
+            NSCell *cell = sharedCheckboxCell(states, zoomRectSize, zoomFactor);
             NSControlSize controlSize = [cell controlSize];
             IntSize zoomedSize = checkboxSizes()[controlSize];
             zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
@@ -792,7 +794,7 @@
         case RadioPart: {
             // We inflate the rect as needed to account for padding included in the cell to accommodate the radio button
             // shadow".  We don't consider this part of the bounds of the control in WebKit.
-            NSCell *cell = sharedRadioCell(states, zoomedRect, zoomFactor);
+            NSCell *cell = sharedRadioCell(states, zoomRectSize, zoomFactor);
             NSControlSize controlSize = [cell controlSize];
             IntSize zoomedSize = radioSizes()[controlSize];
             zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
@@ -803,7 +805,7 @@
         case PushButtonPart:
         case DefaultButtonPart:
         case ButtonPart: {
-            NSButtonCell *cell = button(part, states, zoomedRect, zoomFactor);
+            NSButtonCell *cell = button(part, states, zoomRectSize, zoomFactor);
             NSControlSize controlSize = [cell controlSize];
 
             // We inflate the rect as needed to account for the Aqua button's shadow.
@@ -817,7 +819,7 @@
         }
         case InnerSpinButtonPart: {
             static const int stepperMargin[4] = { 0, 0, 0, 0 };
-            ControlSize controlSize = controlSizeFromPixelSize(stepperSizes(), zoomedRect.size(), zoomFactor);
+            ControlSize controlSize = controlSizeFromPixelSize(stepperSizes(), zoomRectSize, zoomFactor);
             IntSize zoomedSize = stepperSizes()[controlSize];
             zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
             zoomedSize.setWidth(zoomedSize.width() * zoomFactor);
@@ -830,7 +832,7 @@
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
-void ThemeMac::paint(ControlPart part, ControlStates* states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView)
+void ThemeMac::paint(ControlPart part, ControlStates* states, GraphicsContext* context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView)
 {
     switch (part) {
         case CheckboxPart:

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (169927 => 169928)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2014-06-13 03:58:46 UTC (rev 169928)
@@ -1171,9 +1171,9 @@
     if (!style().hasAppearance())
         return;
 
-    IntRect inflatedRect = pixelSnappedBorderBoxRect();
+    FloatRect inflatedRect = borderBoxRect();
     theme().adjustRepaintRect(*this, inflatedRect);
-    addVisualOverflow(inflatedRect);
+    addVisualOverflow(pixelSnappedIntRect(LayoutRect(inflatedRect)));
 
     if (RenderFlowThread* flowThread = flowThreadContainingBlock())
         flowThread->addRegionsVisualOverflowFromTheme(this);

Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (169927 => 169928)


--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2014-06-13 03:58:46 UTC (rev 169928)
@@ -1381,10 +1381,10 @@
         LayoutRect borderBox = block->borderBoxRectInRegion(region);
         borderBox = region->rectFlowPortionForBox(block, borderBox);
 
-        IntRect inflatedRect = pixelSnappedIntRect(borderBox);
+        FloatRect inflatedRect = borderBox;
         block->theme().adjustRepaintRect(*block, inflatedRect);
 
-        region->addVisualOverflowForBox(block, inflatedRect);
+        region->addVisualOverflowForBox(block, pixelSnappedIntRect(LayoutRect(inflatedRect)));
         if (region == endRegion)
             break;
     }

Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (169927 => 169928)


--- trunk/Source/WebCore/rendering/RenderTheme.cpp	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp	2014-06-13 03:58:46 UTC (rev 169928)
@@ -290,7 +290,7 @@
     case ButtonPart:
     case InnerSpinButtonPart:
         updateControlStatesForRenderer(o, controlStates);
-        m_theme->paint(part, controlStates, const_cast<GraphicsContext*>(paintInfo.context), integralSnappedRect, o.style().effectiveZoom(), &o.view().frameView());
+        m_theme->paint(part, controlStates, const_cast<GraphicsContext*>(paintInfo.context), devicePixelSnappedRect, o.style().effectiveZoom(), &o.view().frameView());
         return false;
     default:
         break;
@@ -720,14 +720,14 @@
     }
 }
 
-void RenderTheme::adjustRepaintRect(const RenderObject& o, IntRect& r)
+void RenderTheme::adjustRepaintRect(const RenderObject& renderer, FloatRect& rect)
 {
 #if USE(NEW_THEME)
-    ControlStates states(extractControlStatesForRenderer(o));
-    m_theme->inflateControlPaintRect(o.style().appearance(), &states, r, o.style().effectiveZoom());
+    ControlStates states(extractControlStatesForRenderer(renderer));
+    m_theme->inflateControlPaintRect(renderer.style().appearance(), &states, rect, renderer.style().effectiveZoom());
 #else
-    UNUSED_PARAM(o);
-    UNUSED_PARAM(r);
+    UNUSED_PARAM(renderer);
+    UNUSED_PARAM(rect);
 #endif
 }
 

Modified: trunk/Source/WebCore/rendering/RenderTheme.h (169927 => 169928)


--- trunk/Source/WebCore/rendering/RenderTheme.h	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/Source/WebCore/rendering/RenderTheme.h	2014-06-13 03:58:46 UTC (rev 169928)
@@ -124,7 +124,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&, IntRect&);
+    virtual void adjustRepaintRect(const RenderObject&, FloatRect&);
 
     // 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: trunk/Source/WebCore/rendering/RenderThemeMac.h (169927 => 169928)


--- trunk/Source/WebCore/rendering/RenderThemeMac.h	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h	2014-06-13 03:58:46 UTC (rev 169928)
@@ -49,7 +49,7 @@
     // A general method asking if any control tinting is supported at all.
     virtual bool supportsControlTints() const override { return true; }
 
-    virtual void adjustRepaintRect(const RenderObject&, IntRect&) override;
+    virtual void adjustRepaintRect(const RenderObject&, FloatRect&) override;
 
     virtual bool isControlStyled(const RenderStyle*, const BorderData&, const FillLayer&, const Color& backgroundColor) const override;
 

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (169927 => 169928)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2014-06-13 01:53:42 UTC (rev 169927)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2014-06-13 03:58:46 UTC (rev 169928)
@@ -633,9 +633,9 @@
     return result;
 }
 
-void RenderThemeMac::adjustRepaintRect(const RenderObject& o, IntRect& r)
+void RenderThemeMac::adjustRepaintRect(const RenderObject& renderer, FloatRect& rect)
 {
-    ControlPart part = o.style().appearance();
+    ControlPart part = renderer.style().appearance();
 
 #if USE(NEW_THEME)
     switch (part) {
@@ -646,20 +646,20 @@
         case DefaultButtonPart:
         case ButtonPart:
         case InnerSpinButtonPart:
-            return RenderTheme::adjustRepaintRect(o, r);
+            return RenderTheme::adjustRepaintRect(renderer, rect);
         default:
             break;
     }
 #endif
 
-    float zoomLevel = o.style().effectiveZoom();
+    float zoomLevel = renderer.style().effectiveZoom();
 
     if (part == MenulistPart) {
-        setPopupButtonCellState(o, r.size());
+        setPopupButtonCellState(renderer, IntSize(rect.size()));
         IntSize size = popupButtonSizes()[[popupButton() controlSize]];
         size.setHeight(size.height() * zoomLevel);
-        size.setWidth(r.width());
-        r = IntRect(inflateRect(r, size, popupButtonMargins(), zoomLevel));
+        size.setWidth(rect.width());
+        rect = inflateRect(rect, size, popupButtonMargins(), zoomLevel);
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to