Selects should scale when rendering while zoomed
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Aug 2015 20:30:32 +0000 (20:30 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Aug 2015 20:30:32 +0000 (20:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147868

Reviewed by Daniel Bates.

When rendering zoomed <select> elements, draw to an image buffer instead of drawing directly
into the context. This allows us to scale the image buffer up before rendering.

* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintMenuList): Use ThemeMac::drawCellOrFocusRingWithViewIntoContext
    to render search fields, utilizing an offscreen image buffer only when necessary.

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderThemeMac.mm

index ff104b84c524c7b296b9ce6928e1d3f826b00f12..156c3c1dd4d9c33e1a3d24b1571538f8048e6fe0 100644 (file)
@@ -1,3 +1,17 @@
+2015-08-13 Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Selects should scale when rendering while zoomed
+        https://bugs.webkit.org/show_bug.cgi?id=147868
+
+        Reviewed by Daniel Bates.
+
+        When rendering zoomed <select> elements, draw to an image buffer instead of drawing directly
+        into the context. This allows us to scale the image buffer up before rendering.
+
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::paintMenuList): Use ThemeMac::drawCellOrFocusRingWithViewIntoContext
+            to render search fields, utilizing an offscreen image buffer only when necessary.
+
 2015-08-13  Alex Christensen  <achristensen@webkit.org>
 
         [Win] Unreviewed build fix after r188388.
 2015-08-13  Alex Christensen  <achristensen@webkit.org>
 
         [Win] Unreviewed build fix after r188388.
index 941e0a4cbd4eb03a204c9ac9336b22d6e5d92854..0e4131e382b3c0cb212719c5c3a9d50fa50ab477 100644 (file)
@@ -947,11 +947,14 @@ bool RenderThemeMac::paintMenuList(const RenderObject& renderer, const PaintInfo
     }
 
     NSView *view = documentViewFor(renderer);
     }
 
     NSView *view = documentViewFor(renderer);
-    [popupButton drawWithFrame:inflatedRect inView:view];
-    if (isFocused(renderer) && renderer.style().outlineStyleIsAuto()) {
-        if (wkDrawCellFocusRingWithFrameAtTime(popupButton, inflatedRect, view, std::numeric_limits<double>::max()))
-            renderer.document().page()->focusController().setFocusedElementNeedsRepaint();
-    }
+    Page* page = renderer.document().page();
+    float pageScaleFactor = page->pageScaleFactor();
+    float deviceScaleFactor = page->deviceScaleFactor();
+    bool shouldDrawFocusRing = isFocused(renderer) && renderer.style().outlineStyleIsAuto();
+    bool shouldUseImageBuffer = zoomLevel != 1.0f || pageScaleFactor != 1.0f;
+    bool shouldDrawCell = true;
+    if (ThemeMac::drawCellOrFocusRingWithViewIntoContext(popupButton, paintInfo.context, inflatedRect, view, shouldDrawCell, shouldDrawFocusRing, shouldUseImageBuffer, deviceScaleFactor))
+        page->focusController().setFocusedElementNeedsRepaint();
 
     [popupButton setControlView:nil];
 
 
     [popupButton setControlView:nil];