CSSToStyleMap.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #ifndef CSSToStyleMap_h
  22. #define CSSToStyleMap_h
  23. #include "CSSPropertyNames.h"
  24. #include "LengthBox.h"
  25. namespace WebCore {
  26. class FillLayer;
  27. class CSSValue;
  28. class Animation;
  29. class RenderStyle;
  30. class StyleImage;
  31. class StyleResolver;
  32. class NinePieceImage;
  33. class CSSToStyleMap {
  34. WTF_MAKE_NONCOPYABLE(CSSToStyleMap);
  35. WTF_MAKE_FAST_ALLOCATED;
  36. public:
  37. CSSToStyleMap(StyleResolver* resolver) : m_resolver(resolver) { }
  38. void mapFillAttachment(CSSPropertyID, FillLayer*, CSSValue*);
  39. void mapFillClip(CSSPropertyID, FillLayer*, CSSValue*);
  40. void mapFillComposite(CSSPropertyID, FillLayer*, CSSValue*);
  41. void mapFillBlendMode(CSSPropertyID, FillLayer*, CSSValue*);
  42. void mapFillOrigin(CSSPropertyID, FillLayer*, CSSValue*);
  43. void mapFillImage(CSSPropertyID, FillLayer*, CSSValue*);
  44. void mapFillRepeatX(CSSPropertyID, FillLayer*, CSSValue*);
  45. void mapFillRepeatY(CSSPropertyID, FillLayer*, CSSValue*);
  46. void mapFillSize(CSSPropertyID, FillLayer*, CSSValue*);
  47. void mapFillXPosition(CSSPropertyID, FillLayer*, CSSValue*);
  48. void mapFillYPosition(CSSPropertyID, FillLayer*, CSSValue*);
  49. void mapAnimationDelay(Animation*, CSSValue*);
  50. void mapAnimationDirection(Animation*, CSSValue*);
  51. void mapAnimationDuration(Animation*, CSSValue*);
  52. void mapAnimationFillMode(Animation*, CSSValue*);
  53. void mapAnimationIterationCount(Animation*, CSSValue*);
  54. void mapAnimationName(Animation*, CSSValue*);
  55. void mapAnimationPlayState(Animation*, CSSValue*);
  56. void mapAnimationProperty(Animation*, CSSValue*);
  57. void mapAnimationTimingFunction(Animation*, CSSValue*);
  58. void mapNinePieceImage(CSSPropertyID, CSSValue*, NinePieceImage&);
  59. void mapNinePieceImageSlice(CSSValue*, NinePieceImage&);
  60. LengthBox mapNinePieceImageQuad(CSSValue*);
  61. void mapNinePieceImageRepeat(CSSValue*, NinePieceImage&);
  62. private:
  63. // FIXME: These accessors should be replaced by a ResolveState object
  64. // similar to how PaintInfo/LayoutState cache values needed for
  65. // the current paint/layout.
  66. RenderStyle* style() const;
  67. RenderStyle* rootElementStyle() const;
  68. bool useSVGZoomRules() const;
  69. // FIXME: This should be part of some sort of StyleImageCache object which
  70. // is held by the StyleResolver, and likely provided to this object
  71. // during the resolve.
  72. PassRefPtr<StyleImage> styleImage(CSSPropertyID, CSSValue*);
  73. StyleResolver* m_resolver;
  74. };
  75. }
  76. #endif