[Webkit-unassigned] [Bug 43457] Make the cascade level of "user" styles configurable

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 6 14:31:44 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=43457


Dave Hyatt <hyatt at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #63481|review?                     |review-
               Flag|                            |




--- Comment #4 from Dave Hyatt <hyatt at apple.com>  2010-08-06 14:31:43 PST ---
(From update of attachment 63481)

> +    {
> +        OwnPtr<CSSRuleSet> tempUserStyle(new CSSRuleSet);
>          if (pageUserSheet)
> -            m_userStyle->addRulesFromSheet(pageUserSheet, *m_medium, this);
> +            tempUserStyle->addRulesFromSheet(pageUserSheet, *m_medium, this);
>          if (pageGroupUserSheets) {
>              unsigned length = pageGroupUserSheets->size();
> -            for (unsigned i = 0; i < length; i++)
> -                m_userStyle->addRulesFromSheet(pageGroupUserSheets->at(i).get(), *m_medium, this);
> +            for (unsigned i = 0; i < length; i++) {
> +                if (pageGroupUserSheets->at(i)->isUserStyleSheet())
> +                    tempUserStyle->addRulesFromSheet(pageGroupUserSheets->at(i).get(), *m_medium, this);
> +                else
> +                    m_authorStyle->addRulesFromSheet(pageGroupUserSheets->at(i).get(), *m_medium, this);
> +            }
>          }
> +
> +        if (tempUserStyle->m_ruleCount > 0)
> +            m_userStyle = tempUserStyle.leakPtr();
>      }

Unless I'm misreading this, you have indented code inside braces but no longer have an if statement?  Just pull the code out of the braces.


> -            parsedSheet->setIsUserStyleSheet(true);
> +
> +            if (sheet->level() == UserStyleSheet::UserLevel)
> +                parsedSheet->setIsUserStyleSheet(true);
> +            else {
> +                ASSERT(sheet->level() == UserStyleSheet::AuthorLevel);
> +                parsedSheet->setIsUserStyleSheet(false);
> +            }
> +

I wouldn't worry about the assert here... just do:

parsedSheet->setIsUserStyleSheet(sheet->level() == UserStyleSheet::UserLevel)

More compact.


>      OwnPtr<UserStyleSheet> userStyleSheet(new UserStyleSheet(source, url, whitelist, blacklist, injectedFrames));
> +    userStyleSheet->setLevel(level);

Just make level part of the constructor, so that you don't have to have a 2nd line with a setLevel call.

Everything else looks fine.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list