Changeset 30130 in webkit


Ignore:
Timestamp:
Feb 10, 2008 2:33:00 PM (16 years ago)
Author:
hyatt@apple.com
Message:

Fix for bug 17082, cssRules should be live.

Reviewed by olliej

Added fast/css/live-cssrules.html

  • css/CSSRuleList.cpp: (WebCore::CSSRuleList::CSSRuleList): (WebCore::CSSRuleList::length): (WebCore::CSSRuleList::item): (WebCore::CSSRuleList::deleteRule): (WebCore::CSSRuleList::insertRule):
  • css/CSSRuleList.h:
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r30127 r30130  
     12008-02-10  David Hyatt  <hyatt@apple.com>
     2
     3        Fix for bug 17082, cssRules should be live.
     4
     5        Reviewed by olliej
     6
     7        Added fast/css/live-cssrules.html
     8
     9        * css/CSSRuleList.cpp:
     10        (WebCore::CSSRuleList::CSSRuleList):
     11        (WebCore::CSSRuleList::length):
     12        (WebCore::CSSRuleList::item):
     13        (WebCore::CSSRuleList::deleteRule):
     14        (WebCore::CSSRuleList::insertRule):
     15        * css/CSSRuleList.h:
     16
    1172008-02-10  David Hyatt  <hyatt@apple.com>
    218
  • trunk/WebCore/css/CSSRuleList.cpp

    r30122 r30130  
    3838    : RefCounted<CSSRuleList>(0)
    3939{
    40     if (list) {
     40    m_list = list;
     41    if (list && omitCharsetRules) {
     42        m_list = 0;
    4143        unsigned len = list->length();
    4244        for (unsigned i = 0; i < len; ++i) {
    4345            StyleBase* style = list->item(i);
    44             if (style->isRule() && !(omitCharsetRules && style->isCharsetRule()))
     46            if (style->isRule() && !style->isCharsetRule())
    4547                append(static_cast<CSSRule*>(style));
    4648        }
     
    5557}
    5658
     59unsigned CSSRuleList::length() const
     60{
     61    return m_list ? m_list->length() : m_lstCSSRules.count();
     62}
     63
     64CSSRule* CSSRuleList::item(unsigned index)
     65{
     66    if (m_list) {
     67        StyleBase* rule = m_list->item(index);
     68        ASSERT(!rule || rule->isRule());
     69        return static_cast<CSSRule*>(rule);
     70    }
     71    return m_lstCSSRules.at(index);
     72}
     73
    5774void CSSRuleList::deleteRule(unsigned index)
    5875{
     76    ASSERT(!m_list);
    5977    CSSRule* rule = m_lstCSSRules.take(index);
    6078    if (rule)
     
    7088unsigned CSSRuleList::insertRule(CSSRule* rule, unsigned index)
    7189{
     90    ASSERT(!m_list);
    7291    if (rule && m_lstCSSRules.insert(index, rule)) {
    7392        rule->ref();
  • trunk/WebCore/css/CSSRuleList.h

    r27776 r30130  
    2727#include "DeprecatedPtrList.h"
    2828#include <wtf/RefCounted.h>
     29#include <wtf/RefPtr.h>
    2930
    3031namespace WebCore {
     
    3940    ~CSSRuleList();
    4041
    41     unsigned length() const { return m_lstCSSRules.count(); }
    42     CSSRule* item(unsigned index) { return m_lstCSSRules.at(index); }
     42    unsigned length() const;
     43    CSSRule* item(unsigned index);
    4344
    44     /* not part of the DOM */
     45    // FIXME: Not part of the DOM.  Only used by media rules.  We should be able to remove them if we changed media rules to work
     46    // as StyleLists instead.
    4547    unsigned insertRule(CSSRule*, unsigned index);
    4648    void deleteRule(unsigned index);
     
    4850
    4951protected:
    50     DeprecatedPtrList<CSSRule> m_lstCSSRules;
     52    RefPtr<StyleList> m_list;
     53    DeprecatedPtrList<CSSRule> m_lstCSSRules; // FIXME: Want to eliminate, but used by IE rules() extension and still used by media rules.
    5154};
    5255
Note: See TracChangeset for help on using the changeset viewer.