Bug 94419 - Clean up SVGLocatable inheritance
Summary: Clean up SVGLocatable inheritance
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 420+
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Philip Rogers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-18 16:11 PDT by Philip Rogers
Modified: 2012-08-24 13:16 PDT (History)
4 users (show)

See Also:


Attachments
Cleanup SVGLocatable inheritance (5.27 KB, patch)
2012-08-18 16:20 PDT, Philip Rogers
no flags Details | Formatted Diff | Diff
Remove incorrect getBBox() code (2.20 KB, patch)
2012-08-19 22:29 PDT, Philip Rogers
krit: review+
krit: commit-queue-
Details | Formatted Diff | Diff
Update comment. (2.22 KB, patch)
2012-08-20 09:27 PDT, Philip Rogers
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Rogers 2012-08-18 16:11:41 PDT
SVGLocatable's inheritance chain is a little crufty. SVGTransformableElement inherits from SVGLocatableElement but unnecessarily re-defines the SVGLocatable functions. Furthermore, SVGPathElement defines getBBox() but the function is deadcode.
Comment 1 Philip Rogers 2012-08-18 16:20:18 PDT
Created attachment 159276 [details]
Cleanup SVGLocatable inheritance
Comment 2 Philip Rogers 2012-08-18 16:28:38 PDT
Reviewers: for context, here's an incomplete but useful description of the inheritance tree:
https://docs.google.com/a/chromium.org/drawings/d/1h9TLoPbMI6h6q_RZK3BNgVc0nhxkBWStkpTYYozzeWU/edit
Comment 3 Build Bot 2012-08-18 16:48:44 PDT
Comment on attachment 159276 [details]
Cleanup SVGLocatable inheritance

Attachment 159276 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/13529452
Comment 4 Philip Rogers 2012-08-18 17:03:03 PDT
The windows build has a warning that is causing the build to fail. This is real and might be why the code was architected this way to begin with.
http://msdn.microsoft.com/en-us/library/6b3sy7ae(v=vs.80).aspx

The issue is we have a diamond inheritance chain:
SVGLocatable -> SVGTransformable -> SVGStyledTransformableElement
SVGLocatable -> SVGStyledLocatable -> SVGStyledLocatableElement -> SVGStyledTransformableElement
getBBox() is only defined on SVGStyledLocatableElement but the win build is complaining that SVGStyledTransformableElement.getBBox() doesn't know which of the two parents to use.

Removing the review flag for now.
Comment 5 Dirk Schulze 2012-08-18 17:44:55 PDT
(In reply to comment #4)
> The windows build has a warning that is causing the build to fail. This is real and might be why the code was architected this way to begin with.
> http://msdn.microsoft.com/en-us/library/6b3sy7ae(v=vs.80).aspx
> 
> The issue is we have a diamond inheritance chain:
> SVGLocatable -> SVGTransformable -> SVGStyledTransformableElement
> SVGLocatable -> SVGStyledLocatable -> SVGStyledLocatableElement -> SVGStyledTransformableElement
> getBBox() is only defined on SVGStyledLocatableElement but the win build is complaining that SVGStyledTransformableElement.getBBox() doesn't know which of the two parents to use.
> 
> Removing the review flag for now.

Yes, we had this issue before that prevent us from cleaning up in the past. However, like said before, we will have a major refactoring later anyway. Since SVG 2 will switch to WebIDL, multiple inheritances are not allowed anymore. Don't spend to  much time on it yet.
Comment 6 Philip Rogers 2012-08-18 17:48:57 PDT
(In reply to comment #5)
> (In reply to comment #4)
> > The windows build has a warning that is causing the build to fail. This is real and might be why the code was architected this way to begin with.
> > http://msdn.microsoft.com/en-us/library/6b3sy7ae(v=vs.80).aspx
> > 
> > The issue is we have a diamond inheritance chain:
> > SVGLocatable -> SVGTransformable -> SVGStyledTransformableElement
> > SVGLocatable -> SVGStyledLocatable -> SVGStyledLocatableElement -> SVGStyledTransformableElement
> > getBBox() is only defined on SVGStyledLocatableElement but the win build is complaining that SVGStyledTransformableElement.getBBox() doesn't know which of the two parents to use.
> > 
> > Removing the review flag for now.
> 
> Yes, we had this issue before that prevent us from cleaning up in the past. However, like said before, we will have a major refactoring later anyway. Since SVG 2 will switch to WebIDL, multiple inheritances are not allowed anymore. Don't spend to  much time on it yet.

Sounds good to me; I'm not a fan of multiple inheritance. Want me to extract out the deadcode removal in SVGPathElement and land that? It's genuinely wrong and confusing for anyone looking at bounding box code.
Comment 7 Philip Rogers 2012-08-19 22:29:30 PDT
Created attachment 159333 [details]
Remove incorrect getBBox() code

Extracting out the useful piece from the previous patch.
Comment 8 Dirk Schulze 2012-08-20 09:05:08 PDT
Comment on attachment 159333 [details]
Remove incorrect getBBox() code

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

r=me, but...

> Source/WebCore/ChangeLog:9
> +        SVGPathElement defines a getBBox() function that is both wrong and
> +        deadcode. This patch cleans this up.

I would agree that we should return objectBoundingBox(), but is does not seem to be "deadcode". Can you change this comment please?
Comment 9 Philip Rogers 2012-08-20 09:27:25 PDT
Created attachment 159451 [details]
Update comment.

@krit, good catch.
Comment 10 WebKit Review Bot 2012-08-20 12:52:31 PDT
Comment on attachment 159451 [details]
Update comment.

Clearing flags on attachment: 159451

Committed r126056: <http://trac.webkit.org/changeset/126056>
Comment 11 WebKit Review Bot 2012-08-20 12:52:35 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Mark Lam 2012-08-24 13:16:23 PDT
This change broke svg/custom/getBBox-path.svg on platform mac.  See https://bugs.webkit.org/show_bug.cgi?id=94969.