Title: [102253] branches/safari-534.53-branch/Source

Diff

Modified: branches/safari-534.53-branch/Source/WebCore/ChangeLog (102252 => 102253)


--- branches/safari-534.53-branch/Source/WebCore/ChangeLog	2011-12-07 19:05:50 UTC (rev 102252)
+++ branches/safari-534.53-branch/Source/WebCore/ChangeLog	2011-12-07 19:06:27 UTC (rev 102253)
@@ -1,5 +1,33 @@
 2011-12-06  Lucas Forschler  <[email protected]>
 
+    Merge 98406
+
+    2011-10-25  Beth Dakin  <[email protected]>
+
+            https://bugs.webkit.org/show_bug.cgi?id=70852
+            Setting up a HiDPI base-level GraphicsContext should be more straightforward for 
+            WebKit2
+
+            Reviewed by Dan Bernstein.
+
+            This patch removes the old cg-only GraphicsContext::setBaseCTM() api, and adds 
+            platform-independent GraphicsContext::applyDeviceScaleFactor().
+            * WebCore.exp.in:
+            * platform/graphics/GraphicsContext.cpp:
+            (WebCore::GraphicsContext::platformApplyDeviceScaleFactor):
+            (WebCore::GraphicsContext::applyDeviceScaleFactor):
+            * platform/graphics/GraphicsContext.h:
+            * platform/graphics/cg/GraphicsContextCG.cpp:
+            (WebCore::GraphicsContext::platformApplyDeviceScaleFactor):
+
+            Since this patch removes GraphicsContext::setBaseCTM(), this code has been 
+            reverted to do what it used to do before that was added; it just calls into 
+            WebCoreSystemInterface directly.
+            * platform/graphics/cg/ImageCG.cpp:
+            (WebCore::Image::drawPattern):
+
+2011-12-06  Lucas Forschler  <[email protected]>
+
     Merge 98403
 
     2011-10-25  Anders Carlsson  <[email protected]>

Modified: branches/safari-534.53-branch/Source/WebCore/WebCore.exp.in (102252 => 102253)


--- branches/safari-534.53-branch/Source/WebCore/WebCore.exp.in	2011-12-07 19:05:50 UTC (rev 102252)
+++ branches/safari-534.53-branch/Source/WebCore/WebCore.exp.in	2011-12-07 19:06:27 UTC (rev 102253)
@@ -419,6 +419,7 @@
 __ZN7WebCore15GraphicsContext20setShouldSmoothFontsEb
 __ZN7WebCore15GraphicsContext20endTransparencyLayerEv
 __ZN7WebCore15GraphicsContext21setCompositeOperationENS_17CompositeOperatorE
+__ZN7WebCore15GraphicsContext22applyDeviceScaleFactorEf
 __ZN7WebCore15GraphicsContext22beginTransparencyLayerEf
 __ZN7WebCore15GraphicsContext28setImageInterpolationQualityENS_20InterpolationQualityE
 __ZN7WebCore15GraphicsContext4clipERKNS_4PathE
@@ -1174,7 +1175,6 @@
 __ZNK7WebCore14SecurityOrigin18databaseIdentifierEv
 __ZNK7WebCore14SecurityOrigin5equalEPKS0_
 __ZNK7WebCore15FocusController18focusedOrMainFrameEv
-__ZN7WebCore15GraphicsContext10setBaseCTMERKNS_15AffineTransformE 
 __ZNK7WebCore15GraphicsContext15platformContextEv
 __ZNK7WebCore15GraphicsContext16paintingDisabledEv
 __ZNK7WebCore15GraphicsContext20updatingControlTintsEv

Modified: branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsContext.cpp (102252 => 102253)


--- branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsContext.cpp	2011-12-07 19:05:50 UTC (rev 102252)
+++ branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsContext.cpp	2011-12-07 19:06:27 UTC (rev 102253)
@@ -740,4 +740,16 @@
     }
 }
 
+#if !USE(CG)
+void GraphicsContext::platformApplyDeviceScaleFactor()
+{
 }
+#endif
+
+void GraphicsContext::applyDeviceScaleFactor(float deviceScaleFactor)
+{
+    scale(FloatSize(deviceScaleFactor, deviceScaleFactor));
+    platformApplyDeviceScaleFactor();
+}
+
+}

Modified: branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsContext.h (102252 => 102253)


--- branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsContext.h	2011-12-07 19:05:50 UTC (rev 102252)
+++ branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsContext.h	2011-12-07 19:06:27 UTC (rev 102253)
@@ -276,7 +276,6 @@
 
         void setIsAcceleratedContext(bool);
         bool isAcceleratedContext() const;
-        void setBaseCTM(const AffineTransform&);
 #endif
 
         void save();
@@ -417,6 +416,11 @@
         void setCTM(const AffineTransform&);
         AffineTransform getCTM() const;
 
+        // This function applies the device scale factor to the context, making the context capable of
+        // acting as a base-level context for a HiDPI environment.
+        void applyDeviceScaleFactor(float);
+        void platformApplyDeviceScaleFactor();
+
 #if OS(WINCE) && !PLATFORM(QT)
         void setBitmap(PassRefPtr<SharedBitmap>);
         const AffineTransform& affineTransform() const;

Modified: branches/safari-534.53-branch/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (102252 => 102253)


--- branches/safari-534.53-branch/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2011-12-07 19:05:50 UTC (rev 102252)
+++ branches/safari-534.53-branch/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2011-12-07 19:06:27 UTC (rev 102253)
@@ -1387,11 +1387,6 @@
     return m_data->m_contextFlags & IsAcceleratedCGContext;
 }
 
-void GraphicsContext::setBaseCTM(const AffineTransform& transform)
-{
-    wkSetBaseCTM(platformContext(), transform);
-}
-
 void GraphicsContext::setPlatformTextDrawingMode(TextDrawingModeFlags mode)
 {
     if (paintingDisabled())
@@ -1517,4 +1512,12 @@
     CGContextSetBlendMode(platformContext(), target);
 }
 
+void GraphicsContext::platformApplyDeviceScaleFactor()
+{
+    // CoreGraphics expects the base CTM of a HiDPI context to have the scale factor applied to it.
+    // Failing to change the base level CTM will cause certain CG features, such as focus rings,
+    // to draw with a scale factor of 1 rather than the actual scale factor.
+    wkSetBaseCTM(platformContext(), getCTM());
 }
+
+}

Modified: branches/safari-534.53-branch/Source/WebCore/platform/graphics/cg/ImageCG.cpp (102252 => 102253)


--- branches/safari-534.53-branch/Source/WebCore/platform/graphics/cg/ImageCG.cpp	2011-12-07 19:05:50 UTC (rev 102252)
+++ branches/safari-534.53-branch/Source/WebCore/platform/graphics/cg/ImageCG.cpp	2011-12-07 19:06:27 UTC (rev 102253)
@@ -347,9 +347,7 @@
     CGContextSetFillColorSpace(context, patternSpace.get());
 
     // FIXME: Really want a public API for this.  It is just CGContextSetBaseCTM(context, CGAffineTransformIdentiy).
-    AffineTransform identity;
-    identity.makeIdentity();
-    ctxt->setBaseCTM(identity);
+    wkSetBaseCTM(context, CGAffineTransformIdentity);
     CGContextSetPatternPhase(context, CGSizeZero);
 
     CGContextSetFillColorWithColor(context, color.get());

Modified: branches/safari-534.53-branch/Source/WebKit2/ChangeLog (102252 => 102253)


--- branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-07 19:05:50 UTC (rev 102252)
+++ branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-07 19:06:27 UTC (rev 102253)
@@ -1,5 +1,26 @@
 2011-12-06  Lucas Forschler  <[email protected]>
 
+    Merge 98406
+
+    2011-10-25  Beth Dakin  <[email protected]>
+
+            https://bugs.webkit.org/show_bug.cgi?id=70852
+            Setting up a HiDPI base-level GraphicsContext should be more straightforward for 
+            WebKit2
+
+            Reviewed by Dan Bernstein.
+
+            When we need a base-level HiDPI GraphicsContext, call into new GraphicsContext api 
+            GraphicsContext::applyDeviceScaleFactor() rather than manually scaling and 
+            adjusting the base CTM.
+            * WebProcess/WebPage/DrawingAreaImpl.cpp:
+            (WebKit::DrawingAreaImpl::display):
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::snapshotInViewCoordinates):
+            (WebKit::WebPage::scaledSnapshotInDocumentCoordinates):
+
+2011-12-06  Lucas Forschler  <[email protected]>
+
     Merge 98403
 
     2011-10-25  Anders Carlsson  <[email protected]>

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp (102252 => 102253)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp	2011-12-07 19:05:50 UTC (rev 102252)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp	2011-12-07 19:06:27 UTC (rev 102253)
@@ -680,7 +680,8 @@
         ASSERT(m_webPage->bounds().contains(bounds));
 
     IntSize bitmapSize = bounds.size();
-    bitmapSize.scale(m_webPage->corePage()->deviceScaleFactor());
+    float deviceScaleFactor = m_webPage->corePage()->deviceScaleFactor();
+    bitmapSize.scale(deviceScaleFactor);
     RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(bitmapSize, ShareableBitmap::SupportsAlpha);
     if (!bitmap)
         return;
@@ -705,10 +706,7 @@
         OwnPtr<GraphicsContext> graphicsContext = createGraphicsContext(bitmap.get());
         
         updateInfo.updateRectBounds = bounds;
-    graphicsContext->scale(FloatSize(m_webPage->corePage()->deviceScaleFactor(), m_webPage->corePage()->deviceScaleFactor()));
-#if USE(CG)
-    graphicsContext->setBaseCTM(graphicsContext->getCTM());
-#endif
+    graphicsContext->applyDeviceScaleFactor(deviceScaleFactor);
     
         graphicsContext->translate(-bounds.x(), -bounds.y());
 

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (102252 => 102253)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-12-07 19:05:50 UTC (rev 102252)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-12-07 19:06:27 UTC (rev 102253)
@@ -882,10 +882,7 @@
         return 0;
     
     OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
-    graphicsContext->scale(FloatSize(deviceScaleFactor, deviceScaleFactor));
-#if USE(CG)
-    graphicsContext->setBaseCTM(graphicsContext->getCTM());
-#endif
+    graphicsContext->applyDeviceScaleFactor(deviceScaleFactor);
     graphicsContext->translate(-rect.x(), -rect.y());
 
     frameView->updateLayoutAndStyleIfNeededRecursive();
@@ -911,10 +908,7 @@
         return 0;
 
     OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
-    graphicsContext->scale(FloatSize(combinedScaleFactor, combinedScaleFactor));
-#if USE(CG)
-    graphicsContext->setBaseCTM(graphicsContext->getCTM());
-#endif
+    graphicsContext->applyDeviceScaleFactor(combinedScaleFactor);
     graphicsContext->translate(-rect.x(), -rect.y());
 
     frameView->updateLayoutAndStyleIfNeededRecursive();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to