Title: [174367] trunk/Source/WebKit2
Revision
174367
Author
[email protected]
Date
2014-10-06 14:52:42 -0700 (Mon, 06 Oct 2014)

Log Message

Don't attempt to paint into zero-sized backing store
https://bugs.webkit.org/show_bug.cgi?id=137465

Reviewed by Tim Horton.

Page scale could cause the backing store for a small composited element to become empty,
in which case we'd try to allocate, and paint into a graphics context with no surface
behind it.

Fix by bailing from RemoteLayerBackingStore::display() when checking the backing store
size after accounting for scale.

* Shared/mac/RemoteLayerBackingStore.h:
* Shared/mac/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::backingStoreSize):
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
(WebKit::RemoteLayerBackingStore::display):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (174366 => 174367)


--- trunk/Source/WebKit2/ChangeLog	2014-10-06 21:37:28 UTC (rev 174366)
+++ trunk/Source/WebKit2/ChangeLog	2014-10-06 21:52:42 UTC (rev 174367)
@@ -1,3 +1,23 @@
+2014-10-06  Simon Fraser  <[email protected]>
+
+        Don't attempt to paint into zero-sized backing store
+        https://bugs.webkit.org/show_bug.cgi?id=137465
+
+        Reviewed by Tim Horton.
+        
+        Page scale could cause the backing store for a small composited element to become empty,
+        in which case we'd try to allocate, and paint into a graphics context with no surface
+        behind it.
+        
+        Fix by bailing from RemoteLayerBackingStore::display() when checking the backing store
+        size after accounting for scale.
+
+        * Shared/mac/RemoteLayerBackingStore.h:
+        * Shared/mac/RemoteLayerBackingStore.mm:
+        (WebKit::RemoteLayerBackingStore::backingStoreSize):
+        (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
+        (WebKit::RemoteLayerBackingStore::display):
+
 2014-10-06  Christophe Dumez  <[email protected]>
 
         Use is<>() / downcast<>() for ScrollingTree subclasses

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.h (174366 => 174367)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.h	2014-10-06 21:37:28 UTC (rev 174366)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.h	2014-10-06 21:52:42 UTC (rev 174367)
@@ -96,6 +96,8 @@
     void drawInContext(WebCore::GraphicsContext&, CGImageRef backImage);
     void clearBackingStore();
     void swapToValidFrontBuffer();
+    
+    WebCore::IntSize backingStoreSize() const;
 
     PlatformCALayerRemote* m_layer;
 

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (174366 => 174367)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm	2014-10-06 21:37:28 UTC (rev 174366)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm	2014-10-06 21:52:42 UTC (rev 174367)
@@ -171,12 +171,17 @@
     setNeedsDisplay(IntRect(IntPoint(), expandedIntSize(m_size)));
 }
 
-void RemoteLayerBackingStore::swapToValidFrontBuffer()
+IntSize RemoteLayerBackingStore::backingStoreSize() const
 {
     FloatSize scaledSize = m_size;
     scaledSize.scale(m_scale);
-    IntSize expandedScaledSize = roundedIntSize(scaledSize);
+    return roundedIntSize(scaledSize);
+}
 
+void RemoteLayerBackingStore::swapToValidFrontBuffer()
+{
+    IntSize expandedScaledSize = backingStoreSize();
+
 #if USE(IOSURFACE)
     if (m_acceleratesDrawing) {
         if (!m_backBuffer.surface || m_backBuffer.surface->isInUse()) {
@@ -215,7 +220,9 @@
     // Make the previous front buffer non-volatile early, so that we can dirty the whole layer if it comes back empty.
     setBufferVolatility(BufferType::Front, false);
 
-    if (m_dirtyRegion.isEmpty() || m_size.isEmpty())
+    IntSize expandedScaledSize = backingStoreSize();
+
+    if (m_dirtyRegion.isEmpty() || expandedScaledSize.isEmpty())
         return false;
 
     IntRect layerBounds(IntPoint(), expandedIntSize(m_size));
@@ -227,9 +234,6 @@
         m_dirtyRegion.unite(indicatorRect);
     }
 
-    FloatSize scaledSize = m_size;
-    scaledSize.scale(m_scale);
-    IntSize expandedScaledSize = roundedIntSize(scaledSize);
     IntRect expandedScaledLayerBounds(IntPoint(), expandedScaledSize);
     bool willPaintEntireBackingStore = m_dirtyRegion.contains(layerBounds);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to