Subpixel rendering[iOS]: <select> decoration is misaligned when the renderer is on...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 11 May 2014 19:46:53 +0000 (19:46 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 11 May 2014 19:46:53 +0000 (19:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132779
<rdar://problem/16631071>

Reviewed by Simon Fraser.

Push <select> theme decoration's rect to device pixel position to ensure
that the theme bounds are aligned with the renderer's bounds. (in painting terms)
However, as the decoration code paints multiple items, they all need to use snapped
final coordinates for painting : tracked here https://bugs.webkit.org/show_bug.cgi?id=132780
This patch also changes the padding values for <select> [iOS] to compensate for the integer
truncation that happened before subpixel.

Not testable.

* css/html.css:
(select):
* platform/efl/RenderThemeEfl.cpp:
(WebCore::RenderThemeEfl::paintMenuListButtonDecorations):
* platform/efl/RenderThemeEfl.h:
* platform/gtk/RenderThemeGtk.cpp:
(WebCore::RenderThemeGtk::paintMenuListButtonDecorations):
* platform/gtk/RenderThemeGtk.h:
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::paintDecorations):
* rendering/RenderTheme.h:
(WebCore::RenderTheme::paintMenuListButtonDecorations):
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintMenuListButtonDecorations):
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintMenuListButtonDecorations):
* rendering/RenderThemeSafari.cpp:
(WebCore::RenderThemeSafari::paintMenuListButtonDecorations):
* rendering/RenderThemeSafari.h:
* rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::paintMenuList):
(WebCore::RenderThemeWin::paintMenuListButtonDecorations):
* rendering/RenderThemeWin.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168601 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/html.css
Source/WebCore/platform/efl/RenderThemeEfl.cpp
Source/WebCore/platform/efl/RenderThemeEfl.h
Source/WebCore/platform/gtk/RenderThemeGtk.cpp
Source/WebCore/platform/gtk/RenderThemeGtk.h
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeIOS.h
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/rendering/RenderThemeMac.h
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/rendering/RenderThemeSafari.cpp
Source/WebCore/rendering/RenderThemeSafari.h
Source/WebCore/rendering/RenderThemeWin.cpp
Source/WebCore/rendering/RenderThemeWin.h

index 4c8c74e..16fb64c 100644 (file)
@@ -1,3 +1,46 @@
+2014-05-11  Zalan Bujtas  <zalan@apple.com>
+
+        Subpixel rendering[iOS]: <select> decoration is misaligned when the renderer is on subpixel position.
+        https://bugs.webkit.org/show_bug.cgi?id=132779
+        <rdar://problem/16631071>
+
+        Reviewed by Simon Fraser.
+
+        Push <select> theme decoration's rect to device pixel position to ensure
+        that the theme bounds are aligned with the renderer's bounds. (in painting terms)
+        However, as the decoration code paints multiple items, they all need to use snapped 
+        final coordinates for painting : tracked here https://bugs.webkit.org/show_bug.cgi?id=132780
+        This patch also changes the padding values for <select> [iOS] to compensate for the integer
+        truncation that happened before subpixel. 
+
+        Not testable.
+
+        * css/html.css:
+        (select):
+        * platform/efl/RenderThemeEfl.cpp:
+        (WebCore::RenderThemeEfl::paintMenuListButtonDecorations):
+        * platform/efl/RenderThemeEfl.h:
+        * platform/gtk/RenderThemeGtk.cpp:
+        (WebCore::RenderThemeGtk::paintMenuListButtonDecorations):
+        * platform/gtk/RenderThemeGtk.h:
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::paintDecorations):
+        * rendering/RenderTheme.h:
+        (WebCore::RenderTheme::paintMenuListButtonDecorations):
+        * rendering/RenderThemeIOS.h:
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::paintMenuListButtonDecorations):
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::paintMenuListButtonDecorations):
+        * rendering/RenderThemeSafari.cpp:
+        (WebCore::RenderThemeSafari::paintMenuListButtonDecorations):
+        * rendering/RenderThemeSafari.h:
+        * rendering/RenderThemeWin.cpp:
+        (WebCore::RenderThemeWin::paintMenuList):
+        (WebCore::RenderThemeWin::paintMenuListButtonDecorations):
+        * rendering/RenderThemeWin.h:
+
 2014-05-11  Zan Dobersek  <zdobersek@igalia.com>
 
         Move Source/WebCore/workers/ code to std::unique_ptr
index 2c3d0b9..7e862ae 100644 (file)
@@ -882,7 +882,7 @@ select {
     /* We want to be as close to background:transparent as possible without actually being transparent */
     background-color: rgba(255, 255, 255, 0.01);
     font: 11px Helvetica;
-    padding: 0 0.5em 0 0.5em;
+    padding: 0 0.4em 0 0.4em;
 #else
     -webkit-appearance: menulist;
     border: 1px solid;
index 9c04b4e..5ce0efb 100755 (executable)
@@ -863,9 +863,9 @@ void RenderThemeEfl::adjustMenuListButtonStyle(StyleResolver* styleResolver, Ren
     adjustMenuListStyle(styleResolver, style, element);
 }
 
-bool RenderThemeEfl::paintMenuListButtonDecorations(const RenderObject& object, const PaintInfo& info, const IntRect& rect)
+bool RenderThemeEfl::paintMenuListButtonDecorations(const RenderObject& object, const PaintInfo& info, const FloatRect& rect)
 {
-    return paintMenuList(object, info, rect);
+    return paintMenuList(object, info, IntRect(rect));
 }
 
 void RenderThemeEfl::adjustTextFieldStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const
index d3ec757..ba99f26 100644 (file)
@@ -129,7 +129,7 @@ public:
     virtual bool paintMenuList(const RenderObject&, const PaintInfo&, const IntRect&);
 
     virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
-    virtual bool paintMenuListButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&);
+    virtual bool paintMenuListButtonDecorations(const RenderObject&, const PaintInfo&, const FloatRect&);
 
     virtual void adjustSearchFieldResultsDecorationPartStyle(StyleResolver*, RenderStyle*, Element*) const;
     virtual bool paintSearchFieldResultsDecorationPart(const RenderObject&, const PaintInfo&, const IntRect&);
index 020fe4a..51eff24 100644 (file)
@@ -241,9 +241,9 @@ void RenderThemeGtk::adjustMenuListButtonStyle(StyleResolver* styleResolver, Ren
     adjustMenuListStyle(styleResolver, style, e);
 }
 
-bool RenderThemeGtk::paintMenuListButtonDecorations(const RenderObject& object, const PaintInfo& info, const IntRect& rect)
+bool RenderThemeGtk::paintMenuListButtonDecorations(const RenderObject& object, const PaintInfo& info, const FloatRect& rect)
 {
-    return paintMenuList(object, info, rect);
+    return paintMenuList(object, info, IntRect(rect));
 }
 
 bool RenderThemeGtk::paintTextArea(const RenderObject& o, const PaintInfo& i, const IntRect& r)
index 1ca5020..5b52e64 100644 (file)
@@ -138,7 +138,7 @@ protected:
     virtual void adjustMenuListStyle(StyleResolver*, RenderStyle*, Element*) const;
     virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
     virtual bool paintMenuList(const RenderObject&, const PaintInfo&, const IntRect&);
-    virtual bool paintMenuListButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&);
+    virtual bool paintMenuListButtonDecorations(const RenderObject&, const PaintInfo&, const FloatRect&);
 
     virtual void adjustSearchFieldResultsDecorationPartStyle(StyleResolver*, RenderStyle*, Element*) const;
     virtual bool paintSearchFieldResultsDecorationPart(const RenderObject&, const PaintInfo&, const IntRect&);
index 1f04100..c98ab40 100644 (file)
@@ -476,7 +476,7 @@ bool RenderTheme::paintDecorations(const RenderObject& renderer, const PaintInfo
     // Call the appropriate paint method based off the appearance value.
     switch (renderer.style().appearance()) {
     case MenulistButtonPart:
-        return paintMenuListButtonDecorations(renderer, paintInfo, integralSnappedRect);
+        return paintMenuListButtonDecorations(renderer, paintInfo, devicePixelSnappedRect);
     case TextFieldPart:
         return paintTextFieldDecorations(renderer, paintInfo, devicePixelSnappedRect);
     case TextAreaPart:
index 397bd9d..ff753b5 100644 (file)
@@ -302,7 +302,7 @@ protected:
     virtual bool paintMenuListDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
 
     virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
-    virtual bool paintMenuListButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
+    virtual bool paintMenuListButtonDecorations(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; }
 
     virtual bool paintPushButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
     virtual bool paintSquareButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
index 6826a9e..c423008 100644 (file)
@@ -70,7 +70,7 @@ protected:
     virtual bool paintTextAreaDecorations(const RenderObject&, const PaintInfo&, const FloatRect&) override;
 
     virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const override;
-    virtual bool paintMenuListButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) override;
+    virtual bool paintMenuListButtonDecorations(const RenderObject&, const PaintInfo&, const FloatRect&) override;
 
     virtual void adjustSliderTrackStyle(StyleResolver*, RenderStyle*, Element*) const override;
     virtual bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override;
index 8c59dcc..82e1d0c 100644 (file)
@@ -583,7 +583,7 @@ void RenderThemeIOS::adjustMenuListButtonStyle(StyleResolver*, RenderStyle* styl
     }
 }
 
-bool RenderThemeIOS::paintMenuListButtonDecorations(const RenderObject& box, const PaintInfo& paintInfo, const IntRect& rect)
+bool RenderThemeIOS::paintMenuListButtonDecorations(const RenderObject& box, const PaintInfo& paintInfo, const FloatRect& rect)
 {
     RenderStyle& style = box.style();
     float borderTopWidth = style.borderTopWidth();
@@ -637,7 +637,7 @@ bool RenderThemeIOS::paintMenuListButtonDecorations(const RenderObject& box, con
         int count = 3;
         int padding = 3;
 
-        IntRect ellipse(buttonClip.x() + (buttonClip.width() - count * (size + padding) + padding) / 2.0, buttonClip.maxY() - 10.0, size, size);
+        FloatRect ellipse(buttonClip.x() + (buttonClip.width() - count * (size + padding) + padding) / 2.0, buttonClip.maxY() - 10.0, size, size);
 
         for (int i = 0; i < count; ++i) {
             paintInfo.context->drawRaisedEllipse(ellipse, Color::white, ColorSpaceDeviceRGB, Color(0.0f, 0.0f, 0.0f, 0.5f), ColorSpaceDeviceRGB);
index 998e271..8d792b6 100644 (file)
@@ -134,7 +134,7 @@ protected:
     virtual bool paintMenuList(const RenderObject&, const PaintInfo&, const IntRect&);
     virtual void adjustMenuListStyle(StyleResolver*, RenderStyle*, Element*) const;
 
-    virtual bool paintMenuListButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&);
+    virtual bool paintMenuListButtonDecorations(const RenderObject&, const PaintInfo&, const FloatRect&);
     virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
 
 #if ENABLE(PROGRESS_ELEMENT)
index 8429f9b..e3db807 100644 (file)
@@ -1267,7 +1267,7 @@ void RenderThemeMac::paintMenuListButtonGradients(const RenderObject& o, const P
     }
 }
 
-bool RenderThemeMac::paintMenuListButtonDecorations(const RenderObject& renderer, const PaintInfo& paintInfo, const IntRect& rect)
+bool RenderThemeMac::paintMenuListButtonDecorations(const RenderObject& renderer, const PaintInfo& paintInfo, const FloatRect& rect)
 {
     IntRect bounds = IntRect(rect.x() + renderer.style().borderLeftWidth(),
         rect.y() + renderer.style().borderTopWidth(),
index 8329733..eda3f32 100644 (file)
@@ -810,7 +810,7 @@ void RenderThemeSafari::paintMenuListButtonGradients(const RenderObject& o, cons
     paintInfo.context->restore();
 }
 
-bool RenderThemeSafari::paintMenuListButtonDecorations(const RenderObject& renderer, const PaintInfo& paintInfo, const IntRect& rect)
+bool RenderThemeSafari::paintMenuListButtonDecorations(const RenderObject& renderer, const PaintInfo& paintInfo, const FloatRect& rect)
 {
     IntRect bounds = IntRect(rect.x() + renderer.style().borderLeftWidth(),
         rect.y() + renderer.style().borderTopWidth(),
index 1e89fd9..5ee9b4b 100644 (file)
@@ -105,7 +105,7 @@ protected:
     virtual bool paintMenuList(const RenderObject&, const PaintInfo&, const IntRect&);
     virtual void adjustMenuListStyle(StyleResolver*, RenderStyle*, Element*) const;
 
-    virtual bool paintMenuListButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&);
+    virtual bool paintMenuListButtonDecorations(const RenderObject&, const PaintInfo&, const FloatRect&);
     virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
 
     virtual bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&);
index 1b93e02..932eef8 100644 (file)
@@ -794,7 +794,7 @@ bool RenderThemeWin::paintMenuList(const RenderObject& renderer, const PaintInfo
 
     drawControl(paintInfo.context, renderer, theme, ThemeData(part, determineState(renderer)), rect);
     
-    return paintMenuListButtonDecorations(renderer, paintInfo, rect);
+    return paintMenuListButtonDecorations(renderer, paintInfo, FloatRect(rect));
 }
 
 void RenderThemeWin::adjustMenuListStyle(StyleResolver* styleResolver, RenderStyle* style, Element* e) const
@@ -834,7 +834,7 @@ void RenderThemeWin::adjustMenuListButtonStyle(StyleResolver* styleResolver, Ren
     style->setWhiteSpace(PRE);
 }
 
-bool RenderThemeWin::paintMenuListButtonDecorations(const RenderObject& renderer, const PaintInfo& paintInfo, const IntRect& rect)
+bool RenderThemeWin::paintMenuListButtonDecorations(const RenderObject& renderer, const PaintInfo& paintInfo, const FloatRect& rect)
 {
     // FIXME: Don't make hardcoded assumptions about the thickness of the textfield border.
     int borderThickness = haveTheme ? 1 : 2;
index f51426d..feb059f 100644 (file)
@@ -89,7 +89,7 @@ public:
     virtual bool paintMenuList(const RenderObject&, const PaintInfo&, const IntRect&);
     virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
 
-    virtual bool paintMenuListButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&);
+    virtual bool paintMenuListButtonDecorations(const RenderObject&, const PaintInfo&, const FloatRect&);
 
     virtual bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&);
     virtual bool paintSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&);