Bug 138384 - [filters2] Support for backdrop-filter
Summary: [filters2] Support for backdrop-filter
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dean Jackson
URL:
Keywords: InRadar
Depends on: 138455
Blocks:
  Show dependency treegraph
 
Reported: 2014-11-04 16:19 PST by Dean Jackson
Modified: 2014-11-06 14:23 PST (History)
3 users (show)

See Also:


Attachments
Patch (203.06 KB, patch)
2014-11-04 16:30 PST, Dean Jackson
no flags Details | Formatted Diff | Diff
Patch (169.63 KB, patch)
2014-11-04 17:26 PST, Dean Jackson
no flags Details | Formatted Diff | Diff
Patch (169.63 KB, patch)
2014-11-05 10:34 PST, Dean Jackson
no flags Details | Formatted Diff | Diff
Patch (169.78 KB, patch)
2014-11-05 12:13 PST, Dean Jackson
no flags Details | Formatted Diff | Diff
Patch (169.94 KB, patch)
2014-11-05 12:55 PST, Dean Jackson
no flags Details | Formatted Diff | Diff
Patch (168.03 KB, patch)
2014-11-05 13:53 PST, Dean Jackson
no flags Details | Formatted Diff | Diff
Patch (168.64 KB, patch)
2014-11-05 13:59 PST, Dean Jackson
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dean Jackson 2014-11-04 16:19:47 PST
[filters2] Support for backdrop-filter
Comment 1 Dean Jackson 2014-11-04 16:22:13 PST
http://dev.w3.org/fxtf/filters-2/#BackdropFilterProperty

Support enough of backdrop-filter to show as a prototype.

- parse the CSS
- provide computed style
- render the background in the compositor
- set the CoreAnimation properties to filter the rendering
Comment 2 Radar WebKit Bug Importer 2014-11-04 16:23:06 PST
<rdar://problem/18874494>
Comment 3 Dean Jackson 2014-11-04 16:30:55 PST
Created attachment 240976 [details]
Patch
Comment 4 Dean Jackson 2014-11-04 16:31:18 PST
Not for review yet. Just checking build.
Comment 5 WebKit Commit Bot 2014-11-04 16:32:55 PST
Attachment 240976 [details] did not pass style-queue:


ERROR: Source/WebCore/WebCore.exp.in:0:  Source/WebCore/WebCore.exp.in should be sorted, use Tools/Scripts/sort-export-file script  [list/order] [5]
Total errors found: 1 in 59 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Dean Jackson 2014-11-04 17:26:40 PST
Created attachment 240989 [details]
Patch
Comment 7 WebKit Commit Bot 2014-11-04 17:28:16 PST
Attachment 240989 [details] did not pass style-queue:


ERROR: Source/WebCore/WebCore.exp.in:0:  Source/WebCore/WebCore.exp.in should be sorted, use Tools/Scripts/sort-export-file script  [list/order] [5]
Total errors found: 1 in 48 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 Dean Jackson 2014-11-05 10:34:54 PST
Created attachment 241039 [details]
Patch
Comment 9 WebKit Commit Bot 2014-11-05 10:37:14 PST
Attachment 241039 [details] did not pass style-queue:


ERROR: Source/WebCore/WebCore.exp.in:0:  Source/WebCore/WebCore.exp.in should be sorted, use Tools/Scripts/sort-export-file script  [list/order] [5]
Total errors found: 1 in 48 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 10 Dean Jackson 2014-11-05 12:13:40 PST
Created attachment 241048 [details]
Patch
Comment 11 WebKit Commit Bot 2014-11-05 12:17:02 PST
Attachment 241048 [details] did not pass style-queue:


ERROR: Source/WebCore/WebCore.exp.in:0:  Source/WebCore/WebCore.exp.in should be sorted, use Tools/Scripts/sort-export-file script  [list/order] [5]
Total errors found: 1 in 48 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 12 Dean Jackson 2014-11-05 12:55:26 PST
Created attachment 241051 [details]
Patch
Comment 13 WebKit Commit Bot 2014-11-05 12:58:02 PST
Attachment 241051 [details] did not pass style-queue:


ERROR: Source/WebCore/WebCore.exp.in:0:  Source/WebCore/WebCore.exp.in should be sorted, use Tools/Scripts/sort-export-file script  [list/order] [5]
Total errors found: 1 in 48 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 14 Simon Fraser (smfr) 2014-11-05 13:26:08 PST
Comment on attachment 241051 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=241051&action=review

> Source/WebCore/platform/graphics/GraphicsLayer.h:439
> +    enum CustomAppearance { NoCustomAppearance, ScrollingOverhang, ScrollingShadow, UsesBackdrop };

Not sure that you need UsesBackdrop.

> Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:1689
> +        m_backdropLayer->setMasksToBounds(true);

Is this necessary?

> Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:1701
> +    if (LayerMap* layerCloneMap = m_layerClones.get()) {
> +        LayerMap::const_iterator end = layerCloneMap->end();
> +        for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) {
> +            if (m_replicaLayer && isReplicatedRootClone(it->key))
> +                continue;
> +
> +            it->value->setFilters(m_filters);
> +        }
> +    }

Seems wrong.

> Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:440
> +        BackdropFiltersChanged = 1LLU << 33

Please move up to below FiltersChanged and adjust all the values.

> Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm:828
> +    case GraphicsLayer::UsesBackdrop:

Why?

> Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm:119
> +    case GraphicsLayer::UsesBackdrop:

Remove?

> Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm:1185
> +            case PlatformCALayer::LayerTypeBackdropLayer:
> +                ts << "backdrop-layer";
> +                break;

There should be some dumping of the backdrop filters too here somewhere.

> Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm:119
> +@interface WKBackdropView : WKCompositingView
> +@end
> +
> +@implementation WKBackdropView
> ++ (Class)layerClass
> +{
> +    return [CABackdropLayer self];
> +}
> +
> +@end

Doesn't UIKit have a backdrop view class?

> LayoutTests/css3/filters/backdrop/backdropfilter-property-computed-style-expected.txt:352
> +Color then three values : drop-shadow(red 1px 2px 3px)
> +PASS filterStyle.length is 1
> +PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_DROP_SHADOW
> +PASS subRule.cssText is 'drop-shadow(rgb(255, 0, 0) 1px 2px 3px)'
> +
> +Three values then color : drop-shadow(1px 2px 3px red)
> +PASS filterStyle.length is 1
> +PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_DROP_SHADOW
> +PASS subRule.cssText is 'drop-shadow(rgb(255, 0, 0) 1px 2px 3px)'
> +
> +Color then three values with zero length : drop-shadow(#abc 0 0 0)
> +PASS filterStyle.length is 1
> +PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_DROP_SHADOW
> +PASS subRule.cssText is 'drop-shadow(rgb(170, 187, 204) 0px 0px 0px)'
> +
> +Three values with zero length : drop-shadow(0 0 0)
> +PASS filterStyle.length is 1
> +PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_DROP_SHADOW
> +PASS subRule.cssText is 'drop-shadow(rgba(0, 0, 0, 0) 0px 0px 0px)'
> +
> +Two values no color : drop-shadow(1px 2px)
> +PASS filterStyle.length is 1
> +PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_DROP_SHADOW
> +PASS subRule.cssText is 'drop-shadow(rgba(0, 0, 0, 0) 1px 2px 0px)'

Disallow drop shadow as a backdrop filter?
Comment 15 Dean Jackson 2014-11-05 13:34:10 PST
Comment on attachment 241051 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=241051&action=review

>> Source/WebCore/platform/graphics/GraphicsLayer.h:439
>> +    enum CustomAppearance { NoCustomAppearance, ScrollingOverhang, ScrollingShadow, UsesBackdrop };
> 
> Not sure that you need UsesBackdrop.

OK. I'll remove it.

>> Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:1689
>> +        m_backdropLayer->setMasksToBounds(true);
> 
> Is this necessary?

Yes. Otherwise the blur would be visible around the edges of the element.

>> Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:1701
>> +    }
> 
> Seems wrong.

It can be removed at the moment (until cloning is done)

>> Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:440
>> +        BackdropFiltersChanged = 1LLU << 33
> 
> Please move up to below FiltersChanged and adjust all the values.

OK

>> Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm:828
>> +    case GraphicsLayer::UsesBackdrop:
> 
> Why?

Will remove.

>> Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm:1185
>> +                break;
> 
> There should be some dumping of the backdrop filters too here somewhere.

I guess so, but do we do that for normal filters?

>> Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm:119
>> +@end
> 
> Doesn't UIKit have a backdrop view class?

Yes I think so, but I'm not sure we want to use that. Do we?

>> LayoutTests/css3/filters/backdrop/backdropfilter-property-computed-style-expected.txt:352
>> +PASS subRule.cssText is 'drop-shadow(rgba(0, 0, 0, 0) 1px 2px 0px)'
> 
> Disallow drop shadow as a backdrop filter?

Actually, I think it should be supported, even though it is pretty weird. The background might not be a solid image, in which case you might want to apply a shadow.

Although we currently don't support shadows on our CA filters.
Comment 16 Dean Jackson 2014-11-05 13:53:38 PST
Created attachment 241054 [details]
Patch
Comment 17 WebKit Commit Bot 2014-11-05 13:56:55 PST
Attachment 241054 [details] did not pass style-queue:


ERROR: Source/WebCore/WebCore.exp.in:0:  Source/WebCore/WebCore.exp.in should be sorted, use Tools/Scripts/sort-export-file script  [list/order] [5]
Total errors found: 1 in 47 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 18 Dean Jackson 2014-11-05 13:59:44 PST
Created attachment 241055 [details]
Patch
Comment 19 WebKit Commit Bot 2014-11-05 14:01:58 PST
Attachment 241055 [details] did not pass style-queue:


ERROR: Source/WebCore/WebCore.exp.in:0:  Source/WebCore/WebCore.exp.in should be sorted, use Tools/Scripts/sort-export-file script  [list/order] [5]
Total errors found: 1 in 48 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 20 Dean Jackson 2014-11-05 21:51:02 PST
Committed r175672: <http://trac.webkit.org/changeset/175672>
Comment 21 WebKit Commit Bot 2014-11-05 23:39:05 PST
Re-opened since this is blocked by bug 138455
Comment 22 Dean Jackson 2014-11-06 14:23:57 PST
Committed r175716: <http://trac.webkit.org/changeset/175716>