diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/css/PageRuleCollector.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/css/PageRuleCollector.cpp')
-rw-r--r-- | Source/WebCore/css/PageRuleCollector.cpp | 25 |
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; |