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

Side by Side Diff: Source/core/css/resolver/StyleBuilderCustom.cpp

Issue 462133002: Remove custom style building functions for 'clip'. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased. Created 6 years, 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "core/css/CSSGradientValue.h" 49 #include "core/css/CSSGradientValue.h"
50 #include "core/css/CSSGridTemplateAreasValue.h" 50 #include "core/css/CSSGridTemplateAreasValue.h"
51 #include "core/css/CSSHelper.h" 51 #include "core/css/CSSHelper.h"
52 #include "core/css/CSSImageSetValue.h" 52 #include "core/css/CSSImageSetValue.h"
53 #include "core/css/CSSLineBoxContainValue.h" 53 #include "core/css/CSSLineBoxContainValue.h"
54 #include "core/css/parser/BisonCSSParser.h" 54 #include "core/css/parser/BisonCSSParser.h"
55 #include "core/css/CSSPrimitiveValueMappings.h" 55 #include "core/css/CSSPrimitiveValueMappings.h"
56 #include "core/css/CSSPropertyMetadata.h" 56 #include "core/css/CSSPropertyMetadata.h"
57 #include "core/css/Counter.h" 57 #include "core/css/Counter.h"
58 #include "core/css/Pair.h" 58 #include "core/css/Pair.h"
59 #include "core/css/Rect.h"
60 #include "core/css/StylePropertySet.h" 59 #include "core/css/StylePropertySet.h"
61 #include "core/css/StyleRule.h" 60 #include "core/css/StyleRule.h"
62 #include "core/css/resolver/ElementStyleResources.h" 61 #include "core/css/resolver/ElementStyleResources.h"
63 #include "core/css/resolver/FilterOperationResolver.h" 62 #include "core/css/resolver/FilterOperationResolver.h"
64 #include "core/css/resolver/FontBuilder.h" 63 #include "core/css/resolver/FontBuilder.h"
65 #include "core/css/resolver/StyleBuilder.h" 64 #include "core/css/resolver/StyleBuilder.h"
66 #include "core/css/resolver/TransformBuilder.h" 65 #include "core/css/resolver/TransformBuilder.h"
67 #include "core/frame/LocalFrame.h" 66 #include "core/frame/LocalFrame.h"
68 #include "core/frame/Settings.h" 67 #include "core/frame/Settings.h"
69 #include "core/rendering/style/CounterContent.h" 68 #include "core/rendering/style/CounterContent.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? toCSSPrimiti veValue(value) : 0; 123 CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? toCSSPrimiti veValue(value) : 0;
125 if (primitiveValue && primitiveValue->getValueID() == CSSValueCurrentcolor) 124 if (primitiveValue && primitiveValue->getValueID() == CSSValueCurrentcolor)
126 state.style()->setHasCurrentColor(); 125 state.style()->setHasCurrentColor();
127 126
128 if (isInherit && !state.parentStyle()->hasExplicitlyInheritedProperties() && !CSSPropertyMetadata::isInheritedProperty(id)) 127 if (isInherit && !state.parentStyle()->hasExplicitlyInheritedProperties() && !CSSPropertyMetadata::isInheritedProperty(id))
129 state.parentStyle()->setHasExplicitlyInheritedProperties(); 128 state.parentStyle()->setHasExplicitlyInheritedProperties();
130 129
131 StyleBuilder::applyProperty(id, state, value, isInitial, isInherit); 130 StyleBuilder::applyProperty(id, state, value, isInitial, isInherit);
132 } 131 }
133 132
134 static Length clipConvertToLength(StyleResolverState& state, CSSPrimitiveValue* value)
135 {
136 return value->convertToLength<FixedConversion | PercentConversion | AutoConv ersion>(state.cssToLengthConversionData());
137 }
138
139 void StyleBuilderFunctions::applyInitialCSSPropertyClip(StyleResolverState& stat e)
140 {
141 state.style()->setClip(Length(), Length(), Length(), Length());
142 state.style()->setHasClip(false);
143 }
144
145 void StyleBuilderFunctions::applyInheritCSSPropertyClip(StyleResolverState& stat e)
146 {
147 RenderStyle* parentStyle = state.parentStyle();
148 if (!parentStyle->hasClip())
149 return applyInitialCSSPropertyClip(state);
150 state.style()->setClip(parentStyle->clipTop(), parentStyle->clipRight(), par entStyle->clipBottom(), parentStyle->clipLeft());
151 state.style()->setHasClip(true);
152 }
153
154 void StyleBuilderFunctions::applyValueCSSPropertyClip(StyleResolverState& state, CSSValue* value)
155 {
156 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
157
158 if (primitiveValue->getValueID() == CSSValueAuto) {
159 state.style()->setClip(Length(), Length(), Length(), Length());
160 state.style()->setHasClip(false);
161 return;
162 }
163
164 Rect* rect = primitiveValue->getRectValue();
165 Length top = clipConvertToLength(state, rect->top());
166 Length right = clipConvertToLength(state, rect->right());
167 Length bottom = clipConvertToLength(state, rect->bottom());
168 Length left = clipConvertToLength(state, rect->left());
169 state.style()->setClip(top, right, bottom, left);
170 state.style()->setHasClip(true);
171 }
172
173 void StyleBuilderFunctions::applyInitialCSSPropertyColor(StyleResolverState& sta te) 133 void StyleBuilderFunctions::applyInitialCSSPropertyColor(StyleResolverState& sta te)
174 { 134 {
175 Color color = RenderStyle::initialColor(); 135 Color color = RenderStyle::initialColor();
176 if (state.applyPropertyToRegularStyle()) 136 if (state.applyPropertyToRegularStyle())
177 state.style()->setColor(color); 137 state.style()->setColor(color);
178 if (state.applyPropertyToVisitedLinkStyle()) 138 if (state.applyPropertyToVisitedLinkStyle())
179 state.style()->setVisitedLinkColor(color); 139 state.style()->setVisitedLinkColor(color);
180 } 140 }
181 141
182 void StyleBuilderFunctions::applyInheritCSSPropertyColor(StyleResolverState& sta te) 142 void StyleBuilderFunctions::applyInheritCSSPropertyColor(StyleResolverState& sta te)
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 break; 1241 break;
1282 default: 1242 default:
1283 ASSERT_NOT_REACHED(); 1243 ASSERT_NOT_REACHED();
1284 break; 1244 break;
1285 } 1245 }
1286 1246
1287 state.style()->setGridAutoFlow(autoFlow); 1247 state.style()->setGridAutoFlow(autoFlow);
1288 } 1248 }
1289 1249
1290 } // namespace blink 1250 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.cpp ('k') | Source/core/rendering/RenderLayerModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698