RESOLVED FIXED 102967
Make CachedSVGDocumentReference independent of FilterOperation
https://bugs.webkit.org/show_bug.cgi?id=102967
Summary Make CachedSVGDocumentReference independent of FilterOperation
Dirk Schulze
Reported 2012-11-21 11:46:50 PST
Make CachedSVGDocumentReference independent of FilterOperation to reuse it on clip-path and masking.
Attachments
Patch (22.98 KB, patch)
2012-11-21 11:55 PST, Dirk Schulze
koivisto: review+
Dirk Schulze
Comment 1 2012-11-21 11:55:00 PST
Antti Koivisto
Comment 2 2012-11-21 16:13:32 PST
Comment on attachment 175495 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=175495&action=review r=me > Source/WebCore/platform/graphics/filters/FilterOperation.h:-169 > - class Data { > - public: > - virtual ~Data() { } > - }; Huh. Good to kill this. > Source/WebCore/rendering/FilterEffectRenderer.cpp:125 > PassRefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(Document* document, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation* op) 'filterOperation' would be a better name than 'op'
Dirk Schulze
Comment 3 2012-11-21 16:29:22 PST
Stephen White
Comment 4 2012-11-23 13:07:17 PST
Comment on attachment 175495 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=175495&action=review >> Source/WebCore/platform/graphics/filters/FilterOperation.h:-169 >> - }; > > Huh. Good to kill this. The reason there was this done this way in the first place was to avoid a layering violation, by having platform depend on css or SVG. This change adds a dependency on loader/, which seems to have lots of dependencies on SVG. So this definitely seems like a layering violation too. That being said, it looks like platform/ -> loader/ are pretty common, so this is already a pretty leaky boat. :(
Sam Weinig
Comment 5 2012-11-24 22:30:56 PST
(In reply to comment #4) > (From update of attachment 175495 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=175495&action=review > > >> Source/WebCore/platform/graphics/filters/FilterOperation.h:-169 > >> - }; > > > > Huh. Good to kill this. > > The reason there was this done this way in the first place was to avoid a layering violation, by having platform depend on css or SVG. This change adds a dependency on loader/, which seems to have lots of dependencies on SVG. So this definitely seems like a layering violation too. > > That being said, it looks like platform/ -> loader/ are pretty common, so this is already a pretty leaky boat. :( Please do not add to this! There should be no new layering violations please.
Dirk Schulze
Comment 6 2012-11-25 07:13:24 PST
(In reply to comment #5) > (In reply to comment #4) > > (From update of attachment 175495 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=175495&action=review > > > > >> Source/WebCore/platform/graphics/filters/FilterOperation.h:-169 > > >> - }; > > > > > > Huh. Good to kill this. > > > > The reason there was this done this way in the first place was to avoid a layering violation, by having platform depend on css or SVG. This change adds a dependency on loader/, which seems to have lots of dependencies on SVG. So this definitely seems like a layering violation too. > > > > That being said, it looks like platform/ -> loader/ are pretty common, so this is already a pretty leaky boat. :( > > Please do not add to this! There should be no new layering violations please. There was already a violation before. I prefer readable code before code that just hides this issue. Can you open a new bug report for fixing the violation in a proper way please?
Sam Weinig
Comment 7 2012-11-25 10:07:59 PST
(In reply to comment #6) > (In reply to comment #5) > > (In reply to comment #4) > > > (From update of attachment 175495 [details] [details] [details]) > > > View in context: https://bugs.webkit.org/attachment.cgi?id=175495&action=review > > > > > > >> Source/WebCore/platform/graphics/filters/FilterOperation.h:-169 > > > >> - }; > > > > > > > > Huh. Good to kill this. > > > > > > The reason there was this done this way in the first place was to avoid a layering violation, by having platform depend on css or SVG. This change adds a dependency on loader/, which seems to have lots of dependencies on SVG. So this definitely seems like a layering violation too. > > > > > > That being said, it looks like platform/ -> loader/ are pretty common, so this is already a pretty leaky boat. :( > > > > Please do not add to this! There should be no new layering violations please. > > There was already a violation before. I prefer readable code before code that just hides this issue. Can you open a new bug report for fixing the violation in a proper way please? Can you explain what the existing issue was, as I don't see it.
Dirk Schulze
Comment 8 2012-11-26 09:46:08 PST
Comment on attachment 175495 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=175495&action=review > Source/WebCore/css/CachedSVGDocumentReference.h:-37 > -class CachedSVGDocumentReference : public ReferenceFilterOperation::Data, public CachedSVGDocumentClient { CachedSVGDocumentReference that inherits from Data, defined in ReferenceFilterOperation and CachedSVGDocumentClient, but is stored in a member variable of ReferenceFilterOperation in comparison to CachedSVGDocumentReference which just inherits from CachedSVGDocumentClient and is still stored in a member variable in ReferenceFilterOperation? Not much of a difference, with the exception that this looks a lot cleaner IMO. This makes it possible to reuse this class for ReferenceMaskOperation and ReferenceClipPathOperation. Alternatives could be: class CachedSVGDocumentReference : public ReferenceFilterOperation::Data, public ReferenceMaskOperation::Data, public ReferenceClipPathOperation::Data, public CachedSVGDocumentClient ... , or create a base class and add multiple inheritances to the former named classes. Of course you could see the old CachedSVGDocumentReference as some kind of behavioral design pattern, but in general it makes it harder to understand the code. I am happy to find a proper solution and don't think that RenferenceFilterOperation should have access to the document at all IMO. I would prefer a new bug report to fix this issue since I plan other changes over the next weeks and months anyway. But if you feel strongly about it, we can roll the patch out for now.
Sam Weinig
Comment 9 2012-11-26 11:39:03 PST
(In reply to comment #8) > (From update of attachment 175495 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=175495&action=review > > > Source/WebCore/css/CachedSVGDocumentReference.h:-37 > > -class CachedSVGDocumentReference : public ReferenceFilterOperation::Data, public CachedSVGDocumentClient { > > CachedSVGDocumentReference that inherits from Data, defined in ReferenceFilterOperation and CachedSVGDocumentClient, but is stored in a member variable of ReferenceFilterOperation in comparison to CachedSVGDocumentReference which just inherits from CachedSVGDocumentClient and is still stored in a member variable in ReferenceFilterOperation? Not much of a difference, with the exception that this looks a lot cleaner IMO. You misunderstand, the issue is that platform/ cannot #include non-platform/, not the other way around.
Dirk Schulze
Comment 10 2012-11-27 13:43:19 PST
(In reply to comment #9) > (In reply to comment #8) > > (From update of attachment 175495 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=175495&action=review > > > > > Source/WebCore/css/CachedSVGDocumentReference.h:-37 > > > -class CachedSVGDocumentReference : public ReferenceFilterOperation::Data, public CachedSVGDocumentClient { > > > > CachedSVGDocumentReference that inherits from Data, defined in ReferenceFilterOperation and CachedSVGDocumentClient, but is stored in a member variable of ReferenceFilterOperation in comparison to CachedSVGDocumentReference which just inherits from CachedSVGDocumentClient and is still stored in a member variable in ReferenceFilterOperation? Not much of a difference, with the exception that this looks a lot cleaner IMO. > > > You misunderstand, the issue is that platform/ cannot #include non-platform/, not the other way around. Yes, I think I am confused when I look at it. The files are not dependent on content in platform/ and have nothing platform dependent, neither CachedSVGDocument nor CachedSVGDocumentClient. But I didn't check if there are inheriting classes from CachedResource. Why should CachedSVGDocument be platform dependent?
Simon Fraser (smfr)
Comment 11 2012-11-28 10:39:43 PST
Comment on attachment 175495 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=175495&action=review > Source/WebCore/platform/graphics/filters/FilterOperation.h:31 > +#include "CachedSVGDocumentReference.h" Here's your layering violation right here.
Simon Fraser (smfr)
Comment 12 2012-11-28 10:40:14 PST
I agree with Sam: this patch is adding a new layering violation.
Dirk Schulze
Comment 13 2012-11-28 17:42:26 PST
(In reply to comment #11) > (From update of attachment 175495 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=175495&action=review > > > Source/WebCore/platform/graphics/filters/FilterOperation.h:31 > > +#include "CachedSVGDocumentReference.h" > > Here's your layering violation right here. Ah sorry, that is right. Thought that the file is in WebCore/css/style where it belongs to IMO. There is no reason why this file is in platform. Same for FilterOperations. Would you be ok to move these files to the proper locations?
Simon Fraser (smfr)
Comment 14 2012-11-28 17:52:29 PST
Aren't they in platform/ because GraphicsLayer needs them?
Stephen White
Comment 15 2012-11-28 17:55:25 PST
(In reply to comment #13) > (In reply to comment #11) > > (From update of attachment 175495 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=175495&action=review > > > > > Source/WebCore/platform/graphics/filters/FilterOperation.h:31 > > > +#include "CachedSVGDocumentReference.h" > > > > Here's your layering violation right here. > > Ah sorry, that is right. Thought that the file is in WebCore/css/style where it belongs to IMO. There is no reason why this file is in platform. Same for FilterOperations. Would you be ok to move these files to the proper locations? That doesn't work either, because lots of files in platform/ depend on these files, e.g., platform/graphics/GraphicsLayer.h platform/graphics/ca/PlatformCAAnimation.h platform/graphics/texmap/TextureMapper.h etc. So then those would become layer violations.
Dirk Schulze
Comment 16 2012-11-28 18:13:38 PST
(In reply to comment #15) > (In reply to comment #13) > > (In reply to comment #11) > > > (From update of attachment 175495 [details] [details] [details]) > > > View in context: https://bugs.webkit.org/attachment.cgi?id=175495&action=review > > > > > > > Source/WebCore/platform/graphics/filters/FilterOperation.h:31 > > > > +#include "CachedSVGDocumentReference.h" > > > > > > Here's your layering violation right here. > > > > Ah sorry, that is right. Thought that the file is in WebCore/css/style where it belongs to IMO. There is no reason why this file is in platform. Same for FilterOperations. Would you be ok to move these files to the proper locations? > > That doesn't work either, because lots of files in platform/ depend on these files, e.g., platform/graphics/GraphicsLayer.h > platform/graphics/ca/PlatformCAAnimation.h > platform/graphics/texmap/TextureMapper.h > etc. > > So then those would become layer violations. Right, let me think about that. Then the code is actually not that (In reply to comment #15) > (In reply to comment #13) > > (In reply to comment #11) > > > (From update of attachment 175495 [details] [details] [details]) > > > View in context: https://bugs.webkit.org/attachment.cgi?id=175495&action=review > > > > > > > Source/WebCore/platform/graphics/filters/FilterOperation.h:31 > > > > +#include "CachedSVGDocumentReference.h" > > > > > > Here's your layering violation right here. > > > > Ah sorry, that is right. Thought that the file is in WebCore/css/style where it belongs to IMO. There is no reason why this file is in platform. Same for FilterOperations. Would you be ok to move these files to the proper locations? > > That doesn't work either, because lots of files in platform/ depend on these files, e.g., platform/graphics/GraphicsLayer.h > platform/graphics/ca/PlatformCAAnimation.h > platform/graphics/texmap/TextureMapper.h > etc. > > So then those would become layer violations. Ah right, there is a bad dependency graph on FilterOperations. Hm... I'll look into it tomorrow again.
Note You need to log in before you can comment on or make changes to this bug.