| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google, Inc. | 2 * Copyright (C) 2013 Google, Inc. |
| 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 23 matching lines...) Expand all Loading... |
| 34 class RuleSet; | 34 class RuleSet; |
| 35 class SpaceSplitString; | 35 class SpaceSplitString; |
| 36 class StyleResolver; | 36 class StyleResolver; |
| 37 | 37 |
| 38 class SharedStyleFinder { | 38 class SharedStyleFinder { |
| 39 STACK_ALLOCATED(); | 39 STACK_ALLOCATED(); |
| 40 public: | 40 public: |
| 41 // RuleSets are passed non-const as the act of matching against them can cau
se them | 41 // RuleSets are passed non-const as the act of matching against them can cau
se them |
| 42 // to be compacted. :( | 42 // to be compacted. :( |
| 43 SharedStyleFinder(const ElementResolveContext& context, | 43 SharedStyleFinder(const ElementResolveContext& context, |
| 44 const RuleFeatureSet& features, | 44 const RuleFeatureSet& features, StyleResolver& styleResolver) |
| 45 RuleSet* attributeRuleSet, StyleResolver& styleResolver) | |
| 46 : m_elementAffectedByClassRules(false) | 45 : m_elementAffectedByClassRules(false) |
| 47 , m_features(features) | 46 , m_features(features) |
| 48 , m_attributeRuleSet(attributeRuleSet) | |
| 49 , m_styleResolver(styleResolver) | 47 , m_styleResolver(styleResolver) |
| 50 , m_context(context) | 48 , m_context(context) |
| 51 { } | 49 { } |
| 52 | 50 |
| 53 RenderStyle* findSharedStyle(); | 51 RenderStyle* findSharedStyle(); |
| 54 | 52 |
| 55 private: | 53 private: |
| 56 Element* findElementForStyleSharing() const; | 54 Element* findElementForStyleSharing() const; |
| 57 | 55 |
| 58 // Only used when we're collecting stats on styles. | 56 // Only used when we're collecting stats on styles. |
| 59 bool documentContainsValidCandidate() const; | 57 bool documentContainsValidCandidate() const; |
| 60 | 58 |
| 61 bool classNamesAffectedByRules(const SpaceSplitString&) const; | 59 bool classNamesAffectedByRules(const Element&) const; |
| 60 bool attributesAffectedByRules(const Element&) const; |
| 62 | 61 |
| 63 bool canShareStyleWithElement(Element& candidate) const; | 62 bool canShareStyleWithElement(Element& candidate) const; |
| 64 bool sharingCandidateHasIdenticalStyleAffectingAttributes(Element& candidate
) const; | 63 bool sharingCandidateHasIdenticalStyleAffectingAttributes(Element& candidate
) const; |
| 65 bool sharingCandidateCanShareHostStyles(Element& candidate) const; | 64 bool sharingCandidateCanShareHostStyles(Element& candidate) const; |
| 66 bool sharingCandidateDistributedToSameInsertionPoint(Element& candidate) con
st; | 65 bool sharingCandidateDistributedToSameInsertionPoint(Element& candidate) con
st; |
| 67 bool matchesRuleSet(RuleSet*); | |
| 68 | 66 |
| 69 Element& element() const { return *m_context.element(); } | 67 Element& element() const { return *m_context.element(); } |
| 70 Document& document() const { return element().document(); } | 68 Document& document() const { return element().document(); } |
| 71 | 69 |
| 72 bool m_elementAffectedByClassRules; | 70 bool m_elementAffectedByClassRules; |
| 73 const RuleFeatureSet& m_features; | 71 const RuleFeatureSet& m_features; |
| 74 RawPtr<RuleSet> m_attributeRuleSet; | |
| 75 StyleResolver& m_styleResolver; | 72 StyleResolver& m_styleResolver; |
| 76 const ElementResolveContext& m_context; | 73 const ElementResolveContext& m_context; |
| 77 }; | 74 }; |
| 78 | 75 |
| 79 } // namespace blink | 76 } // namespace blink |
| 80 | 77 |
| 81 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_SHAREDSTYLEFINDER_H_ | 78 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_SHAREDSTYLEFINDER_H_ |
| OLD | NEW |