Title: [164910] trunk/Source/WebKit2
Revision
164910
Author
[email protected]
Date
2014-02-28 21:36:01 -0800 (Fri, 28 Feb 2014)

Log Message

[iOS] Assertions and bad behavior when zooming into an iframe containing apple.com
https://bugs.webkit.org/show_bug.cgi?id=129537

Reviewed by Benjamin Poulain.

When building RemoteLayerTreeTransactions, the ordering of setting created
layers and doing the recursive tree walk was wrong, such that we failed
to noticed layers created during the recursiveBuildTransaction().

Also harden the UI-side code against Obj-C exceptions thrown when layers
are missing.

* Shared/mac/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyProperties): Assert when
children are not found, and protect against Obj-C exceptions.
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties):
Initialize the members.
* WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::buildTransaction): Do the recursive walk
before setting created and destroyed layers, since the walk can create
layers (especially when swapping into tiled layers).

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (164909 => 164910)


--- trunk/Source/WebKit2/ChangeLog	2014-03-01 05:34:19 UTC (rev 164909)
+++ trunk/Source/WebKit2/ChangeLog	2014-03-01 05:36:01 UTC (rev 164910)
@@ -1,3 +1,28 @@
+2014-02-28  Simon Fraser  <[email protected]>
+
+        [iOS] Assertions and bad behavior when zooming into an iframe containing apple.com
+        https://bugs.webkit.org/show_bug.cgi?id=129537
+
+        Reviewed by Benjamin Poulain.
+        
+        When building RemoteLayerTreeTransactions, the ordering of setting created
+        layers and doing the recursive tree walk was wrong, such that we failed
+        to noticed layers created during the recursiveBuildTransaction().
+        
+        Also harden the UI-side code against Obj-C exceptions thrown when layers
+        are missing.
+
+        * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+        (WebKit::RemoteLayerTreePropertyApplier::applyProperties): Assert when 
+        children are not found, and protect against Obj-C exceptions.
+        * Shared/mac/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties):
+        Initialize the members.
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
+        (WebKit::RemoteLayerTreeContext::buildTransaction): Do the recursive walk
+        before setting created and destroyed layers, since the walk can create
+        layers (especially when swapping into tiled layers).
+
 2014-02-28  Jinwoo Song  <[email protected]>
 
         Fix WebKit2 build after r164890

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm (164909 => 164910)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm	2014-03-01 05:34:19 UTC (rev 164909)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm	2014-03-01 05:36:01 UTC (rev 164910)
@@ -28,6 +28,7 @@
 
 #import "PlatformCALayerRemote.h"
 #import <QuartzCore/CALayer.h>
+#import <WebCore/BlockExceptions.h>
 #import <WebCore/PlatformCAFilters.h>
 #import <WebCore/ScrollbarThemeMac.h>
 #if PLATFORM(IOS)
@@ -197,12 +198,15 @@
 
 void RemoteLayerTreePropertyApplier::applyProperties(CALayer *layer, const RemoteLayerTreeTransaction::LayerProperties& properties, const RelatedLayerMap& relatedLayers)
 {
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     applyPropertiesToLayer(layer, properties);
 
     if (properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
         RetainPtr<NSMutableArray> children = adoptNS([[NSMutableArray alloc] initWithCapacity:properties.children.size()]);
-        for (auto& child : properties.children)
+        for (auto& child : properties.children) {
+            ASSERT(relatedLayers.get(child));
             [children addObject:relatedLayers.get(child)];
+        }
 
         layer.sublayers = children.get();
     }
@@ -225,17 +229,21 @@
 #endif
         }
     }
+    END_BLOCK_OBJC_EXCEPTIONS;
 }
 
 #if PLATFORM(IOS)
 void RemoteLayerTreePropertyApplier::applyProperties(UIView *view, const RemoteLayerTreeTransaction::LayerProperties& properties, const RelatedLayerMap& relatedLayers)
 {
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     applyPropertiesToLayer(view.layer, properties);
 
     if (properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
         RetainPtr<NSMutableArray> children = adoptNS([[NSMutableArray alloc] initWithCapacity:properties.children.size()]);
-        for (auto& child : properties.children)
+        for (auto child : properties.children) {
+            ASSERT(relatedLayers.get(child));
             [children addObject:relatedLayers.get(child)];
+        }
 
         [view _web_setSubviews:children.get()];
     }
@@ -251,6 +259,7 @@
                 maskView.layer.mask = maskView.layer;
         }
     }
+    END_BLOCK_OBJC_EXCEPTIONS;
 }
 #endif
 

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (164909 => 164910)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2014-03-01 05:34:19 UTC (rev 164909)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2014-03-01 05:36:01 UTC (rev 164910)
@@ -41,6 +41,9 @@
 namespace WebKit {
 
 RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties()
+    : layerID(0)
+    , type(PlatformCALayer::LayerTypeLayer)
+    , hostingContextID(0)
 {
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm (164909 => 164910)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm	2014-03-01 05:34:19 UTC (rev 164909)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm	2014-03-01 05:36:01 UTC (rev 164910)
@@ -95,11 +95,11 @@
 {
     PlatformCALayerRemote& rootLayerRemote = toPlatformCALayerRemote(rootLayer);
     transaction.setRootLayerID(rootLayerRemote.layerID());
-    
+
+    rootLayerRemote.recursiveBuildTransaction(transaction);
+
     transaction.setCreatedLayers(std::move(m_createdLayers));
     transaction.setDestroyedLayerIDs(std::move(m_destroyedLayers));
-
-    rootLayerRemote.recursiveBuildTransaction(transaction);
 }
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to