RESOLVED FIXED Bug 72443
Implement url() filter function
https://bugs.webkit.org/show_bug.cgi?id=72443
Summary Implement url() filter function
Dean Jackson
Reported 2011-11-15 16:32:43 PST
Implement the url (reference to SVG filter) filter function.
Attachments
Patch (49.86 KB, patch)
2012-05-22 16:11 PDT, Stephen White
no flags
Archive of layout-test-results from ec2-cr-linux-04 (542.66 KB, application/zip)
2012-05-22 20:42 PDT, WebKit Review Bot
no flags
Archive of layout-test-results from ec2-cr-linux-01 (759.80 KB, application/zip)
2012-05-22 21:58 PDT, WebKit Review Bot
no flags
Patch (68.33 KB, patch)
2012-05-28 12:18 PDT, Stephen White
no flags
Archive of layout-test-results from ec2-cr-linux-02 (559.15 KB, application/zip)
2012-05-28 13:21 PDT, WebKit Review Bot
no flags
Patch (70.91 KB, patch)
2012-05-29 08:02 PDT, Stephen White
no flags
Patch (53.80 KB, patch)
2012-05-29 14:12 PDT, Stephen White
no flags
Patch (53.81 KB, patch)
2012-05-29 14:53 PDT, Stephen White
no flags
Speculative fix for EFL build (53.91 KB, patch)
2012-05-30 07:08 PDT, Stephen White
no flags
Patch (54.60 KB, patch)
2012-05-30 15:11 PDT, Stephen White
no flags
Patch (106.07 KB, patch)
2012-05-31 14:49 PDT, Stephen White
no flags
Patch (106.01 KB, patch)
2012-05-31 16:30 PDT, Stephen White
no flags
Patch (104.98 KB, patch)
2012-06-04 08:57 PDT, Stephen White
no flags
Patch (104.98 KB, patch)
2012-06-19 15:11 PDT, Stephen White
no flags
Archive of layout-test-results from ec2-cr-linux-02 (514.05 KB, application/zip)
2012-06-19 19:12 PDT, WebKit Review Bot
no flags
Fixed image results (minor pixel diffs due to intervening skia change) (105.08 KB, patch)
2012-06-20 09:49 PDT, Stephen White
no flags
Patch (109.18 KB, patch)
2012-06-22 10:22 PDT, Stephen White
no flags
Patch for landing (109.74 KB, patch)
2012-06-28 15:46 PDT, Stephen White
no flags
Radar WebKit Bug Importer
Comment 1 2011-11-15 16:33:27 PST
Stephen White
Comment 2 2012-04-04 10:34:51 PDT
*** Bug 75704 has been marked as a duplicate of this bug. ***
Stephen White
Comment 3 2012-04-04 12:20:51 PDT
Unless there are any objections, I'd like to take this on. That said, I'm wading into areas of the code I know little about, so apologies in advance for the newbie questions. Starting from the loading side, it seems that there is already a CachedSVGDocument class that the loader knows about (equivalent of CachedImage; I'm making analogies to the Image case). I'm guessing that we could use this to load and reference the document from which the filters will be loaded. If the filters are in the current document (#bar), will the loader automatically handle that case, or should we special-case it to avoid double-parsing? What we don't seem to have is some kind of representation of an SVG document (or set of nodes?) in rendering/style/. Do we need this? Something like a StyleSVGDocument (equivalent to a StyleImage), and StyledCachedSVGDocument (equivalent to StyleCachedImage), in order to get feedback from the loader? Or perhaps StyleSVGFilter and StyleCachedSVGFilter, representing only the relevant filter network, extracted from the SVG document? Keeping it restricted to Filters could be a bit neater, but OTOH if there are other upcoming changes to allow other SVG nodes referenced from CSS, it might be useful to keep it more general. Over in css/, WebKitCSSFilterValue already seems to parse the url() syntax, so I presume there are no changes needed on the idl side. Can we just leave the URL as a string as far as the idl is concerned, or do we need to create another subclass here too (say, CSSSVGDocumentValue), to connect the url to the (proposed) StyleCachedSVGDocument, similar to how WebKitCSSShaderValue connects its url to a StyleCachedShader? Then over on the processing side, I was thinking of adding a RefPtr<Filter> to ReferenceFilterOperation, so that it could hold the SVG filter network representing that stage of the CSS filter chain. Thanks in advance for any comments you may have.
Stephen White
Comment 4 2012-04-06 07:42:15 PDT
+mikelawther, to shine his CSS brilliance in the dark cave of my ignorance
Stephen White
Comment 5 2012-05-09 11:48:43 PDT
OK, so I've gotten as far as parsing the filter URL, triggering a CachedResourceLoader to load me a CachedSVGDocument. I'm currently stuck on how to notify the element (or style?) that the load is complete. Presumably when I've figured that out, I trigger a SyntheticStyleChange, and create the appropriate filter network from the SVG nodes on a style change (handwave handwave). On the Image side, it seems this is done by making RenderObject a CachedImageClient (at least, I'm assuming that's how it works for background image styles, etc, but I'm not certain). This seems pretty Image-specific, though, and just hanging yet another CachedResourceClient subclass onto RenderObject seems pretty crude. One possible solution would be to make RenderObject derived from CachedResourceClient instead, so it could handle notifications from any CachedResource. I have no idea if that's really a workable solution (ie., if there are image-specific notifications which need to remain). Another thing I'm not too happy about: I'm paralleling the Image/Shader CSS style classes, which means I've created three style classes: StyleCachedSVGDocument, StylePendingSVGDocument, StyleSVGDocument. This seems pretty heavy-weight, unless it's there just to please some layering issues. It seems like it could be one class, which mutates from pending to cached as the style resolve completes, but perhaps I'm misunderstanding the purpose.
Eric Seidel (no email)
Comment 6 2012-05-09 13:48:18 PDT
It appears you'll need something similar to StyleCachedImage to hold onto the CachedSVGDocument from the RenderStyle object. It's possible one might make the existing StylePendingImage stuff more generic so we can avoid loading unused svg filters.
Stephen White
Comment 7 2012-05-22 16:11:20 PDT
Stephen White
Comment 8 2012-05-22 16:15:10 PDT
This is a really early (raw) patch. There are no tests, there are some troublesome FIXMEs, and the setData()/data() thing on ReferenceFilterOperation is a big hack. It does load internally or externally-referenced SVG files, though, and it does produce pixels: it will process an SVG filter network in a CSS filter on load. I'm putting it up to get some feedback from people who know this area of the code better than me while I continue to refine it.
Dean Jackson
Comment 9 2012-05-22 18:21:14 PDT
Comment on attachment 143390 [details] Patch Thanks for starting this. Yeah, it's a little annoying that so much has to be copied from the shader path.
Build Bot
Comment 10 2012-05-22 18:32:59 PDT
Early Warning System Bot
Comment 11 2012-05-22 19:13:58 PDT
Build Bot
Comment 12 2012-05-22 19:28:49 PDT
Early Warning System Bot
Comment 13 2012-05-22 19:38:03 PDT
Build Bot
Comment 14 2012-05-22 19:46:05 PDT
WebKit Review Bot
Comment 15 2012-05-22 20:42:43 PDT
Comment on attachment 143390 [details] Patch Attachment 143390 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/12773068 New failing tests: css3/filters/filter-property-computed-style.html css3/filters/filter-property-parsing.html css3/filters/filter-property.html
WebKit Review Bot
Comment 16 2012-05-22 20:42:54 PDT
Created attachment 143445 [details] Archive of layout-test-results from ec2-cr-linux-04 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-04 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Gustavo Noronha (kov)
Comment 17 2012-05-22 21:13:08 PDT
WebKit Review Bot
Comment 18 2012-05-22 21:58:48 PDT
Comment on attachment 143390 [details] Patch Attachment 143390 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/12772095 New failing tests: css3/filters/filter-property-computed-style.html css3/filters/filter-property-parsing.html css3/filters/filter-property.html
WebKit Review Bot
Comment 19 2012-05-22 21:58:54 PDT
Created attachment 143459 [details] Archive of layout-test-results from ec2-cr-linux-01 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-01 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Gyuyoung Kim
Comment 20 2012-05-22 22:15:15 PDT
Nikolas Zimmermann
Comment 21 2012-05-23 01:50:34 PDT
Thanks Stephen for doing the important prototyping! I'll check it out in more detail during the day.
Stephen White
Comment 22 2012-05-28 12:18:59 PDT
Gyuyoung Kim
Comment 23 2012-05-28 12:45:36 PDT
Build Bot
Comment 24 2012-05-28 12:46:15 PDT
Early Warning System Bot
Comment 25 2012-05-28 12:48:59 PDT
Early Warning System Bot
Comment 26 2012-05-28 12:51:15 PDT
WebKit Review Bot
Comment 27 2012-05-28 13:21:46 PDT
Comment on attachment 144386 [details] Patch Attachment 144386 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/12850234 New failing tests: css3/filters/filter-property-computed-style.html css3/filters/filter-property-parsing.html css3/filters/filter-property.html
WebKit Review Bot
Comment 28 2012-05-28 13:21:52 PDT
Created attachment 144391 [details] Archive of layout-test-results from ec2-cr-linux-02 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-02 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Stephen White
Comment 29 2012-05-28 13:22:05 PDT
(In reply to comment #22) > Created an attachment (id=144386) [details] > Patch Another checkpoint: - added new source files to Mac build - put all relevant code behind ENABLE(SVG) (haven't tried to compile without it yet, but it should be almost there) - refactored all external resource loading into loadPendingResources() - removed m_filter and m_lastEffect from ReferenceFilterOperation (for now; may have to add it back for composited path later, but this patch will focus on software processing) - added plumbing to invalidate CSS style & redraw filters when SVG render nodes are invalidated: RenderSVGResourceContainer now maintains a list of RenderLayer clients
Build Bot
Comment 30 2012-05-28 13:41:13 PDT
Build Bot
Comment 31 2012-05-28 13:45:00 PDT
Stephen White
Comment 32 2012-05-29 08:02:23 PDT
Stephen White
Comment 33 2012-05-29 08:36:12 PDT
(In reply to comment #32) > Created an attachment (id=144561) [details] > Patch Mostly EWS-food: - more fixes for Mac - removed spurious "url()" added by WebKitCSSSVGDocumentValue to fix two filters tests - fixed getComputedStyle for reference filters by retaining the full URL (for getComputedStyle) as well as the fragment (for node lookups)
Build Bot
Comment 34 2012-05-29 08:51:20 PDT
Early Warning System Bot
Comment 35 2012-05-29 09:26:13 PDT
Early Warning System Bot
Comment 36 2012-05-29 11:05:59 PDT
Gustavo Noronha (kov)
Comment 37 2012-05-29 12:09:21 PDT
Gustavo Noronha (kov)
Comment 38 2012-05-29 12:19:44 PDT
Gyuyoung Kim
Comment 39 2012-05-29 12:33:14 PDT
Stephen White
Comment 40 2012-05-29 14:12:12 PDT
Simon Fraser (smfr)
Comment 41 2012-05-29 14:17:47 PDT
Comment on attachment 144617 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=144617&action=review > Source/WebCore/css/StyleResolver.cpp:5464 > + if (!cachedDocument) > + > + // Stash the CachedSVGDocument on the reference filter. > + referenceFilter->setData(cachedDocument); Something is missing here.
Stephen White
Comment 42 2012-05-29 14:34:21 PDT
(In reply to comment #40) > Created an attachment (id=144617) [details] > Patch Getting closer now (not setting r? 'cos it still needs tests and polish) - fixed all build files (I think?) - ripped out StyleCachedSVGDocument/StyleSVGDocument/StylePendingSVGDocument (useless boilerplate); moved everything into WebKitCSSSVGDocumentValue
Stephen White
Comment 43 2012-05-29 14:40:06 PDT
(In reply to comment #41) > (From update of attachment 144617 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=144617&action=review > > > Source/WebCore/css/StyleResolver.cpp:5464 > > + if (!cachedDocument) > > + > > + // Stash the CachedSVGDocument on the reference filter. > > + referenceFilter->setData(cachedDocument); > > Something is missing here. Indeed. Thanks.
Build Bot
Comment 44 2012-05-29 14:41:46 PDT
Stephen White
Comment 45 2012-05-29 14:53:05 PDT
Gyuyoung Kim
Comment 46 2012-05-29 19:18:20 PDT
Gustavo Noronha (kov)
Comment 47 2012-05-29 19:24:26 PDT
Gyuyoung Kim
Comment 48 2012-05-29 20:37:14 PDT
Comment on attachment 144628 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=144628&action=review EFL port doesn't enable CSS_FILTERS yet. So, could you consider it as I mention. > Source/WebCore/css/StyleResolver.cpp:5444 > +#if ENABLE(SVG) It looks loadPendingSVGDocuments() needs to use ENABLE(CSS_FILTERS) as well. > Source/WebCore/css/StyleResolver.cpp:5947 > +#if ENABLE(SVG) ditto. > Source/WebCore/css/StyleResolver.h:519 > + HashMap<FilterOperation*, WebKitCSSSVGDocumentValue*> m_pendingSVGDocuments; Don't you need to add FilterOperation class to namespace ? There is a build break on EFL port. WebKit/Source/WebCore/css/StyleResolver.h:520:13: error: ‘FilterOperation’ was not declared in this scope > Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp:114 > + Don't you need to wrap CSS_FILTERS macro ? filterNeedsRepaint() is able to be enabled when CSS_FILTERS is ON. http://trac.webkit.org/browser/trunk/Source/WebCore/rendering/RenderLayer.h#L578 577 #if ENABLE(CSS_FILTERS) 578 virtual void filterNeedsRepaint(); 579 bool hasFilter() const { return renderer()->hasFilter(); } 580 #else
Stephen White
Comment 49 2012-05-30 07:08:58 PDT
Created attachment 144805 [details] Speculative fix for EFL build
Stephen White
Comment 50 2012-05-30 15:11:13 PDT
Build Bot
Comment 51 2012-05-30 15:52:09 PDT
Stephen White
Comment 52 2012-05-31 14:49:15 PDT
Build Bot
Comment 53 2012-05-31 15:21:14 PDT
Stephen White
Comment 54 2012-05-31 16:30:42 PDT
Stephen White
Comment 55 2012-06-01 07:32:25 PDT
(In reply to comment #54) > Created an attachment (id=145174) [details] > Patch I think this patch is now ready for review. All known bugs have been fixed, and I've added tests which exercise the major operational modes. Dean, would you mind taking a look at the CSS and filters bits? Niko or Dirk, could you look at the SVG bits?
Tim Horton
Comment 56 2012-06-02 00:14:00 PDT
Comment on attachment 145174 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=145174&action=review > Source/WebCore/css/CSSParser.cpp:82 > +#if ENABLE(CSS_FILTERS) && ENABLE(SVG) > +#include "WebKitCSSSVGDocumentValue.h" > +#endif This should be in its own block below. > Source/WebCore/css/StyleResolver.cpp:5738 > + // FIXME: There's probably a better way to detect if this is > + // a fragment relative to this document. Some combination of completeURL and equalIgnoringFragmentIdentifier? SVGURIReference.cpp has some vaguely related code. > LayoutTests/css3/filters/effect-reference-ordering.html:1 > +<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0" version="1.1" color-interpolation-filters="sRGB"> I don't think we do color-interpolation-filters yet; is this here for a reason? (https://bugs.webkit.org/show_bug.cgi?id=6033)
Stephen White
Comment 57 2012-06-04 08:56:54 PDT
Comment on attachment 145174 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=145174&action=review Thanks for your comments. >> Source/WebCore/css/CSSParser.cpp:82 >> +#endif > > This should be in its own block below. I moved it into the ENABLE(CSS_FILTERS) block for grouping and conciseness, but if you'd still prefer it in its own block, let me know. >> Source/WebCore/css/StyleResolver.cpp:5738 >> + // a fragment relative to this document. > > Some combination of completeURL and equalIgnoringFragmentIdentifier? SVGURIReference.cpp has some vaguely related code. Thanks! SVGURIReference::isExternalURIReference() seems to be just what I need. >> LayoutTests/css3/filters/effect-reference-ordering.html:1 >> +<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0" version="1.1" color-interpolation-filters="sRGB"> > > I don't think we do color-interpolation-filters yet; is this here for a reason? (https://bugs.webkit.org/show_bug.cgi?id=6033) I was probably trying to get Firefox's results to look like ours, since we do sRGB by default and ignore this attribute. Removed for now.
Stephen White
Comment 58 2012-06-04 08:57:36 PDT
Stephen White
Comment 59 2012-06-04 11:02:41 PDT
(In reply to comment #58) > Created an attachment (id=145595) [details] > Patch Addresses Tim's comments, and changes the SVG morphology filter in the tests into a hue rotation (so it's easier to see what the correct results should be).
Stephen White
Comment 60 2012-06-19 15:11:50 PDT
Stephen White
Comment 61 2012-06-19 15:13:02 PDT
(In reply to comment #60) > Created an attachment (id=148438) [details] > Patch Updated to ToT.
WebKit Review Bot
Comment 62 2012-06-19 19:12:27 PDT
Comment on attachment 148438 [details] Patch Attachment 148438 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/12996090 New failing tests: css3/filters/effect-reference-ordering.html css3/filters/effect-reference-hw.html css3/filters/effect-reference-external.html css3/filters/effect-reference.html
WebKit Review Bot
Comment 63 2012-06-19 19:12:34 PDT
Created attachment 148486 [details] Archive of layout-test-results from ec2-cr-linux-02 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-02 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Stephen White
Comment 64 2012-06-20 09:49:56 PDT
Created attachment 148586 [details] Fixed image results (minor pixel diffs due to intervening skia change)
Dean Jackson
Comment 65 2012-06-20 18:34:15 PDT
Comment on attachment 148586 [details] Fixed image results (minor pixel diffs due to intervening skia change) View in context: https://bugs.webkit.org/attachment.cgi?id=148586&action=review Looking pretty good. Just some small points and questions. > Source/WebCore/ChangeLog:5 > + Implement filter url() function. > + https://bugs.webkit.org/show_bug.cgi?id=72443 > + Please add some description of the implementation here, at least at a high-level. I can read the details for each file below, but without much context. > Source/WebCore/ChangeLog:80 > + * platform/mac/ScrollbarThemeMac.mm: > + Fix mac build for the GraphicsLayer/PlatformLayer change. I guess you mean just include PlatformLayer.h? > Source/WebCore/Target.pri:1687 > + css/WebKitCSSSVGDocumentValue.h \ > css/WebKitCSSShaderValue.h \ Shouldn't the new PlatformLayer.h be listed in this file too? > Source/WebCore/WebCore.gypi:2585 > + 'css/WebKitCSSSVGDocumentValue.cpp', > + 'css/WebKitCSSSVGDocumentValue.h', > 'css/WebKitCSSTransformValue.cpp', ditto on PlatformLayer.h > Source/WebCore/css/StyleResolver.cpp:1801 > + // Start loading resources referenced by this style. > + loadPendingResources(); > > -#if ENABLE(CSS_SHADERS) > - // Start loading the shaders referenced by this style. > - loadPendingShaders(); > -#endif > - > + // Start loading all pending resources referenced by this style. This last comment is a duplicate. > Source/WebCore/css/StyleResolver.cpp:5676 > + if (!m_style->hasFilter() || m_pendingSVGDocuments.isEmpty()) > + return; This might show me up as a moron, but shouldn't this be && ? If there is no filter AND nothing pending? I understand the no filter bit. I assume this is because the item would never have been put into the pending list if it was already in the process of being loaded? > Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp:14 > + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY > + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE I think you have the wrong license here. > Source/WebCore/css/WebKitCSSSVGDocumentValue.h:15 > + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY > + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ditto here > Source/WebCore/css/WebKitCSSSVGDocumentValue.h:49 > + WebKitCSSSVGDocumentValue(const String& url); Since you have inline functions above, any reason why you don't put the constructor here as well? I have zero feelings about this - just asking. Same with customCssText. > Source/WebCore/platform/graphics/filters/FilterOperation.h:190 > + void* m_data; It's annoying we can't use a CachedSVGDocument here :( > Source/WebCore/rendering/FilterEffectRenderer.cpp:129 > + if (!document) > + return 0; Would this case be anything other than an error? Worth putting an ASSERT? > Source/WebCore/rendering/FilterEffectRenderer.cpp:141 > + // FIXME: Figure out what to do with SourceAlpha. Right now, we're > + // using the alpha of the original input layer, which is obviously > + // wrong. We should probably be extracting the alpha from the > + // previousEffect, but this requires some more processing. > + // This may need a spec clarification. Good point. I'm not sure the input element alpha is definitely wrong, but this is the first time we've had this in a chain. > Source/WebCore/rendering/FilterEffectRenderer.cpp:352 > + if (filterOperation->getOperationType() != FilterOperation::REFERENCE) { > effect->inputEffects().append(previousEffect); > - m_effects.append(effect); > + m_effects.append(effect); Why is this skipped for url()? > Source/WebCore/rendering/RenderLayerFilterInfo.h:89 > + void updateReferenceFilter(ReferenceFilterOperation*); I don't see this used anywhere. Am I missing it? > LayoutTests/css3/filters/effect-reference-ordering.html:15 > +<img style="-webkit-filter: url(#blurY);" src="resources/reference.png"> > +<img style="-webkit-filter: contrast(500%) url(#blurY);" src="resources/reference.png"> > +<img style="-webkit-filter: url(#blurY) contrast(500%);" src="resources/reference.png"> could we add another that's shorthand + url + shorthand? > LayoutTests/css3/filters/resources/hueRotate.svg:5 > + <filter id="MyFilter"> > + <feColorMatrix type="hueRotate" values="180"/> > + </filter> Since we're replicating the filterBuilder functionality a bit, I think we also need a test that has a filter with nested elements and non-linear input (named inputs). > LayoutTests/platform/chromium-linux/css3/filters/effect-reference-expected.txt:10 > + [feColorMatrix type="HUEROTATE" values="180.00"] > + [SourceGraphic] Hmmm... I wonder if we should decorate our filtered elements like this too, or provide that option in WKTR?
Simon Fraser (smfr)
Comment 66 2012-06-20 20:13:13 PDT
Comment on attachment 148586 [details] Fixed image results (minor pixel diffs due to intervening skia change) View in context: https://bugs.webkit.org/attachment.cgi?id=148586&action=review >> Source/WebCore/platform/graphics/filters/FilterOperation.h:190 >> + void* m_data; > > It's annoying we can't use a CachedSVGDocument here :( Not just annoying, but it makes the code hard to understand and debug. When platform code needs a reference to something outside of platform, we normally do this by making an interface in platform that is implemented by something outside of it.
Stephen White
Comment 67 2012-06-22 10:21:56 PDT
Comment on attachment 148586 [details] Fixed image results (minor pixel diffs due to intervening skia change) View in context: https://bugs.webkit.org/attachment.cgi?id=148586&action=review Thanks for the review. >> Source/WebCore/ChangeLog:5 >> + > > Please add some description of the implementation here, at least at a high-level. I can read the details for each file below, but without much context. Done. >> Source/WebCore/ChangeLog:80 >> + Fix mac build for the GraphicsLayer/PlatformLayer change. > > I guess you mean just include PlatformLayer.h? Actually, this file was relying on ImageBuffer.h to bring in GraphicsLayer.h. Since it no longer does (and only includes PlatformLayer.h), we have to #include it directly. Added this info to the ChangeLog. > Source/WebCore/Target.pri:1687 > css/WebKitCSSShaderValue.h \ Done. > Source/WebCore/WebCore.gypi:2585 > 'css/WebKitCSSTransformValue.cpp', Done. >> Source/WebCore/css/StyleResolver.cpp:1801 >> + // Start loading all pending resources referenced by this style. > > This last comment is a duplicate. Fixed, thanks. >> Source/WebCore/css/StyleResolver.cpp:5676 >> + return; > > This might show me up as a moron, but shouldn't this be && ? If there is no filter AND nothing pending? I understand the no filter bit. I assume this is because the item would never have been put into the pending list if it was already in the process of being loaded? No, I think you can have a filter, but no pending SVG documents (say, if you have no url() filters in the style, or if they're all internal references), in which case you have nothing to do. >> Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp:14 >> + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > > I think you have the wrong license here. I've been told this is correct: 2-clause, Google in the (c) line, Apple in the license text. Most of the files in platform/graphics/chromium have this, for example. Or is there something else I got wrong? >> Source/WebCore/css/WebKitCSSSVGDocumentValue.h:49 >> + WebKitCSSSVGDocumentValue(const String& url); > > Since you have inline functions above, any reason why you don't put the constructor here as well? I have zero feelings about this - just asking. Same with customCssText. I tend to inline accessors, but not much else unless the profiler tells me to. Here's quote from a coworker smarter than me: --- Constructors and destructors are often significantly more complex than you think they are, especially if your class has any non-POD data members. Many STL classes have inlined constructors/destructors which may be copied into your function body. Because the bodies of these appear to be empty, they often seem like trivial functions that can safely be inlined. Don't give in to this temptation. Define them in the implementation file unless you really _need_ them to be inlined. Even if they do nothing now, someone could later add something seemingly-trivial to the class and make your hundreds of inlined destructors much more complex. For more information, read Item 30 in Effective C++. >>> Source/WebCore/platform/graphics/filters/FilterOperation.h:190 >>> + void* m_data; >> >> It's annoying we can't use a CachedSVGDocument here :( > > Not just annoying, but it makes the code hard to understand and debug. > > When platform code needs a reference to something outside of platform, we normally do this by making an interface in platform that is implemented by something outside of it. Yeah, I'm not a fan of this either, although I will note that the custom filter classes do this too. They just define CustomFilterProgram down in platform/graphics/filters, but still do an unconditional static_cast up to StyleCustomFilterProgram in CSS-land. I really would rather have this data stored in a hash table at a higher level, but I seem to be hamstrung by data hiding. StyleResolver knows about the WebKitCSSSVGDocumentValue (where the CachedSVGDocument lives), and uses it to load the SVG document, but RenderLayerFilterInfo and FilterEffectRenderer only get the FilterOperations, not the WebKitCSSSVGDocumentValue. This void* is only to get the pointer from one place to the other two, so there's no real interface to be defined down at the FilterOperation level, since it doesn't do anything with it. If there's a better way to do that, I'm definitely interested. >> Source/WebCore/rendering/FilterEffectRenderer.cpp:129 >> + return 0; > > Would this case be anything other than an error? Worth putting an ASSERT? Actually, this function can be called with an external document which has not been loaded yet, in which case cachedSVGDocument->document() is NULL. >> Source/WebCore/rendering/FilterEffectRenderer.cpp:352 >> + m_effects.append(effect); > > Why is this skipped for url()? buildReferenceFilter() adds all the FilterEffects it creates in the build loop, and connects it to its input in the call to SVGFilterBuilder::create(), so there's no need to do either here. >> Source/WebCore/rendering/RenderLayerFilterInfo.h:89 >> + void updateReferenceFilter(ReferenceFilterOperation*); > > I don't see this used anywhere. Am I missing it? Good catch. Removed. >> LayoutTests/css3/filters/effect-reference-ordering.html:15 >> +<img style="-webkit-filter: url(#blurY) contrast(500%);" src="resources/reference.png"> > > could we add another that's shorthand + url + shorthand? Done.
Stephen White
Comment 68 2012-06-22 10:22:37 PDT
Dean Jackson
Comment 69 2012-06-28 13:38:10 PDT
Comment on attachment 149050 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=149050&action=review Thanks Stephen. Small comments. > Source/WebCore/GNUmakefile.list.am:1760 > + Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp \ > + Source/WebCore/css/WebKitCSSSVGDocumentValue.h \ > Source/WebCore/css/WebKitCSSShaderValue.cpp \ Should PlatformLayer.h be here too? (Missed this the first time) > Source/WebCore/WebCore.vcproj/WebCore.vcproj:37570 > + <File > + RelativePath="..\css\WebKitCSSShaderValue.cpp" And in this file too? > Source/WebCore/platform/graphics/filters/FilterOperation.h:190 > + void* m_data; This is the bit I'm most worried about, but as you mentioned, there are not any easy solutions. Maybe we could file a followup to clean this up? > Source/WebCore/rendering/FilterEffectRenderer.cpp:141 > + // FIXME: Figure out what to do with SourceAlpha. Right now, we're > + // using the alpha of the original input layer, which is obviously > + // wrong. We should probably be extracting the alpha from the > + // previousEffect, but this requires some more processing. > + // This may need a spec clarification. Could you file a spec bug on this and link from here?
Stephen White
Comment 70 2012-06-28 15:06:27 PDT
Comment on attachment 149050 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=149050&action=review Thanks again for your diligence. > Source/WebCore/GNUmakefile.list.am:1760 > Source/WebCore/css/WebKitCSSShaderValue.cpp \ Done. >> Source/WebCore/WebCore.vcproj/WebCore.vcproj:37570 >> + RelativePath="..\css\WebKitCSSShaderValue.cpp" > > And in this file too? Done. >> Source/WebCore/platform/graphics/filters/FilterOperation.h:190 >> + void* m_data; > > This is the bit I'm most worried about, but as you mentioned, there are not any easy solutions. Maybe we could file a followup to clean this up? Done. https://bugs.webkit.org/show_bug.cgi?id=90213 >> Source/WebCore/rendering/FilterEffectRenderer.cpp:141 >> + // This may need a spec clarification. > > Could you file a spec bug on this and link from here? Sure, but I can't seem to find it at https://www.w3.org/Bugs/Public/enter_bug.cgi?product=FXTF (seems to only have the Web Animations spec?)
Stephen White
Comment 71 2012-06-28 15:46:07 PDT
Created attachment 150030 [details] Patch for landing
WebKit Review Bot
Comment 72 2012-06-28 19:50:45 PDT
Comment on attachment 150030 [details] Patch for landing Clearing flags on attachment: 150030 Committed r121513: <http://trac.webkit.org/changeset/121513>
WebKit Review Bot
Comment 73 2012-06-28 19:50:56 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.