| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 const unsigned styleSharingListSize = 15; | 76 const unsigned styleSharingListSize = 15; |
| 77 const unsigned styleSharingMaxDepth = 32; | 77 const unsigned styleSharingMaxDepth = 32; |
| 78 using StyleSharingList = WillBeHeapDeque<RawPtrWillBeMember<Element>, styleShari
ngListSize>; | 78 using StyleSharingList = WillBeHeapDeque<RawPtrWillBeMember<Element>, styleShari
ngListSize>; |
| 79 using ActiveInterpolationsMap = HashMap<PropertyHandle, Vector<RefPtr<Interpolat
ion>, 1>>; | 79 using ActiveInterpolationsMap = HashMap<PropertyHandle, Vector<RefPtr<Interpolat
ion>, 1>>; |
| 80 | 80 |
| 81 // This class selects a ComputedStyle for a given element based on a collection
of stylesheets. | 81 // This class selects a ComputedStyle for a given element based on a collection
of stylesheets. |
| 82 class CORE_EXPORT StyleResolver final : public NoBaseWillBeGarbageCollectedFinal
ized<StyleResolver> { | 82 class CORE_EXPORT StyleResolver final : public NoBaseWillBeGarbageCollectedFinal
ized<StyleResolver> { |
| 83 WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED
(StyleResolver); | 83 WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED
(StyleResolver); |
| 84 public: | 84 public: |
| 85 explicit StyleResolver(Document&); | 85 static PassOwnPtrWillBeRawPtr<StyleResolver> create(Document& document) |
| 86 virtual ~StyleResolver(); | 86 { |
| 87 return adoptPtrWillBeNoop(new StyleResolver(document)); |
| 88 } |
| 89 ~StyleResolver(); |
| 87 | 90 |
| 88 // FIXME: StyleResolver should not be keeping tree-walk state. | 91 // FIXME: StyleResolver should not be keeping tree-walk state. |
| 89 // These should move to some global tree-walk state, or should be contained
in a | 92 // These should move to some global tree-walk state, or should be contained
in a |
| 90 // TreeWalkContext or similar which is passed in to StyleResolver methods wh
en available. | 93 // TreeWalkContext or similar which is passed in to StyleResolver methods wh
en available. |
| 91 // Using these during tree walk will allow style selector to optimize child
and descendant selector lookups. | 94 // Using these during tree walk will allow style selector to optimize child
and descendant selector lookups. |
| 92 void pushParentElement(Element&); | 95 void pushParentElement(Element&); |
| 93 void popParentElement(Element&); | 96 void popParentElement(Element&); |
| 94 | 97 |
| 95 PassRefPtr<ComputedStyle> styleForElement(Element*, const ComputedStyle* par
entStyle = 0, StyleSharingBehavior = AllowStyleSharing, | 98 PassRefPtr<ComputedStyle> styleForElement(Element*, const ComputedStyle* par
entStyle = 0, StyleSharingBehavior = AllowStyleSharing, |
| 96 RuleMatchingBehavior = MatchAllRules); | 99 RuleMatchingBehavior = MatchAllRules); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 void increaseStyleSharingDepth() { ++m_styleSharingDepth; } | 181 void increaseStyleSharingDepth() { ++m_styleSharingDepth; } |
| 179 void decreaseStyleSharingDepth() { --m_styleSharingDepth; } | 182 void decreaseStyleSharingDepth() { --m_styleSharingDepth; } |
| 180 | 183 |
| 181 PassRefPtrWillBeRawPtr<PseudoElement> createPseudoElementIfNeeded(Element& p
arent, PseudoId); | 184 PassRefPtrWillBeRawPtr<PseudoElement> createPseudoElementIfNeeded(Element& p
arent, PseudoId); |
| 182 | 185 |
| 183 DECLARE_TRACE(); | 186 DECLARE_TRACE(); |
| 184 | 187 |
| 185 void addTreeBoundaryCrossingScope(ContainerNode& scope); | 188 void addTreeBoundaryCrossingScope(ContainerNode& scope); |
| 186 | 189 |
| 187 private: | 190 private: |
| 191 explicit StyleResolver(Document&); |
| 192 |
| 188 PassRefPtr<ComputedStyle> initialStyleForElement(); | 193 PassRefPtr<ComputedStyle> initialStyleForElement(); |
| 189 | 194 |
| 190 void initWatchedSelectorRules(); | 195 void initWatchedSelectorRules(); |
| 191 | 196 |
| 192 // FIXME: This should probably go away, folded into FontBuilder. | 197 // FIXME: This should probably go away, folded into FontBuilder. |
| 193 void updateFont(StyleResolverState&); | 198 void updateFont(StyleResolverState&); |
| 194 | 199 |
| 195 void loadPendingResources(StyleResolverState&); | 200 void loadPendingResources(StyleResolverState&); |
| 196 void adjustComputedStyle(StyleResolverState&, Element*); | 201 void adjustComputedStyle(StyleResolverState&, Element*); |
| 197 | 202 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 263 |
| 259 OwnPtr<StyleResolverStats> m_styleResolverStats; | 264 OwnPtr<StyleResolverStats> m_styleResolverStats; |
| 260 | 265 |
| 261 // Use only for Internals::updateStyleAndReturnAffectedElementCount. | 266 // Use only for Internals::updateStyleAndReturnAffectedElementCount. |
| 262 unsigned m_accessCount; | 267 unsigned m_accessCount; |
| 263 }; | 268 }; |
| 264 | 269 |
| 265 } // namespace blink | 270 } // namespace blink |
| 266 | 271 |
| 267 #endif // StyleResolver_h | 272 #endif // StyleResolver_h |
| OLD | NEW |