Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Unified Diff: Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 645073003: Move special code for 'shape-outside' out of StyleBuilderFunctions.cpp.tmpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/StyleBuilderConverter.cpp
diff --git a/Source/core/css/resolver/StyleBuilderConverter.cpp b/Source/core/css/resolver/StyleBuilderConverter.cpp
index 4ffe88db3b55529bdcd101c287699562f702ea21..f05caa85c793992c5f82f209694246d4fcd686e1 100644
--- a/Source/core/css/resolver/StyleBuilderConverter.cpp
+++ b/Source/core/css/resolver/StyleBuilderConverter.cpp
@@ -27,6 +27,7 @@
#include "config.h"
#include "core/css/resolver/StyleBuilderConverter.h"
+#include "core/css/BasicShapeFunctions.h"
#include "core/css/CSSFontFeatureValue.h"
#include "core/css/CSSFunctionValue.h"
#include "core/css/CSSGridLineNamesValue.h"
@@ -718,6 +719,36 @@ PassRefPtr<ShadowList> StyleBuilderConverter::convertShadow(StyleResolverState&
return ShadowList::adopt(shadows);
}
+PassRefPtr<ShapeValue> StyleBuilderConverter::convertShapeValue(StyleResolverState& state, CSSValue* value)
+{
+ if (value->isPrimitiveValue()) {
+ ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone);
+ return nullptr;
+ }
+
+ if (value->isImageValue() || value->isImageGeneratorValue() || value->isImageSetValue())
+ return ShapeValue::createImageValue(state.styleImage(CSSPropertyShapeOutside, value));
+
+ ASSERT(value->isValueList());
Timothy Loh 2014/10/20 12:29:57 I wouldn't bother with this since toCSSValueList c
+
+ RefPtr<BasicShape> shape;
+ CSSBoxType cssBox = BoxMissing;
+ CSSValueList* valueList = toCSSValueList(value);
+ for (unsigned i = 0; i < valueList->length(); ++i) {
+ CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->item(i));
+ if (primitiveValue->isShape())
+ shape = basicShapeForValue(state, primitiveValue->getShapeValue());
+ else
+ cssBox = CSSBoxType(*primitiveValue);
+ }
+
+ if (shape)
+ return ShapeValue::createShapeValue(shape.release(), cssBox);
+ if (cssBox != BoxMissing)
+ return ShapeValue::createBoxShapeValue(cssBox);
+ return nullptr;
Timothy Loh 2014/10/20 12:29:57 I think we never reach this?
andersr 2014/10/20 12:36:03 Can the parser deliver an empty CSSValueList?
+}
+
float StyleBuilderConverter::convertSpacing(StyleResolverState& state, CSSValue* value)
{
CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698