Title: [115672] trunk/Source
Revision
115672
Author
[email protected]
Date
2012-04-30 14:41:19 -0700 (Mon, 30 Apr 2012)

Log Message

[gtk, qt, chromium, win] Fix usage of LayoutUnits and rounding in platform code
https://bugs.webkit.org/show_bug.cgi?id=85222

Reviewed by Eric Seidel.

Update platform code to use the pixel snapped values for painting rects
to line up with device pixels and change platform specific hit testing
code to use roundedPoint as hit testing is still mostly done on integer
bounds.

Source/WebCore: 

No new tests, no change in functionality.

* platform/qt/RenderThemeQt.cpp:
(WebCore::RenderThemeQt::paintMediaVolumeSliderTrack):
* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenuWin::paint):
* rendering/RenderThemeChromiumSkia.cpp:
(WebCore::RenderThemeChromiumSkia::paintSearchFieldCancelButton):
(WebCore::RenderThemeChromiumSkia::paintSearchFieldResultsDecoration):
(WebCore::RenderThemeChromiumSkia::paintSearchFieldResultsButton):

Source/WebKit/gtk: 

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::mouseDidMoveOverElement):
* webkit/webkithittestresult.cpp:
(WebKit::kit):
* webkit/webkitwebview.cpp:
(getLocationForKeyboardGeneratedContextMenu):
(webkit_web_view_query_tooltip):

Source/WebKit2: 

* WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp:
(WebKit::WebPopupMenu::setUpPlatformData):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (115671 => 115672)


--- trunk/Source/WebCore/ChangeLog	2012-04-30 21:38:59 UTC (rev 115671)
+++ trunk/Source/WebCore/ChangeLog	2012-04-30 21:41:19 UTC (rev 115672)
@@ -1,3 +1,26 @@
+2012-04-30  Emil A Eklund  <[email protected]>
+
+        [gtk, qt, chromium, win] Fix usage of LayoutUnits and rounding in platform code
+        https://bugs.webkit.org/show_bug.cgi?id=85222
+
+        Reviewed by Eric Seidel.
+
+        Update platform code to use the pixel snapped values for painting rects
+        to line up with device pixels and change platform specific hit testing
+        code to use roundedPoint as hit testing is still mostly done on integer
+        bounds.
+
+        No new tests, no change in functionality.
+
+        * platform/qt/RenderThemeQt.cpp:
+        (WebCore::RenderThemeQt::paintMediaVolumeSliderTrack):
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenuWin::paint):
+        * rendering/RenderThemeChromiumSkia.cpp:
+        (WebCore::RenderThemeChromiumSkia::paintSearchFieldCancelButton):
+        (WebCore::RenderThemeChromiumSkia::paintSearchFieldResultsDecoration):
+        (WebCore::RenderThemeChromiumSkia::paintSearchFieldResultsButton):
+
 2012-04-30  Kentaro Hara  <[email protected]>
 
         [V8][JSC] Remove hard-coded "Not enough arguments" errors

Modified: trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp (115671 => 115672)


--- trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp	2012-04-30 21:38:59 UTC (rev 115671)
+++ trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp	2012-04-30 21:41:19 UTC (rev 115672)
@@ -737,7 +737,7 @@
     if (!o->isSlider())
         return false;
 
-    IntRect b = toRenderBox(o)->contentBoxRect();
+    IntRect b = pixelSnappedIntRect(toRenderBox(o)->contentBoxRect());
 
     // Position the outer rectangle
     int top = r.y() + b.y();

Modified: trunk/Source/WebCore/platform/win/PopupMenuWin.cpp (115671 => 115672)


--- trunk/Source/WebCore/platform/win/PopupMenuWin.cpp	2012-04-30 21:38:59 UTC (rev 115671)
+++ trunk/Source/WebCore/platform/win/PopupMenuWin.cpp	2012-04-30 21:41:19 UTC (rev 115672)
@@ -655,7 +655,7 @@
         if (itemStyle.isVisible()) {
             int textX = max<int>(0, client()->clientPaddingLeft() - client()->clientInsetLeft());
             if (RenderTheme::defaultTheme()->popupOptionSupportsTextIndent() && itemStyle.textDirection() == LTR)
-                textX += minimumValueForLength(itemStyle.textIndent(), itemRect.width());
+                textX += minimumIntValueForLength(itemStyle.textIndent(), itemRect.width());
             int textY = itemRect.y() + itemFont.fontMetrics().ascent() + (itemRect.height() - itemFont.fontMetrics().height()) / 2;
             context.drawBidiText(itemFont, textRun, IntPoint(textX, textY));
         }

Modified: trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp (115671 => 115672)


--- trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp	2012-04-30 21:38:59 UTC (rev 115671)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp	2012-04-30 21:41:19 UTC (rev 115672)
@@ -283,7 +283,7 @@
     LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
 
     // Make sure the scaled button stays square and will fit in its parent's box.
-    LayoutUnit cancelButtonSize = std::min(inputContentBox.width(), std::min(inputContentBox.height(), r.height()));
+    LayoutUnit cancelButtonSize = std::min(inputContentBox.width(), std::min<LayoutUnit>(inputContentBox.height(), r.height()));
     // Calculate cancel button's coordinates relative to the input element.
     // Center the button vertically.  Round up though, so if it has to be one pixel off-center, it will
     // be one pixel closer to the bottom of the field.  This tends to look better with the text.
@@ -326,7 +326,7 @@
     LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
 
     // Make sure the scaled decoration stays square and will fit in its parent's box.
-    LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min(inputContentBox.height(), r.height()));
+    LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min<LayoutUnit>(inputContentBox.height(), r.height()));
     // Calculate decoration's coordinates relative to the input element.
     // Center the decoration vertically.  Round up though, so if it has to be one pixel off-center, it will
     // be one pixel closer to the bottom of the field.  This tends to look better with the text.
@@ -361,7 +361,7 @@
     LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
 
     // Make sure the scaled decoration will fit in its parent's box.
-    LayoutUnit magnifierHeight = std::min(inputContentBox.height(), r.height());
+    LayoutUnit magnifierHeight = std::min<LayoutUnit>(inputContentBox.height(), r.height());
     LayoutUnit magnifierWidth = std::min<LayoutUnit>(inputContentBox.width(), magnifierHeight * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize);
     LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
                              inputContentBox.y() + (inputContentBox.height() - magnifierHeight + 1) / 2,

Modified: trunk/Source/WebKit/gtk/ChangeLog (115671 => 115672)


--- trunk/Source/WebKit/gtk/ChangeLog	2012-04-30 21:38:59 UTC (rev 115671)
+++ trunk/Source/WebKit/gtk/ChangeLog	2012-04-30 21:41:19 UTC (rev 115672)
@@ -1,3 +1,23 @@
+2012-04-30  Emil A Eklund  <[email protected]>
+
+        [gtk, qt, chromium, win] Fix usage of LayoutUnits and rounding in platform code
+        https://bugs.webkit.org/show_bug.cgi?id=85222
+
+        Reviewed by Eric Seidel.
+
+        Update platform code to use the pixel snapped values for painting rects
+        to line up with device pixels and change platform specific hit testing
+        code to use roundedPoint as hit testing is still mostly done on integer
+        bounds.
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::mouseDidMoveOverElement):
+        * webkit/webkithittestresult.cpp:
+        (WebKit::kit):
+        * webkit/webkitwebview.cpp:
+        (getLocationForKeyboardGeneratedContextMenu):
+        (webkit_web_view_query_tooltip):
+
 2012-04-30  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Update NEWS and configure.ac for 1.9.1 release

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp (115671 => 115672)


--- trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp	2012-04-30 21:38:59 UTC (rev 115671)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp	2012-04-30 21:41:19 UTC (rev 115672)
@@ -750,7 +750,7 @@
     if (Node* node = hit.innerNonSharedNode()) {
         Frame* frame = node->document()->frame();
         FrameView* view = frame ? frame->view() : 0;
-        m_webView->priv->tooltipArea = view ? view->contentsToWindow(node->getRect()) : IntRect();
+        m_webView->priv->tooltipArea = view ? view->contentsToWindow(node->getPixelSnappedRect()) : IntRect();
     } else
         m_webView->priv->tooltipArea = IntRect();
 }

Modified: trunk/Source/WebKit/gtk/webkit/webkithittestresult.cpp (115671 => 115672)


--- trunk/Source/WebKit/gtk/webkit/webkithittestresult.cpp	2012-04-30 21:38:59 UTC (rev 115671)
+++ trunk/Source/WebKit/gtk/webkit/webkithittestresult.cpp	2012-04-30 21:41:19 UTC (rev 115672)
@@ -318,9 +318,9 @@
     targetFrame = result.targetFrame();
     if (targetFrame && targetFrame->view()) {
         // Convert document coords to widget coords.
-        point = targetFrame->view()->contentsToWindow(result.point());
+        point = targetFrame->view()->contentsToWindow(result.roundedPoint());
     } else
-        point = result.point();
+        point = result.roundedPoint();
 
     return WEBKIT_HIT_TEST_RESULT(g_object_new(WEBKIT_TYPE_HIT_TEST_RESULT,
                                                "link-uri", linkURI.get(),

Modified: trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp (115671 => 115672)


--- trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp	2012-04-30 21:38:59 UTC (rev 115671)
+++ trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp	2012-04-30 21:41:19 UTC (rev 115672)
@@ -433,7 +433,7 @@
     if (!selection->selection().isNonOrphanedCaretOrRange()
          || (selection->selection().isCaret() && !selection->selection().isContentEditable())) {
         if (Node* focusedNode = getFocusedNode(frame))
-            return focusedNode->getRect().location();
+            return focusedNode->getPixelSnappedRect().location();
 
         // There was no selection and no focused node, so just put the context
         // menu into the corner of the view, offset slightly.
@@ -1604,7 +1604,7 @@
                 String title = static_cast<Element*>(titleNode)->title();
                 if (!title.isEmpty()) {
                     if (FrameView* view = coreFrame->view()) {
-                        GdkRectangle area = view->contentsToWindow(node->getRect());
+                        GdkRectangle area = view->contentsToWindow(node->getPixelSnappedRect());
                         gtk_tooltip_set_tip_area(tooltip, &area);
                     }
                     gtk_tooltip_set_text(tooltip, title.utf8().data());

Modified: trunk/Source/WebKit2/ChangeLog (115671 => 115672)


--- trunk/Source/WebKit2/ChangeLog	2012-04-30 21:38:59 UTC (rev 115671)
+++ trunk/Source/WebKit2/ChangeLog	2012-04-30 21:41:19 UTC (rev 115672)
@@ -1,3 +1,18 @@
+2012-04-30  Emil A Eklund  <[email protected]>
+
+        [gtk, qt, chromium, win] Fix usage of LayoutUnits and rounding in platform code
+        https://bugs.webkit.org/show_bug.cgi?id=85222
+
+        Reviewed by Eric Seidel.
+
+        Update platform code to use the pixel snapped values for painting rects
+        to line up with device pixels and change platform specific hit testing
+        code to use roundedPoint as hit testing is still mostly done on integer
+        bounds.
+
+        * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp:
+        (WebKit::WebPopupMenu::setUpPlatformData):
+
 2012-04-30  Anders Carlsson  <[email protected]>
 
         Put all of TiledCoreAnimationDrawingArea in #if ENABLE(THREADED_SCROLLING)

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp (115671 => 115672)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp	2012-04-30 21:38:59 UTC (rev 115671)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp	2012-04-30 21:41:19 UTC (rev 115672)
@@ -136,7 +136,7 @@
         if (itemStyle.isVisible()) {
             int textX = std::max(0, data.m_clientPaddingLeft - data.m_clientInsetLeft);
             if (RenderTheme::defaultTheme()->popupOptionSupportsTextIndent() && itemStyle.textDirection() == LTR)
-                textX += minimumValueForLength(itemStyle.textIndent(), itemRect.width());
+                textX += minimumIntValueForLength(itemStyle.textIndent(), itemRect.width());
             int textY = itemRect.y() + itemFont.fontMetrics().ascent() + (itemRect.height() - itemFont.fontMetrics().height()) / 2;
 
             notSelectedBackingStoreContext->drawBidiText(itemFont, textRun, IntPoint(textX, textY));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to