Title: [168559] trunk/Source
Revision
168559
Author
za...@apple.com
Date
2014-05-09 17:08:28 -0700 (Fri, 09 May 2014)

Log Message

Subpixel rendering[iOS]: Top bar on apple.com/support jiggles when the swoosh animates.
https://bugs.webkit.org/show_bug.cgi?id=132750
<rdar://problem/16803281>

Reviewed by Simon Fraser.

This patch ensures that GraphicsLayer and RemoteLayerBackingStore have the same dimensions.

Remove integral enclosing when we set the size on RemoteLayerBackingStore. It makes the layer's size
different from the backingstore when the passed value is fractional.
We scale and integral round this value to size the shareable bitmap later. Rounding ensures that
the final size value matches what we calculated at GraphicsLayerCA::updateGeometry()

Currently not testable.

Source/WebCore:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateGeometry):
(WebCore::GraphicsLayerCA::computePixelAlignment): include device scale factor to be able calculate the final content scale.
* platform/graphics/ca/GraphicsLayerCA.h:

Source/WebKit2:
* Shared/mac/RemoteLayerBackingStore.h:
(WebKit::RemoteLayerBackingStore::size):
* Shared/mac/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::ensureBackingStore):
(WebKit::RemoteLayerBackingStore::setNeedsDisplay): use enclosing here to ensure we cover the entire backing store.
(WebKit::RemoteLayerBackingStore::display):
(WebKit::RemoteLayerBackingStore::drawInContext):
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::updateBackingStore):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (168558 => 168559)


--- trunk/Source/WebCore/ChangeLog	2014-05-10 00:06:51 UTC (rev 168558)
+++ trunk/Source/WebCore/ChangeLog	2014-05-10 00:08:28 UTC (rev 168559)
@@ -1,3 +1,25 @@
+2014-05-09  Zalan Bujtas  <za...@apple.com>
+
+        Subpixel rendering[iOS]: Top bar on apple.com/support jiggles when the swoosh animates.
+        https://bugs.webkit.org/show_bug.cgi?id=132750
+        <rdar://problem/16803281>
+
+        Reviewed by Simon Fraser.
+
+        This patch ensures that GraphicsLayer and RemoteLayerBackingStore have the same dimensions.
+        
+        Remove integral enclosing when we set the size on RemoteLayerBackingStore. It makes the layer's size
+        different from the backingstore when the passed value is fractional.
+        We scale and integral round this value to size the shareable bitmap later. Rounding ensures that
+        the final size value matches what we calculated at GraphicsLayerCA::updateGeometry()
+
+        Currently not testable.
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::updateGeometry):
+        (WebCore::GraphicsLayerCA::computePixelAlignment): include device scale factor to be able calculate the final content scale.
+        * platform/graphics/ca/GraphicsLayerCA.h:
+
 2014-05-09  Mark Hahnenberg  <mhahnenb...@apple.com>
 
         JSDOMWindow should disable property caching after a certain point

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (168558 => 168559)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2014-05-10 00:06:51 UTC (rev 168558)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2014-05-10 00:08:28 UTC (rev 168559)
@@ -1533,7 +1533,7 @@
     FloatPoint3D scaledAnchorPoint;
     FloatSize scaledSize;
     FloatSize pixelAlignmentOffset;
-    computePixelAlignment(pageScaleFactor, positionRelativeToBase, scaledPosition, scaledSize, scaledAnchorPoint, pixelAlignmentOffset);
+    computePixelAlignment(pageScaleFactor * deviceScaleFactor(), positionRelativeToBase, scaledPosition, scaledSize, scaledAnchorPoint, pixelAlignmentOffset);
 
     FloatRect adjustedBounds(m_boundsOrigin - pixelAlignmentOffset, scaledSize);
 
@@ -3429,10 +3429,10 @@
     noteLayerPropertyChanged(GeometryChanged | ContentsScaleChanged | ContentsOpaqueChanged);
 }
 
-void GraphicsLayerCA::computePixelAlignment(float pageScaleFactor, const FloatPoint& positionRelativeToBase,
+void GraphicsLayerCA::computePixelAlignment(float contentsScale, const FloatPoint& positionRelativeToBase,
     FloatPoint& position, FloatSize& size, FloatPoint3D& anchorPoint, FloatSize& alignmentOffset) const
 {
-    if (isIntegral(pageScaleFactor) || !m_drawsContent || m_masksToBounds) {
+    if (isIntegral(contentsScale) || !m_drawsContent || m_masksToBounds) {
         position = m_position;
         size = m_size;
         anchorPoint = m_anchorPoint;
@@ -3443,12 +3443,12 @@
     FloatRect baseRelativeBounds(positionRelativeToBase, m_size);
     FloatRect scaledBounds = baseRelativeBounds;
     // Scale by the page scale factor to compute the screen-relative bounds.
-    scaledBounds.scale(pageScaleFactor);
+    scaledBounds.scale(contentsScale);
     // Round to integer boundaries.
     FloatRect alignedBounds = enclosingIntRect(scaledBounds);
     
     // Convert back to layer coordinates.
-    alignedBounds.scale(1 / pageScaleFactor);
+    alignedBounds.scale(1 / contentsScale);
 
 #if !PLATFORM(IOS)
     // Epsilon is necessary to ensure that backing store size computation in CA, which involves integer truncation,
@@ -3471,7 +3471,7 @@
     if (alignedBounds.height())
         anchorPointY = (baseRelativeBounds.height() * anchorPointY + alignmentOffset.height()) / alignedBounds.height();
      
-    anchorPoint = FloatPoint3D(anchorPointX, anchorPointY, m_anchorPoint.z() * pageScaleFactor);
+    anchorPoint = FloatPoint3D(anchorPointX, anchorPointY, m_anchorPoint.z() * contentsScale);
 }
 
 void GraphicsLayerCA::noteSublayersChanged(ScheduleFlushOrNot scheduleFlush)

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (168558 => 168559)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2014-05-10 00:06:51 UTC (rev 168558)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2014-05-10 00:08:28 UTC (rev 168559)
@@ -276,7 +276,7 @@
     virtual void getDebugBorderInfo(Color&, float& width) const override;
     virtual void dumpAdditionalProperties(TextStream&, int indent, LayerTreeAsTextBehavior) const override;
 
-    void computePixelAlignment(float pixelAlignmentScale, const FloatPoint& positionRelativeToBase,
+    void computePixelAlignment(float contentsScale, const FloatPoint& positionRelativeToBase,
         FloatPoint& position, FloatSize&, FloatPoint3D& anchorPoint, FloatSize& alignmentOffset) const;
 
     TransformationMatrix layerTransform(const FloatPoint& position, const TransformationMatrix* customTransform = 0) const;

Modified: trunk/Source/WebKit2/ChangeLog (168558 => 168559)


--- trunk/Source/WebKit2/ChangeLog	2014-05-10 00:06:51 UTC (rev 168558)
+++ trunk/Source/WebKit2/ChangeLog	2014-05-10 00:08:28 UTC (rev 168559)
@@ -1,3 +1,30 @@
+2014-05-09  Zalan Bujtas  <za...@apple.com>
+
+        Subpixel rendering[iOS]: Top bar on apple.com/support jiggles when the swoosh animates.
+        https://bugs.webkit.org/show_bug.cgi?id=132750
+        <rdar://problem/16803281>
+
+        Reviewed by Simon Fraser.
+
+        This patch ensures that GraphicsLayer and RemoteLayerBackingStore have the same dimensions.
+        
+        Remove integral enclosing when we set the size on RemoteLayerBackingStore. It makes the layer's size
+        different from the backingstore when the passed value is fractional.
+        We scale and integral round this value to size the shareable bitmap later. Rounding ensures that
+        the final size value matches what we calculated at GraphicsLayerCA::updateGeometry()
+
+        Currently not testable.
+
+        * Shared/mac/RemoteLayerBackingStore.h:
+        (WebKit::RemoteLayerBackingStore::size):
+        * Shared/mac/RemoteLayerBackingStore.mm:
+        (WebKit::RemoteLayerBackingStore::ensureBackingStore):
+        (WebKit::RemoteLayerBackingStore::setNeedsDisplay): use enclosing here to ensure we cover the entire backing store.
+        (WebKit::RemoteLayerBackingStore::display):
+        (WebKit::RemoteLayerBackingStore::drawInContext):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::updateBackingStore):
+
 2014-05-09  Benjamin Poulain  <bpoul...@apple.com>
 
         [iOS][WK2] Set up the resize events

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.h (168558 => 168559)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.h	2014-05-10 00:06:51 UTC (rev 168558)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.h	2014-05-10 00:08:28 UTC (rev 168559)
@@ -51,14 +51,14 @@
     RemoteLayerBackingStore(RemoteLayerTreeContext*);
     ~RemoteLayerBackingStore();
 
-    void ensureBackingStore(PlatformCALayerRemote*, WebCore::IntSize, float scale, bool acceleratesDrawing, bool isOpaque);
+    void ensureBackingStore(PlatformCALayerRemote*, WebCore::FloatSize, float scale, bool acceleratesDrawing, bool isOpaque);
 
     void setNeedsDisplay(const WebCore::IntRect);
     void setNeedsDisplay();
 
     bool display();
 
-    WebCore::IntSize size() const { return m_size; }
+    WebCore::FloatSize size() const { return m_size; }
     float scale() const { return m_scale; }
     bool acceleratesDrawing() const { return m_acceleratesDrawing; }
     bool isOpaque() const { return m_isOpaque; }
@@ -100,7 +100,7 @@
 
     PlatformCALayerRemote* m_layer;
 
-    WebCore::IntSize m_size;
+    WebCore::FloatSize m_size;
     float m_scale;
     bool m_isOpaque;
 

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (168558 => 168559)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm	2014-05-10 00:06:51 UTC (rev 168558)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm	2014-05-10 00:08:28 UTC (rev 168559)
@@ -74,7 +74,7 @@
         m_context->backingStoreWillBeDestroyed(this);
 }
 
-void RemoteLayerBackingStore::ensureBackingStore(PlatformCALayerRemote* layer, IntSize size, float scale, bool acceleratesDrawing, bool isOpaque)
+void RemoteLayerBackingStore::ensureBackingStore(PlatformCALayerRemote* layer, FloatSize size, float scale, bool acceleratesDrawing, bool isOpaque)
 {
     if (m_layer == layer && m_size == size && m_scale == scale && m_acceleratesDrawing == acceleratesDrawing && m_isOpaque == isOpaque)
         return;
@@ -167,7 +167,7 @@
 
 void RemoteLayerBackingStore::setNeedsDisplay()
 {
-    setNeedsDisplay(IntRect(IntPoint(), m_size));
+    setNeedsDisplay(IntRect(IntPoint(), expandedIntSize(m_size)));
 }
 
 bool RemoteLayerBackingStore::display()
@@ -181,7 +181,7 @@
     if (m_dirtyRegion.isEmpty() || m_size.isEmpty())
         return false;
 
-    IntRect layerBounds(IntPoint(), m_size);
+    IntRect layerBounds(IntPoint(), expandedIntSize(m_size));
     if (!hasFrontBuffer())
         m_dirtyRegion.unite(layerBounds);
 
@@ -192,9 +192,8 @@
 
     FloatSize scaledSize = m_size;
     scaledSize.scale(m_scale);
-    IntSize expandedScaledSize = expandedIntSize(scaledSize);
+    IntSize expandedScaledSize = roundedIntSize(scaledSize);
     IntRect expandedScaledLayerBounds(IntPoint(), expandedScaledSize);
-
     bool willPaintEntireBackingStore = m_dirtyRegion.contains(layerBounds);
 #if USE(IOSURFACE)
     if (m_acceleratesDrawing) {
@@ -240,8 +239,9 @@
 
 void RemoteLayerBackingStore::drawInContext(GraphicsContext& context, CGImageRef backImage)
 {
-    IntRect layerBounds(IntPoint(), m_size);
-    IntRect scaledLayerBounds(IntPoint(), expandedIntSize(m_size * m_scale));
+    FloatSize scaledSize = m_size;
+    scaledSize.scale(m_scale);
+    IntRect scaledLayerBounds(IntPoint(), roundedIntSize(scaledSize));
 
     if (!m_isOpaque)
         context.clearRect(scaledLayerBounds);
@@ -267,9 +267,9 @@
     // FIXME: find a consistent way to scale and snap dirty and CG clip rects.
     for (const auto& rect : dirtyRects) {
         FloatRect scaledRect(rect);
-        scaledRect.scale(m_scale, m_scale);
+        scaledRect.scale(m_scale);
         scaledRect = enclosingIntRect(scaledRect);
-        scaledRect.scale(1 / m_scale, 1 / m_scale);
+        scaledRect.scale(1 / m_scale);
         m_paintingRects.append(scaledRect);
     }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (168558 => 168559)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2014-05-10 00:06:51 UTC (rev 168558)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2014-05-10 00:08:28 UTC (rev 168559)
@@ -182,7 +182,7 @@
     if (!m_properties.backingStore)
         return;
 
-    m_properties.backingStore->ensureBackingStore(this, expandedIntSize(m_properties.bounds.size()), m_properties.contentsScale, m_acceleratesDrawing, m_properties.opaque);
+    m_properties.backingStore->ensureBackingStore(this, m_properties.bounds.size(), m_properties.contentsScale, m_acceleratesDrawing, m_properties.opaque);
 }
 
 void PlatformCALayerRemote::setNeedsDisplay(const FloatRect* rect)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to