Title: [102195] branches/safari-534.53-branch/Source/WebCore

Diff

Modified: branches/safari-534.53-branch/Source/WebCore/ChangeLog (102194 => 102195)


--- branches/safari-534.53-branch/Source/WebCore/ChangeLog	2011-12-07 00:55:23 UTC (rev 102194)
+++ branches/safari-534.53-branch/Source/WebCore/ChangeLog	2011-12-07 01:03:17 UTC (rev 102195)
@@ -1,5 +1,43 @@
 2011-12-06  Lucas Forschler  <[email protected]>
 
+    Merge 95697
+
+    2011-09-21  Beth Dakin  <[email protected]>
+
+            https://bugs.webkit.org/show_bug.cgi?id=67415
+            Text drawn via -webkit-background-clip:text is blurry at device scale factors >1.0
+            -and corresponding-
+            <rdar://problem/10060379>
+
+            Reviewed by Darin Adler.
+
+            New helper function RenderBoxModelObject scales the mask image by the 
+            deviceScaleFactor to get an image of the appropriate resolution. It also scales 
+            the image's GraphicsContext so that the clip is set up on the same scale. Back in 
+            paintFillLayerExtended() we still clip the image to the original maskRect to get 
+            everything scaled back to the appropriate size.
+            * rendering/RenderBoxModelObject.cpp:
+            (WebCore::createDeviceScaledImageBuffer):
+            (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+
+            Make the deviceScaleFactor convenience function just a namespace-level function in 
+            Page rather than a static member or Page.
+            * page/Page.cpp:
+            (WebCore::deviceScaleFactor):
+            * page/Page.h:
+
+            Pre-existing callers of Page::deviceScaleFactor(Frame*) must now use 
+            WebCore::deviceScaleFactor(Frame*)
+            * editing/DeleteButtonController.cpp:
+            (WebCore::DeleteButtonController::createDeletionUI):
+            * rendering/RenderImage.cpp:
+            (WebCore::RenderImage::imageSizeForError):
+            (WebCore::RenderImage::paintReplaced):
+            * rendering/RenderLayer.cpp:
+            (WebCore::RenderLayer::drawPlatformResizerImage):
+
+2011-12-06  Lucas Forschler  <[email protected]>
+
     Merge 95386
 
     2011-09-17  David Hyatt  <[email protected]>

Modified: branches/safari-534.53-branch/Source/WebCore/editing/DeleteButtonController.cpp (102194 => 102195)


--- branches/safari-534.53-branch/Source/WebCore/editing/DeleteButtonController.cpp	2011-12-07 00:55:23 UTC (rev 102194)
+++ branches/safari-534.53-branch/Source/WebCore/editing/DeleteButtonController.cpp	2011-12-07 01:03:17 UTC (rev 102195)
@@ -255,7 +255,7 @@
     style->setProperty(CSSPropertyHeight, String::number(buttonHeight) + "px");
     style->setProperty(CSSPropertyVisibility, CSSValueVisible);
 
-    float deviceScaleFactor = Page::deviceScaleFactor(m_frame);
+    float deviceScaleFactor = WebCore::deviceScaleFactor(m_frame);
     RefPtr<Image> buttonImage;
     if (deviceScaleFactor >= 2)
         buttonImage = Image::loadPlatformResource("deleteButton@2x");

Modified: branches/safari-534.53-branch/Source/WebCore/page/Page.cpp (102194 => 102195)


--- branches/safari-534.53-branch/Source/WebCore/page/Page.cpp	2011-12-07 00:55:23 UTC (rev 102194)
+++ branches/safari-534.53-branch/Source/WebCore/page/Page.cpp	2011-12-07 01:03:17 UTC (rev 102195)
@@ -113,6 +113,16 @@
         frames[i]->document()->dispatchWindowEvent(Event::create(eventName, false, false));
 }
 
+float deviceScaleFactor(Frame* frame)
+{
+    if (!frame)
+        return 1;
+    Page* page = frame->page();
+    if (!page)
+        return 1;
+    return page->deviceScaleFactor();
+}
+
 Page::Page(PageClients& pageClients)
     : m_chrome(adoptPtr(new Chrome(this, pageClients.chromeClient)))
     , m_dragCaretController(adoptPtr(new DragCaretController))
@@ -613,16 +623,6 @@
     backForward()->markPagesForFullStyleRecalc();
 }
 
-float Page::deviceScaleFactor(Frame* frame)
-{
-    if (!frame)
-        return 1;
-    Page* page = frame->page();
-    if (!page)
-        return 1;
-    return page->deviceScaleFactor();
-}
-
 void Page::didMoveOnscreen()
 {
     for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) {

Modified: branches/safari-534.53-branch/Source/WebCore/page/Page.h (102194 => 102195)


--- branches/safari-534.53-branch/Source/WebCore/page/Page.h	2011-12-07 00:55:23 UTC (rev 102194)
+++ branches/safari-534.53-branch/Source/WebCore/page/Page.h	2011-12-07 01:03:17 UTC (rev 102195)
@@ -95,6 +95,8 @@
 
     enum FindDirection { FindDirectionForward, FindDirectionBackward };
 
+    float deviceScaleFactor(Frame*);
+
     class Page {
         WTF_MAKE_NONCOPYABLE(Page);
         friend class Settings;
@@ -245,7 +247,6 @@
 
         float deviceScaleFactor() const { return m_deviceScaleFactor; }
         void setDeviceScaleFactor(float);
-        static float deviceScaleFactor(Frame*);
 
         // Notifications when the Page starts and stops being presented via a native window.
         void didMoveOnscreen();

Modified: branches/safari-534.53-branch/Source/WebCore/rendering/RenderBoxModelObject.cpp (102194 => 102195)


--- branches/safari-534.53-branch/Source/WebCore/rendering/RenderBoxModelObject.cpp	2011-12-07 00:55:23 UTC (rev 102194)
+++ branches/safari-534.53-branch/Source/WebCore/rendering/RenderBoxModelObject.cpp	2011-12-07 01:03:17 UTC (rev 102195)
@@ -585,7 +585,25 @@
     adjustedRect.inflateY(-ceilf(1 / contextScale.height()));
     return adjustedRect;
 }
+    
+static PassOwnPtr<ImageBuffer> createDeviceScaledImageBuffer(IntSize imageSize, float deviceScaleFactor)
+{
+    // To create an image of the appropriate resolution, we need to scale imageRect's size
+    // by the device scale factor.
+    IntSize scaledImageSize = imageSize;
+    scaledImageSize.scale(deviceScaleFactor);
 
+    OwnPtr<ImageBuffer> scaledImageBuffer = ImageBuffer::create(scaledImageSize);
+    if (!scaledImageBuffer)
+        return nullptr;
+
+    // Scale the whole context by the device scale factor so that all of the clips set up at 
+    // the appropriate size.
+    scaledImageBuffer->context()->scale(FloatSize(deviceScaleFactor, deviceScaleFactor));
+    
+    return scaledImageBuffer.release();
+}
+
 void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, const Color& color, const FillLayer* bgLayer, const IntRect& rect,
     BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox* box, const IntSize& boxSize, CompositeOperator op, RenderObject* backgroundObject)
 {
@@ -679,7 +697,7 @@
         maskRect.intersect(paintInfo.rect);
         
         // Now create the mask.
-        OwnPtr<ImageBuffer> maskImage = ImageBuffer::create(maskRect.size());
+        OwnPtr<ImageBuffer> maskImage = createDeviceScaledImageBuffer(maskRect.size(), WebCore::deviceScaleFactor(frame()));        
         if (!maskImage)
             return;
         

Modified: branches/safari-534.53-branch/Source/WebCore/rendering/RenderImage.cpp (102194 => 102195)


--- branches/safari-534.53-branch/Source/WebCore/rendering/RenderImage.cpp	2011-12-07 00:55:23 UTC (rev 102194)
+++ branches/safari-534.53-branch/Source/WebCore/rendering/RenderImage.cpp	2011-12-07 01:03:17 UTC (rev 102195)
@@ -87,7 +87,7 @@
 
     IntSize imageSize;
     if (newImage->willPaintBrokenImage()) {
-        float deviceScaleFactor = Page::deviceScaleFactor(frame());
+        float deviceScaleFactor = WebCore::deviceScaleFactor(frame());
         pair<Image*, float> brokenImageAndImageScaleFactor = newImage->brokenImage(deviceScaleFactor);
         imageSize = brokenImageAndImageScaleFactor.first->size();
         imageSize.scale(1 / brokenImageAndImageScaleFactor.second);
@@ -274,7 +274,7 @@
             RefPtr<Image> image = m_imageResource->image();
 
             if (m_imageResource->errorOccurred() && !image->isNull() && usableWidth >= image->width() && usableHeight >= image->height()) {
-                float deviceScaleFactor = Page::deviceScaleFactor(frame());
+                float deviceScaleFactor = WebCore::deviceScaleFactor(frame());
                 // Call brokenImage() explicitly to ensure we get the broken image icon at the appropriate resolution.
                 pair<Image*, float> brokenImageAndImageScaleFactor = m_imageResource->cachedImage()->brokenImage(deviceScaleFactor);
                 image = brokenImageAndImageScaleFactor.first;

Modified: branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayer.cpp (102194 => 102195)


--- branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayer.cpp	2011-12-07 00:55:23 UTC (rev 102194)
+++ branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayer.cpp	2011-12-07 01:03:17 UTC (rev 102195)
@@ -2365,7 +2365,7 @@
 
 void RenderLayer::drawPlatformResizerImage(GraphicsContext* context, IntRect resizerCornerRect)
 {
-    float deviceScaleFactor = Page::deviceScaleFactor(renderer()->frame());
+    float deviceScaleFactor = WebCore::deviceScaleFactor(renderer()->frame());
 
     RefPtr<Image> resizeCornerImage;
     IntSize cornerResizerSize;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to