CSSComputedStyleDeclaration.h [plain text]
#pragma once
#include "CSSStyleDeclaration.h"
#include "RenderStyleConstants.h"
#include "SVGRenderStyleDefs.h"
#include "TextFlags.h"
#include <wtf/RefPtr.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class CSSFontStyleValue;
class CSSPrimitiveValue;
class CSSValueList;
class Color;
class Element;
class FilterOperations;
class FontSelectionValue;
class MutableStyleProperties;
class Node;
class RenderObject;
class RenderStyle;
class SVGPaint;
class ShadowData;
class StyleProperties;
class StylePropertyShorthand;
enum EUpdateLayout { DoNotUpdateLayout = false, UpdateLayout = true };
enum AdjustPixelValuesForComputedStyle { AdjustPixelValues, DoNotAdjustPixelValues };
class ComputedStyleExtractor {
public:
ComputedStyleExtractor(Node*, bool allowVisitedStyle = false, PseudoId = NOPSEUDO);
ComputedStyleExtractor(Element*, bool allowVisitedStyle = false, PseudoId = NOPSEUDO);
RefPtr<CSSValue> propertyValue(CSSPropertyID, EUpdateLayout = UpdateLayout);
String customPropertyText(const String& propertyName);
RefPtr<CSSValue> customPropertyValue(const String& propertyName);
Ref<MutableStyleProperties> copyPropertiesInSet(const CSSPropertyID* set, unsigned length);
Ref<MutableStyleProperties> copyProperties();
RefPtr<CSSPrimitiveValue> getFontSizeCSSValuePreferringKeyword();
bool useFixedFontDefaultSize();
bool propertyMatches(CSSPropertyID, const CSSValue*);
static Ref<CSSValue> valueForFilter(const RenderStyle&, const FilterOperations&, AdjustPixelValuesForComputedStyle = AdjustPixelValues);
static Ref<CSSPrimitiveValue> fontNonKeywordWeightFromStyleValue(FontSelectionValue);
static Ref<CSSPrimitiveValue> fontWeightFromStyleValue(FontSelectionValue);
static Ref<CSSPrimitiveValue> fontNonKeywordStretchFromStyleValue(FontSelectionValue);
static Ref<CSSPrimitiveValue> fontStretchFromStyleValue(FontSelectionValue);
static Ref<CSSFontStyleValue> fontNonKeywordStyleFromStyleValue(FontSelectionValue);
static Ref<CSSFontStyleValue> fontStyleFromStyleValue(FontSelectionValue, FontStyleAxis);
private:
Element* styledElement();
RefPtr<CSSValue> svgPropertyValue(CSSPropertyID, EUpdateLayout);
RefPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintType, const String& url, const Color&, const Color& currentColor) const;
static Ref<CSSValue> valueForShadow(const ShadowData*, CSSPropertyID, const RenderStyle&, AdjustPixelValuesForComputedStyle = AdjustPixelValues);
RefPtr<CSSPrimitiveValue> currentColorOrValidColor(const RenderStyle*, const Color&) const;
RefPtr<CSSValueList> getCSSPropertyValuesForShorthandProperties(const StylePropertyShorthand&);
RefPtr<CSSValueList> getCSSPropertyValuesForSidesShorthand(const StylePropertyShorthand&);
Ref<CSSValueList> getBackgroundShorthandValue();
RefPtr<CSSValueList> getCSSPropertyValuesForGridShorthand(const StylePropertyShorthand&);
RefPtr<Element> m_element;
PseudoId m_pseudoElementSpecifier;
bool m_allowVisitedStyle;
};
class CSSComputedStyleDeclaration final : public CSSStyleDeclaration {
public:
static Ref<CSSComputedStyleDeclaration> create(Element& element, bool allowVisitedStyle = false, const String& pseudoElementName = String())
{
return adoptRef(*new CSSComputedStyleDeclaration(element, allowVisitedStyle, pseudoElementName));
}
virtual ~CSSComputedStyleDeclaration();
WEBCORE_EXPORT void ref() final;
WEBCORE_EXPORT void deref() final;
String getPropertyValue(CSSPropertyID) const;
private:
WEBCORE_EXPORT CSSComputedStyleDeclaration(Element&, bool allowVisitedStyle, const String&);
CSSRule* parentRule() const final;
unsigned length() const final;
String item(unsigned index) const final;
RefPtr<DeprecatedCSSOMValue> getPropertyCSSValue(const String& propertyName) final;
String getPropertyValue(const String& propertyName) final;
String getPropertyPriority(const String& propertyName) final;
String getPropertyShorthand(const String& propertyName) final;
bool isPropertyImplicit(const String& propertyName) final;
ExceptionOr<void> setProperty(const String& propertyName, const String& value, const String& priority) final;
ExceptionOr<String> removeProperty(const String& propertyName) final;
String cssText() const final;
ExceptionOr<void> setCssText(const String&) final;
RefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID) final;
String getPropertyValueInternal(CSSPropertyID) final;
ExceptionOr<bool> setPropertyInternal(CSSPropertyID, const String& value, bool important) final;
Ref<MutableStyleProperties> copyProperties() const final;
RefPtr<CSSValue> getPropertyCSSValue(CSSPropertyID, EUpdateLayout = UpdateLayout) const;
mutable Ref<Element> m_element;
PseudoId m_pseudoElementSpecifier;
bool m_allowVisitedStyle;
unsigned m_refCount;
};
}