Title: [168601] trunk/Source/WebCore
Revision
168601
Author
za...@apple.com
Date
2014-05-11 12:46:53 -0700 (Sun, 11 May 2014)

Log Message

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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (168600 => 168601)


--- trunk/Source/WebCore/ChangeLog	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/ChangeLog	2014-05-11 19:46:53 UTC (rev 168601)
@@ -1,3 +1,46 @@
+2014-05-11  Zalan Bujtas  <za...@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  <zdober...@igalia.com>
 
         Move Source/WebCore/workers/ code to std::unique_ptr

Modified: trunk/Source/WebCore/css/html.css (168600 => 168601)


--- trunk/Source/WebCore/css/html.css	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/css/html.css	2014-05-11 19:46:53 UTC (rev 168601)
@@ -882,7 +882,7 @@
     /* 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;

Modified: trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp (168600 => 168601)


--- trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp	2014-05-11 19:46:53 UTC (rev 168601)
@@ -863,9 +863,9 @@
     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

Modified: trunk/Source/WebCore/platform/efl/RenderThemeEfl.h (168600 => 168601)


--- trunk/Source/WebCore/platform/efl/RenderThemeEfl.h	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/platform/efl/RenderThemeEfl.h	2014-05-11 19:46:53 UTC (rev 168601)
@@ -129,7 +129,7 @@
     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&);

Modified: trunk/Source/WebCore/platform/gtk/RenderThemeGtk.cpp (168600 => 168601)


--- trunk/Source/WebCore/platform/gtk/RenderThemeGtk.cpp	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/platform/gtk/RenderThemeGtk.cpp	2014-05-11 19:46:53 UTC (rev 168601)
@@ -241,9 +241,9 @@
     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)

Modified: trunk/Source/WebCore/platform/gtk/RenderThemeGtk.h (168600 => 168601)


--- trunk/Source/WebCore/platform/gtk/RenderThemeGtk.h	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/platform/gtk/RenderThemeGtk.h	2014-05-11 19:46:53 UTC (rev 168601)
@@ -138,7 +138,7 @@
     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&);

Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (168600 => 168601)


--- trunk/Source/WebCore/rendering/RenderTheme.cpp	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp	2014-05-11 19:46:53 UTC (rev 168601)
@@ -476,7 +476,7 @@
     // 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:

Modified: trunk/Source/WebCore/rendering/RenderTheme.h (168600 => 168601)


--- trunk/Source/WebCore/rendering/RenderTheme.h	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/rendering/RenderTheme.h	2014-05-11 19:46:53 UTC (rev 168601)
@@ -302,7 +302,7 @@
     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; }

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (168600 => 168601)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.h	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h	2014-05-11 19:46:53 UTC (rev 168601)
@@ -70,7 +70,7 @@
     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;

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (168600 => 168601)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2014-05-11 19:46:53 UTC (rev 168601)
@@ -583,7 +583,7 @@
     }
 }
 
-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 @@
         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);

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (168600 => 168601)


--- trunk/Source/WebCore/rendering/RenderThemeMac.h	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h	2014-05-11 19:46:53 UTC (rev 168601)
@@ -134,7 +134,7 @@
     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)

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (168600 => 168601)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2014-05-11 19:46:53 UTC (rev 168601)
@@ -1267,7 +1267,7 @@
     }
 }
 
-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(),

Modified: trunk/Source/WebCore/rendering/RenderThemeSafari.cpp (168600 => 168601)


--- trunk/Source/WebCore/rendering/RenderThemeSafari.cpp	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/rendering/RenderThemeSafari.cpp	2014-05-11 19:46:53 UTC (rev 168601)
@@ -810,7 +810,7 @@
     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(),

Modified: trunk/Source/WebCore/rendering/RenderThemeSafari.h (168600 => 168601)


--- trunk/Source/WebCore/rendering/RenderThemeSafari.h	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/rendering/RenderThemeSafari.h	2014-05-11 19:46:53 UTC (rev 168601)
@@ -105,7 +105,7 @@
     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&);

Modified: trunk/Source/WebCore/rendering/RenderThemeWin.cpp (168600 => 168601)


--- trunk/Source/WebCore/rendering/RenderThemeWin.cpp	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/rendering/RenderThemeWin.cpp	2014-05-11 19:46:53 UTC (rev 168601)
@@ -794,7 +794,7 @@
 
     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 @@
     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;

Modified: trunk/Source/WebCore/rendering/RenderThemeWin.h (168600 => 168601)


--- trunk/Source/WebCore/rendering/RenderThemeWin.h	2014-05-11 19:10:41 UTC (rev 168600)
+++ trunk/Source/WebCore/rendering/RenderThemeWin.h	2014-05-11 19:46:53 UTC (rev 168601)
@@ -89,7 +89,7 @@
     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&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to