The Android Open Source Project | 8e35f3c | 2009-03-03 19:30:52 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2004 Zack Rusin <zack@kde.org> |
| 3 | * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 18 | * 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #ifndef CSSComputedStyleDeclaration_h |
| 22 | #define CSSComputedStyleDeclaration_h |
| 23 | |
| 24 | #include "CSSStyleDeclaration.h" |
Steve Block | 54cdeee | 2011-06-10 16:52:27 +0100 | [diff] [blame] | 25 | #include "PlatformString.h" |
Steve Block | dcc8cf2 | 2010-04-27 16:31:00 +0100 | [diff] [blame] | 26 | #include "RenderStyleConstants.h" |
Leon Clarke | e458d70 | 2010-07-15 12:03:35 +0100 | [diff] [blame] | 27 | #include <wtf/RefPtr.h> |
The Android Open Source Project | 8e35f3c | 2009-03-03 19:30:52 -0800 | [diff] [blame] | 28 | |
| 29 | namespace WebCore { |
| 30 | |
Steve Block | e78cbe8 | 2010-05-26 10:11:43 +0100 | [diff] [blame] | 31 | class Color; |
The Android Open Source Project | 8e35f3c | 2009-03-03 19:30:52 -0800 | [diff] [blame] | 32 | class CSSMutableStyleDeclaration; |
Steve Block | e78cbe8 | 2010-05-26 10:11:43 +0100 | [diff] [blame] | 33 | class CSSPrimitiveValue; |
Leon Clarke | e458d70 | 2010-07-15 12:03:35 +0100 | [diff] [blame] | 34 | class Node; |
| 35 | class RenderStyle; |
Steve Block | cac0f67 | 2009-11-05 09:23:40 +0000 | [diff] [blame] | 36 | class ShadowData; |
The Android Open Source Project | 8e35f3c | 2009-03-03 19:30:52 -0800 | [diff] [blame] | 37 | |
| 38 | enum EUpdateLayout { DoNotUpdateLayout = false, UpdateLayout = true }; |
| 39 | |
| 40 | class CSSComputedStyleDeclaration : public CSSStyleDeclaration { |
| 41 | public: |
Steve Block | dcc8cf2 | 2010-04-27 16:31:00 +0100 | [diff] [blame] | 42 | friend PassRefPtr<CSSComputedStyleDeclaration> computedStyle(PassRefPtr<Node>, bool allowVisitedStyle, const String& pseudoElementName); |
The Android Open Source Project | 8e35f3c | 2009-03-03 19:30:52 -0800 | [diff] [blame] | 43 | virtual ~CSSComputedStyleDeclaration(); |
| 44 | |
| 45 | virtual String cssText() const; |
| 46 | |
Ben Murdoch | 21939df | 2010-05-11 18:35:50 +0100 | [diff] [blame] | 47 | virtual unsigned virtualLength() const; |
The Android Open Source Project | 8e35f3c | 2009-03-03 19:30:52 -0800 | [diff] [blame] | 48 | virtual String item(unsigned index) const; |
| 49 | |
| 50 | virtual PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const; |
| 51 | virtual String getPropertyValue(int propertyID) const; |
| 52 | virtual bool getPropertyPriority(int propertyID) const; |
The Android Open Source Project | 6358608 | 2009-03-05 14:34:32 -0800 | [diff] [blame] | 53 | virtual int getPropertyShorthand(int /*propertyID*/) const { return -1; } |
| 54 | virtual bool isPropertyImplicit(int /*propertyID*/) const { return false; } |
The Android Open Source Project | 8e35f3c | 2009-03-03 19:30:52 -0800 | [diff] [blame] | 55 | |
| 56 | virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const; |
| 57 | virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable(); |
| 58 | |
| 59 | PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID, EUpdateLayout) const; |
Feng Qian | 5f1ab04 | 2009-06-17 12:12:20 -0700 | [diff] [blame] | 60 | PassRefPtr<CSSValue> getFontSizeCSSValuePreferringKeyword() const; |
Iain Merrick | 5abb860 | 2010-09-13 16:35:48 +0100 | [diff] [blame] | 61 | bool useFixedFontDefaultSize() const; |
The Android Open Source Project | 8e35f3c | 2009-03-03 19:30:52 -0800 | [diff] [blame] | 62 | #if ENABLE(SVG) |
| 63 | PassRefPtr<CSSValue> getSVGPropertyCSSValue(int propertyID, EUpdateLayout) const; |
| 64 | #endif |
| 65 | |
Ben Murdoch | 0bf48ef | 2009-08-11 17:01:47 +0100 | [diff] [blame] | 66 | protected: |
| 67 | virtual bool cssPropertyMatches(const CSSProperty*) const; |
The Android Open Source Project | 8e35f3c | 2009-03-03 19:30:52 -0800 | [diff] [blame] | 68 | |
| 69 | private: |
Steve Block | dcc8cf2 | 2010-04-27 16:31:00 +0100 | [diff] [blame] | 70 | CSSComputedStyleDeclaration(PassRefPtr<Node>, bool allowVisitedStyle, const String&); |
The Android Open Source Project | 8e35f3c | 2009-03-03 19:30:52 -0800 | [diff] [blame] | 71 | |
| 72 | virtual void setCssText(const String&, ExceptionCode&); |
| 73 | |
| 74 | virtual String removeProperty(int propertyID, ExceptionCode&); |
| 75 | virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&); |
| 76 | |
Steve Block | 68513a7 | 2010-09-29 17:32:26 +0100 | [diff] [blame] | 77 | PassRefPtr<CSSValue> valueForShadow(const ShadowData*, int, RenderStyle*) const; |
Steve Block | e78cbe8 | 2010-05-26 10:11:43 +0100 | [diff] [blame] | 78 | PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle*, const Color&) const; |
Steve Block | 54cdeee | 2011-06-10 16:52:27 +0100 | [diff] [blame] | 79 | |
The Android Open Source Project | 8e35f3c | 2009-03-03 19:30:52 -0800 | [diff] [blame] | 80 | RefPtr<Node> m_node; |
Steve Block | dcc8cf2 | 2010-04-27 16:31:00 +0100 | [diff] [blame] | 81 | PseudoId m_pseudoElementSpecifier; |
| 82 | bool m_allowVisitedStyle; |
The Android Open Source Project | 8e35f3c | 2009-03-03 19:30:52 -0800 | [diff] [blame] | 83 | }; |
| 84 | |
Steve Block | dcc8cf2 | 2010-04-27 16:31:00 +0100 | [diff] [blame] | 85 | inline PassRefPtr<CSSComputedStyleDeclaration> computedStyle(PassRefPtr<Node> node, bool allowVisitedStyle = false, const String& pseudoElementName = String()) |
The Android Open Source Project | 8e35f3c | 2009-03-03 19:30:52 -0800 | [diff] [blame] | 86 | { |
Steve Block | dcc8cf2 | 2010-04-27 16:31:00 +0100 | [diff] [blame] | 87 | return adoptRef(new CSSComputedStyleDeclaration(node, allowVisitedStyle, pseudoElementName)); |
The Android Open Source Project | 8e35f3c | 2009-03-03 19:30:52 -0800 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | } // namespace WebCore |
| 91 | |
| 92 | #endif // CSSComputedStyleDeclaration_h |