diff options
author | Ben Murdoch <benm@google.com> | 2010-06-15 19:36:43 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-06-16 14:52:28 +0100 |
commit | 545e470e52f0ac6a3a072bf559c796b42c6066b6 (patch) | |
tree | c0c14763654d84d37577dde512c3d3b4699a9e86 /WebCore/css/CSSStyleSelector.cpp | |
parent | 719298a66237d38ea5c05f1547123ad8aacbc237 (diff) | |
download | external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.zip external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.gz external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.bz2 |
Merge webkit.org at r61121: Initial merge by git.
Change-Id: Icd6db395c62285be384d137164d95d7466c98760
Diffstat (limited to 'WebCore/css/CSSStyleSelector.cpp')
-rw-r--r-- | WebCore/css/CSSStyleSelector.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp index 92ba843..13bdeb9 100644 --- a/WebCore/css/CSSStyleSelector.cpp +++ b/WebCore/css/CSSStyleSelector.cpp @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) - * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) @@ -357,7 +357,8 @@ public: typedef HashMap<AtomicStringImpl*, CSSRuleDataList*> AtomRuleMap; void addRulesFromSheet(CSSStyleSheet*, const MediaQueryEvaluator&, CSSStyleSelector* = 0); - + + void addStyleRule(StyleBase* item); void addRule(CSSStyleRule* rule, CSSSelector* sel); void addPageRule(CSSStyleRule* rule, CSSSelector* sel); void addToRuleSet(AtomicStringImpl* key, AtomRuleMap& map, @@ -666,7 +667,7 @@ void CSSStyleSelector::matchRules(CSSRuleSet* rules, int& firstRuleIndex, int& l // We need to collect the rules for id, class, tag, and everything else into a buffer and // then sort the buffer. if (m_element->hasID()) - matchRulesForList(rules->getIDRules(m_element->getIDAttribute().impl()), firstRuleIndex, lastRuleIndex); + matchRulesForList(rules->getIDRules(m_element->idForStyleResolution().impl()), firstRuleIndex, lastRuleIndex); if (m_element->hasClass()) { ASSERT(m_styledElement); const SpaceSplitString& classNames = m_styledElement->classNames(); @@ -2037,7 +2038,7 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme return e->hasClass() && static_cast<StyledElement*>(e)->classNames().contains(sel->m_value); if (sel->m_match == CSSSelector::Id) - return e->hasID() && e->getIDAttribute() == sel->m_value; + return e->hasID() && e->idForStyleResolution() == sel->m_value; const QualifiedName& attr = sel->attribute(); @@ -2768,14 +2769,7 @@ void CSSRuleSet::addRulesFromSheet(CSSStyleSheet* sheet, const MediaQueryEvaluat for (int i = 0; i < len; i++) { StyleBase* item = sheet->item(i); if (item->isStyleRule()) { - if (item->isPageRule()) { - CSSPageRule* pageRule = static_cast<CSSPageRule*>(item); - addPageRule(pageRule, pageRule->selectorList().first()); - } else { - CSSStyleRule* rule = static_cast<CSSStyleRule*>(item); - for (CSSSelector* s = rule->selectorList().first(); s; s = CSSSelectorList::next(s)) - addRule(rule, s); - } + addStyleRule(item); } else if (item->isImportRule()) { CSSImportRule* import = static_cast<CSSImportRule*>(item); @@ -2792,9 +2786,7 @@ void CSSRuleSet::addRulesFromSheet(CSSStyleSheet* sheet, const MediaQueryEvaluat CSSRule *childItem = rules->item(j); if (childItem->isStyleRule()) { // It is a StyleRule, so append it to our list - CSSStyleRule* rule = static_cast<CSSStyleRule*>(childItem); - for (CSSSelector* s = rule->selectorList().first(); s; s = CSSSelectorList::next(s)) - addRule(rule, s); + addStyleRule(childItem); } else if (childItem->isFontFaceRule() && styleSelector) { // Add this font face to our set. const CSSFontFaceRule* fontFaceRule = static_cast<CSSFontFaceRule*>(childItem); @@ -2819,6 +2811,18 @@ void CSSRuleSet::addRulesFromSheet(CSSStyleSheet* sheet, const MediaQueryEvaluat } } +void CSSRuleSet::addStyleRule(StyleBase* item) +{ + if (item->isPageRule()) { + CSSPageRule* pageRule = static_cast<CSSPageRule*>(item); + addPageRule(pageRule, pageRule->selectorList().first()); + } else { + CSSStyleRule* rule = static_cast<CSSStyleRule*>(item); + for (CSSSelector* s = rule->selectorList().first(); s; s = CSSSelectorList::next(s)) + addRule(rule, s); + } +} + // ------------------------------------------------------------------------------------- // this is mostly boring stuff on how to apply a certain rule to the renderstyle... @@ -3393,7 +3397,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) // StyleImage. RefPtr<StyleCachedImage> styleCachedImage(image->cachedImage(m_element->document()->docLoader())); if (styleCachedImage) - m_style->addCursor(styleCachedImage->cachedImage(), image->hotspot()); + m_style->addCursor(styleCachedImage->cachedImage(), image->hotSpot()); } else if (type == CSSPrimitiveValue::CSS_IDENT) m_style->setCursor(*primitiveValue); } |