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

Side by Side Diff: Source/core/animation/css/CSSAnimatableValueFactory.cpp

Issue 23581008: Revert r154797: "Move isValid/isCurrentColor from Color to StyleColor" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 { 95 {
96 return AnimatableLengthBox::create( 96 return AnimatableLengthBox::create(
97 createFromLength(lengthBox.left(), style), 97 createFromLength(lengthBox.left(), style),
98 createFromLength(lengthBox.right(), style), 98 createFromLength(lengthBox.right(), style),
99 createFromLength(lengthBox.top(), style), 99 createFromLength(lengthBox.top(), style),
100 createFromLength(lengthBox.bottom(), style)); 100 createFromLength(lengthBox.bottom(), style));
101 } 101 }
102 102
103 PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::createFromColor(CSSProper tyID property, const RenderStyle* style) 103 PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::createFromColor(CSSProper tyID property, const RenderStyle* style)
104 { 104 {
105 StyleColor color = style->colorIncludingFallback(property, false); 105 Color color = style->colorIncludingFallback(property, false);
106 StyleColor visitedLinkColor = style->colorIncludingFallback(property, true); 106 Color visitedLinkColor = style->colorIncludingFallback(property, true);
107 Color fallbackColor = style->color().color(); 107 Color fallbackColor = style->color();
108 Color fallbackVisitedLinkColor = style->visitedLinkColor().color(); 108 Color fallbackVisitedLinkColor = style->visitedLinkColor();
109 Color resolvedColor; 109 Color resolvedColor;
110 if (color.isValid() && !color.isCurrentColor()) 110 if (color.isValid())
111 resolvedColor = color.color(); 111 resolvedColor = color;
112 else 112 else
113 resolvedColor = fallbackColor; 113 resolvedColor = fallbackColor;
114 Color resolvedVisitedLinkColor; 114 Color resolvedVisitedLinkColor;
115 if (visitedLinkColor.isValid() && !visitedLinkColor.isCurrentColor()) 115 if (visitedLinkColor.isValid())
116 resolvedVisitedLinkColor = visitedLinkColor.color(); 116 resolvedVisitedLinkColor = visitedLinkColor;
117 else 117 else
118 resolvedVisitedLinkColor = fallbackVisitedLinkColor; 118 resolvedVisitedLinkColor = fallbackVisitedLinkColor;
119 return AnimatableColor::create(resolvedColor, resolvedVisitedLinkColor); 119 return AnimatableColor::create(resolvedColor, resolvedVisitedLinkColor);
120 } 120 }
121 121
122 // FIXME: Generate this function. 122 // FIXME: Generate this function.
123 PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID prop erty, const RenderStyle* style) 123 PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID prop erty, const RenderStyle* style)
124 { 124 {
125 switch (property) { 125 switch (property) {
126 case CSSPropertyBackgroundColor: 126 case CSSPropertyBackgroundColor:
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 case CSSPropertyWidth: 220 case CSSPropertyWidth:
221 return createFromLength(style->width(), style); 221 return createFromLength(style->width(), style);
222 default: 222 default:
223 RELEASE_ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(propert y), "Web Animations not yet implemented: Create AnimatableValue from render styl e: %s", getPropertyNameString(property).utf8().data()); 223 RELEASE_ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(propert y), "Web Animations not yet implemented: Create AnimatableValue from render styl e: %s", getPropertyNameString(property).utf8().data());
224 ASSERT_NOT_REACHED(); 224 ASSERT_NOT_REACHED();
225 return 0; 225 return 0;
226 } 226 }
227 } 227 }
228 228
229 } // namespace WebCore 229 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698