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

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

Issue 721773002: Build animated font properties through FontBuilder. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove body tags. Created 6 years, 1 month 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 * 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 FontWeight700, 252 FontWeight700,
253 FontWeight800, 253 FontWeight800,
254 FontWeight900 254 FontWeight900
255 }; 255 };
256 256
257 index = clampTo<int>(index, 0, WTF_ARRAY_LENGTH(weights) - 1); 257 index = clampTo<int>(index, 0, WTF_ARRAY_LENGTH(weights) - 1);
258 258
259 return weights[index]; 259 return weights[index];
260 } 260 }
261 261
262 FontDescription::Size animatableValueToFontSize(const AnimatableValue* value)
263 {
264 float size = clampTo<float>(toAnimatableDouble(value)->toDouble(), 0);
265 return FontDescription::Size(0, size, true);
266 }
267
262 } // namespace 268 } // namespace
263 269
264 // FIXME: Generate this function. 270 // FIXME: Generate this function.
265 void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt ate& state, const AnimatableValue* value) 271 void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt ate& state, const AnimatableValue* value)
266 { 272 {
267 ASSERT(CSSPropertyMetadata::isAnimatableProperty(property)); 273 ASSERT(CSSPropertyMetadata::isAnimatableProperty(property));
268 if (value->isUnknown()) { 274 if (value->isUnknown()) {
269 StyleBuilder::applyProperty(property, state, toAnimatableUnknown(value)- >toCSSValue().get()); 275 StyleBuilder::applyProperty(property, state, toAnimatableUnknown(value)- >toCSSValue().get());
270 return; 276 return;
271 } 277 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 case CSSPropertyFlexBasis: 381 case CSSPropertyFlexBasis:
376 style->setFlexBasis(animatableValueToLength(value, state, ValueRangeNonN egative)); 382 style->setFlexBasis(animatableValueToLength(value, state, ValueRangeNonN egative));
377 return; 383 return;
378 case CSSPropertyFloodColor: 384 case CSSPropertyFloodColor:
379 style->setFloodColor(toAnimatableColor(value)->color()); 385 style->setFloodColor(toAnimatableColor(value)->color());
380 return; 386 return;
381 case CSSPropertyFloodOpacity: 387 case CSSPropertyFloodOpacity:
382 style->setFloodOpacity(clampTo<float>(toAnimatableDouble(value)->toDoubl e(), 0, 1)); 388 style->setFloodOpacity(clampTo<float>(toAnimatableDouble(value)->toDoubl e(), 0, 1));
383 return; 389 return;
384 case CSSPropertyFontSize: 390 case CSSPropertyFontSize:
385 style->setFontSize(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0)); 391 state.fontBuilder().setSize(animatableValueToFontSize(value));
386 return; 392 return;
387 case CSSPropertyFontStretch: 393 case CSSPropertyFontStretch:
388 style->setFontStretch(animatableValueToFontStretch(value)); 394 state.fontBuilder().setStretch(animatableValueToFontStretch(value));
389 return; 395 return;
390 case CSSPropertyFontWeight: 396 case CSSPropertyFontWeight:
391 style->setFontWeight(animatableValueToFontWeight(value)); 397 state.fontBuilder().setWeight(animatableValueToFontWeight(value));
392 return; 398 return;
393 case CSSPropertyHeight: 399 case CSSPropertyHeight:
394 style->setHeight(animatableValueToLength(value, state, ValueRangeNonNega tive)); 400 style->setHeight(animatableValueToLength(value, state, ValueRangeNonNega tive));
395 return; 401 return;
396 case CSSPropertyLeft: 402 case CSSPropertyLeft:
397 style->setLeft(animatableValueToLength(value, state)); 403 style->setLeft(animatableValueToLength(value, state));
398 return; 404 return;
399 case CSSPropertyLightingColor: 405 case CSSPropertyLightingColor:
400 style->setLightingColor(toAnimatableColor(value)->color()); 406 style->setLightingColor(toAnimatableColor(value)->color());
401 return; 407 return;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 return; 621 return;
616 case CSSPropertyZoom: 622 case CSSPropertyZoom:
617 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std ::numeric_limits<float>::denorm_min())); 623 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std ::numeric_limits<float>::denorm_min()));
618 return; 624 return;
619 default: 625 default:
620 ASSERT_NOT_REACHED(); 626 ASSERT_NOT_REACHED();
621 } 627 }
622 } 628 }
623 629
624 } // namespace blink 630 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698