| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 } | 289 } |
| 290 | 290 |
| 291 bool isLastInSelectorList() const { return m_isLastInSelectorList; } | 291 bool isLastInSelectorList() const { return m_isLastInSelectorList; } |
| 292 void setLastInSelectorList() { m_isLastInSelectorList = true; } | 292 void setLastInSelectorList() { m_isLastInSelectorList = true; } |
| 293 bool isLastInTagHistory() const { return m_isLastInTagHistory; } | 293 bool isLastInTagHistory() const { return m_isLastInTagHistory; } |
| 294 void setNotLastInTagHistory() { m_isLastInTagHistory = false; } | 294 void setNotLastInTagHistory() { m_isLastInTagHistory = false; } |
| 295 | 295 |
| 296 // http://dev.w3.org/csswg/selectors4/#compound | 296 // http://dev.w3.org/csswg/selectors4/#compound |
| 297 bool isCompound() const; | 297 bool isCompound() const; |
| 298 | 298 |
| 299 // Note: the link match type is only valid for the start of each selecto
r |
| 300 // in a CSSSelectorList. |
| 299 enum LinkMatchMask { MatchLink = 1, MatchVisited = 2, MatchAll = MatchLi
nk | MatchVisited }; | 301 enum LinkMatchMask { MatchLink = 1, MatchVisited = 2, MatchAll = MatchLi
nk | MatchVisited }; |
| 300 unsigned computeLinkMatchType() const; | 302 void updateLinkMatchType(); |
| 303 unsigned linkMatchType() const { return m_linkMatchType; } |
| 301 | 304 |
| 302 bool isForPage() const { return m_isForPage; } | 305 bool isForPage() const { return m_isForPage; } |
| 303 void setForPage() { m_isForPage = true; } | 306 void setForPage() { m_isForPage = true; } |
| 304 | 307 |
| 305 bool relationIsAffectedByPseudoContent() const { return m_relationIsAffe
ctedByPseudoContent; } | 308 bool relationIsAffectedByPseudoContent() const { return m_relationIsAffe
ctedByPseudoContent; } |
| 306 void setRelationIsAffectedByPseudoContent() { m_relationIsAffectedByPseu
doContent = true; } | 309 void setRelationIsAffectedByPseudoContent() { m_relationIsAffectedByPseu
doContent = true; } |
| 307 | 310 |
| 308 private: | 311 private: |
| 309 unsigned m_relation : 3; // enum Relation | 312 unsigned m_relation : 3; // enum Relation |
| 310 mutable unsigned m_match : 4; // enum Match | 313 unsigned m_match : 4; // enum Match |
| 311 mutable unsigned m_pseudoType : 8; // PseudoType | 314 unsigned m_pseudoType : 8; // PseudoType |
| 312 unsigned m_isLastInSelectorList : 1; | 315 unsigned m_isLastInSelectorList : 1; |
| 313 unsigned m_isLastInTagHistory : 1; | 316 unsigned m_isLastInTagHistory : 1; |
| 314 unsigned m_hasRareData : 1; | 317 unsigned m_hasRareData : 1; |
| 315 unsigned m_isForPage : 1; | 318 unsigned m_isForPage : 1; |
| 316 unsigned m_tagIsImplicit : 1; | 319 unsigned m_tagIsImplicit : 1; |
| 317 unsigned m_relationIsAffectedByPseudoContent : 1; | 320 unsigned m_relationIsAffectedByPseudoContent : 1; |
| 321 unsigned m_linkMatchType : 2; // LinkMatchMask |
| 318 | 322 |
| 319 void setPseudoType(PseudoType pseudoType) | 323 void setPseudoType(PseudoType pseudoType) |
| 320 { | 324 { |
| 321 m_pseudoType = pseudoType; | 325 m_pseudoType = pseudoType; |
| 322 ASSERT(static_cast<PseudoType>(m_pseudoType) == pseudoType); // usin
g a bitfield. | 326 ASSERT(static_cast<PseudoType>(m_pseudoType) == pseudoType); // usin
g a bitfield. |
| 323 } | 327 } |
| 324 | 328 |
| 325 unsigned specificityForOneSelector() const; | 329 unsigned specificityForOneSelector() const; |
| 326 unsigned specificityForPage() const; | 330 unsigned specificityForPage() const; |
| 327 | 331 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 inline CSSSelector::CSSSelector() | 414 inline CSSSelector::CSSSelector() |
| 411 : m_relation(SubSelector) | 415 : m_relation(SubSelector) |
| 412 , m_match(Unknown) | 416 , m_match(Unknown) |
| 413 , m_pseudoType(PseudoUnknown) | 417 , m_pseudoType(PseudoUnknown) |
| 414 , m_isLastInSelectorList(false) | 418 , m_isLastInSelectorList(false) |
| 415 , m_isLastInTagHistory(true) | 419 , m_isLastInTagHistory(true) |
| 416 , m_hasRareData(false) | 420 , m_hasRareData(false) |
| 417 , m_isForPage(false) | 421 , m_isForPage(false) |
| 418 , m_tagIsImplicit(false) | 422 , m_tagIsImplicit(false) |
| 419 , m_relationIsAffectedByPseudoContent(false) | 423 , m_relationIsAffectedByPseudoContent(false) |
| 424 , m_linkMatchType(MatchAll) |
| 420 { | 425 { |
| 421 } | 426 } |
| 422 | 427 |
| 423 inline CSSSelector::CSSSelector(const QualifiedName& tagQName, bool tagIsImplici
t) | 428 inline CSSSelector::CSSSelector(const QualifiedName& tagQName, bool tagIsImplici
t) |
| 424 : m_relation(SubSelector) | 429 : m_relation(SubSelector) |
| 425 , m_match(Tag) | 430 , m_match(Tag) |
| 426 , m_pseudoType(PseudoUnknown) | 431 , m_pseudoType(PseudoUnknown) |
| 427 , m_isLastInSelectorList(false) | 432 , m_isLastInSelectorList(false) |
| 428 , m_isLastInTagHistory(true) | 433 , m_isLastInTagHistory(true) |
| 429 , m_hasRareData(false) | 434 , m_hasRareData(false) |
| 430 , m_isForPage(false) | 435 , m_isForPage(false) |
| 431 , m_tagIsImplicit(tagIsImplicit) | 436 , m_tagIsImplicit(tagIsImplicit) |
| 432 , m_relationIsAffectedByPseudoContent(false) | 437 , m_relationIsAffectedByPseudoContent(false) |
| 438 , m_linkMatchType(MatchAll) |
| 433 { | 439 { |
| 434 m_data.m_tagQName = tagQName.impl(); | 440 m_data.m_tagQName = tagQName.impl(); |
| 435 m_data.m_tagQName->ref(); | 441 m_data.m_tagQName->ref(); |
| 436 } | 442 } |
| 437 | 443 |
| 438 inline CSSSelector::CSSSelector(const CSSSelector& o) | 444 inline CSSSelector::CSSSelector(const CSSSelector& o) |
| 439 : m_relation(o.m_relation) | 445 : m_relation(o.m_relation) |
| 440 , m_match(o.m_match) | 446 , m_match(o.m_match) |
| 441 , m_pseudoType(o.m_pseudoType) | 447 , m_pseudoType(o.m_pseudoType) |
| 442 , m_isLastInSelectorList(o.m_isLastInSelectorList) | 448 , m_isLastInSelectorList(o.m_isLastInSelectorList) |
| 443 , m_isLastInTagHistory(o.m_isLastInTagHistory) | 449 , m_isLastInTagHistory(o.m_isLastInTagHistory) |
| 444 , m_hasRareData(o.m_hasRareData) | 450 , m_hasRareData(o.m_hasRareData) |
| 445 , m_isForPage(o.m_isForPage) | 451 , m_isForPage(o.m_isForPage) |
| 446 , m_tagIsImplicit(o.m_tagIsImplicit) | 452 , m_tagIsImplicit(o.m_tagIsImplicit) |
| 447 , m_relationIsAffectedByPseudoContent(o.m_relationIsAffectedByPseudoContent) | 453 , m_relationIsAffectedByPseudoContent(o.m_relationIsAffectedByPseudoContent) |
| 454 , m_linkMatchType(MatchAll) |
| 448 { | 455 { |
| 449 if (o.m_match == Tag) { | 456 if (o.m_match == Tag) { |
| 450 m_data.m_tagQName = o.m_data.m_tagQName; | 457 m_data.m_tagQName = o.m_data.m_tagQName; |
| 451 m_data.m_tagQName->ref(); | 458 m_data.m_tagQName->ref(); |
| 452 } else if (o.m_hasRareData) { | 459 } else if (o.m_hasRareData) { |
| 453 m_data.m_rareData = o.m_data.m_rareData; | 460 m_data.m_rareData = o.m_data.m_rareData; |
| 454 m_data.m_rareData->ref(); | 461 m_data.m_rareData->ref(); |
| 455 } else if (o.m_data.m_value) { | 462 } else if (o.m_data.m_value) { |
| 456 m_data.m_value = o.m_data.m_value; | 463 m_data.m_value = o.m_data.m_value; |
| 457 m_data.m_value->ref(); | 464 m_data.m_value->ref(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 480 if (m_hasRareData) | 487 if (m_hasRareData) |
| 481 return m_data.m_rareData->m_value; | 488 return m_data.m_rareData->m_value; |
| 482 // AtomicString is really just a StringImpl* so the cast below is safe. | 489 // AtomicString is really just a StringImpl* so the cast below is safe. |
| 483 // FIXME: Perhaps call sites could be changed to accept StringImpl? | 490 // FIXME: Perhaps call sites could be changed to accept StringImpl? |
| 484 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); | 491 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); |
| 485 } | 492 } |
| 486 | 493 |
| 487 } // namespace blink | 494 } // namespace blink |
| 488 | 495 |
| 489 #endif // CSSSelector_h | 496 #endif // CSSSelector_h |
| OLD | NEW |