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

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

Issue 195823006: Revert 169264 "Add plumbing for font-stretch" (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 years, 9 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 case CSSPropertyWebkitMaskSize: 218 case CSSPropertyWebkitMaskSize:
219 fillLayer->clearSize(); 219 fillLayer->clearSize();
220 break; 220 break;
221 default: 221 default:
222 ASSERT_NOT_REACHED(); 222 ASSERT_NOT_REACHED();
223 } 223 }
224 fillLayer = fillLayer->next(); 224 fillLayer = fillLayer->next();
225 } 225 }
226 } 226 }
227 227
228 FontStretch animatableValueToFontStretch(const AnimatableValue* value)
229 {
230 ASSERT(FontStretchUltraCondensed == 1 && FontStretchUltraExpanded == 9);
231 unsigned index = round(toAnimatableDouble(value)->toDouble()) - 1;
232 static const FontStretch stretchValues[] = {
233 FontStretchUltraCondensed,
234 FontStretchExtraCondensed,
235 FontStretchCondensed,
236 FontStretchSemiCondensed,
237 FontStretchNormal,
238 FontStretchSemiExpanded,
239 FontStretchExpanded,
240 FontStretchExtraExpanded,
241 FontStretchUltraExpanded
242 };
243
244 index = clampTo<unsigned>(index, 0, WTF_ARRAY_LENGTH(stretchValues) - 1);
245 return stretchValues[index];
246 }
247
248 FontWeight animatableValueToFontWeight(const AnimatableValue* value) 228 FontWeight animatableValueToFontWeight(const AnimatableValue* value)
249 { 229 {
250 int index = round(toAnimatableDouble(value)->toDouble() / 100) - 1; 230 int index = round(toAnimatableDouble(value)->toDouble() / 100) - 1;
251 231
252 static const FontWeight weights[] = { 232 static const FontWeight weights[] = {
253 FontWeight100, 233 FontWeight100,
254 FontWeight200, 234 FontWeight200,
255 FontWeight300, 235 FontWeight300,
256 FontWeight400, 236 FontWeight400,
257 FontWeight500, 237 FontWeight500,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 return; 365 return;
386 case CSSPropertyFloodColor: 366 case CSSPropertyFloodColor:
387 style->setFloodColor(toAnimatableColor(value)->color()); 367 style->setFloodColor(toAnimatableColor(value)->color());
388 return; 368 return;
389 case CSSPropertyFloodOpacity: 369 case CSSPropertyFloodOpacity:
390 style->setFloodOpacity(clampTo<float>(toAnimatableDouble(value)->toDoubl e(), 0, 1)); 370 style->setFloodOpacity(clampTo<float>(toAnimatableDouble(value)->toDoubl e(), 0, 1));
391 return; 371 return;
392 case CSSPropertyFontSize: 372 case CSSPropertyFontSize:
393 style->setFontSize(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0)); 373 style->setFontSize(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0));
394 return; 374 return;
395 case CSSPropertyFontStretch:
396 style->setFontStretch(animatableValueToFontStretch(value));
397 return;
398 case CSSPropertyFontWeight: 375 case CSSPropertyFontWeight:
399 style->setFontWeight(animatableValueToFontWeight(value)); 376 style->setFontWeight(animatableValueToFontWeight(value));
400 return; 377 return;
401 case CSSPropertyHeight: 378 case CSSPropertyHeight:
402 style->setHeight(animatableValueToLength(value, state, NonNegativeValues )); 379 style->setHeight(animatableValueToLength(value, state, NonNegativeValues ));
403 return; 380 return;
404 case CSSPropertyKerning: 381 case CSSPropertyKerning:
405 style->setKerning(toAnimatableSVGLength(value)->toSVGLength()); 382 style->setKerning(toAnimatableSVGLength(value)->toSVGLength());
406 return; 383 return;
407 case CSSPropertyLeft: 384 case CSSPropertyLeft:
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 return; 612 return;
636 case CSSPropertyZoom: 613 case CSSPropertyZoom:
637 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std ::numeric_limits<float>::denorm_min())); 614 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std ::numeric_limits<float>::denorm_min()));
638 return; 615 return;
639 default: 616 default:
640 ASSERT_NOT_REACHED(); 617 ASSERT_NOT_REACHED();
641 } 618 }
642 } 619 }
643 620
644 } // namespace WebCore 621 } // namespace WebCore
OLDNEW
« no previous file with comments | « trunk/Source/core/css/parser/CSSPropertyParser.cpp ('k') | trunk/Source/core/css/resolver/FontBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698