summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-09-10 19:10:20 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-09-10 19:10:20 +0200
commit284837daa07b29d6a63a748544a90b1f5842ac5c (patch)
treeecd258180bde91fe741e0cfd2638beb3c6da7e8e /Source/WebCore/css/CSSComputedStyleDeclaration.cpp
parent2e2ba8ff45915f40ed3e014101269c175f2a89a0 (diff)
downloadqtwebkit-284837daa07b29d6a63a748544a90b1f5842ac5c.tar.gz
Imported WebKit commit 68645295d2e3e09af2c942f092556f06aa5f8b0d (http://svn.webkit.org/repository/webkit/trunk@128073)
New snapshot
Diffstat (limited to 'Source/WebCore/css/CSSComputedStyleDeclaration.cpp')
-rw-r--r--Source/WebCore/css/CSSComputedStyleDeclaration.cpp140
1 files changed, 79 insertions, 61 deletions
diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
index 0708c23ba..ebc27aac7 100644
--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -25,7 +25,10 @@
#include "CSSComputedStyleDeclaration.h"
#include "AnimationController.h"
+#include "BasicShapeFunctions.h"
+#include "BasicShapes.h"
#include "CSSAspectRatioValue.h"
+#include "CSSBasicShapes.h"
#include "CSSBorderImage.h"
#include "CSSLineBoxContainValue.h"
#include "CSSParser.h"
@@ -46,7 +49,6 @@
#include "FontFeatureSettings.h"
#include "FontFeatureValue.h"
#include "FontValue.h"
-#include "MemoryInstrumentation.h"
#include "Pair.h"
#include "Rect.h"
#include "RenderBox.h"
@@ -56,20 +58,16 @@
#include "StyleInheritedData.h"
#include "StylePropertySet.h"
#include "StylePropertyShorthand.h"
+#include "WebCoreMemoryInstrumentation.h"
#include "WebKitCSSTransformValue.h"
#include "WebKitFontFamilyNames.h"
#include <wtf/text/StringBuilder.h>
-#if ENABLE(CSS_EXCLUSIONS)
-#include "CSSWrapShapes.h"
-#include "WrapShapeFunctions.h"
-#include "WrapShapes.h"
-#endif
-
#if ENABLE(CSS_SHADERS)
#include "CustomFilterNumberParameter.h"
#include "CustomFilterOperation.h"
#include "CustomFilterParameter.h"
+#include "CustomFilterTransformParameter.h"
#include "WebKitCSSMixFunctionValue.h"
#endif
@@ -160,6 +158,7 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyOutlineColor,
CSSPropertyOutlineStyle,
CSSPropertyOutlineWidth,
+ CSSPropertyOverflowWrap,
CSSPropertyOverflowX,
CSSPropertyOverflowY,
CSSPropertyPaddingBottom,
@@ -234,6 +233,7 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyWebkitBoxPack,
CSSPropertyWebkitBoxReflect,
CSSPropertyWebkitBoxShadow,
+ CSSPropertyWebkitClipPath,
CSSPropertyWebkitColorCorrection,
CSSPropertyWebkitColumnBreakAfter,
CSSPropertyWebkitColumnBreakBefore,
@@ -253,7 +253,6 @@ static const CSSPropertyID computedProperties[] = {
#if ENABLE(CSS_FILTERS)
CSSPropertyWebkitFilter,
#endif
-#if ENABLE(CSS3_FLEXBOX)
CSSPropertyWebkitAlignContent,
CSSPropertyWebkitAlignItems,
CSSPropertyWebkitAlignSelf,
@@ -263,7 +262,6 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyWebkitFlexDirection,
CSSPropertyWebkitFlexWrap,
CSSPropertyWebkitJustifyContent,
-#endif
CSSPropertyWebkitFontKerning,
CSSPropertyWebkitFontSmoothing,
CSSPropertyWebkitFontVariantLigatures,
@@ -305,9 +303,7 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyWebkitMaskRepeat,
CSSPropertyWebkitMaskSize,
CSSPropertyWebkitNbspMode,
-#if ENABLE(CSS3_FLEXBOX)
CSSPropertyWebkitOrder,
-#endif
#if ENABLE(OVERFLOW_SCROLLING)
CSSPropertyWebkitOverflowScrolling,
#endif
@@ -715,6 +711,45 @@ static LayoutRect sizingBox(RenderObject* renderer)
return box->style()->boxSizing() == BORDER_BOX ? box->borderBoxRect() : box->computedCSSContentBoxRect();
}
+static PassRefPtr<WebKitCSSTransformValue> matrixTransformValue(const TransformationMatrix& transform, const RenderStyle* style)
+{
+ RefPtr<WebKitCSSTransformValue> transformValue;
+ if (transform.isAffine()) {
+ transformValue = WebKitCSSTransformValue::create(WebKitCSSTransformValue::MatrixTransformOperation);
+
+ transformValue->append(cssValuePool().createValue(transform.a(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.b(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.c(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.d(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(zoomAdjustedNumberValue(transform.e(), style));
+ transformValue->append(zoomAdjustedNumberValue(transform.f(), style));
+ } else {
+ transformValue = WebKitCSSTransformValue::create(WebKitCSSTransformValue::Matrix3DTransformOperation);
+
+ transformValue->append(cssValuePool().createValue(transform.m11(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m12(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m13(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m14(), CSSPrimitiveValue::CSS_NUMBER));
+
+ transformValue->append(cssValuePool().createValue(transform.m21(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m22(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m23(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m24(), CSSPrimitiveValue::CSS_NUMBER));
+
+ transformValue->append(cssValuePool().createValue(transform.m31(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m32(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m33(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m34(), CSSPrimitiveValue::CSS_NUMBER));
+
+ transformValue->append(zoomAdjustedNumberValue(transform.m41(), style));
+ transformValue->append(zoomAdjustedNumberValue(transform.m42(), style));
+ transformValue->append(zoomAdjustedNumberValue(transform.m43(), style));
+ transformValue->append(cssValuePool().createValue(transform.m44(), CSSPrimitiveValue::CSS_NUMBER));
+ }
+
+ return transformValue.release();
+}
+
static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle* style)
{
if (!renderer || !renderer->hasTransform() || !style->hasTransform())
@@ -728,50 +763,15 @@ static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const Rend
style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin);
// Note that this does not flatten to an affine transform if ENABLE(3D_RENDERING) is off, by design.
- RefPtr<WebKitCSSTransformValue> transformVal;
-
// FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
- if (transform.isAffine()) {
- transformVal = WebKitCSSTransformValue::create(WebKitCSSTransformValue::MatrixTransformOperation);
-
- transformVal->append(cssValuePool().createValue(transform.a(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(cssValuePool().createValue(transform.b(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(cssValuePool().createValue(transform.c(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(cssValuePool().createValue(transform.d(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(zoomAdjustedNumberValue(transform.e(), style));
- transformVal->append(zoomAdjustedNumberValue(transform.f(), style));
- } else {
- transformVal = WebKitCSSTransformValue::create(WebKitCSSTransformValue::Matrix3DTransformOperation);
-
- transformVal->append(cssValuePool().createValue(transform.m11(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(cssValuePool().createValue(transform.m12(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(cssValuePool().createValue(transform.m13(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(cssValuePool().createValue(transform.m14(), CSSPrimitiveValue::CSS_NUMBER));
-
- transformVal->append(cssValuePool().createValue(transform.m21(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(cssValuePool().createValue(transform.m22(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(cssValuePool().createValue(transform.m23(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(cssValuePool().createValue(transform.m24(), CSSPrimitiveValue::CSS_NUMBER));
-
- transformVal->append(cssValuePool().createValue(transform.m31(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(cssValuePool().createValue(transform.m32(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(cssValuePool().createValue(transform.m33(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(cssValuePool().createValue(transform.m34(), CSSPrimitiveValue::CSS_NUMBER));
-
- transformVal->append(zoomAdjustedNumberValue(transform.m41(), style));
- transformVal->append(zoomAdjustedNumberValue(transform.m42(), style));
- transformVal->append(zoomAdjustedNumberValue(transform.m43(), style));
- transformVal->append(cssValuePool().createValue(transform.m44(), CSSPrimitiveValue::CSS_NUMBER));
- }
-
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- list->append(transformVal);
+ list->append(matrixTransformValue(transform, style));
return list.release();
}
#if ENABLE(CSS_SHADERS)
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForCustomFilterNumberParameter(const CustomFilterNumberParameter* numberParameter) const
+static PassRefPtr<CSSValue> valueForCustomFilterNumberParameter(const CustomFilterNumberParameter* numberParameter)
{
RefPtr<CSSValueList> numberParameterValue = CSSValueList::createSpaceSeparated();
for (unsigned i = 0; i < numberParameter->size(); ++i)
@@ -779,13 +779,24 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForCustomFilterNumberPara
return numberParameterValue.release();
}
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForCustomFilterParameter(const CustomFilterParameter* parameter) const
+static PassRefPtr<CSSValue> valueForCustomFilterTransformParameter(const RenderObject* renderer, const RenderStyle* style, const CustomFilterTransformParameter* transformParameter)
+{
+ IntSize size = renderer ? pixelSnappedIntRect(toRenderBox(renderer)->borderBoxRect()).size() : IntSize();
+ TransformationMatrix transform;
+ transformParameter->applyTransform(transform, size);
+ // FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
+ return matrixTransformValue(transform, style);
+}
+
+static PassRefPtr<CSSValue> valueForCustomFilterParameter(const RenderObject* renderer, const RenderStyle* style, const CustomFilterParameter* parameter)
{
// FIXME: Add here computed style for the other types: boolean, transform, matrix, texture.
ASSERT(parameter);
switch (parameter->parameterType()) {
case CustomFilterParameter::NUMBER:
return valueForCustomFilterNumberParameter(static_cast<const CustomFilterNumberParameter*>(parameter));
+ case CustomFilterParameter::TRANSFORM:
+ return valueForCustomFilterTransformParameter(renderer, style, static_cast<const CustomFilterTransformParameter*>(parameter));
}
ASSERT_NOT_REACHED();
@@ -794,8 +805,11 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForCustomFilterParameter(
#endif // ENABLE(CSS_SHADERS)
#if ENABLE(CSS_FILTERS)
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(RenderStyle* style) const
+PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(const RenderObject* renderer, const RenderStyle* style) const
{
+#if !ENABLE(CSS_SHADERS)
+ UNUSED_PARAM(renderer);
+#endif
if (style->filter().operations().isEmpty())
return cssValuePool().createIdentifierValue(CSSValueNone);
@@ -926,7 +940,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(RenderStyle* st
const CustomFilterParameter* parameter = parameters.at(i).get();
RefPtr<CSSValueList> parameterCSSNameAndValue = CSSValueList::createSpaceSeparated();
parameterCSSNameAndValue->append(cssValuePool().createValue(parameter->name(), CSSPrimitiveValue::CSS_STRING));
- parameterCSSNameAndValue->append(valueForCustomFilterParameter(parameter));
+ parameterCSSNameAndValue->append(valueForCustomFilterParameter(renderer, style, parameter));
parametersCSSValue->append(parameterCSSNameAndValue.release());
}
@@ -1127,7 +1141,7 @@ bool CSSComputedStyleDeclaration::useFixedFontDefaultSize() const
return style->fontDescription().useFixedDefaultSize();
}
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, CSSPropertyID propertyID, RenderStyle* style) const
+PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, CSSPropertyID propertyID, const RenderStyle* style) const
{
if (!shadow)
return cssValuePool().createIdentifierValue(CSSValueNone);
@@ -1273,8 +1287,8 @@ static PassRefPtr<CSSValue> counterToCSSValue(const RenderStyle* style, CSSPrope
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end(); ++it) {
- list->append(cssValuePool().createValue(it->first.get(), CSSPrimitiveValue::CSS_STRING));
- short number = propertyID == CSSPropertyCounterIncrement ? it->second.m_incrementValue : it->second.m_resetValue;
+ list->append(cssValuePool().createValue(it->first, CSSPrimitiveValue::CSS_STRING));
+ short number = propertyID == CSSPropertyCounterIncrement ? it->second.incrementValue() : it->second.resetValue();
list->append(cssValuePool().createValue((double)number, CSSPrimitiveValue::CSS_NUMBER));
}
return list.release();
@@ -1680,7 +1694,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
return cssValuePool().createValue(style->display());
case CSSPropertyEmptyCells:
return cssValuePool().createValue(style->emptyCells());
-#if ENABLE(CSS3_FLEXBOX)
case CSSPropertyWebkitAlignContent:
return cssValuePool().createValue(style->alignContent());
case CSSPropertyWebkitAlignItems:
@@ -1710,7 +1723,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
return cssValuePool().createValue(style->justifyContent());
case CSSPropertyWebkitOrder:
return cssValuePool().createValue(style->order(), CSSPrimitiveValue::CSS_NUMBER);
-#endif
case CSSPropertyFloat:
return cssValuePool().createValue(style->floating());
case CSSPropertyFont: {
@@ -1914,6 +1926,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
return zoomAdjustedPixelValue(style->outlineWidth(), style.get());
case CSSPropertyOverflow:
return cssValuePool().createValue(max(style->overflowX(), style->overflowY()));
+ case CSSPropertyOverflowWrap:
+ return cssValuePool().createValue(style->overflowWrap());
case CSSPropertyOverflowX:
return cssValuePool().createValue(style->overflowX());
case CSSPropertyOverflowY:
@@ -2060,7 +2074,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
case CSSPropertyWordSpacing:
return zoomAdjustedPixelValue(style->wordSpacing(), style.get());
case CSSPropertyWordWrap:
- return cssValuePool().createValue(style->wordWrap());
+ return cssValuePool().createValue(style->overflowWrap());
case CSSPropertyWebkitLineBreak:
return cssValuePool().createValue(style->khtmlLineBreak());
case CSSPropertyWebkitNbspMode:
@@ -2390,6 +2404,10 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
return counterToCSSValue(style.get(), propertyID);
case CSSPropertyCounterReset:
return counterToCSSValue(style.get(), propertyID);
+ case CSSPropertyWebkitClipPath:
+ if (!style->clipPath())
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ return valueForBasicShape(style->clipPath());
#if ENABLE(CSS_REGIONS)
case CSSPropertyWebkitFlowInto:
if (style->flowThread().isNull())
@@ -2412,17 +2430,17 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
case CSSPropertyWebkitShapeInside:
if (!style->wrapShapeInside())
return cssValuePool().createIdentifierValue(CSSValueAuto);
- return valueForWrapShape(style->wrapShapeInside());
+ return valueForBasicShape(style->wrapShapeInside());
case CSSPropertyWebkitShapeOutside:
if (!style->wrapShapeOutside())
return cssValuePool().createIdentifierValue(CSSValueAuto);
- return valueForWrapShape(style->wrapShapeOutside());
+ return valueForBasicShape(style->wrapShapeOutside());
case CSSPropertyWebkitWrapThrough:
return cssValuePool().createValue(style->wrapThrough());
#endif
#if ENABLE(CSS_FILTERS)
case CSSPropertyWebkitFilter:
- return valueForFilter(style.get());
+ return valueForFilter(renderer, style.get());
#endif
#if ENABLE(CSS_COMPOSITING)
case CSSPropertyWebkitBlendMode:
@@ -2716,7 +2734,7 @@ PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::copyPropertiesInSet(co
void CSSComputedStyleDeclaration::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
- MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
info.addInstrumentedMember(m_node);
}