[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mrobinson at webkit.org mrobinson at webkit.org
Wed Dec 22 14:28:54 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 9de15e78ac680fd1d15053df16cc1fafa45e8331
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 11 15:24:11 2010 +0000

    2010-10-11  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Xan Lopez.
    
            [GTK] Search field icons should be centered vertically in the field
            https://bugs.webkit.org/show_bug.cgi?id=47441
    
            Add a pixel dump result which tests the fix.
    
            * platform/gtk/fast/css/text-input-with-webkit-border-radius-expected.checksum: Added.
            * platform/gtk/fast/css/text-input-with-webkit-border-radius-expected.png: Added.
    2010-10-11  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Xan Lopez.
    
            [GTK] Search field icons should be centered vertically in the field
            https://bugs.webkit.org/show_bug.cgi?id=47441
    
            Center search field icons vertically in the search field.
    
            * platform/gtk/RenderThemeGtk.cpp:
            (WebCore::centerRectVerticallyInParentInputElement): Added this helper.
            (WebCore::RenderThemeGtk::paintSearchFieldResultsDecoration): Center the search
            field icon by adjusting its drawing rect relative to the containing search field.
            (WebCore::RenderThemeGtk::paintSearchFieldCancelButton): Ditto.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69495 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index dc412e0..e98b314 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-10-11  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        [GTK] Search field icons should be centered vertically in the field
+        https://bugs.webkit.org/show_bug.cgi?id=47441
+
+        Add a pixel dump result which tests the fix.
+
+        * platform/gtk/fast/css/text-input-with-webkit-border-radius-expected.checksum: Added.
+        * platform/gtk/fast/css/text-input-with-webkit-border-radius-expected.png: Added.
+
 2010-10-10  Antonio Gomes  <agomes at rim.com>
 
         Reviewed by Andreas Kling.
diff --git a/LayoutTests/platform/gtk/fast/css/text-input-with-webkit-border-radius-expected.checksum b/LayoutTests/platform/gtk/fast/css/text-input-with-webkit-border-radius-expected.checksum
new file mode 100644
index 0000000..f16d02c
--- /dev/null
+++ b/LayoutTests/platform/gtk/fast/css/text-input-with-webkit-border-radius-expected.checksum
@@ -0,0 +1 @@
+f194de8858e2cbaf3509b2a198287bce
\ No newline at end of file
diff --git a/LayoutTests/platform/gtk/fast/css/text-input-with-webkit-border-radius-expected.png b/LayoutTests/platform/gtk/fast/css/text-input-with-webkit-border-radius-expected.png
new file mode 100644
index 0000000..d6d021a
Binary files /dev/null and b/LayoutTests/platform/gtk/fast/css/text-input-with-webkit-border-radius-expected.png differ
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ea105bf..02e7595 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-10-11  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        [GTK] Search field icons should be centered vertically in the field
+        https://bugs.webkit.org/show_bug.cgi?id=47441
+
+        Center search field icons vertically in the search field.
+
+        * platform/gtk/RenderThemeGtk.cpp:
+        (WebCore::centerRectVerticallyInParentInputElement): Added this helper.
+        (WebCore::RenderThemeGtk::paintSearchFieldResultsDecoration): Center the search
+        field icon by adjusting its drawing rect relative to the containing search field.
+        (WebCore::RenderThemeGtk::paintSearchFieldCancelButton): Ditto.
+
 2010-10-11  Pavel Podivilov  <podivilov at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/WebCore/platform/gtk/RenderThemeGtk.cpp b/WebCore/platform/gtk/RenderThemeGtk.cpp
index e647eee..e49b0b8 100644
--- a/WebCore/platform/gtk/RenderThemeGtk.cpp
+++ b/WebCore/platform/gtk/RenderThemeGtk.cpp
@@ -498,13 +498,26 @@ void RenderThemeGtk::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector* s
     style->setHeight(Length(size.height(), Fixed));
 }
 
-bool RenderThemeGtk::paintSearchFieldResultsDecoration(RenderObject* o, const PaintInfo& i, const IntRect& rect)
+static IntRect centerRectVerticallyInParentInputElement(RenderObject* object, const IntRect& rect)
 {
-    GraphicsContext* context = i.context;
+    IntRect centeredRect(rect);
+    Node* input = object->node()->shadowAncestorNode(); // Get the renderer of <input> element.
+    if (!input->renderer()->isBox()) 
+        return centeredRect;
 
-    static Image* searchImage = Image::loadPlatformThemeIcon(GTK_STOCK_FIND, rect.width()).releaseRef();
-    context->drawImage(searchImage, DeviceColorSpace, rect);
+    // If possible center the y-coordinate of the rect vertically in the parent input element.
+    // We also add one pixel here to ensure that the y coordinate is rounded up for box heights
+    // that are even, which looks in relation to the box text.
+    IntRect inputContentBox = toRenderBox(input->renderer())->absoluteContentBox();
+    centeredRect.setY(inputContentBox.y() + (inputContentBox.height() - centeredRect.height() + 1) / 2);
+    return centeredRect;
+}
 
+bool RenderThemeGtk::paintSearchFieldResultsDecoration(RenderObject* object, const PaintInfo& i, const IntRect& rect)
+{
+    static Image* searchImage = Image::loadPlatformThemeIcon(GTK_STOCK_FIND, rect.width()).releaseRef();
+    IntRect centeredRect(centerRectVerticallyInParentInputElement(object, rect));
+    i.context->drawImage(searchImage, DeviceColorSpace, centeredRect);
     return false;
 }
 
@@ -519,14 +532,12 @@ void RenderThemeGtk::adjustSearchFieldCancelButtonStyle(CSSStyleSelector* select
     style->setHeight(Length(size.height(), Fixed));
 }
 
-bool RenderThemeGtk::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
+bool RenderThemeGtk::paintSearchFieldCancelButton(RenderObject* object, const PaintInfo& i, const IntRect& rect)
 {
-    GraphicsContext* context = i.context;
-
     // TODO: Brightening up the image on hover is desirable here, I believe.
     static Image* cancelImage = Image::loadPlatformThemeIcon(GTK_STOCK_CLEAR, rect.width()).releaseRef();
-    context->drawImage(cancelImage, DeviceColorSpace, rect);
-
+    IntRect centeredRect(centerRectVerticallyInParentInputElement(object, rect));
+    i.context->drawImage(cancelImage, DeviceColorSpace, centeredRect);
     return false;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list