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

Unified Diff: Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl

Issue 1266713003: Clean up some StyleBuilder property application code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | Source/core/css/resolver/FilterOperationResolver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
diff --git a/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl b/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
index 9e8d9ad1d90e463d49061a0c9aee00a7e6c10d1f..82db206ba9a93ecbe56116f4f7f42fbd081732cf 100644
--- a/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
+++ b/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
@@ -139,9 +139,6 @@ namespace blink {
{{declare_value_function(property_id)}}
{
- if (!value->isPrimitiveValue())
- return;
-
CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
if (primitiveValue->getValueID() == {{auto_identity}})
state.style()->{{auto_setter}}();
@@ -351,13 +348,7 @@ static bool borderImageLengthMatchesAllSides(const BorderImageLengthBox& borderI
int length = list ? list->length() : 0;
for (int i = 0; i < length; ++i) {
CSSValue* currValue = list->item(i);
- if (!currValue->isPrimitiveValue())
- continue;
-
Pair* pair = toCSSPrimitiveValue(currValue)->getPairValue();
- if (!pair || !pair->first() || !pair->second())
- continue;
-
AtomicString identifier(pair->first()->getStringValue());
int value = pair->second()->getIntValue();
CounterDirectives& directives = map.add(identifier, CounterDirectives()).storedValue->value;
@@ -474,8 +465,7 @@ static bool borderImageLengthMatchesAllSides(const BorderImageLengthBox& borderI
Vector<GridTrackSize> trackSizes;
NamedGridLinesMap namedGridLines;
OrderedNamedGridLines orderedNamedGridLines;
- if (!StyleBuilderConverter::convertGridTrackList(value, trackSizes, namedGridLines, orderedNamedGridLines, state))
- return;
+ StyleBuilderConverter::convertGridTrackList(value, trackSizes, namedGridLines, orderedNamedGridLines, state);
const NamedGridAreaMap& namedGridAreas = state.style()->namedGridArea();
if (!namedGridAreas.isEmpty())
StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea(namedGridAreas, namedGridLines, For{{type}}s);
@@ -515,38 +505,29 @@ static bool borderImageLengthMatchesAllSides(const BorderImageLengthBox& borderI
String url;
if (value->isValueList()) {
CSSValueList* list = toCSSValueList(value);
- ASSERT(list->length() > 1);
-
- if (!list->item(0)->isPrimitiveValue())
- return;
-
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(list->item(0));
- if (!primitiveValue->isURI())
- return;
-
- url = primitiveValue->getStringValue();
+ ASSERT(list->length() == 2);
+ url = toCSSPrimitiveValue(list->item(0))->getStringValue();
value = list->item(1);
}
- if (value->isPrimitiveValue()) {
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
- Color color;
- SVGPaintType paintType = SVG_PAINTTYPE_RGBCOLOR;
- if (primitiveValue->getValueID() == CSSValueNone) {
- paintType = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE;
- } else if (primitiveValue->isURI()) {
- paintType = SVG_PAINTTYPE_URI;
- url = primitiveValue->getStringValue();
- } else if (primitiveValue->getValueID() == CSSValueCurrentcolor) {
- color = state.style()->color();
- paintType = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTYPE_URI_CURRENTCOLOR;
- } else {
- color = StyleBuilderConverter::convertColor(state, primitiveValue);
- paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_RGBCOLOR;
- }
- {{set_value(property)}}(paintType, color, url,
- state.applyPropertyToRegularStyle(),
- state.applyPropertyToVisitedLinkStyle());
+
+ CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+ Color color;
+ SVGPaintType paintType = SVG_PAINTTYPE_RGBCOLOR;
+ if (primitiveValue->getValueID() == CSSValueNone) {
+ paintType = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE;
+ } else if (primitiveValue->isURI()) {
+ paintType = SVG_PAINTTYPE_URI;
+ url = primitiveValue->getStringValue();
+ } else if (primitiveValue->getValueID() == CSSValueCurrentcolor) {
+ color = state.style()->color();
+ paintType = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTYPE_URI_CURRENTCOLOR;
+ } else {
+ color = StyleBuilderConverter::convertColor(state, primitiveValue);
+ paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_RGBCOLOR;
}
+ {{set_value(property)}}(paintType, color, url,
+ state.applyPropertyToRegularStyle(),
+ state.applyPropertyToVisitedLinkStyle());
}
{% endmacro %}
{{apply_svg_paint('CSSPropertyFill', 'FillPaint')}}
« no previous file with comments | « no previous file | Source/core/css/resolver/FilterOperationResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698