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

Side by Side Diff: sky/engine/core/css/resolver/CSSToStyleMap.cpp

Issue 1229273004: Remove Animations and Transitions. (Closed) Base URL: https://github.com/domokit/mojo.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 10 matching lines...) Expand all
21 * 21 *
22 * You should have received a copy of the GNU Library General Public License 22 * You should have received a copy of the GNU Library General Public License
23 * along with this library; see the file COPYING.LIB. If not, write to 23 * along with this library; see the file COPYING.LIB. If not, write to
24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 * Boston, MA 02110-1301, USA. 25 * Boston, MA 02110-1301, USA.
26 */ 26 */
27 27
28 #include "sky/engine/core/css/resolver/CSSToStyleMap.h" 28 #include "sky/engine/core/css/resolver/CSSToStyleMap.h"
29 29
30 #include "gen/sky/core/CSSValueKeywords.h" 30 #include "gen/sky/core/CSSValueKeywords.h"
31 #include "sky/engine/core/animation/css/CSSAnimationData.h"
32 #include "sky/engine/core/css/CSSBorderImageSliceValue.h" 31 #include "sky/engine/core/css/CSSBorderImageSliceValue.h"
33 #include "sky/engine/core/css/CSSPrimitiveValue.h" 32 #include "sky/engine/core/css/CSSPrimitiveValue.h"
34 #include "sky/engine/core/css/CSSPrimitiveValueMappings.h" 33 #include "sky/engine/core/css/CSSPrimitiveValueMappings.h"
35 #include "sky/engine/core/css/CSSTimingFunctionValue.h"
36 #include "sky/engine/core/css/Pair.h" 34 #include "sky/engine/core/css/Pair.h"
37 #include "sky/engine/core/css/Rect.h" 35 #include "sky/engine/core/css/Rect.h"
38 #include "sky/engine/core/css/resolver/StyleResolverState.h" 36 #include "sky/engine/core/css/resolver/StyleResolverState.h"
39 #include "sky/engine/core/rendering/style/BorderImageLengthBox.h" 37 #include "sky/engine/core/rendering/style/BorderImageLengthBox.h"
40 #include "sky/engine/core/rendering/style/FillLayer.h" 38 #include "sky/engine/core/rendering/style/FillLayer.h"
41 39
42 namespace blink { 40 namespace blink {
43 41
44 const CSSToLengthConversionData& CSSToStyleMap::cssToLengthConversionData() cons t 42 const CSSToLengthConversionData& CSSToStyleMap::cssToLengthConversionData() cons t
45 { 43 {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 if (pair) 246 if (pair)
249 primitiveValue = pair->second(); 247 primitiveValue = pair->second();
250 248
251 Length length = primitiveValue->convertToLength<FixedConversion | PercentCon version>(cssToLengthConversionData()); 249 Length length = primitiveValue->convertToLength<FixedConversion | PercentCon version>(cssToLengthConversionData());
252 250
253 layer->setYPosition(length); 251 layer->setYPosition(length);
254 if (pair) 252 if (pair)
255 layer->setBackgroundYOrigin(*(pair->first())); 253 layer->setBackgroundYOrigin(*(pair->first()));
256 } 254 }
257 255
258 double CSSToStyleMap::mapAnimationDelay(CSSValue* value)
259 {
260 if (value->isInitialValue())
261 return CSSTimingData::initialDelay();
262 return toCSSPrimitiveValue(value)->computeSeconds();
263 }
264
265 Timing::PlaybackDirection CSSToStyleMap::mapAnimationDirection(CSSValue* value)
266 {
267 if (value->isInitialValue())
268 return CSSAnimationData::initialDirection();
269
270 switch (toCSSPrimitiveValue(value)->getValueID()) {
271 case CSSValueNormal:
272 return Timing::PlaybackDirectionNormal;
273 case CSSValueAlternate:
274 return Timing::PlaybackDirectionAlternate;
275 case CSSValueReverse:
276 return Timing::PlaybackDirectionReverse;
277 case CSSValueAlternateReverse:
278 return Timing::PlaybackDirectionAlternateReverse;
279 default:
280 ASSERT_NOT_REACHED();
281 return CSSAnimationData::initialDirection();
282 }
283 }
284
285 double CSSToStyleMap::mapAnimationDuration(CSSValue* value)
286 {
287 if (value->isInitialValue())
288 return CSSTimingData::initialDuration();
289 return toCSSPrimitiveValue(value)->computeSeconds();
290 }
291
292 Timing::FillMode CSSToStyleMap::mapAnimationFillMode(CSSValue* value)
293 {
294 if (value->isInitialValue())
295 return CSSAnimationData::initialFillMode();
296
297 switch (toCSSPrimitiveValue(value)->getValueID()) {
298 case CSSValueNone:
299 return Timing::FillModeNone;
300 case CSSValueForwards:
301 return Timing::FillModeForwards;
302 case CSSValueBackwards:
303 return Timing::FillModeBackwards;
304 case CSSValueBoth:
305 return Timing::FillModeBoth;
306 default:
307 ASSERT_NOT_REACHED();
308 return CSSAnimationData::initialFillMode();
309 }
310 }
311
312 double CSSToStyleMap::mapAnimationIterationCount(CSSValue* value)
313 {
314 if (value->isInitialValue())
315 return CSSAnimationData::initialIterationCount();
316 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
317 if (primitiveValue->getValueID() == CSSValueInfinite)
318 return std::numeric_limits<double>::infinity();
319 return primitiveValue->getFloatValue();
320 }
321
322 AtomicString CSSToStyleMap::mapAnimationName(CSSValue* value)
323 {
324 if (value->isInitialValue())
325 return CSSAnimationData::initialName();
326 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
327 if (primitiveValue->getValueID() == CSSValueNone)
328 return CSSAnimationData::initialName();
329 return AtomicString(primitiveValue->getStringValue());
330 }
331
332 EAnimPlayState CSSToStyleMap::mapAnimationPlayState(CSSValue* value)
333 {
334 if (value->isInitialValue())
335 return CSSAnimationData::initialPlayState();
336 if (toCSSPrimitiveValue(value)->getValueID() == CSSValuePaused)
337 return AnimPlayStatePaused;
338 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueRunning);
339 return AnimPlayStatePlaying;
340 }
341
342 CSSTransitionData::TransitionProperty CSSToStyleMap::mapAnimationProperty(CSSVal ue* value)
343 {
344 if (value->isInitialValue())
345 return CSSTransitionData::initialProperty();
346 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
347 if (primitiveValue->isString())
348 return CSSTransitionData::TransitionProperty(primitiveValue->getStringVa lue());
349 if (primitiveValue->getValueID() == CSSValueAll)
350 return CSSTransitionData::TransitionProperty(CSSTransitionData::Transiti onAll);
351 if (primitiveValue->getValueID() == CSSValueNone)
352 return CSSTransitionData::TransitionProperty(CSSTransitionData::Transiti onNone);
353 return CSSTransitionData::TransitionProperty(primitiveValue->getPropertyID() );
354 }
355
356 PassRefPtr<TimingFunction> CSSToStyleMap::mapAnimationTimingFunction(CSSValue* v alue, bool allowStepMiddle)
357 {
358 // FIXME: We should probably only call into this function with a valid
359 // single timing function value which isn't initial or inherit. We can
360 // currently get into here with initial since the parser expands unset
361 // properties in shorthands to initial.
362
363 if (value->isPrimitiveValue()) {
364 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
365 switch (primitiveValue->getValueID()) {
366 case CSSValueLinear:
367 return LinearTimingFunction::shared();
368 case CSSValueEase:
369 return CubicBezierTimingFunction::preset(CubicBezierTimingFunction:: Ease);
370 case CSSValueEaseIn:
371 return CubicBezierTimingFunction::preset(CubicBezierTimingFunction:: EaseIn);
372 case CSSValueEaseOut:
373 return CubicBezierTimingFunction::preset(CubicBezierTimingFunction:: EaseOut);
374 case CSSValueEaseInOut:
375 return CubicBezierTimingFunction::preset(CubicBezierTimingFunction:: EaseInOut);
376 case CSSValueStepStart:
377 return StepsTimingFunction::preset(StepsTimingFunction::Start);
378 case CSSValueStepMiddle:
379 if (allowStepMiddle)
380 return StepsTimingFunction::preset(StepsTimingFunction::Middle);
381 return CSSTimingData::initialTimingFunction();
382 case CSSValueStepEnd:
383 return StepsTimingFunction::preset(StepsTimingFunction::End);
384 default:
385 ASSERT_NOT_REACHED();
386 return CSSTimingData::initialTimingFunction();
387 }
388 }
389
390 if (value->isCubicBezierTimingFunctionValue()) {
391 CSSCubicBezierTimingFunctionValue* cubicTimingFunction = toCSSCubicBezie rTimingFunctionValue(value);
392 return CubicBezierTimingFunction::create(cubicTimingFunction->x1(), cubi cTimingFunction->y1(), cubicTimingFunction->x2(), cubicTimingFunction->y2());
393 }
394
395 if (value->isInitialValue())
396 return CSSTimingData::initialTimingFunction();
397
398 CSSStepsTimingFunctionValue* stepsTimingFunction = toCSSStepsTimingFunctionV alue(value);
399 if (stepsTimingFunction->stepAtPosition() == StepsTimingFunction::StepAtMidd le && !allowStepMiddle)
400 return CSSTimingData::initialTimingFunction();
401 return StepsTimingFunction::create(stepsTimingFunction->numberOfSteps(), ste psTimingFunction->stepAtPosition());
402 }
403
404 void CSSToStyleMap::mapNinePieceImage(RenderStyle* mutableStyle, CSSPropertyID p roperty, CSSValue* value, NinePieceImage& image) 256 void CSSToStyleMap::mapNinePieceImage(RenderStyle* mutableStyle, CSSPropertyID p roperty, CSSValue* value, NinePieceImage& image)
405 { 257 {
406 // If we're not a value list, then we are "none" and don't need to alter the empty image at all. 258 // If we're not a value list, then we are "none" and don't need to alter the empty image at all.
407 if (!value || !value->isValueList()) 259 if (!value || !value->isValueList())
408 return; 260 return;
409 261
410 // Retrieve the border image value. 262 // Retrieve the border image value.
411 CSSValueList* borderImage = toCSSValueList(value); 263 CSSValueList* borderImage = toCSSValueList(value);
412 264
413 // Set the image (this kicks off the load). 265 // Set the image (this kicks off the load).
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 verticalRule = SpaceImageRule; 412 verticalRule = SpaceImageRule;
561 break; 413 break;
562 default: // CSSValueRepeat 414 default: // CSSValueRepeat
563 verticalRule = RepeatImageRule; 415 verticalRule = RepeatImageRule;
564 break; 416 break;
565 } 417 }
566 image.setVerticalRule(verticalRule); 418 image.setVerticalRule(verticalRule);
567 } 419 }
568 420
569 }; 421 };
OLDNEW
« no previous file with comments | « sky/engine/core/css/resolver/CSSToStyleMap.h ('k') | sky/engine/core/css/resolver/SharedStyleFinder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698