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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/CSSToStyleMap.cpp

Issue 1306823004: Split out String, URI and CustomIdent from CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@split_out_attr_values
Patch Set: Rebase Created 5 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 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 13 matching lines...) Expand all
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 "config.h" 28 #include "config.h"
29 #include "core/css/resolver/CSSToStyleMap.h" 29 #include "core/css/resolver/CSSToStyleMap.h"
30 30
31 #include "core/CSSValueKeywords.h" 31 #include "core/CSSValueKeywords.h"
32 #include "core/animation/css/CSSAnimationData.h" 32 #include "core/animation/css/CSSAnimationData.h"
33 #include "core/css/CSSBorderImageSliceValue.h" 33 #include "core/css/CSSBorderImageSliceValue.h"
34 #include "core/css/CSSCustomIdentValue.h"
34 #include "core/css/CSSPrimitiveValue.h" 35 #include "core/css/CSSPrimitiveValue.h"
35 #include "core/css/CSSPrimitiveValueMappings.h" 36 #include "core/css/CSSPrimitiveValueMappings.h"
36 #include "core/css/CSSQuadValue.h" 37 #include "core/css/CSSQuadValue.h"
37 #include "core/css/CSSTimingFunctionValue.h" 38 #include "core/css/CSSTimingFunctionValue.h"
38 #include "core/css/CSSValuePair.h" 39 #include "core/css/CSSValuePair.h"
39 #include "core/css/resolver/StyleBuilderConverter.h" 40 #include "core/css/resolver/StyleBuilderConverter.h"
40 #include "core/css/resolver/StyleResolverState.h" 41 #include "core/css/resolver/StyleResolverState.h"
41 #include "core/style/BorderImageLengthBox.h" 42 #include "core/style/BorderImageLengthBox.h"
42 #include "core/style/FillLayer.h" 43 #include "core/style/FillLayer.h"
43 44
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 341 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
341 if (primitiveValue->getValueID() == CSSValueInfinite) 342 if (primitiveValue->getValueID() == CSSValueInfinite)
342 return std::numeric_limits<double>::infinity(); 343 return std::numeric_limits<double>::infinity();
343 return primitiveValue->getFloatValue(); 344 return primitiveValue->getFloatValue();
344 } 345 }
345 346
346 AtomicString CSSToStyleMap::mapAnimationName(CSSValue* value) 347 AtomicString CSSToStyleMap::mapAnimationName(CSSValue* value)
347 { 348 {
348 if (value->isInitialValue()) 349 if (value->isInitialValue())
349 return CSSAnimationData::initialName(); 350 return CSSAnimationData::initialName();
350 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 351 if (value->isCustomIdentValue())
351 if (primitiveValue->getValueID() == CSSValueNone) 352 return AtomicString(toCSSCustomIdentValue(value)->value());
352 return CSSAnimationData::initialName(); 353 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone);
353 return AtomicString(primitiveValue->getStringValue()); 354 return CSSAnimationData::initialName();
354 } 355 }
355 356
356 EAnimPlayState CSSToStyleMap::mapAnimationPlayState(CSSValue* value) 357 EAnimPlayState CSSToStyleMap::mapAnimationPlayState(CSSValue* value)
357 { 358 {
358 if (value->isInitialValue()) 359 if (value->isInitialValue())
359 return CSSAnimationData::initialPlayState(); 360 return CSSAnimationData::initialPlayState();
360 if (toCSSPrimitiveValue(value)->getValueID() == CSSValuePaused) 361 if (toCSSPrimitiveValue(value)->getValueID() == CSSValuePaused)
361 return AnimPlayStatePaused; 362 return AnimPlayStatePaused;
362 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueRunning); 363 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueRunning);
363 return AnimPlayStatePlaying; 364 return AnimPlayStatePlaying;
364 } 365 }
365 366
366 CSSTransitionData::TransitionProperty CSSToStyleMap::mapAnimationProperty(CSSVal ue* value) 367 CSSTransitionData::TransitionProperty CSSToStyleMap::mapAnimationProperty(CSSVal ue* value)
367 { 368 {
368 if (value->isInitialValue()) 369 if (value->isInitialValue())
369 return CSSTransitionData::initialProperty(); 370 return CSSTransitionData::initialProperty();
371 if (value->isCustomIdentValue())
372 return CSSTransitionData::TransitionProperty(toCSSCustomIdentValue(value )->value());
370 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 373 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
371 if (primitiveValue->isCustomIdent())
372 return CSSTransitionData::TransitionProperty(primitiveValue->getStringVa lue());
373 if (primitiveValue->getValueID() == CSSValueNone) 374 if (primitiveValue->getValueID() == CSSValueNone)
374 return CSSTransitionData::TransitionProperty(CSSTransitionData::Transiti onNone); 375 return CSSTransitionData::TransitionProperty(CSSTransitionData::Transiti onNone);
375 return CSSTransitionData::TransitionProperty(primitiveValue->getPropertyID() ); 376 return CSSTransitionData::TransitionProperty(primitiveValue->getPropertyID() );
376 } 377 }
377 378
378 PassRefPtr<TimingFunction> CSSToStyleMap::mapAnimationTimingFunction(CSSValue* v alue, bool allowStepMiddle) 379 PassRefPtr<TimingFunction> CSSToStyleMap::mapAnimationTimingFunction(CSSValue* v alue, bool allowStepMiddle)
379 { 380 {
380 // FIXME: We should probably only call into this function with a valid 381 // FIXME: We should probably only call into this function with a valid
381 // single timing function value which isn't initial or inherit. We can 382 // single timing function value which isn't initial or inherit. We can
382 // currently get into here with initial since the parser expands unset 383 // currently get into here with initial since the parser expands unset
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 verticalRule = SpaceImageRule; 581 verticalRule = SpaceImageRule;
581 break; 582 break;
582 default: // CSSValueRepeat 583 default: // CSSValueRepeat
583 verticalRule = RepeatImageRule; 584 verticalRule = RepeatImageRule;
584 break; 585 break;
585 } 586 }
586 image.setVerticalRule(verticalRule); 587 image.setVerticalRule(verticalRule);
587 } 588 }
588 589
589 }; 590 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698