| 1 | /* |
| 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. |
| 4 | * Copyright (C) 2012 Google Inc. All rights reserved. |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Library General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Library General Public License for more details. |
| 15 | * |
| 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 |
| 18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | * Boston, MA 02110-1301, USA. |
| 20 | */ |
| 21 | |
| 22 | #pragma once |
| 23 | |
| 24 | #include "CSSPropertyNames.h" |
| 25 | #include <wtf/FastMalloc.h> |
| 26 | #include <wtf/Noncopyable.h> |
| 27 | |
| 28 | namespace WebCore { |
| 29 | |
| 30 | class Animation; |
| 31 | class CSSValue; |
| 32 | class FillLayer; |
| 33 | class LengthBox; |
| 34 | class NinePieceImage; |
| 35 | class RenderStyle; |
| 36 | class StyleImage; |
| 37 | class StyleResolver; |
| 38 | |
| 39 | class CSSToStyleMap { |
| 40 | WTF_MAKE_NONCOPYABLE(CSSToStyleMap); |
| 41 | WTF_MAKE_FAST_ALLOCATED; |
| 42 | |
| 43 | public: |
| 44 | CSSToStyleMap(StyleResolver*); |
| 45 | |
| 46 | void mapFillAttachment(CSSPropertyID, FillLayer&, const CSSValue&); |
| 47 | void mapFillClip(CSSPropertyID, FillLayer&, const CSSValue&); |
| 48 | void mapFillComposite(CSSPropertyID, FillLayer&, const CSSValue&); |
| 49 | void mapFillBlendMode(CSSPropertyID, FillLayer&, const CSSValue&); |
| 50 | void mapFillOrigin(CSSPropertyID, FillLayer&, const CSSValue&); |
| 51 | void mapFillImage(CSSPropertyID, FillLayer&, CSSValue&); |
| 52 | void mapFillRepeatX(CSSPropertyID, FillLayer&, const CSSValue&); |
| 53 | void mapFillRepeatY(CSSPropertyID, FillLayer&, const CSSValue&); |
| 54 | void mapFillSize(CSSPropertyID, FillLayer&, const CSSValue&); |
| 55 | void mapFillXPosition(CSSPropertyID, FillLayer&, const CSSValue&); |
| 56 | void mapFillYPosition(CSSPropertyID, FillLayer&, const CSSValue&); |
| 57 | void mapFillMaskSourceType(CSSPropertyID, FillLayer&, const CSSValue&); |
| 58 | |
| 59 | void mapAnimationDelay(Animation&, const CSSValue&); |
| 60 | void mapAnimationDirection(Animation&, const CSSValue&); |
| 61 | void mapAnimationDuration(Animation&, const CSSValue&); |
| 62 | void mapAnimationFillMode(Animation&, const CSSValue&); |
| 63 | void mapAnimationIterationCount(Animation&, const CSSValue&); |
| 64 | void mapAnimationName(Animation&, const CSSValue&); |
| 65 | void mapAnimationPlayState(Animation&, const CSSValue&); |
| 66 | void mapAnimationProperty(Animation&, const CSSValue&); |
| 67 | void mapAnimationTimingFunction(Animation&, const CSSValue&); |
| 68 | |
| 69 | void mapNinePieceImage(CSSPropertyID, CSSValue*, NinePieceImage&); |
| 70 | void mapNinePieceImageSlice(CSSValue&, NinePieceImage&); |
| 71 | LengthBox mapNinePieceImageQuad(CSSValue&); |
| 72 | void mapNinePieceImageRepeat(CSSValue&, NinePieceImage&); |
| 73 | |
| 74 | private: |
| 75 | // FIXME: These accessors should be replaced by a ResolveState object |
| 76 | // similar to how PaintInfo/LayoutState cache values needed for |
| 77 | // the current paint/layout. |
| 78 | RenderStyle* style() const; |
| 79 | const RenderStyle* rootElementStyle() const; |
| 80 | bool useSVGZoomRules() const; |
| 81 | |
| 82 | // FIXME: This should be part of some sort of StyleImageCache object which |
| 83 | // is held by the StyleResolver, and likely provided to this object |
| 84 | // during the resolve. |
| 85 | RefPtr<StyleImage> styleImage(CSSValue&); |
| 86 | |
| 87 | StyleResolver* m_resolver; |
| 88 | }; |
| 89 | |
| 90 | } // namespace WebCore |
| 91 | |