OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 20 matching lines...) Expand all Loading... |
31 #ifndef HTMLContentElement_h | 31 #ifndef HTMLContentElement_h |
32 #define HTMLContentElement_h | 32 #define HTMLContentElement_h |
33 | 33 |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
35 #include "core/css/CSSSelectorList.h" | 35 #include "core/css/CSSSelectorList.h" |
36 #include "core/dom/shadow/InsertionPoint.h" | 36 #include "core/dom/shadow/InsertionPoint.h" |
37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 class HTMLContentSelectFilter : public NoBaseWillBeGarbageCollected<HTMLContentS
electFilter> { | 41 class HTMLContentSelectFilter : public NoBaseWillBeGarbageCollectedFinalized<HTM
LContentSelectFilter> { |
42 public: | 42 public: |
43 virtual ~HTMLContentSelectFilter() { } | 43 virtual ~HTMLContentSelectFilter() { } |
44 virtual bool canSelectNode(const WillBeHeapVector<RawPtrWillBeMember<Node>,
32>& siblings, int nth) const = 0; | 44 virtual bool canSelectNode(const WillBeHeapVector<RawPtrWillBeMember<Node>,
32>& siblings, int nth) const = 0; |
45 | 45 |
46 DEFINE_INLINE_VIRTUAL_TRACE() { } | 46 DEFINE_INLINE_VIRTUAL_TRACE() { } |
47 }; | 47 }; |
48 | 48 |
49 class CORE_EXPORT HTMLContentElement final : public InsertionPoint { | 49 class CORE_EXPORT HTMLContentElement final : public InsertionPoint { |
50 DEFINE_WRAPPERTYPEINFO(); | 50 DEFINE_WRAPPERTYPEINFO(); |
51 public: | 51 public: |
52 static PassRefPtrWillBeRawPtr<HTMLContentElement> create(Document&, PassOwnP
trWillBeRawPtr<HTMLContentSelectFilter> = nullptr); | 52 static PassRefPtrWillBeRawPtr<HTMLContentElement> create(Document&, PassOwnP
trWillBeRawPtr<HTMLContentSelectFilter> = nullptr); |
53 virtual ~HTMLContentElement(); | 53 virtual ~HTMLContentElement(); |
54 | 54 |
55 virtual bool canAffectSelector() const override { return true; } | 55 virtual bool canAffectSelector() const override { return true; } |
56 | 56 |
57 bool canSelectNode(const WillBeHeapVector<RawPtrWillBeMember<Node>, 32>& sib
lings, int nth) const; | 57 bool canSelectNode(const WillBeHeapVector<RawPtrWillBeMember<Node>, 32>& sib
lings, int nth) const; |
58 | 58 |
59 const CSSSelectorList& selectorList() const; | 59 const CSSSelectorList& selectorList() const; |
60 bool isSelectValid() const; | 60 bool isSelectValid() const; |
61 | 61 |
| 62 DECLARE_VIRTUAL_TRACE(); |
| 63 |
62 private: | 64 private: |
63 HTMLContentElement(Document&, PassOwnPtrWillBeRawPtr<HTMLContentSelectFilter
>); | 65 HTMLContentElement(Document&, PassOwnPtrWillBeRawPtr<HTMLContentSelectFilter
>); |
64 | 66 |
65 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr
ide; | 67 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr
ide; |
66 | 68 |
67 bool validateSelect() const; | 69 bool validateSelect() const; |
68 void parseSelect(); | 70 void parseSelect(); |
69 | 71 |
70 bool matchSelector(const WillBeHeapVector<RawPtrWillBeMember<Node>, 32>& sib
lings, int nth) const; | 72 bool matchSelector(const WillBeHeapVector<RawPtrWillBeMember<Node>, 32>& sib
lings, int nth) const; |
71 | 73 |
(...skipping 27 matching lines...) Expand all Loading... |
99 if (!isSelectValid()) | 101 if (!isSelectValid()) |
100 return false; | 102 return false; |
101 if (!siblings[nth]->isElementNode()) | 103 if (!siblings[nth]->isElementNode()) |
102 return false; | 104 return false; |
103 return matchSelector(siblings, nth); | 105 return matchSelector(siblings, nth); |
104 } | 106 } |
105 | 107 |
106 } // namespace blink | 108 } // namespace blink |
107 | 109 |
108 #endif // HTMLContentElement_h | 110 #endif // HTMLContentElement_h |
OLD | NEW |