Changeset 175716 in webkit
- Timestamp:
- Nov 6, 2014 2:23:16 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 16 added
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r175715 r175716 1 2014-11-06 Dean Jackson <dino@apple.com> 2 3 [filters2] Support for backdrop-filter 4 https://bugs.webkit.org/show_bug.cgi?id=138384 5 <rdar://problem/18874494> 6 7 Reviewed by Simon Fraser. 8 9 Take 2!! Previous patch was rolled out. 10 11 Tests for backdrop-filter. These are skipped on non-Apple platforms. 12 13 * platform/win/TestExpections: Skip these tests. 14 * platform/efl/TestExpections: 15 * platform/gtk/TestExpections: 16 * platform/mac-mavericks/TestExpectations: Yosemite only. 17 18 * css3/filters/backdrop/backdropfilter-property-computed-style-expected.txt: Added. 19 * css3/filters/backdrop/backdropfilter-property-computed-style.html: Added. 20 * css3/filters/backdrop/backdropfilter-property-expected.txt: Added. 21 * css3/filters/backdrop/backdropfilter-property-parsing-expected.txt: Added. 22 * css3/filters/backdrop/backdropfilter-property-parsing-invalid-expected.txt: Added. 23 * css3/filters/backdrop/backdropfilter-property-parsing-invalid.html: Added. 24 * css3/filters/backdrop/backdropfilter-property-parsing.html: Added. 25 * css3/filters/backdrop/backdropfilter-property.html: Added. 26 * css3/filters/backdrop/effect-hw-expected.html: Added. 27 * css3/filters/backdrop/effect-hw.html: Added. 28 * css3/filters/backdrop/script-tests/backdropfilter-property-computed-style.js: Added. 29 (testComputedFilterRule): 30 * css3/filters/backdrop/script-tests/backdropfilter-property-parsing-invalid.js: Added. 31 (testInvalidFilterRule): 32 * css3/filters/backdrop/script-tests/backdropfilter-property-parsing.js: Added. 33 (jsWrapperClass): 34 (shouldBeType): 35 (testFilterRule): 36 * css3/filters/backdrop/script-tests/backdropfilter-property.js: Added. 37 1 38 2014-11-06 Benjamin Poulain <bpoulain@apple.com> 2 39 -
trunk/LayoutTests/platform/efl/TestExpectations
r175687 r175716 446 446 media/encrypted-media/encrypted-media-not-loaded.html [ WontFix ] 447 447 media/encrypted-media/encrypted-media-syntax.html [ WontFix ] 448 449 # No support for Filters Level 2 on EFL yet 450 Bug(EFL) css3/filters/backdrop [ Skip ] 448 451 449 452 #//////////////////////////////////////////////////////////////////////////////////////// -
trunk/LayoutTests/platform/gtk/TestExpectations
r175687 r175716 443 443 444 444 webkit.org/b/133806 svg/masking/mask-transformed-text-missing.svg [ ImageOnlyFailure ] 445 446 # No support for Filters Level 2 on GTK yet 447 Bug(GTK) css3/filters/backdrop [ Skip ] 445 448 446 449 #//////////////////////////////////////////////////////////////////////////////////////// -
trunk/LayoutTests/platform/mac-mavericks/TestExpectations
r175687 r175716 1 1 # This test should only be run on Yosemite or later. 2 2 platform/mac/editing/input/undo-grouping-on-text-insertion.html [ Skip ] 3 4 # Backdrop filters are not supported on Mavericks 5 css3/filters/backdrop [ Skip ] -
trunk/LayoutTests/platform/win/TestExpectations
r175687 r175716 45 45 css3/filters/filter-is-on-subpixel-position.html 46 46 css3/masking/clip-path-filter.html 47 css3/filters/backdrop 47 48 48 49 # Remove from list after enabling CANVAS_PATH -
trunk/Source/WebCore/ChangeLog
r175715 r175716 1 2014-11-06 Dean Jackson <dino@apple.com> 2 3 [filters2] Support for backdrop-filter 4 https://bugs.webkit.org/show_bug.cgi?id=138384 5 <rdar://problem/18874494> 6 7 Reviewed by Simon Fraser. 8 9 Take 2!! Previous patch was rolled out. 10 11 Add prototype support for backdrop-filter 12 http://dev.w3.org/fxtf/filters-2/#BackdropFilterProperty 13 14 This adds support for parsing the new CSS property, adding 15 the value to RenderStyle, noticing that on the layer tree, 16 and the platform code in GraphicsLayer to render a backdrop 17 and apply an effect to the result. 18 19 Some things are missing: 20 - animation of the backdrop-filter is not yet supported 21 - backdrops will not work in cloned layers yet (e.g. reflections) 22 23 Tests: css3/filters/backdrop/backdropfilter-property-computed-style.html 24 css3/filters/backdrop/backdropfilter-property-parsing-invalid.html 25 css3/filters/backdrop/backdropfilter-property-parsing.html 26 css3/filters/backdrop/backdropfilter-property.html 27 css3/filters/backdrop/effect-hw.html 28 29 * WebCore.exp.in: Export the setBackdropFilters method so it can 30 be used from WebKit. 31 32 * css/CSSComputedStyleDeclaration.cpp: New property name. 33 (WebCore::isLayoutDependent): 34 (WebCore::ComputedStyleExtractor::propertyValue): Use the existing valueForFilter method. 35 36 * css/CSSParser.cpp: 37 (WebCore::CSSParser::parseValue): Piggyback on the filter parser. 38 39 * css/CSSPropertyNames.in: Add -webkit-backdrop-filter. 40 41 * css/StyleResolver.cpp: 42 (WebCore::StyleResolver::adjustRenderStyle): Add test for backdrop. 43 (WebCore::StyleResolver::applyProperty): Support new property. 44 45 * platform/graphics/GraphicsLayer.h: 46 (WebCore::GraphicsLayer::needsBackdrop): New method to test for existence of values. 47 (WebCore::GraphicsLayer::backdropFilters): Keeps the list of filters. 48 (WebCore::GraphicsLayer::setBackdropFilters): 49 (WebCore::GraphicsLayer::clearBackdropFilters): 50 51 * platform/graphics/ca/GraphicsLayerCA.cpp: This adds a new m_backdropLayer CALayer 52 that will sit behind the contents layer and provide the element's backdrop. 53 (WebCore::GraphicsLayerCA::willBeDestroyed): 54 (WebCore::GraphicsLayerCA::moveOrCopyAnimations): 55 (WebCore::GraphicsLayerCA::setBackdropFilters): Set a custom appearance so 56 remote layer hosts will notice the special layer. Also set the actual 57 layer properties. 58 (WebCore::GraphicsLayerCA::addAnimation): Remove whitespace. 59 (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): Update backdrop if necessary. 60 (WebCore::GraphicsLayerCA::updateLayerNames): Give the new layer a name. 61 (WebCore::GraphicsLayerCA::updateSublayerList): 62 (WebCore::GraphicsLayerCA::updateGeometry): Make the backdrop layer match the contents 63 layer geometry. 64 (WebCore::GraphicsLayerCA::updateBackdropFilters): Create the backdrop layer if necessary, 65 and copy the filter values to any clones. 66 (WebCore::GraphicsLayerCA::ensureStructuralLayer): We need a structural layer if we 67 have backdrop filters. 68 (WebCore::GraphicsLayerCA::structuralLayerPurpose): 69 (WebCore::GraphicsLayerCA::createAnimationFromKeyframes): 70 (WebCore::GraphicsLayerCA::swapFromOrToTiledLayer): 71 * platform/graphics/ca/GraphicsLayerCA.h: New StructuralLayerPurpose, new LayerChangeFlag. 72 73 * platform/graphics/ca/PlatformCALayer.h: New LayerType. 74 75 * platform/graphics/ca/mac/PlatformCALayerMac.mm: Define CABackdropLayer. 76 (PlatformCALayerMac::PlatformCALayerMac): Create the correct CALayer type. 77 78 * rendering/RenderElement.h: 79 (WebCore::RenderElement::createsGroup): 80 (WebCore::RenderElement::hasBackdropFilter): This method is always around, but 81 only can return true when FILTERS_LEVEL_2 is enabled. 82 83 * rendering/RenderLayer.cpp: 84 (WebCore::RenderLayer::paintsWithFilters): Remove an unnecessary comment. 85 (WebCore::RenderLayer::calculateClipRects): 86 87 * rendering/RenderLayer.h: Add hasBackdropFilter. 88 89 * rendering/RenderLayerBacking.cpp: 90 (WebCore::RenderLayerBacking::RenderLayerBacking): 91 (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer): Update the backdrop filters. 92 (WebCore::RenderLayerBacking::updateBackdropFilters): Set the filters on the GraphicsLayer. 93 (WebCore::RenderLayerBacking::updateGeometry): 94 * rendering/RenderLayerBacking.h: 95 96 * rendering/RenderLayerCompositor.cpp: 97 (WebCore::RenderLayerCompositor::requiresOwnBackingStore): Needs backingstore if it has a backdrop filter. 98 (WebCore::RenderLayerCompositor::reasonsForCompositing): 99 (WebCore::RenderLayerCompositor::requiresCompositingForFilters): Return early if we have 100 a backdrop filter, because currently we absolutely require compositing. 101 102 * rendering/RenderLayerModelObject.cpp: 103 (WebCore::RenderLayerModelObject::styleWillChange): Add hasBackdropFilter(). 104 105 * rendering/style/RenderStyle.cpp: 106 (WebCore::RenderStyle::changeRequiresLayout): Check backdrops for change. 107 108 * rendering/style/RenderStyle.h: Add the backdropFilter style stuff. 109 * rendering/style/StyleRareNonInheritedData.cpp: 110 (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): 111 (WebCore::StyleRareNonInheritedData::operator==): 112 (WebCore::StyleRareNonInheritedData::hasBackdropFilters): 113 * rendering/style/StyleRareNonInheritedData.h: 114 1 115 2014-11-06 Benjamin Poulain <bpoulain@apple.com> 2 116 -
trunk/Source/WebCore/WebCore.exp.in
r175710 r175716 550 550 __ZN7WebCore15GraphicsContextD1Ev 551 551 __ZN7WebCore15GraphicsLayerCA10initializeEv 552 __ZN7WebCore15GraphicsLayerCA18setBackdropFiltersERKNS_16FilterOperationsE 552 553 __ZN7WebCore15GraphicsLayerCA10setFiltersERKNS_16FilterOperationsE 553 554 __ZN7WebCore15GraphicsLayerCA10setOpacityEf -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r175687 r175716 292 292 CSSPropertyWebkitJustifySelf, 293 293 CSSPropertyWebkitFilter, 294 #if ENABLE(FILTERS_LEVEL_2) 295 CSSPropertyWebkitBackdropFilter, 296 #endif 294 297 CSSPropertyWebkitFontKerning, 295 298 CSSPropertyWebkitFontSmoothing, … … 1600 1603 case CSSPropertyWebkitTransform: 1601 1604 case CSSPropertyWebkitFilter: 1605 #if ENABLE(FILTERS_LEVEL_2) 1606 case CSSPropertyWebkitBackdropFilter: 1607 #endif 1602 1608 return true; 1603 1609 case CSSPropertyMargin: { … … 2892 2898 case CSSPropertyWebkitFilter: 2893 2899 return valueForFilter(style.get(), style->filter()); 2900 #if ENABLE(FILTERS_LEVEL_2) 2901 case CSSPropertyWebkitBackdropFilter: 2902 return valueForFilter(style.get(), style->backdropFilter()); 2903 #endif 2894 2904 #if ENABLE(CSS_COMPOSITING) 2895 2905 case CSSPropertyMixBlendMode: -
trunk/Source/WebCore/css/CSSParser.cpp
r175687 r175716 2456 2456 break; 2457 2457 case CSSPropertyWebkitFilter: 2458 #if ENABLE(FILTERS_LEVEL_2) 2459 case CSSPropertyWebkitBackdropFilter: 2460 #endif 2458 2461 if (id == CSSValueNone) 2459 2462 validPrimitive = true; -
trunk/Source/WebCore/css/CSSPropertyNames.in
r175687 r175716 372 372 justify-content [NewStyleBuilder] 373 373 -webkit-justify-content = justify-content 374 #if defined(ENABLE_FILTERS_LEVEL_2) && ENABLE_FILTERS_LEVEL_2 375 -webkit-backdrop-filter 376 #endif 374 377 -webkit-justify-self 375 378 -webkit-font-size-delta -
trunk/Source/WebCore/css/StyleResolver.cpp
r175687 r175716 1260 1260 || style.boxReflect() 1261 1261 || style.hasFilter() 1262 #if ENABLE(FILTERS_LEVEL_2) 1263 || style.hasBackdropFilter() 1264 #endif 1262 1265 || style.hasBlendMode() 1263 1266 || style.hasIsolation() … … 1353 1356 || style.overflowY() != OVISIBLE 1354 1357 || style.hasFilter() 1358 #if ENABLE(FILTERS_LEVEL_2) 1359 || style.hasBackdropFilter() 1360 #endif 1355 1361 || style.hasBlendMode())) 1356 1362 style.setTransformStyle3D(TransformStyle3DFlat); … … 2702 2708 return; 2703 2709 } 2710 2711 #if ENABLE(FILTERS_LEVEL_2) 2712 case CSSPropertyWebkitBackdropFilter: { 2713 HANDLE_INHERIT_AND_INITIAL(backdropFilter, BackdropFilter); 2714 FilterOperations operations; 2715 if (createFilterOperations(value, operations)) 2716 state.style()->setBackdropFilter(operations); 2717 return; 2718 } 2719 #endif 2704 2720 2705 2721 #if ENABLE(CSS_GRID_LAYOUT) -
trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp
r175687 r175716 363 363 m_filterFunctionListsMatch = false; 364 364 365 #if ENABLE(FILTERS_LEVEL_2) 366 if (m_keyframes.size() < 2 || (!m_keyframes.containsProperty(CSSPropertyWebkitFilter) && !m_keyframes.containsProperty(CSSPropertyWebkitBackdropFilter))) 367 #else 365 368 if (m_keyframes.size() < 2 || !m_keyframes.containsProperty(CSSPropertyWebkitFilter)) 369 #endif 366 370 return; 367 371 -
trunk/Source/WebCore/platform/graphics/GraphicsLayer.h
r175687 r175716 326 326 virtual void setAcceleratesDrawing(bool b) { m_acceleratesDrawing = b; } 327 327 328 bool needsBackdrop() const { return !m_backdropFilters.isEmpty(); } 329 328 330 // The color used to paint the layer background. Pass an invalid color to remove it. 329 331 // Note that this covers the entire layer. Use setContentsToSolidColor() if the color should … … 343 345 344 346 const FilterOperations& filters() const { return m_filters; } 345 346 // Returns true if filter can be rendered by the compositor 347 // Returns true if filter can be rendered by the compositor. 347 348 virtual bool setFilters(const FilterOperations& filters) { m_filters = filters; return true; } 349 350 const FilterOperations& backdropFilters() const { return m_backdropFilters; } 351 virtual bool setBackdropFilters(const FilterOperations& filters) { m_backdropFilters = filters; return true; } 348 352 349 353 #if ENABLE(CSS_COMPOSITING) … … 519 523 // needs to notifiy the change to the platform layer as needed. 520 524 void clearFilters() { m_filters.clear(); } 525 void clearBackdropFilters() { m_backdropFilters.clear(); } 521 526 522 527 // Given a KeyframeValueList containing filterOperations, return true if the operations are valid. … … 565 570 566 571 FilterOperations m_filters; 572 FilterOperations m_backdropFilters; 567 573 568 574 #if ENABLE(CSS_COMPOSITING) -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r175687 r175716 303 303 #endif 304 304 } 305 305 306 306 PassRefPtr<PlatformCALayer> GraphicsLayerCA::createPlatformCALayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* owner) 307 307 { … … 377 377 if (m_structuralLayer) 378 378 m_structuralLayer->setOwner(nullptr); 379 379 380 if (m_backdropLayer) 381 m_backdropLayer->setOwner(nullptr); 382 380 383 removeCloneLayers(); 381 384 … … 568 571 for (size_t i = 0; i < numAnimations; ++i) { 569 572 const LayerPropertyAnimation& currAnimation = propertyAnimations[i]; 570 573 571 574 if (currAnimation.m_property == AnimatedPropertyWebkitTransform || currAnimation.m_property == AnimatedPropertyOpacity 572 575 || currAnimation.m_property == AnimatedPropertyBackgroundColor … … 686 689 } 687 690 691 bool GraphicsLayerCA::setBackdropFilters(const FilterOperations& filterOperations) 692 { 693 bool canCompositeFilters = filtersCanBeComposited(filterOperations); 694 695 if (m_backdropFilters == filterOperations) 696 return canCompositeFilters; 697 698 // Filters cause flattening, so we should never have filters on a layer with preserves3D(). 699 ASSERT(!filterOperations.size() || !preserves3D()); 700 701 if (canCompositeFilters) 702 GraphicsLayer::setBackdropFilters(filterOperations); 703 else { 704 // FIXME: This would clear the backdrop filters if we had a software implementation. 705 clearBackdropFilters(); 706 } 707 noteLayerPropertyChanged(BackdropFiltersChanged); 708 return canCompositeFilters; 709 } 710 688 711 #if ENABLE(CSS_COMPOSITING) 689 712 void GraphicsLayerCA::setBlendMode(BlendMode blendMode) … … 800 823 if (createdAnimations) 801 824 noteLayerPropertyChanged(AnimationChanged); 802 825 803 826 return createdAnimations; 804 827 } … … 1266 1289 1267 1290 // Need to handle Preserves3DChanged first, because it affects which layers subsequent properties are applied to 1268 if (m_uncommittedChanges & (Preserves3DChanged | ReplicatedLayerChanged ))1291 if (m_uncommittedChanges & (Preserves3DChanged | ReplicatedLayerChanged | BackdropFiltersChanged)) 1269 1292 updateStructuralLayer(); 1270 1293 … … 1314 1337 if (m_uncommittedChanges & FiltersChanged) 1315 1338 updateFilters(); 1339 1340 if (m_uncommittedChanges & BackdropFiltersChanged) 1341 updateBackdropFilters(); 1316 1342 1317 1343 #if ENABLE(CSS_COMPOSITING) … … 1401 1427 m_structuralLayer->setName("Replica flattening layer " + name()); 1402 1428 break; 1429 case StructuralLayerForBackdrop: 1430 m_structuralLayer->setName("Backdrop hosting layer " + name()); 1431 break; 1403 1432 case NoStructuralLayer: 1404 1433 break; … … 1425 1454 1426 1455 if (m_structuralLayer) { 1456 if (m_backdropLayer) 1457 structuralLayerChildren.append(m_backdropLayer); 1458 1427 1459 if (m_replicaLayer) 1428 1460 structuralLayerChildren.append(downcast<GraphicsLayerCA>(*m_replicaLayer).primaryLayer()); … … 1510 1542 m_layer->setBounds(adjustedBounds); 1511 1543 m_layer->setAnchorPoint(scaledAnchorPoint); 1544 1545 if (m_backdropLayer) { 1546 m_backdropLayer->setPosition(adjustedPosition); 1547 m_backdropLayer->setBounds(adjustedBounds); 1548 m_backdropLayer->setAnchorPoint(scaledAnchorPoint); 1549 } 1512 1550 1513 1551 if (LayerMap* layerCloneMap = m_layerClones.get()) { … … 1641 1679 } 1642 1680 1681 void GraphicsLayerCA::updateBackdropFilters() 1682 { 1683 if (m_backdropFilters.isEmpty()) { 1684 if (m_backdropLayer) { 1685 m_backdropLayer->removeFromSuperlayer(); 1686 m_backdropLayer->setOwner(nullptr); 1687 m_backdropLayer = nullptr; 1688 } 1689 return; 1690 } 1691 1692 if (!m_backdropLayer) { 1693 m_backdropLayer = createPlatformCALayer(PlatformCALayer::LayerTypeBackdropLayer, this); 1694 m_backdropLayer->setPosition(m_layer->position()); 1695 m_backdropLayer->setBounds(m_layer->bounds()); 1696 m_backdropLayer->setAnchorPoint(m_layer->anchorPoint()); 1697 m_backdropLayer->setMasksToBounds(true); 1698 } 1699 m_backdropLayer->setFilters(m_backdropFilters); 1700 } 1701 1643 1702 #if ENABLE(CSS_COMPOSITING) 1644 1703 void GraphicsLayerCA::updateBlendMode() … … 1671 1730 | BackfaceVisibilityChanged 1672 1731 | FiltersChanged 1732 | BackdropFiltersChanged 1673 1733 | OpacityChanged; 1674 1734 … … 1686 1746 1687 1747 // Release the structural layer. 1688 m_structuralLayer = 0;1748 m_structuralLayer = nullptr; 1689 1749 1690 1750 m_uncommittedChanges |= structuralLayerChangeFlags; … … 1750 1810 if (isReplicated()) 1751 1811 return StructuralLayerForReplicaFlattening; 1752 1812 1813 if (needsBackdrop()) 1814 return StructuralLayerForBackdrop; 1815 1753 1816 return NoStructuralLayer; 1754 1817 } … … 2263 2326 { 2264 2327 ASSERT(valueList.property() != AnimatedPropertyWebkitTransform && (!supportsAcceleratedFilterAnimations() || valueList.property() != AnimatedPropertyWebkitFilter)); 2265 2328 2266 2329 bool isKeyframe = valueList.size() > 2; 2267 2330 bool valuesOK; … … 3000 3063 | AcceleratesDrawingChanged 3001 3064 | FiltersChanged 3065 | BackdropFiltersChanged 3002 3066 | MaskLayerChanged 3003 3067 | OpacityChanged -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
r175687 r175716 106 106 virtual bool filtersCanBeComposited(const FilterOperations&); 107 107 108 WEBCORE_EXPORT virtual bool setBackdropFilters(const FilterOperations&) override; 109 108 110 #if ENABLE(CSS_COMPOSITING) 109 111 WEBCORE_EXPORT virtual void setBlendMode(BlendMode) override; … … 203 205 void updateOpacityOnLayer(); 204 206 void updateFilters(); 207 void updateBackdropFilters(); 205 208 206 209 #if ENABLE(CSS_COMPOSITING) … … 384 387 NoStructuralLayer = 0, 385 388 StructuralLayerForPreserves3D, 386 StructuralLayerForReplicaFlattening 389 StructuralLayerForReplicaFlattening, 390 StructuralLayerForBackdrop 387 391 }; 388 392 void ensureStructuralLayer(StructuralLayerPurpose); … … 428 432 VisibleRectChanged = 1LLU << 25, 429 433 FiltersChanged = 1LLU << 26, 430 TilingAreaChanged = 1LLU << 27, 431 TilesAdded = 1LLU < 28, 432 DebugIndicatorsChanged = 1LLU << 29, 433 CustomAppearanceChanged = 1LLU << 30, 434 CustomBehaviorChanged = 1LLU << 31, 435 BlendModeChanged = 1LLU << 32 434 BackdropFiltersChanged = 1LLU << 27, 435 TilingAreaChanged = 1LLU << 28, 436 TilesAdded = 1LLU < 29, 437 DebugIndicatorsChanged = 1LLU << 30, 438 CustomAppearanceChanged = 1LLU << 31, 439 CustomBehaviorChanged = 1LLU << 32, 440 BlendModeChanged = 1LLU << 33 436 441 }; 437 442 typedef uint64_t LayerChangeFlags; … … 447 452 RefPtr<PlatformCALayer> m_contentsClippingLayer; // A layer used to clip inner content 448 453 RefPtr<PlatformCALayer> m_contentsLayer; // A layer used for inner content, like image and video 454 RefPtr<PlatformCALayer> m_backdropLayer; // The layer used for backdrop rendering, if necessary. 449 455 450 456 // References to clones of our layers, for replicated layers. -
trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h
r175687 r175716 78 78 LayerTypeAVPlayerLayer, 79 79 LayerTypeWebGLLayer, 80 LayerTypeBackdropLayer, 80 81 LayerTypeCustom 81 82 }; -
trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
r175687 r175716 63 63 #endif 64 64 65 #if ENABLE(FILTERS_LEVEL_2) 66 @interface CABackdropLayer : CALayer 67 @end 68 #endif 65 69 66 70 SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation) … … 233 237 case LayerTypeTransformLayer: 234 238 layerClass = [CATransformLayer class]; 239 break; 240 case LayerTypeBackdropLayer: 241 #if ENABLE(FILTERS_LEVEL_2) 242 layerClass = [CABackdropLayer class]; 243 #else 244 ASSERT_NOT_REACHED(); 245 layerClass = [CALayer class]; 246 #endif 235 247 break; 236 248 case LayerTypeWebTiledLayer: -
trunk/Source/WebCore/rendering/RenderElement.h
r175687 r175716 123 123 124 124 // Returns true if this renderer requires a new stacking context. 125 bool createsGroup() const { return isTransparent() || hasMask() || hasFilter() || hasB lendMode(); }125 bool createsGroup() const { return isTransparent() || hasMask() || hasFilter() || hasBackdropFilter() || hasBlendMode(); } 126 126 127 127 bool isTransparent() const { return style().opacity() < 1.0f; } … … 138 138 139 139 bool hasFilter() const { return style().hasFilter(); } 140 bool hasBackdropFilter() const 141 { 142 #if ENABLE(FILTERS_LEVEL_2) 143 return style().hasBackdropFilter(); 144 #else 145 return false; 146 #endif 147 } 140 148 141 149 #if ENABLE(CSS_COMPOSITING) -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r175687 r175716 316 316 bool RenderLayer::paintsWithFilters() const 317 317 { 318 // FIXME: Eventually there will be cases where we paint with filters even without accelerated compositing,319 // and this whole function won't be inside the #if below.320 321 318 if (!renderer().hasFilter()) 322 319 return false; … … 6219 6216 && !renderer().hasClipPath() 6220 6217 && !renderer().hasFilter() 6218 && !renderer().hasBackdropFilter() 6221 6219 #if PLATFORM(IOS) 6222 6220 && !hasAcceleratedTouchScrolling() -
trunk/Source/WebCore/rendering/RenderLayer.h
r175687 r175716 792 792 void filterNeedsRepaint(); 793 793 bool hasFilter() const { return renderer().hasFilter(); } 794 bool hasBackdropFilter() const 795 { 796 #if ENABLE(FILTERS_LEVEL_2) 797 return renderer().hasBackdropFilter(); 798 #else 799 return false; 800 #endif 801 } 794 802 795 803 #if ENABLE(CSS_COMPOSITING) -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r175687 r175716 113 113 , m_requiresOwnBackingStore(true) 114 114 , m_canCompositeFilters(false) 115 #if ENABLE(FILTERS_LEVEL_2) 116 , m_canCompositeBackdropFilters(false) 117 #endif 115 118 , m_backgroundLayerPaintsFixedRootBackground(false) 116 119 { … … 312 315 updateTransform(renderer().style()); 313 316 updateFilters(renderer().style()); 317 #if ENABLE(FILTERS_LEVEL_2) 318 updateBackdropFilters(renderer().style()); 319 #endif 314 320 #if ENABLE(CSS_COMPOSITING) 315 321 updateBlendMode(renderer().style()); … … 375 381 m_canCompositeFilters = m_graphicsLayer->setFilters(style.filter()); 376 382 } 383 384 #if ENABLE(FILTERS_LEVEL_2) 385 void RenderLayerBacking::updateBackdropFilters(const RenderStyle& style) 386 { 387 m_canCompositeBackdropFilters = m_graphicsLayer->setBackdropFilters(style.backdropFilter()); 388 } 389 #endif 377 390 378 391 #if ENABLE(CSS_COMPOSITING) … … 653 666 654 667 updateFilters(style); 655 668 #if ENABLE(FILTERS_LEVEL_2) 669 updateBackdropFilters(style); 670 #endif 656 671 #if ENABLE(CSS_COMPOSITING) 657 672 updateBlendMode(style); -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r175687 r175716 233 233 234 234 bool canCompositeFilters() const { return m_canCompositeFilters; } 235 #if ENABLE(FILTERS_LEVEL_2) 236 bool canCompositeBackdropFilters() const { return m_canCompositeBackdropFilters; } 237 #endif 235 238 236 239 // Return an estimate of the backing store area (in pixels) allocated by this object's GraphicsLayers. … … 280 283 void updateTransform(const RenderStyle&); 281 284 void updateFilters(const RenderStyle&); 285 #if ENABLE(FILTERS_LEVEL_2) 286 void updateBackdropFilters(const RenderStyle&); 287 #endif 282 288 #if ENABLE(CSS_COMPOSITING) 283 289 void updateBlendMode(const RenderStyle&); … … 349 355 bool m_requiresOwnBackingStore; 350 356 bool m_canCompositeFilters; 357 #if ENABLE(FILTERS_LEVEL_2) 358 bool m_canCompositeBackdropFilters; 359 #endif 351 360 bool m_backgroundLayerPaintsFixedRootBackground; 352 361 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r175687 r175716 2181 2181 || renderer.hasReflection() 2182 2182 || renderer.hasFilter() 2183 || renderer.hasBackdropFilter() 2183 2184 #if PLATFORM(IOS) 2184 2185 || requiresCompositingForScrolling(layer) … … 2186 2187 ) 2187 2188 return true; 2188 2189 2189 2190 2190 if (layer.mustCompositeForIndirectReasons()) { 2191 2191 RenderLayer::IndirectCompositingReason reason = layer.indirectCompositingReason(); … … 2274 2274 reasons |= CompositingReasonReflectionWithCompositedDescendants; 2275 2275 2276 if (renderer->hasFilter() )2276 if (renderer->hasFilter() || renderer->hasBackdropFilter()) 2277 2277 reasons |= CompositingReasonFilterWithCompositedDescendants; 2278 2278 … … 2595 2595 bool RenderLayerCompositor::requiresCompositingForFilters(RenderLayerModelObject& renderer) const 2596 2596 { 2597 #if ENABLE(FILTERS_LEVEL_2) 2598 if (renderer.hasBackdropFilter()) 2599 return true; 2600 #endif 2601 2597 2602 if (!(m_compositingTriggers & ChromeClient::FilterTrigger)) 2598 2603 return false; -
trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp
r175687 r175716 115 115 ) 116 116 layer()->repaintIncludingDescendants(); 117 } else if (newStyle.hasTransform() || newStyle.opacity() < 1 || newStyle.hasFilter() ) {117 } else if (newStyle.hasTransform() || newStyle.opacity() < 1 || newStyle.hasFilter() || newStyle.hasBackdropFilter()) { 118 118 // If we don't have a layer yet, but we are going to get one because of transform or opacity, 119 119 // then we need to repaint the old position of the object. -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r175687 r175716 639 639 return true; 640 640 641 #if ENABLE(FILTERS_LEVEL_2) 642 if (rareNonInheritedData->hasBackdropFilters() != other.rareNonInheritedData->hasBackdropFilters()) 643 return true; 644 #endif 645 641 646 const QuotesData* quotesDataA = rareInheritedData->quotes.get(); 642 647 const QuotesData* quotesDataB = other.rareInheritedData->quotes.get(); -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r175687 r175716 1117 1117 const FilterOperations& filter() const { return rareNonInheritedData->m_filter->m_operations; } 1118 1118 bool hasFilter() const { return !rareNonInheritedData->m_filter->m_operations.operations().isEmpty(); } 1119 1120 #if ENABLE(FILTERS_LEVEL_2) 1121 FilterOperations& mutableBackdropFilter() { return rareNonInheritedData.access()->m_backdropFilter.access()->m_operations; } 1122 const FilterOperations& backdropFilter() const { return rareNonInheritedData->m_backdropFilter->m_operations; } 1123 bool hasBackdropFilter() const { return !rareNonInheritedData->m_backdropFilter->m_operations.operations().isEmpty(); } 1124 #else 1125 bool hasBackdropFilter() const { return false; } 1126 #endif 1119 1127 1120 1128 #if ENABLE(CSS_COMPOSITING) … … 1548 1556 1549 1557 void setFilter(const FilterOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_filter, m_operations, ops); } 1558 #if ENABLE(FILTERS_LEVEL_2) 1559 void setBackdropFilter(const FilterOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_backdropFilter, m_operations, ops); } 1560 #endif 1550 1561 1551 1562 void setTabSize(unsigned size) { SET_VAR(rareInheritedData, m_tabSize, size); } … … 1996 2007 #endif 1997 2008 static const FilterOperations& initialFilter() { DEPRECATED_DEFINE_STATIC_LOCAL(FilterOperations, ops, ()); return ops; } 2009 #if ENABLE(FILTERS_LEVEL_2) 2010 static const FilterOperations& initialBackdropFilter() { DEPRECATED_DEFINE_STATIC_LOCAL(FilterOperations, ops, ()); return ops; } 2011 #endif 1998 2012 #if ENABLE(CSS_COMPOSITING) 1999 2013 static BlendMode initialBlendMode() { return BlendModeNormal; } -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
r175687 r175716 50 50 , m_transform(StyleTransformData::create()) 51 51 , m_filter(StyleFilterData::create()) 52 #if ENABLE(FILTERS_LEVEL_2) 53 , m_backdropFilter(StyleFilterData::create()) 54 #endif 52 55 #if ENABLE(CSS_GRID_LAYOUT) 53 56 , m_grid(StyleGridData::create()) … … 120 123 , m_transform(o.m_transform) 121 124 , m_filter(o.m_filter) 125 #if ENABLE(FILTERS_LEVEL_2) 126 , m_backdropFilter(o.m_backdropFilter) 127 #endif 122 128 #if ENABLE(CSS_GRID_LAYOUT) 123 129 , m_grid(o.m_grid) … … 215 221 && m_transform == o.m_transform 216 222 && m_filter == o.m_filter 223 #if ENABLE(FILTERS_LEVEL_2) 224 && m_backdropFilter == o.m_backdropFilter 225 #endif 217 226 #if ENABLE(CSS_GRID_LAYOUT) 218 227 && m_grid == o.m_grid … … 347 356 } 348 357 358 #if ENABLE(FILTERS_LEVEL_2) 359 bool StyleRareNonInheritedData::hasBackdropFilters() const 360 { 361 return m_backdropFilter.get() && !m_backdropFilter->m_operations.isEmpty(); 362 } 363 #endif 364 349 365 } // namespace WebCore -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
r175687 r175716 95 95 bool transitionDataEquivalent(const StyleRareNonInheritedData&) const; 96 96 bool hasFilters() const; 97 #if ENABLE(FILTERS_LEVEL_2) 98 bool hasBackdropFilters() const; 99 #endif 97 100 bool hasOpacity() const { return opacity < 1; } 98 101 … … 120 123 DataRef<StyleTransformData> m_transform; // Transform properties (rotate, scale, skew, etc.) 121 124 DataRef<StyleFilterData> m_filter; // Filter operations (url, sepia, blur, etc.) 125 #if ENABLE(FILTERS_LEVEL_2) 126 DataRef<StyleFilterData> m_backdropFilter; // Filter operations (url, sepia, blur, etc.) 127 #endif 122 128 123 129 #if ENABLE(CSS_GRID_LAYOUT) -
trunk/Source/WebKit2/ChangeLog
r175711 r175716 1 2014-11-06 Dean Jackson <dino@apple.com> 2 3 [filters2] Support for backdrop-filter 4 https://bugs.webkit.org/show_bug.cgi?id=138384 5 <rdar://problem/18874494> 6 7 Reviewed by Simon Fraser. 8 9 Take 2!! Previous patch was rolled out. 10 11 * Shared/mac/RemoteLayerBackingStore.mm: 12 (WebKit::RemoteLayerBackingStore::drawInContext): Handle LayerTypeBackdropLayer in the switch. 13 * Shared/mac/RemoteLayerTreeTransaction.mm: 14 (WebKit::RemoteLayerTreeTransaction::description): Describe a backdrop layer. 15 * UIProcess/ios/RemoteLayerTreeHostIOS.mm: 16 (+[WKBackdropView layerClass]): Define CABackdropLayer and use it as the class. 17 (WebKit::RemoteLayerTreeHost::createLayer): 18 * UIProcess/mac/RemoteLayerTreeHost.mm: Ditto. 19 (WebKit::RemoteLayerTreeHost::createLayer): 20 1 21 2014-11-06 Tim Horton <timothy_horton@apple.com> 2 22 -
trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm
r175687 r175716 349 349 case PlatformCALayer::LayerTypeAVPlayerLayer: 350 350 case PlatformCALayer::LayerTypeWebGLLayer: 351 case PlatformCALayer::LayerTypeBackdropLayer: 351 352 case PlatformCALayer::LayerTypeCustom: 352 353 ASSERT_NOT_REACHED(); -
trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm
r175687 r175716 1181 1181 ts << "root-layer"; 1182 1182 break; 1183 case PlatformCALayer::LayerTypeBackdropLayer: 1184 ts << "backdrop-layer"; 1185 break; 1183 1186 case PlatformCALayer::LayerTypeAVPlayerLayer: 1184 1187 ts << "av-player-layer (context-id " << createdLayer.hostingContextID << ")"; -
trunk/Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm
r175687 r175716 37 37 @interface CALayer(WKLayerInternal) 38 38 - (void)setContextId:(uint32_t)contextID; 39 @end 40 41 @interface CABackdropLayer : CALayer 39 42 @end 40 43 … … 105 108 @end 106 109 110 @interface WKBackdropView : WKCompositingView 111 @end 112 113 @implementation WKBackdropView 114 + (Class)layerClass 115 { 116 return [CABackdropLayer self]; 117 } 118 119 @end 120 107 121 @interface WKRemoteView : WKCompositingView 108 122 @end … … 152 166 view = adoptNS([[WKCompositingView alloc] init]); 153 167 break; 168 case PlatformCALayer::LayerTypeBackdropLayer: 169 view = adoptNS([[WKBackdropView alloc] init]); 170 break; 154 171 case PlatformCALayer::LayerTypeTransformLayer: 155 172 view = adoptNS([[WKTransformView alloc] init]); -
trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm
r175687 r175716 42 42 #endif 43 43 44 #if ENABLE(FILTERS_LEVEL_2) 45 @interface CABackdropLayer : CALayer 46 @end 47 #endif 48 44 49 using namespace WebCore; 45 50 … … 223 228 layer = adoptNS([[CATransformLayer alloc] init]); 224 229 break; 230 case PlatformCALayer::LayerTypeBackdropLayer: 231 #if ENABLE(FILTERS_LEVEL_2) 232 layer = adoptNS([[CABackdropLayer alloc] init]); 233 #else 234 ASSERT_NOT_REACHED(); 235 layer = adoptNS([[CALayer alloc] init]); 236 #endif 237 break; 225 238 case PlatformCALayer::LayerTypeCustom: 226 239 case PlatformCALayer::LayerTypeAVPlayerLayer: -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
r175687 r175716 230 230 ThreeDTransformTrigger | 231 231 VideoTrigger | 232 PluginTrigger| 232 PluginTrigger| 233 233 CanvasTrigger | 234 234 #if PLATFORM(IOS)
Note: See TracChangeset
for help on using the changeset viewer.