⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 101972 in webkit


Ignore:
Timestamp:
Dec 4, 2011, 9:44:02 PM (15 years ago)
Author:
kling@webkit.org
Message:

CSSStyleSheet can't be reparented, enforce this at compile time.
<http://webkit.org/b/73793>

Reviewed by Benjamin Poulain.

  • css/StyleSheet.h:

(WebCore::StyleSheet::clearOwnerRule):

Changed setParentRule(CSSImportRule*) to clearOwnerRule() to document and
enforce the fact that style sheets should never be reparented after creation.

(WebCore::StyleSheet::ownerRule):

Renamed parentRule() to ownerRule() to match the CSSOM name.

(WebCore::StyleSheet::ownerNode):
(WebCore::StyleSheet::clearOwnerNode):

Also renamed StyleSheet::m_parentNode to m_ownerNode to match its accessors.

  • css/CSSStyleSheet.h:

Removed ownerRule() as we now inherit it from StyleSheet.

  • bindings/js/JSDOMBinding.h:

(WebCore::root):

  • css/CSSImportRule.cpp:

(WebCore::CSSImportRule::~CSSImportRule):
(WebCore::CSSImportRule::setCSSStyleSheet):

  • css/StyleSheet.cpp:

(WebCore::StyleSheet::StyleSheet):
(WebCore::StyleSheet::parentStyleSheet):
(WebCore::StyleSheet::baseURL):

  • inspector/InspectorStyleSheet.cpp:

(WebCore::fillMediaListChain):

Update call sites to use the new names.

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r101970 r101972  
     12011-12-04  Andreas Kling  <kling@webkit.org>
     2
     3        CSSStyleSheet can't be reparented, enforce this at compile time.
     4        <http://webkit.org/b/73793>
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        * css/StyleSheet.h:
     9        (WebCore::StyleSheet::clearOwnerRule):
     10
     11            Changed setParentRule(CSSImportRule*) to clearOwnerRule() to document and
     12            enforce the fact that style sheets should never be reparented after creation.
     13
     14        (WebCore::StyleSheet::ownerRule):
     15
     16            Renamed parentRule() to ownerRule() to match the CSSOM name.
     17
     18        (WebCore::StyleSheet::ownerNode):
     19        (WebCore::StyleSheet::clearOwnerNode):
     20
     21            Also renamed StyleSheet::m_parentNode to m_ownerNode to match its accessors.
     22
     23        * css/CSSStyleSheet.h:
     24
     25            Removed ownerRule() as we now inherit it from StyleSheet.
     26
     27        * bindings/js/JSDOMBinding.h:
     28        (WebCore::root):
     29        * css/CSSImportRule.cpp:
     30        (WebCore::CSSImportRule::~CSSImportRule):
     31        (WebCore::CSSImportRule::setCSSStyleSheet):
     32        * css/StyleSheet.cpp:
     33        (WebCore::StyleSheet::StyleSheet):
     34        (WebCore::StyleSheet::parentStyleSheet):
     35        (WebCore::StyleSheet::baseURL):
     36        * inspector/InspectorStyleSheet.cpp:
     37        (WebCore::fillMediaListChain):
     38
     39            Update call sites to use the new names.
     40
    1412011-12-04  Andreas Kling  <kling@webkit.org>
    242
  • trunk/Source/WebCore/bindings/js/JSDOMBinding.h

    r101943 r101972  
    195195    inline void* root(StyleSheet* styleSheet)
    196196    {
    197         if (styleSheet->parentRule())
    198             return root(styleSheet->parentRule());
     197        if (styleSheet->ownerRule())
     198            return root(styleSheet->ownerRule());
    199199        if (styleSheet->ownerNode())
    200200            return root(styleSheet->ownerNode());
  • trunk/Source/WebCore/css/CSSImportRule.cpp

    r99595 r101972  
    5151        m_lstMedia->setParentStyleSheet(0);
    5252    if (m_styleSheet)
    53         m_styleSheet->setParentRule(0);
     53        m_styleSheet->clearOwnerRule();
    5454    if (m_cachedSheet)
    5555        m_cachedSheet->removeClient(&m_styleSheetClient);
     
    5959{
    6060    if (m_styleSheet)
    61         m_styleSheet->setParentRule(0);
     61        m_styleSheet->clearOwnerRule();
    6262    m_styleSheet = CSSStyleSheet::create(this, href, baseURL, charset);
    6363
  • trunk/Source/WebCore/css/CSSStyleSheet.h

    r101943 r101972  
    6767    }
    6868
    69     CSSImportRule* ownerRule() const { return parentRule(); }
    7069    PassRefPtr<CSSRuleList> cssRules(bool omitCharsetRules = false);
    7170    unsigned insertRule(const String& rule, unsigned index, ExceptionCode&);
  • trunk/Source/WebCore/css/StyleSheet.cpp

    r101943 r101972  
    3131StyleSheet::StyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL)
    3232    : m_disabled(false)
    33     , m_parentRule(0)
    34     , m_parentNode(parentNode)
     33    , m_ownerRule(0)
     34    , m_ownerNode(parentNode)
    3535    , m_originalURL(originalURL)
    3636    , m_finalURL(finalURL)
     
    4040StyleSheet::StyleSheet(CSSImportRule* parentRule, const String& originalURL, const KURL& finalURL)
    4141    : m_disabled(false)
    42     , m_parentRule(parentRule)
    43     , m_parentNode(0)
     42    , m_ownerRule(parentRule)
     43    , m_ownerNode(0)
    4444    , m_originalURL(originalURL)
    4545    , m_finalURL(finalURL)
     
    5656{
    5757    ASSERT(isCSSStyleSheet());
    58     return m_parentRule ? m_parentRule->parentStyleSheet() : 0;
     58    return m_ownerRule ? m_ownerRule->parentStyleSheet() : 0;
    5959}
    6060
     
    7777    if (StyleSheet* parentSheet = parentStyleSheet())
    7878        return parentSheet->baseURL();
    79     if (!m_parentNode)
     79    if (!m_ownerNode)
    8080        return KURL();
    81     return m_parentNode->document()->baseURL();
     81    return m_ownerNode->document()->baseURL();
    8282}
    8383
  • trunk/Source/WebCore/css/StyleSheet.h

    r101943 r101972  
    4040    void setDisabled(bool);
    4141
    42     Node* ownerNode() const { return m_parentNode; }
    43     void clearOwnerNode() { m_parentNode = 0; }
     42    Node* ownerNode() const { return m_ownerNode; }
     43    void clearOwnerNode() { m_ownerNode = 0; }
     44
     45    CSSImportRule* ownerRule() const { return m_ownerRule; }
     46    void clearOwnerRule() { m_ownerRule = 0; }
    4447
    4548    StyleSheet* parentStyleSheet() const;
    46 
    47     CSSImportRule* parentRule() const { return m_parentRule; }
    48     void setParentRule(CSSImportRule* rule) { m_parentRule = rule; }
    4949
    5050    // Note that href is the URL that started the redirect chain that led to
     
    7777private:
    7878    bool m_disabled;
    79     CSSImportRule* m_parentRule;
    80     Node* m_parentNode;
     79    CSSImportRule* m_ownerRule;
     80    Node* m_ownerNode;
    8181    String m_originalURL;
    8282    KURL m_finalURL;
  • trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp

    r100987 r101972  
    213213                    mediaArray->pushObject(buildMediaObject(mediaList, styleSheet->ownerNode() ? MediaListSourceLinkedSheet : MediaListSourceInlineSheet, sourceURL));
    214214                }
    215                 parentRule = styleSheet->parentRule();
     215                parentRule = styleSheet->ownerRule();
    216216                if (parentRule)
    217217                    break;
Note: See TracChangeset for help on using the changeset viewer.