| 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 15 matching lines...) Expand all Loading... |
| 26 #include "core/CoreExport.h" | 26 #include "core/CoreExport.h" |
| 27 #include "core/animation/css/CSSAnimationUpdate.h" | 27 #include "core/animation/css/CSSAnimationUpdate.h" |
| 28 #include "core/css/CSSPendingSubstitutionValue.h" | 28 #include "core/css/CSSPendingSubstitutionValue.h" |
| 29 #include "core/css/CSSToLengthConversionData.h" | 29 #include "core/css/CSSToLengthConversionData.h" |
| 30 #include "core/css/resolver/CSSToStyleMap.h" | 30 #include "core/css/resolver/CSSToStyleMap.h" |
| 31 #include "core/css/resolver/ElementResolveContext.h" | 31 #include "core/css/resolver/ElementResolveContext.h" |
| 32 #include "core/css/resolver/ElementStyleResources.h" | 32 #include "core/css/resolver/ElementStyleResources.h" |
| 33 #include "core/css/resolver/FontBuilder.h" | 33 #include "core/css/resolver/FontBuilder.h" |
| 34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
| 35 #include "core/dom/Element.h" | 35 #include "core/dom/Element.h" |
| 36 #include "core/layout/api/LayoutViewItem.h" | |
| 37 #include "core/style/CachedUAStyle.h" | 36 #include "core/style/CachedUAStyle.h" |
| 38 #include "core/style/ComputedStyle.h" | 37 #include "core/style/ComputedStyle.h" |
| 39 #include "core/style/StyleInheritedData.h" | 38 #include "core/style/StyleInheritedData.h" |
| 40 #include <memory> | 39 #include <memory> |
| 41 | 40 |
| 42 namespace blink { | 41 namespace blink { |
| 43 | 42 |
| 44 class FontDescription; | 43 class FontDescription; |
| 45 | 44 |
| 46 class CORE_EXPORT StyleResolverState { | 45 class CORE_EXPORT StyleResolverState { |
| 47 STACK_ALLOCATED(); | 46 STACK_ALLOCATED(); |
| 48 WTF_MAKE_NONCOPYABLE(StyleResolverState); | 47 WTF_MAKE_NONCOPYABLE(StyleResolverState); |
| 49 public: | 48 public: |
| 50 StyleResolverState(Document&, const ElementResolveContext&, const ComputedSt
yle* parentStyle); | 49 StyleResolverState(Document&, const ElementResolveContext&, const ComputedSt
yle* parentStyle); |
| 51 StyleResolverState(Document&, Element*, const ComputedStyle* parentStyle = 0
); | 50 StyleResolverState(Document&, Element*, const ComputedStyle* parentStyle = 0
); |
| 52 ~StyleResolverState(); | 51 ~StyleResolverState(); |
| 53 | 52 |
| 54 // In FontFaceSet and CanvasRenderingContext2D, we don't have an element to
grab the document from. | 53 // In FontFaceSet and CanvasRenderingContext2D, we don't have an element to
grab the document from. |
| 55 // This is why we have to store the document separately. | 54 // This is why we have to store the document separately. |
| 56 Document& document() const { return *m_document; } | 55 Document& document() const { return *m_document; } |
| 57 // These are all just pass-through methods to ElementResolveContext. | 56 // These are all just pass-through methods to ElementResolveContext. |
| 58 Element* element() const { return m_elementContext.element(); } | 57 Element* element() const { return m_elementContext.element(); } |
| 59 const ContainerNode* parentNode() const { return m_elementContext.parentNode
(); } | 58 const ContainerNode* parentNode() const { return m_elementContext.parentNode
(); } |
| 60 const ComputedStyle* rootElementStyle() const { return m_elementContext.root
ElementStyle(); } | 59 const ComputedStyle* rootElementStyle() const { return m_elementContext.root
ElementStyle(); } |
| 61 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt
ate(); } | 60 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt
ate(); } |
| 62 bool distributedToInsertionPoint() const { return m_elementContext.distribut
edToInsertionPoint(); } | 61 bool distributedToInsertionPoint() const { return m_elementContext.distribut
edToInsertionPoint(); } |
| 63 | 62 |
| 64 const ElementResolveContext& elementContext() const { return m_elementContex
t; } | 63 const ElementResolveContext& elementContext() const { return m_elementContex
t; } |
| 65 | 64 |
| 66 void setStyle(PassRefPtr<ComputedStyle> style) | 65 void setStyle(PassRefPtr<ComputedStyle>); |
| 67 { | |
| 68 // FIXME: Improve RAII of StyleResolverState to remove this function. | |
| 69 m_style = style; | |
| 70 m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), r
ootElementStyle(), document().layoutViewItem(), m_style->effectiveZoom()); | |
| 71 } | |
| 72 const ComputedStyle* style() const { return m_style.get(); } | 66 const ComputedStyle* style() const { return m_style.get(); } |
| 73 ComputedStyle* style() { return m_style.get(); } | 67 ComputedStyle* style() { return m_style.get(); } |
| 74 PassRefPtr<ComputedStyle> takeStyle() { return m_style.release(); } | 68 PassRefPtr<ComputedStyle> takeStyle() { return m_style.release(); } |
| 75 | 69 |
| 76 ComputedStyle& mutableStyleRef() const { return *m_style; } | 70 ComputedStyle& mutableStyleRef() const { return *m_style; } |
| 77 const ComputedStyle& styleRef() const { return mutableStyleRef(); } | 71 const ComputedStyle& styleRef() const { return mutableStyleRef(); } |
| 78 | 72 |
| 79 const CSSToLengthConversionData& cssToLengthConversionData() const { return
m_cssToLengthConversionData; } | 73 const CSSToLengthConversionData& cssToLengthConversionData() const { return
m_cssToLengthConversionData; } |
| 80 CSSToLengthConversionData fontSizeConversionData() const; | 74 CSSToLengthConversionData fontSizeConversionData() const; |
| 81 | 75 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 184 |
| 191 HeapHashMap<String, Member<StylePropertySet>> m_customPropertySetsForApplyAt
Rule; | 185 HeapHashMap<String, Member<StylePropertySet>> m_customPropertySetsForApplyAt
Rule; |
| 192 | 186 |
| 193 mutable HeapHashMap<Member<const CSSPendingSubstitutionValue>, Member<HeapHa
shMap<CSSPropertyID, Member<const CSSValue>>>> m_parsedPropertiesForPendingSubst
itutionCache; | 187 mutable HeapHashMap<Member<const CSSPendingSubstitutionValue>, Member<HeapHa
shMap<CSSPropertyID, Member<const CSSValue>>>> m_parsedPropertiesForPendingSubst
itutionCache; |
| 194 | 188 |
| 195 }; | 189 }; |
| 196 | 190 |
| 197 } // namespace blink | 191 } // namespace blink |
| 198 | 192 |
| 199 #endif // StyleResolverState_h | 193 #endif // StyleResolverState_h |
| OLD | NEW |