Bug 61408 - MediaList should not inherit from StyleBase
Summary: MediaList should not inherit from StyleBase
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Julien Chaffraix
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-24 18:04 PDT by Julien Chaffraix
Modified: 2011-11-01 17:19 PDT (History)
4 users (show)

See Also:


Attachments
Proposed refactoring (9.05 KB, patch)
2011-05-24 18:11 PDT, Julien Chaffraix
commit-queue: commit-queue-
Details | Formatted Diff | Diff
Take 2: Same as previously but should make the Mac bot happy (10.73 KB, patch)
2011-05-25 18:57 PDT, Julien Chaffraix
no flags Details | Formatted Diff | Diff
Updated patch, not for review until I can re-engineer the change (11.07 KB, patch)
2011-06-13 09:15 PDT, Julien Chaffraix
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Chaffraix 2011-05-24 18:04:42 PDT
As part of cutting down the dependency on StyleBase. MediaList does not strictly need to inherit from StyleBase. It just needs to be TreeShared<StyleBase>. Patch forthcoming.
Comment 1 Julien Chaffraix 2011-05-24 18:11:23 PDT
Created attachment 94723 [details]
Proposed refactoring
Comment 2 WebKit Commit Bot 2011-05-24 21:41:59 PDT
Comment on attachment 94723 [details]
Proposed refactoring

Attachment 94723 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/8729746
Comment 3 Julien Chaffraix 2011-05-25 18:57:09 PDT
Created attachment 94901 [details]
Take 2: Same as previously but should make the Mac bot happy
Comment 4 Eric Seidel (no email) 2011-05-27 18:06:49 PDT
I'm not sure I understand all the pieces at play here.
Comment 5 Brent Fulgham 2011-05-31 20:57:52 PDT
Comment on attachment 94901 [details]
Take 2: Same as previously but should make the Mac bot happy

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

Could you please clarify the behavior of the new m_parsedMediaLists member?  How are these elements accessed/traversed now?

> Source/WebCore/bindings/js/JSDOMBinding.h:179
> +    inline void* root(MediaList* list)

You shouldn't need to declare this inline since the implementation is in the header file.

> Source/WebCore/css/CSSParser.cpp:6276
> +    m_parsedMediaLists.append(list.release());

Previously we operated on media lists and rules as equivalent entities.  Why is it better to separate them like this?  Also, I don't see where the m_parsedStyleObjects method is revised to handle the presumably new access methods to get Media Lists (as opposed to Style Rules) out of the parser?

> Source/WebCore/css/CSSParser.h:323
> +        Vector<RefPtr<MediaList> > m_parsedMediaLists;

Again -- why do we want to handle these items as separate entities?  Does it make something more efficient, or simplify code elsewhere?
Comment 6 Julien Chaffraix 2011-06-01 07:48:47 PDT
Comment on attachment 94901 [details]
Take 2: Same as previously but should make the Mac bot happy

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

>> Source/WebCore/bindings/js/JSDOMBinding.h:179
>> +    inline void* root(MediaList* list)
> 
> You shouldn't need to declare this inline since the implementation is in the header file.

This is true. However the other root() methods use inline. I would rather keep the code consistent here even if it is redundant.

>> Source/WebCore/css/CSSParser.cpp:6276
>> +    m_parsedMediaLists.append(list.release());
> 
> Previously we operated on media lists and rules as equivalent entities.  Why is it better to separate them like this?  Also, I don't see where the m_parsedStyleObjects method is revised to handle the presumably new access methods to get Media Lists (as opposed to Style Rules) out of the parser?

As far as the media lists vs rules goes, I don't think there is a problem in either direction. I would argue that it makes more sense to split it between the different types of objects as it is done to some extend in CSSParser already (see m_parsedRuleList vs m_parsedStyleObjects).
m_parsedStyleObjects is never read, only appended to and cleared in the destructor so splitting the object in 2 should not have an ill effect.

>> Source/WebCore/css/CSSParser.h:323
>> +        Vector<RefPtr<MediaList> > m_parsedMediaLists;
> 
> Again -- why do we want to handle these items as separate entities?  Does it make something more efficient, or simplify code elsewhere?

I don't think this will make the code more efficient. It would simplify the code as MediaList only needed the TreeShared behavior from StyleBase not the whole logic from the class. StyleBase is the default class a lot of CSS objects inherit from but it is a fallacy as not all objects needs to use this "interface".
Comment 7 Julien Chaffraix 2011-06-10 20:07:18 PDT
Comment on attachment 94901 [details]
Take 2: Same as previously but should make the Mac bot happy

Discussed this with Antti on IRC, adding a dependency on TreeShared is not the way to go. It would be better to add the parent logic directly into the class and make MediaList RefCounted.
Comment 8 Julien Chaffraix 2011-06-13 09:15:13 PDT
Created attachment 96961 [details]
Updated patch, not for review until I can re-engineer the change
Comment 9 Julien Chaffraix 2011-11-01 17:19:03 PDT
Andreas Kling came and during his CSS refactoring got rid of the dependency.

See bug 70203.