Title: [123912] trunk
Revision
123912
Author
[email protected]
Date
2012-07-27 13:33:56 -0700 (Fri, 27 Jul 2012)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=92327
-webkit-background-clip:text is blurry in WebKit 1 apps when
deviceScaleFactor > 1
-and corresponding-
<rdar://problem/11683788>

Reviewed by Simon Fraser.

Source/WebCore: 

The bug here is that the code to make createCompatibleBuffer() HiDPI-savvy 
assumed that the deviceScaleFactor would always be baked into the CTM of the
GraphicsContext. But that is NOT the case in WebKit 1.

createCompatibleBuffer() is used for clip text and gradients.

Now getCTM() takes a parameter indicating whether the result should definitely
include the device scale, or if it should possibly included the device scale, 
which is the option that matches old behavior.
* platform/graphics/GraphicsContext.h:
(GraphicsContext):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::getCTM):
* platform/graphics/openvg/GraphicsContextOpenVG.cpp:
(WebCore::GraphicsContext::getCTM):
* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContext::getCTM):
* platform/graphics/skia/GraphicsContextSkia.cpp:
(WebCore::GraphicsContext::getCTM):
* platform/graphics/wince/GraphicsContextWinCE.cpp:
(WebCore::GraphicsContext::getCTM):
* platform/graphics/wx/GraphicsContextWx.cpp:
(WebCore::GraphicsContext::getCTM):

Actually use the new parameter in the CG implementation. Use CG API to get a
matrix that definitely includes the device scale when that is required. 
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::getCTM):

Remove some symbol cruft that doesn't seem to require a replacement.
* WebCore.exp.in:

Use DefinitelyIncludeDeviceScale when getting the CTM in the buggy spot.
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::createCompatibleBuffer):

The ImageBuffer for gradients is created using createCompatibleBuffer(), and since 
createCompatibleBuffer() now uses getCTM(DefinitelyIncludeDeviceScale) to 
determine appropriate sizing, drawPattern() should use that same matrix to 
determine pattern sizing.
* platform/graphics/GeneratorGeneratedImage.cpp:
(WebCore::GeneratorGeneratedImage::drawPattern):

LayoutTests: 

* fast/hidpi/gradient-with-scaled-ancestor.html: Added.
* platform/mac/fast/hidpi/gradient-with-scaled-ancestor-expected.png: Added.
* platform/mac/fast/hidpi/gradient-with-scaled-ancestor-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123911 => 123912)


--- trunk/LayoutTests/ChangeLog	2012-07-27 20:10:19 UTC (rev 123911)
+++ trunk/LayoutTests/ChangeLog	2012-07-27 20:33:56 UTC (rev 123912)
@@ -1,3 +1,17 @@
+2012-07-27  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=92327
+        -webkit-background-clip:text is blurry in WebKit 1 apps when
+        deviceScaleFactor > 1
+        -and corresponding-
+        <rdar://problem/11683788>
+
+        Reviewed by Simon Fraser.
+
+        * fast/hidpi/gradient-with-scaled-ancestor.html: Added.
+        * platform/mac/fast/hidpi/gradient-with-scaled-ancestor-expected.png: Added.
+        * platform/mac/fast/hidpi/gradient-with-scaled-ancestor-expected.txt: Added.
+
 2012-07-27  Brian Weinstein  <[email protected]>
 
         Add Mac results for fast/table/table-row-outline-paint.html.

Added: trunk/LayoutTests/fast/hidpi/gradient-with-scaled-ancestor.html (0 => 123912)


--- trunk/LayoutTests/fast/hidpi/gradient-with-scaled-ancestor.html	                        (rev 0)
+++ trunk/LayoutTests/fast/hidpi/gradient-with-scaled-ancestor.html	2012-07-27 20:33:56 UTC (rev 123912)
@@ -0,0 +1,3 @@
+<div style="-webkit-transform:scale(1.5); -webkit-transform-origin:top left;">
+<div style="height:300px;width:300px;background-image:-webkit-repeating-linear-gradient(top left, red 10%, blue 30%);border:1px solid">
+</div>

Added: trunk/LayoutTests/platform/mac/fast/hidpi/gradient-with-scaled-ancestor-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/hidpi/gradient-with-scaled-ancestor-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/fast/hidpi/gradient-with-scaled-ancestor-expected.txt (0 => 123912)


--- trunk/LayoutTests/platform/mac/fast/hidpi/gradient-with-scaled-ancestor-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/hidpi/gradient-with-scaled-ancestor-expected.txt	2012-07-27 20:33:56 UTC (rev 123912)
@@ -0,0 +1,8 @@
+layer at (0,0) size 1184x585
+  RenderView at (0,0) size 800x585
+layer at (0,0) size 800x585
+  RenderBlock {HTML} at (0,0) size 800x585
+    RenderBody {BODY} at (8,8) size 784x569
+layer at (8,8) size 784x302
+  RenderBlock {DIV} at (0,0) size 784x302
+    RenderBlock {DIV} at (0,0) size 302x302 [border: (1px solid #000000)]

Modified: trunk/Source/WebCore/ChangeLog (123911 => 123912)


--- trunk/Source/WebCore/ChangeLog	2012-07-27 20:10:19 UTC (rev 123911)
+++ trunk/Source/WebCore/ChangeLog	2012-07-27 20:33:56 UTC (rev 123912)
@@ -1,3 +1,56 @@
+2012-07-27  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=92327
+        -webkit-background-clip:text is blurry in WebKit 1 apps when
+        deviceScaleFactor > 1
+        -and corresponding-
+        <rdar://problem/11683788>
+
+        Reviewed by Simon Fraser.
+
+        The bug here is that the code to make createCompatibleBuffer() HiDPI-savvy 
+        assumed that the deviceScaleFactor would always be baked into the CTM of the
+        GraphicsContext. But that is NOT the case in WebKit 1.
+
+        createCompatibleBuffer() is used for clip text and gradients.
+
+        Now getCTM() takes a parameter indicating whether the result should definitely
+        include the device scale, or if it should possibly included the device scale, 
+        which is the option that matches old behavior.
+        * platform/graphics/GraphicsContext.h:
+        (GraphicsContext):
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::getCTM):
+        * platform/graphics/openvg/GraphicsContextOpenVG.cpp:
+        (WebCore::GraphicsContext::getCTM):
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContext::getCTM):
+        * platform/graphics/skia/GraphicsContextSkia.cpp:
+        (WebCore::GraphicsContext::getCTM):
+        * platform/graphics/wince/GraphicsContextWinCE.cpp:
+        (WebCore::GraphicsContext::getCTM):
+        * platform/graphics/wx/GraphicsContextWx.cpp:
+        (WebCore::GraphicsContext::getCTM):
+
+        Actually use the new parameter in the CG implementation. Use CG API to get a
+        matrix that definitely includes the device scale when that is required. 
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::getCTM):
+
+        Remove some symbol cruft that doesn't seem to require a replacement.
+        * WebCore.exp.in:
+
+        Use DefinitelyIncludeDeviceScale when getting the CTM in the buggy spot.
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::createCompatibleBuffer):
+
+        The ImageBuffer for gradients is created using createCompatibleBuffer(), and since 
+        createCompatibleBuffer() now uses getCTM(DefinitelyIncludeDeviceScale) to 
+        determine appropriate sizing, drawPattern() should use that same matrix to 
+        determine pattern sizing.
+        * platform/graphics/GeneratorGeneratedImage.cpp:
+        (WebCore::GeneratorGeneratedImage::drawPattern):
+
 2012-07-27  Tony Chang  <[email protected]>
 
         flex-wrap: wrap not wrapping for % sized items in column flow

Modified: trunk/Source/WebCore/WebCore.exp.in (123911 => 123912)


--- trunk/Source/WebCore/WebCore.exp.in	2012-07-27 20:10:19 UTC (rev 123911)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-07-27 20:33:56 UTC (rev 123912)
@@ -1178,7 +1178,6 @@
 __ZNK7WebCore15GraphicsContext15platformContextEv
 __ZNK7WebCore15GraphicsContext16paintingDisabledEv
 __ZNK7WebCore15GraphicsContext20updatingControlTintsEv
-__ZNK7WebCore15GraphicsContext6getCTMEv
 __ZNK7WebCore15ProgressTracker17estimatedProgressEv
 __ZNK7WebCore15ProtectionSpace10serverTypeEv
 __ZNK7WebCore15ProtectionSpace26receivesCredentialSecurelyEv

Modified: trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp (123911 => 123912)


--- trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp	2012-07-27 20:10:19 UTC (rev 123911)
+++ trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp	2012-07-27 20:33:56 UTC (rev 123912)
@@ -53,7 +53,7 @@
     m_generator->adjustParametersForTiledDrawing(adjustedSize, adjustedSrcRect);
 
     // Factor in the destination context's scale to generate at the best resolution
-    AffineTransform destContextCTM = destContext->getCTM();
+    AffineTransform destContextCTM = destContext->getCTM(GraphicsContext::DefinitelyIncludeDeviceScale);
     double xScale = fabs(destContextCTM.xScale());
     double yScale = fabs(destContextCTM.yScale());
     AffineTransform adjustedPatternCTM = patternTransform;

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (123911 => 123912)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2012-07-27 20:10:19 UTC (rev 123911)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2012-07-27 20:33:56 UTC (rev 123912)
@@ -769,7 +769,7 @@
     // resolution than one pixel per unit. Also set up a corresponding scale factor on the
     // graphics context.
 
-    AffineTransform transform = getCTM();
+    AffineTransform transform = getCTM(DefinitelyIncludeDeviceScale);
     IntSize scaledSize(static_cast<int>(ceil(size.width() * transform.xScale())), static_cast<int>(ceil(size.height() * transform.yScale())));
 
     OwnPtr<ImageBuffer> buffer = ImageBuffer::create(scaledSize, 1, ColorSpaceDeviceRGB, isAcceleratedContext() ? Accelerated : Unaccelerated);

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (123911 => 123912)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2012-07-27 20:10:19 UTC (rev 123911)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2012-07-27 20:33:56 UTC (rev 123912)
@@ -413,8 +413,10 @@
 
         void concatCTM(const AffineTransform&);
         void setCTM(const AffineTransform&);
-        AffineTransform getCTM() const;
 
+        enum IncludeDeviceScale { DefinitelyIncludeDeviceScale, PossiblyIncludeDeviceScale };
+        AffineTransform getCTM(IncludeDeviceScale includeScale = PossiblyIncludeDeviceScale) const;
+
 #if ENABLE(3D_RENDERING) && USE(TEXTURE_MAPPER)
         // This is needed when using accelerated-compositing in software mode, like in TextureMapper.
         void concat3DTransform(const TransformationMatrix&);

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (123911 => 123912)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2012-07-27 20:10:19 UTC (rev 123911)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2012-07-27 20:33:56 UTC (rev 123912)
@@ -192,7 +192,7 @@
     delete m_data;
 }
 
-AffineTransform GraphicsContext::getCTM() const
+AffineTransform GraphicsContext::getCTM(IncludeDeviceScale) const
 {
     if (paintingDisabled())
         return AffineTransform();

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (123911 => 123912)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2012-07-27 20:10:19 UTC (rev 123911)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2012-07-27 20:33:56 UTC (rev 123912)
@@ -1411,12 +1411,18 @@
     m_data->m_userToDeviceTransformKnownToBeIdentity = false;
 }
 
-AffineTransform GraphicsContext::getCTM() const
+AffineTransform GraphicsContext::getCTM(IncludeDeviceScale includeScale) const
 {
     if (paintingDisabled())
         return AffineTransform();
 
-    return AffineTransform(CGContextGetCTM(platformContext()));
+    // The CTM usually includes the deviceScaleFactor except in WebKit 1 when the
+    // content is non-composited, since the scale factor is integrated at a lower
+    // level. To guarantee the deviceScale is included, we can use this CG API.
+    if (includeScale == DefinitelyIncludeDeviceScale)
+        return CGContextGetUserSpaceToDeviceSpaceTransform(platformContext());
+
+    return CGContextGetCTM(platformContext());
 }
 
 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect, RoundingMode roundingMode)

Modified: trunk/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp (123911 => 123912)


--- trunk/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp	2012-07-27 20:10:19 UTC (rev 123911)
+++ trunk/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp	2012-07-27 20:33:56 UTC (rev 123912)
@@ -67,7 +67,7 @@
     return m_data->baseSurface();
 }
 
-AffineTransform GraphicsContext::getCTM() const
+AffineTransform GraphicsContext::getCTM(IncludeDeviceScale) const
 {
     if (paintingDisabled())
         return AffineTransform();

Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp (123911 => 123912)


--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp	2012-07-27 20:10:19 UTC (rev 123911)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp	2012-07-27 20:33:56 UTC (rev 123912)
@@ -287,7 +287,7 @@
     return m_data->p();
 }
 
-AffineTransform GraphicsContext::getCTM() const
+AffineTransform GraphicsContext::getCTM(IncludeDeviceScale) const
 {
     if (paintingDisabled())
         return AffineTransform();

Modified: trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp (123911 => 123912)


--- trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp	2012-07-27 20:10:19 UTC (rev 123911)
+++ trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp	2012-07-27 20:33:56 UTC (rev 123912)
@@ -754,7 +754,7 @@
     platformContext()->didDrawPath(path, paint);
 }
 
-AffineTransform GraphicsContext::getCTM() const
+AffineTransform GraphicsContext::getCTM(IncludeDeviceScale) const
 {
     if (paintingDisabled())
         return AffineTransform();

Modified: trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp (123911 => 123912)


--- trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp	2012-07-27 20:10:19 UTC (rev 123911)
+++ trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp	2012-07-27 20:33:56 UTC (rev 123912)
@@ -1492,7 +1492,7 @@
     GradientFill(dc, tv.data(), tv.size(), mesh.data(), mesh.size(), vertical ? GRADIENT_FILL_RECT_V : GRADIENT_FILL_RECT_H);
 }
 
-AffineTransform GraphicsContext::getCTM() const
+AffineTransform GraphicsContext::getCTM(IncludeDeviceScale) const
 {
     if (paintingDisabled())
         return AffineTransform();

Modified: trunk/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp (123911 => 123912)


--- trunk/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp	2012-07-27 20:10:19 UTC (rev 123911)
+++ trunk/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp	2012-07-27 20:33:56 UTC (rev 123912)
@@ -477,7 +477,7 @@
     clip(path);
 }
 
-AffineTransform GraphicsContext::getCTM() const
+AffineTransform GraphicsContext::getCTM(IncludeDeviceScale) const
 { 
     if (paintingDisabled())
         return AffineTransform();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to