| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 class CSSSelector; | 36 class CSSSelector; |
| 37 class ContainerNode; | 37 class ContainerNode; |
| 38 class Element; | 38 class Element; |
| 39 class RenderStyle; | 39 class RenderStyle; |
| 40 | 40 |
| 41 class SelectorChecker { | 41 class SelectorChecker { |
| 42 WTF_MAKE_NONCOPYABLE(SelectorChecker); | 42 WTF_MAKE_NONCOPYABLE(SelectorChecker); |
| 43 public: | 43 public: |
| 44 enum Mode { ResolvingStyle = 0, QueryingRules, SharingRules }; | 44 enum Mode { ResolvingStyle = 0, QueryingRules, SharingRules }; |
| 45 explicit SelectorChecker(Document&, Mode); | 45 explicit SelectorChecker(Document&, Mode); |
| 46 enum ContextFlags { | |
| 47 // FIXME: Revmoe DefaultBehavior. | |
| 48 DefaultBehavior = 0, | |
| 49 TreatShadowHostAsNormalScope = 1, | |
| 50 }; | |
| 51 | 46 |
| 52 struct SelectorCheckingContext { | 47 struct SelectorCheckingContext { |
| 53 STACK_ALLOCATED(); | 48 STACK_ALLOCATED(); |
| 54 public: | 49 public: |
| 55 // Initial selector constructor | 50 // Initial selector constructor |
| 56 SelectorCheckingContext(const CSSSelector& selector, Element* element) | 51 SelectorCheckingContext(const CSSSelector& selector, Element* element) |
| 57 : selector(&selector) | 52 : selector(&selector) |
| 58 , element(element) | 53 , element(element) |
| 59 , scope(nullptr) | 54 , scope(nullptr) |
| 60 , elementStyle(0) | 55 , elementStyle(0) |
| 61 , contextFlags(DefaultBehavior) | |
| 62 { | 56 { |
| 63 } | 57 } |
| 64 | 58 |
| 65 const CSSSelector* selector; | 59 const CSSSelector* selector; |
| 66 RawPtr<Element> element; | 60 RawPtr<Element> element; |
| 67 RawPtr<const ContainerNode> scope; | 61 RawPtr<const ContainerNode> scope; |
| 68 RenderStyle* elementStyle; | 62 RenderStyle* elementStyle; |
| 69 ContextFlags contextFlags; | |
| 70 }; | 63 }; |
| 71 | 64 |
| 72 bool match(const SelectorCheckingContext&) const; | 65 bool match(const SelectorCheckingContext&) const; |
| 73 | 66 |
| 74 static bool tagMatches(const Element&, const QualifiedName&); | 67 static bool tagMatches(const Element&, const QualifiedName&); |
| 75 static bool isHostInItsShadowTree(const Element&, const ContainerNode* scope
); | 68 static bool isHostInItsShadowTree(const Element&, const ContainerNode* scope
); |
| 76 | 69 |
| 77 private: | 70 private: |
| 78 bool checkPseudoClass(const SelectorCheckingContext&) const; | 71 bool checkPseudoClass(const SelectorCheckingContext&) const; |
| 79 bool checkOne(const SelectorCheckingContext&) const; | 72 bool checkOne(const SelectorCheckingContext&) const; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 104 } | 97 } |
| 105 | 98 |
| 106 inline bool SelectorChecker::isHostInItsShadowTree(const Element& element, const
ContainerNode* scope) | 99 inline bool SelectorChecker::isHostInItsShadowTree(const Element& element, const
ContainerNode* scope) |
| 107 { | 100 { |
| 108 return scope && scope->isInShadowTree() && scope->shadowHost() == element; | 101 return scope && scope->isInShadowTree() && scope->shadowHost() == element; |
| 109 } | 102 } |
| 110 | 103 |
| 111 } | 104 } |
| 112 | 105 |
| 113 #endif // SKY_ENGINE_CORE_CSS_SELECTORCHECKER_H_ | 106 #endif // SKY_ENGINE_CORE_CSS_SELECTORCHECKER_H_ |
| OLD | NEW |