summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/PageRuleCollector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/css/PageRuleCollector.cpp')
-rw-r--r--Source/WebCore/css/PageRuleCollector.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/Source/WebCore/css/PageRuleCollector.cpp b/Source/WebCore/css/PageRuleCollector.cpp
index d7f70403e..b82c88717 100644
--- a/Source/WebCore/css/PageRuleCollector.cpp
+++ b/Source/WebCore/css/PageRuleCollector.cpp
@@ -37,7 +37,7 @@ namespace WebCore {
static inline bool comparePageRules(const StyleRulePage* r1, const StyleRulePage* r2)
{
- return r1->selector()->specificity() < r2->selector()->specificity();
+ return r1->selector()->specificityForPage() < r2->selector()->specificityForPage();
}
bool PageRuleCollector::isLeftPage(int pageIndex) const
@@ -58,7 +58,7 @@ bool PageRuleCollector::isFirstPage(int pageIndex) const
String PageRuleCollector::pageName(int /* pageIndex */) const
{
// FIXME: Implement page index to page name mapping.
- return "";
+ return emptyString();
}
void PageRuleCollector::matchAllPageRules(int pageIndex)
@@ -70,7 +70,8 @@ void PageRuleCollector::matchAllPageRules(int pageIndex)
matchPageRules(CSSDefaultStyleSheets::defaultPrintStyle, isLeft, isFirst, page);
matchPageRules(m_ruleSets.userStyle(), isLeft, isFirst, page);
// Only consider the global author RuleSet for @page rules, as per the HTML5 spec.
- matchPageRules(m_ruleSets.authorStyle(), isLeft, isFirst, page);
+ if (m_ruleSets.isAuthorStyleDefined())
+ matchPageRules(&m_ruleSets.authorStyle(), isLeft, isFirst, page);
}
void PageRuleCollector::matchPageRules(RuleSet* rules, bool isLeftPage, bool isFirstPage, const String& pageName)
@@ -92,18 +93,18 @@ void PageRuleCollector::matchPageRules(RuleSet* rules, bool isLeftPage, bool isF
static bool checkPageSelectorComponents(const CSSSelector* selector, bool isLeftPage, bool isFirstPage, const String& pageName)
{
for (const CSSSelector* component = selector; component; component = component->tagHistory()) {
- if (component->m_match == CSSSelector::Tag) {
+ if (component->match() == CSSSelector::Tag) {
const AtomicString& localName = component->tagQName().localName();
if (localName != starAtom && localName != pageName)
return false;
- }
-
- CSSSelector::PseudoType pseudoType = component->pseudoType();
- if ((pseudoType == CSSSelector::PseudoLeftPage && !isLeftPage)
- || (pseudoType == CSSSelector::PseudoRightPage && isLeftPage)
- || (pseudoType == CSSSelector::PseudoFirstPage && !isFirstPage))
- {
- return false;
+ } else if (component->match() == CSSSelector::PagePseudoClass) {
+ CSSSelector::PagePseudoClassType pseudoType = component->pagePseudoClassType();
+ if ((pseudoType == CSSSelector::PagePseudoClassLeft && !isLeftPage)
+ || (pseudoType == CSSSelector::PagePseudoClassRight && isLeftPage)
+ || (pseudoType == CSSSelector::PagePseudoClassFirst && !isFirstPage))
+ {
+ return false;
+ }
}
}
return true;