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

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

Issue 82083002: Move viewport unit resolution to style recalc time (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rebased Created 7 years 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 namespace WebCore { 62 namespace WebCore {
63 63
64 static PassRefPtr<AnimatableValue> createFromLength(const Length& length, const RenderStyle& style) 64 static PassRefPtr<AnimatableValue> createFromLength(const Length& length, const RenderStyle& style)
65 { 65 {
66 switch (length.type()) { 66 switch (length.type()) {
67 case Fixed: 67 case Fixed:
68 return AnimatableLength::create(adjustFloatForAbsoluteZoom(length.value( ), style), AnimatableLength::UnitTypePixels); 68 return AnimatableLength::create(adjustFloatForAbsoluteZoom(length.value( ), style), AnimatableLength::UnitTypePixels);
69 case Percent: 69 case Percent:
70 return AnimatableLength::create(length.value(), AnimatableLength::UnitTy pePercentage); 70 return AnimatableLength::create(length.value(), AnimatableLength::UnitTy pePercentage);
71 case ViewportPercentageWidth:
72 return AnimatableLength::create(length.value(), AnimatableLength::UnitTy peViewportWidth);
73 case ViewportPercentageHeight:
74 return AnimatableLength::create(length.value(), AnimatableLength::UnitTy peViewportHeight);
75 case ViewportPercentageMin:
76 return AnimatableLength::create(length.value(), AnimatableLength::UnitTy peViewportMin);
77 case ViewportPercentageMax:
78 return AnimatableLength::create(length.value(), AnimatableLength::UnitTy peViewportMax);
79 case Calculated: 71 case Calculated:
80 return AnimatableLength::create(CSSCalcValue::createExpressionNode(lengt h.calculationValue()->expression(), style.effectiveZoom())); 72 return AnimatableLength::create(CSSCalcValue::createExpressionNode(lengt h.calculationValue()->expression(), style.effectiveZoom()));
81 case Auto: 73 case Auto:
82 case Intrinsic: 74 case Intrinsic:
83 case MinIntrinsic: 75 case MinIntrinsic:
84 case MinContent: 76 case MinContent:
85 case MaxContent: 77 case MaxContent:
86 case FillAvailable: 78 case FillAvailable:
87 case FitContent: 79 case FitContent:
88 return AnimatableUnknown::create(CSSPrimitiveValue::create(length)); 80 return AnimatableUnknown::create(CSSPrimitiveValue::create(length));
89 case Undefined: 81 case Undefined:
90 return AnimatableUnknown::create(CSSValueNone); 82 return AnimatableUnknown::create(CSSValueNone);
91 case ExtendToZoom: // Does not apply to elements. 83 case ExtendToZoom: // Does not apply to elements.
84 case DeviceWidth:
kenneth.r.christiansen 2013/12/16 10:08:19 Do we need these? They are not used in @viewport a
85 case DeviceHeight:
92 ASSERT_NOT_REACHED(); 86 ASSERT_NOT_REACHED();
93 return 0; 87 return 0;
94 } 88 }
95 ASSERT_NOT_REACHED(); 89 ASSERT_NOT_REACHED();
96 return 0; 90 return 0;
97 } 91 }
98 92
99 static PassRefPtr<AnimatableValue> createFromLineHeight(const Length& length, co nst RenderStyle& style) 93 static PassRefPtr<AnimatableValue> createFromLineHeight(const Length& length, co nst RenderStyle& style)
100 { 94 {
101 if (length.type() == Percent) { 95 if (length.type() == Percent) {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 return createFromDouble(style.zoom()); 461 return createFromDouble(style.zoom());
468 default: 462 default:
469 ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(property), "Web Animations not yet implemented: Create AnimatableValue from render style: %s", getPropertyNameString(property).utf8().data()); 463 ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(property), "Web Animations not yet implemented: Create AnimatableValue from render style: %s", getPropertyNameString(property).utf8().data());
470 ASSERT_NOT_REACHED(); 464 ASSERT_NOT_REACHED();
471 // This return value is to avoid a release crash if possible. 465 // This return value is to avoid a release crash if possible.
472 return AnimatableUnknown::create(0); 466 return AnimatableUnknown::create(0);
473 } 467 }
474 } 468 }
475 469
476 } // namespace WebCore 470 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698