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 * Copyright (C) 2012 Google Inc. All rights reserved. | 4 * Copyright (C) 2012 Google 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 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 */ | 20 */ |
21 | 21 |
22 #ifndef CSSToStyleMap_h | 22 #ifndef CSSToStyleMap_h |
23 #define CSSToStyleMap_h | 23 #define CSSToStyleMap_h |
24 | 24 |
25 #include "core/CSSPropertyNames.h" | 25 #include "core/CSSPropertyNames.h" |
26 #include "core/animation/Timing.h" | 26 #include "core/animation/Timing.h" |
27 #include "core/animation/css/CSSTransitionData.h" | 27 #include "core/animation/css/CSSTransitionData.h" |
28 #include "core/css/resolver/ElementStyleResources.h" | |
29 #include "core/rendering/style/RenderStyleConstants.h" | 28 #include "core/rendering/style/RenderStyleConstants.h" |
30 #include "platform/animation/TimingFunction.h" | 29 #include "platform/animation/TimingFunction.h" |
31 #include "wtf/Noncopyable.h" | |
32 | 30 |
33 namespace blink { | 31 namespace blink { |
34 | 32 |
35 class FillLayer; | 33 class FillLayer; |
36 class CSSToLengthConversionData; | |
37 class CSSValue; | 34 class CSSValue; |
38 class RenderStyle; | |
39 class StyleImage; | |
40 class StyleResolverState; | 35 class StyleResolverState; |
41 class NinePieceImage; | 36 class NinePieceImage; |
42 class BorderImageLengthBox; | 37 class BorderImageLengthBox; |
43 | 38 |
44 // CSSToStyleMap is a short-lived helper object which | |
45 // given the current StyleResolverState can map | |
46 // CSSValue objects into their RenderStyle equivalents. | |
47 | |
48 class CSSToStyleMap { | 39 class CSSToStyleMap { |
49 STACK_ALLOCATED(); | |
50 WTF_MAKE_NONCOPYABLE(CSSToStyleMap); | |
51 public: | 40 public: |
52 CSSToStyleMap(const StyleResolverState& state, ElementStyleResources& elemen
tStyleResources) : m_state(state), m_elementStyleResources(elementStyleResources
) { } | 41 static void mapFillAttachment(StyleResolverState&, FillLayer*, CSSValue*); |
53 void mapFillAttachment(FillLayer*, CSSValue*) const; | 42 static void mapFillClip(StyleResolverState&, FillLayer*, CSSValue*); |
54 void mapFillClip(FillLayer*, CSSValue*) const; | 43 static void mapFillComposite(StyleResolverState&, FillLayer*, CSSValue*); |
55 void mapFillComposite(FillLayer*, CSSValue*) const; | 44 static void mapFillBlendMode(StyleResolverState&, FillLayer*, CSSValue*); |
56 void mapFillBlendMode(FillLayer*, CSSValue*) const; | 45 static void mapFillOrigin(StyleResolverState&, FillLayer*, CSSValue*); |
57 void mapFillOrigin(FillLayer*, CSSValue*) const; | 46 static void mapFillImage(StyleResolverState&, FillLayer*, CSSValue*); |
58 void mapFillImage(FillLayer*, CSSValue*); | 47 static void mapFillRepeatX(StyleResolverState&, FillLayer*, CSSValue*); |
59 void mapFillRepeatX(FillLayer*, CSSValue*) const; | 48 static void mapFillRepeatY(StyleResolverState&, FillLayer*, CSSValue*); |
60 void mapFillRepeatY(FillLayer*, CSSValue*) const; | 49 static void mapFillSize(StyleResolverState&, FillLayer*, CSSValue*); |
61 void mapFillSize(FillLayer*, CSSValue*) const; | 50 static void mapFillXPosition(StyleResolverState&, FillLayer*, CSSValue*); |
62 void mapFillXPosition(FillLayer*, CSSValue*) const; | 51 static void mapFillYPosition(StyleResolverState&, FillLayer*, CSSValue*); |
63 void mapFillYPosition(FillLayer*, CSSValue*) const; | 52 static void mapFillMaskSourceType(StyleResolverState&, FillLayer*, CSSValue*
); |
64 void mapFillMaskSourceType(FillLayer*, CSSValue*) const; | |
65 | 53 |
66 static double mapAnimationDelay(CSSValue*); | 54 static double mapAnimationDelay(CSSValue*); |
67 static Timing::PlaybackDirection mapAnimationDirection(CSSValue*); | 55 static Timing::PlaybackDirection mapAnimationDirection(CSSValue*); |
68 static double mapAnimationDuration(CSSValue*); | 56 static double mapAnimationDuration(CSSValue*); |
69 static Timing::FillMode mapAnimationFillMode(CSSValue*); | 57 static Timing::FillMode mapAnimationFillMode(CSSValue*); |
70 static double mapAnimationIterationCount(CSSValue*); | 58 static double mapAnimationIterationCount(CSSValue*); |
71 static AtomicString mapAnimationName(CSSValue*); | 59 static AtomicString mapAnimationName(CSSValue*); |
72 static EAnimPlayState mapAnimationPlayState(CSSValue*); | 60 static EAnimPlayState mapAnimationPlayState(CSSValue*); |
73 static CSSTransitionData::TransitionProperty mapAnimationProperty(CSSValue*)
; | 61 static CSSTransitionData::TransitionProperty mapAnimationProperty(CSSValue*)
; |
74 static PassRefPtr<TimingFunction> mapAnimationTimingFunction(CSSValue*, bool
allowStepMiddle = false); | 62 static PassRefPtr<TimingFunction> mapAnimationTimingFunction(CSSValue*, bool
allowStepMiddle = false); |
75 | 63 |
76 void mapNinePieceImage(RenderStyle* mutableStyle, CSSPropertyID, CSSValue*,
NinePieceImage&); | 64 static void mapNinePieceImage(StyleResolverState&, CSSPropertyID, CSSValue*,
NinePieceImage&); |
77 void mapNinePieceImageSlice(CSSValue*, NinePieceImage&) const; | 65 static void mapNinePieceImageSlice(StyleResolverState&, CSSValue*, NinePiece
Image&); |
78 BorderImageLengthBox mapNinePieceImageQuad(CSSValue*) const; | 66 static BorderImageLengthBox mapNinePieceImageQuad(StyleResolverState&, CSSVa
lue*); |
79 void mapNinePieceImageRepeat(CSSValue*, NinePieceImage&) const; | 67 static void mapNinePieceImageRepeat(StyleResolverState&, CSSValue*, NinePiec
eImage&); |
80 | |
81 private: | |
82 const CSSToLengthConversionData& cssToLengthConversionData() const; | |
83 | |
84 PassRefPtr<StyleImage> styleImage(CSSPropertyID, CSSValue*); | |
85 | |
86 // FIXME: Consider passing a StyleResolverState (or ElementResolveState) | |
87 // as an argument instead of caching it on this object. | |
88 const StyleResolverState& m_state; | |
89 ElementStyleResources& m_elementStyleResources; | |
90 }; | 68 }; |
91 | 69 |
92 } | 70 } |
93 | 71 |
94 #endif | 72 #endif |
OLD | NEW |