OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * 1999 Waldo Bastian (bastian@kde.org) | 3 * 1999 Waldo Bastian (bastian@kde.org) |
4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // ** isCustomPseudoElement(): | 77 // ** isCustomPseudoElement(): |
78 // | 78 // |
79 // It appears this is used only for pseudo elements that appear in user-agen
t shadow DOM. They are not exposed to author-created | 79 // It appears this is used only for pseudo elements that appear in user-agen
t shadow DOM. They are not exposed to author-created |
80 // shadow DOM. | 80 // shadow DOM. |
81 | 81 |
82 class CORE_EXPORT CSSSelector { | 82 class CORE_EXPORT CSSSelector { |
83 WTF_MAKE_FAST_ALLOCATED(CSSSelector); | 83 WTF_MAKE_FAST_ALLOCATED(CSSSelector); |
84 public: | 84 public: |
85 CSSSelector(); | 85 CSSSelector(); |
86 CSSSelector(const CSSSelector&); | 86 CSSSelector(const CSSSelector&); |
87 explicit CSSSelector(const QualifiedName&, bool tagIsForNamespaceRule =
false); | 87 explicit CSSSelector(const QualifiedName&, bool tagIsImplicit = false); |
88 | 88 |
89 ~CSSSelector(); | 89 ~CSSSelector(); |
90 | 90 |
91 /** | 91 /** |
92 * Re-create selector text from selector's data | 92 * Re-create selector text from selector's data |
93 */ | 93 */ |
94 String selectorText(const String& = "") const; | 94 String selectorText(const String& = "") const; |
95 | 95 |
96 // checks if the 2 selectors (including sub selectors) agree. | 96 // checks if the 2 selectors (including sub selectors) agree. |
97 bool operator==(const CSSSelector&) const; | 97 bool operator==(const CSSSelector&) const; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 323 |
324 private: | 324 private: |
325 unsigned m_relation : 3; // enum Relation | 325 unsigned m_relation : 3; // enum Relation |
326 mutable unsigned m_match : 4; // enum Match | 326 mutable unsigned m_match : 4; // enum Match |
327 mutable unsigned m_pseudoType : 8; // PseudoType | 327 mutable unsigned m_pseudoType : 8; // PseudoType |
328 mutable unsigned m_parsedNth : 1; // Used for :nth-* | 328 mutable unsigned m_parsedNth : 1; // Used for :nth-* |
329 unsigned m_isLastInSelectorList : 1; | 329 unsigned m_isLastInSelectorList : 1; |
330 unsigned m_isLastInTagHistory : 1; | 330 unsigned m_isLastInTagHistory : 1; |
331 unsigned m_hasRareData : 1; | 331 unsigned m_hasRareData : 1; |
332 unsigned m_isForPage : 1; | 332 unsigned m_isForPage : 1; |
333 unsigned m_tagIsForNamespaceRule : 1; | 333 unsigned m_tagIsImplicit : 1; |
334 unsigned m_relationIsAffectedByPseudoContent : 1; | 334 unsigned m_relationIsAffectedByPseudoContent : 1; |
335 | 335 |
336 unsigned specificityForOneSelector() const; | 336 unsigned specificityForOneSelector() const; |
337 unsigned specificityForPage() const; | 337 unsigned specificityForPage() const; |
338 void extractPseudoType() const; | 338 void extractPseudoType() const; |
339 | 339 |
340 // Hide. | 340 // Hide. |
341 CSSSelector& operator=(const CSSSelector&); | 341 CSSSelector& operator=(const CSSSelector&); |
342 | 342 |
343 struct RareData : public RefCounted<RareData> { | 343 struct RareData : public RefCounted<RareData> { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 | 468 |
469 inline CSSSelector::CSSSelector() | 469 inline CSSSelector::CSSSelector() |
470 : m_relation(SubSelector) | 470 : m_relation(SubSelector) |
471 , m_match(Unknown) | 471 , m_match(Unknown) |
472 , m_pseudoType(PseudoNotParsed) | 472 , m_pseudoType(PseudoNotParsed) |
473 , m_parsedNth(false) | 473 , m_parsedNth(false) |
474 , m_isLastInSelectorList(false) | 474 , m_isLastInSelectorList(false) |
475 , m_isLastInTagHistory(true) | 475 , m_isLastInTagHistory(true) |
476 , m_hasRareData(false) | 476 , m_hasRareData(false) |
477 , m_isForPage(false) | 477 , m_isForPage(false) |
478 , m_tagIsForNamespaceRule(false) | 478 , m_tagIsImplicit(false) |
479 , m_relationIsAffectedByPseudoContent(false) | 479 , m_relationIsAffectedByPseudoContent(false) |
480 { | 480 { |
481 } | 481 } |
482 | 482 |
483 inline CSSSelector::CSSSelector(const QualifiedName& tagQName, bool tagIsForName
spaceRule) | 483 inline CSSSelector::CSSSelector(const QualifiedName& tagQName, bool tagIsImplici
t) |
484 : m_relation(SubSelector) | 484 : m_relation(SubSelector) |
485 , m_match(Tag) | 485 , m_match(Tag) |
486 , m_pseudoType(PseudoNotParsed) | 486 , m_pseudoType(PseudoNotParsed) |
487 , m_parsedNth(false) | 487 , m_parsedNth(false) |
488 , m_isLastInSelectorList(false) | 488 , m_isLastInSelectorList(false) |
489 , m_isLastInTagHistory(true) | 489 , m_isLastInTagHistory(true) |
490 , m_hasRareData(false) | 490 , m_hasRareData(false) |
491 , m_isForPage(false) | 491 , m_isForPage(false) |
492 , m_tagIsForNamespaceRule(tagIsForNamespaceRule) | 492 , m_tagIsImplicit(tagIsImplicit) |
493 , m_relationIsAffectedByPseudoContent(false) | 493 , m_relationIsAffectedByPseudoContent(false) |
494 { | 494 { |
495 m_data.m_tagQName = tagQName.impl(); | 495 m_data.m_tagQName = tagQName.impl(); |
496 m_data.m_tagQName->ref(); | 496 m_data.m_tagQName->ref(); |
497 } | 497 } |
498 | 498 |
499 inline CSSSelector::CSSSelector(const CSSSelector& o) | 499 inline CSSSelector::CSSSelector(const CSSSelector& o) |
500 : m_relation(o.m_relation) | 500 : m_relation(o.m_relation) |
501 , m_match(o.m_match) | 501 , m_match(o.m_match) |
502 , m_pseudoType(o.m_pseudoType) | 502 , m_pseudoType(o.m_pseudoType) |
503 , m_parsedNth(o.m_parsedNth) | 503 , m_parsedNth(o.m_parsedNth) |
504 , m_isLastInSelectorList(o.m_isLastInSelectorList) | 504 , m_isLastInSelectorList(o.m_isLastInSelectorList) |
505 , m_isLastInTagHistory(o.m_isLastInTagHistory) | 505 , m_isLastInTagHistory(o.m_isLastInTagHistory) |
506 , m_hasRareData(o.m_hasRareData) | 506 , m_hasRareData(o.m_hasRareData) |
507 , m_isForPage(o.m_isForPage) | 507 , m_isForPage(o.m_isForPage) |
508 , m_tagIsForNamespaceRule(o.m_tagIsForNamespaceRule) | 508 , m_tagIsImplicit(o.m_tagIsImplicit) |
509 , m_relationIsAffectedByPseudoContent(o.m_relationIsAffectedByPseudoContent) | 509 , m_relationIsAffectedByPseudoContent(o.m_relationIsAffectedByPseudoContent) |
510 { | 510 { |
511 if (o.m_match == Tag) { | 511 if (o.m_match == Tag) { |
512 m_data.m_tagQName = o.m_data.m_tagQName; | 512 m_data.m_tagQName = o.m_data.m_tagQName; |
513 m_data.m_tagQName->ref(); | 513 m_data.m_tagQName->ref(); |
514 } else if (o.m_hasRareData) { | 514 } else if (o.m_hasRareData) { |
515 m_data.m_rareData = o.m_data.m_rareData; | 515 m_data.m_rareData = o.m_data.m_rareData; |
516 m_data.m_rareData->ref(); | 516 m_data.m_rareData->ref(); |
517 } else if (o.m_data.m_value) { | 517 } else if (o.m_data.m_value) { |
518 m_data.m_value = o.m_data.m_value; | 518 m_data.m_value = o.m_data.m_value; |
(...skipping 23 matching lines...) Expand all Loading... |
542 if (m_hasRareData) | 542 if (m_hasRareData) |
543 return m_data.m_rareData->m_value; | 543 return m_data.m_rareData->m_value; |
544 // AtomicString is really just a StringImpl* so the cast below is safe. | 544 // AtomicString is really just a StringImpl* so the cast below is safe. |
545 // FIXME: Perhaps call sites could be changed to accept StringImpl? | 545 // FIXME: Perhaps call sites could be changed to accept StringImpl? |
546 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); | 546 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); |
547 } | 547 } |
548 | 548 |
549 } // namespace blink | 549 } // namespace blink |
550 | 550 |
551 #endif // CSSSelector_h | 551 #endif // CSSSelector_h |
OLD | NEW |