Changeset 238550 in webkit
- Timestamp:
- Nov 27, 2018, 5:34:17 AM (8 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h (modified) (1 diff)
-
Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r238549 r238550 1 2018-11-27 Antti Koivisto <antti@apple.com> 2 3 Factor mask layer applying in RemoteLayerTreePropertyApplier into a shared function 4 https://bugs.webkit.org/show_bug.cgi?id=192001 5 6 Reviewed by Tim Horton. 7 8 * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h: 9 * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm: 10 (WebKit::RemoteLayerTreePropertyApplier::applyProperties): 11 (WebKit::RemoteLayerTreePropertyApplier::updateMask): 12 13 Shared function, with some special tricks for iOS backdrop layers. 14 15 (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToUIView): 16 1 17 2018-11-27 Antti Koivisto <antti@apple.com> 2 18 -
trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h
r238549 r238550 42 42 private: 43 43 static void updateChildren(RemoteLayerTreeNode&, const RemoteLayerTreeTransaction::LayerProperties&, const RelatedLayerMap&); 44 static void updateMask(RemoteLayerTreeNode&, const RemoteLayerTreeTransaction::LayerProperties&, const RelatedLayerMap&); 44 45 #if PLATFORM(IOS_FAMILY) 45 46 static void applyPropertiesToUIView(UIView *, const RemoteLayerTreeTransaction::LayerProperties&, const RelatedLayerMap&); -
trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm
r238547 r238550 259 259 BEGIN_BLOCK_OBJC_EXCEPTIONS; 260 260 261 CALayer *layer = node.layer(); 262 263 applyPropertiesToLayer(layer, layerTreeHost, properties, layerContentsType); 261 applyPropertiesToLayer(node.layer(), layerTreeHost, properties, layerContentsType); 264 262 updateChildren(node, properties, relatedLayers); 263 updateMask(node, properties, relatedLayers); 265 264 266 265 #if PLATFORM(IOS_FAMILY) 267 266 applyPropertiesToUIView(node.uiView(), properties, relatedLayers); 268 #else 269 if (properties.changedProperties & RemoteLayerTreeTransaction::MaskLayerChanged) { 270 if (!properties.maskLayerID) 271 layer.mask = nullptr; 272 else { 273 CALayer *maskLayer = relatedLayers.get(properties.maskLayerID)->layer(); 274 ASSERT(!maskLayer.superlayer); 275 if (!maskLayer.superlayer) 276 layer.mask = maskLayer; 277 } 278 } 279 #endif 267 #endif 268 280 269 END_BLOCK_OBJC_EXCEPTIONS; 281 270 } … … 329 318 } 330 319 331 #if PLATFORM(IOS_FAMILY) 332 void RemoteLayerTreePropertyApplier::applyPropertiesToUIView(UIView *view, const RemoteLayerTreeTransaction::LayerProperties& properties, const RelatedLayerMap& relatedLayers) 333 { 334 if (properties.changedProperties.contains(RemoteLayerTreeTransaction::MaskLayerChanged)) { 335 CALayer *maskOwnerLayer = view.layer; 336 320 void RemoteLayerTreePropertyApplier::updateMask(RemoteLayerTreeNode& node, const RemoteLayerTreeTransaction::LayerProperties& properties, const RelatedLayerMap& relatedLayers) 321 { 322 if (!properties.changedProperties.contains(RemoteLayerTreeTransaction::MaskLayerChanged)) 323 return; 324 325 auto maskOwnerLayer = [&] { 326 CALayer *layer = node.layer(); 327 #if PLATFORM(IOS_FAMILY) 337 328 if (properties.customAppearance == GraphicsLayer::CustomAppearance::LightBackdrop || properties.customAppearance == GraphicsLayer::CustomAppearance::DarkBackdrop) { 338 329 // This is a UIBackdropView, which means any mask must be applied to the CABackdropLayer rather 339 330 // that the view's layer. The backdrop is the first layer child. 340 if (view.layer.sublayers.count && [view.layer.sublayers[0] isKindOfClass:[CABackdropLayer class]]) 341 maskOwnerLayer = view.layer.sublayers[0]; 342 } 343 344 if (!properties.maskLayerID) 345 maskOwnerLayer.mask = nullptr; 346 else { 347 UIView *maskView = relatedLayers.get(properties.maskLayerID)->uiView(); 348 // FIXME: need to check that the mask view is kept alive. 349 ASSERT(!maskView.layer.superlayer); 350 if (!maskView.layer.superlayer) 351 maskOwnerLayer.mask = maskView.layer; 352 } 353 } 354 331 if (layer.sublayers.count && [layer.sublayers[0] isKindOfClass:[CABackdropLayer class]]) 332 layer = layer.sublayers[0]; 333 } 334 #endif 335 return layer; 336 }; 337 338 if (!properties.maskLayerID) { 339 maskOwnerLayer().mask = nullptr; 340 return; 341 } 342 343 CALayer *maskLayer = relatedLayers.get(properties.maskLayerID)->layer(); 344 ASSERT(!maskLayer.superlayer); 345 if (maskLayer.superlayer) 346 return; 347 maskOwnerLayer().mask = maskLayer; 348 } 349 350 #if PLATFORM(IOS_FAMILY) 351 void RemoteLayerTreePropertyApplier::applyPropertiesToUIView(UIView *view, const RemoteLayerTreeTransaction::LayerProperties& properties, const RelatedLayerMap& relatedLayers) 352 { 355 353 if (properties.changedProperties.containsAny({ RemoteLayerTreeTransaction::ContentsHiddenChanged, RemoteLayerTreeTransaction::UserInteractionEnabledChanged })) 356 354 view.userInteractionEnabled = !properties.contentsHidden && properties.userInteractionEnabled;
Note:
See TracChangeset
for help on using the changeset viewer.