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 | 4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights |
5 * reserved. | 5 * reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 class CSSSelectorList; | 33 class CSSSelectorList; |
34 | 34 |
35 // This class represents a selector for a StyleRule. | 35 // This class represents a selector for a StyleRule. |
36 | 36 |
37 // CSS selector representation is somewhat complicated and subtle. A | 37 // CSS selector representation is somewhat complicated and subtle. A |
38 // representative list of selectors is in CSSSelectorTest; run it in a debug | 38 // representative list of selectors is in CSSSelectorTest; run it in a debug |
39 // build to see useful debugging output. | 39 // build to see useful debugging output. |
40 // | 40 // |
41 // ** tagHistory() and relation(): | 41 // ** TagHistory() and Relation(): |
42 // | 42 // |
43 // Selectors are represented as a linked list of simple selectors (defined more | 43 // Selectors are represented as a linked list of simple selectors (defined more |
44 // or less according to | 44 // or less according to |
45 // http://www.w3.org/TR/css3-selectors/#simple-selectors-dfn). The tagHistory() | 45 // http://www.w3.org/TR/css3-selectors/#simple-selectors-dfn). The tagHistory() |
46 // method returns the next simple selector in the list. The relation() method | 46 // method returns the next simple selector in the list. The relation() method |
47 // returns the relationship of the current simple selector to the one in | 47 // returns the relationship of the current simple selector to the one in |
48 // tagHistory(). For example, the CSS selector .a.b #c is represented as: | 48 // tagHistory(). For example, the CSS selector .a.b #c is represented as: |
49 // | 49 // |
50 // selectorText(): .a.b #c | 50 // SelectorText(): .a.b #c |
51 // --> (relation == Descendant) | 51 // --> (relation == kDescendant) |
52 // selectorText(): .a.b | 52 // SelectorText(): .a.b |
53 // --> (relation == SubSelector) | 53 // --> (relation == kSubSelector) |
54 // selectorText(): .b | 54 // SelectorText(): .b |
55 // | 55 // |
56 // The order of tagHistory() varies depending on the situation. | 56 // The order of tagHistory() varies depending on the situation. |
57 // * Relations using combinators | 57 // * Relations using combinators |
58 // (http://www.w3.org/TR/css3-selectors/#combinators), such as descendant, | 58 // (http://www.w3.org/TR/css3-selectors/#combinators), such as descendant, |
59 // sibling, etc., are parsed right-to-left (in the example above, this is why | 59 // sibling, etc., are parsed right-to-left (in the example above, this is why |
60 // #c is earlier in the tagHistory() chain than .a.b). | 60 // #c is earlier in the tagHistory() chain than .a.b). |
61 // * SubSelector relations are parsed left-to-right in most cases (such as the | 61 // * SubSelector relations are parsed left-to-right in most cases (such as the |
62 // .a.b example above); a counter-example is the | 62 // .a.b example above); a counter-example is the |
63 // ::content pseudo-element. Most (all?) other pseudo elements and pseudo | 63 // ::content pseudo-element. Most (all?) other pseudo elements and pseudo |
64 // classes are parsed left-to-right. | 64 // classes are parsed left-to-right. |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 } | 535 } |
536 | 536 |
537 inline bool CSSSelector::IsIdClassOrAttributeSelector() const { | 537 inline bool CSSSelector::IsIdClassOrAttributeSelector() const { |
538 return IsAttributeSelector() || Match() == CSSSelector::kId || | 538 return IsAttributeSelector() || Match() == CSSSelector::kId || |
539 Match() == CSSSelector::kClass; | 539 Match() == CSSSelector::kClass; |
540 } | 540 } |
541 | 541 |
542 } // namespace blink | 542 } // namespace blink |
543 | 543 |
544 #endif // CSSSelector_h | 544 #endif // CSSSelector_h |
OLD | NEW |