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

Side by Side Diff: sky/engine/core/css/CSSPrimitiveValue.cpp

Issue 711203002: Remove zoom() and effectiveZoom(). (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 290 }
291 291
292 CSSPrimitiveValue::CSSPrimitiveValue(RGBA32 color, UnitType type) 292 CSSPrimitiveValue::CSSPrimitiveValue(RGBA32 color, UnitType type)
293 : CSSValue(PrimitiveClass) 293 : CSSValue(PrimitiveClass)
294 { 294 {
295 ASSERT(type == CSS_RGBCOLOR); 295 ASSERT(type == CSS_RGBCOLOR);
296 m_primitiveUnitType = CSS_RGBCOLOR; 296 m_primitiveUnitType = CSS_RGBCOLOR;
297 m_value.rgbcolor = color; 297 m_value.rgbcolor = color;
298 } 298 }
299 299
300 CSSPrimitiveValue::CSSPrimitiveValue(const Length& length, float zoom) 300 CSSPrimitiveValue::CSSPrimitiveValue(const Length& length)
301 : CSSValue(PrimitiveClass) 301 : CSSValue(PrimitiveClass)
302 { 302 {
303 switch (length.type()) { 303 switch (length.type()) {
304 case Auto: 304 case Auto:
305 m_primitiveUnitType = CSS_VALUE_ID; 305 m_primitiveUnitType = CSS_VALUE_ID;
306 m_value.valueID = CSSValueAuto; 306 m_value.valueID = CSSValueAuto;
307 break; 307 break;
308 case Intrinsic: 308 case Intrinsic:
309 m_primitiveUnitType = CSS_VALUE_ID; 309 m_primitiveUnitType = CSS_VALUE_ID;
310 m_value.valueID = CSSValueIntrinsic; 310 m_value.valueID = CSSValueIntrinsic;
(...skipping 22 matching lines...) Expand all
333 m_primitiveUnitType = CSS_VALUE_ID; 333 m_primitiveUnitType = CSS_VALUE_ID;
334 m_value.valueID = CSSValueInternalExtendToZoom; 334 m_value.valueID = CSSValueInternalExtendToZoom;
335 break; 335 break;
336 case Percent: 336 case Percent:
337 m_primitiveUnitType = CSS_PERCENTAGE; 337 m_primitiveUnitType = CSS_PERCENTAGE;
338 ASSERT(std::isfinite(length.percent())); 338 ASSERT(std::isfinite(length.percent()));
339 m_value.num = length.percent(); 339 m_value.num = length.percent();
340 break; 340 break;
341 case Fixed: 341 case Fixed:
342 m_primitiveUnitType = CSS_PX; 342 m_primitiveUnitType = CSS_PX;
343 m_value.num = length.value() / zoom; 343 m_value.num = length.value();
344 break; 344 break;
345 case Calculated: { 345 case Calculated: {
346 const CalculationValue& calc = length.calculationValue(); 346 const CalculationValue& calc = length.calculationValue();
347 if (calc.pixels() && calc.percent()) { 347 if (calc.pixels() && calc.percent()) {
348 init(CSSCalcValue::create( 348 init(CSSCalcValue::create(
349 CSSCalcValue::createExpressionNode(calc.pixels() / zoom, calc.pe rcent()), 349 CSSCalcValue::createExpressionNode(calc.pixels(), calc.percent() ),
350 calc.isNonNegative() ? ValueRangeNonNegative : ValueRangeAll)); 350 calc.isNonNegative() ? ValueRangeNonNegative : ValueRangeAll));
351 break; 351 break;
352 } 352 }
353 if (calc.percent()) { 353 if (calc.percent()) {
354 m_primitiveUnitType = CSS_PERCENTAGE; 354 m_primitiveUnitType = CSS_PERCENTAGE;
355 m_value.num = calc.percent(); 355 m_value.num = calc.percent();
356 } else { 356 } else {
357 m_primitiveUnitType = CSS_PX; 357 m_primitiveUnitType = CSS_PX;
358 m_value.num = calc.pixels() / zoom; 358 m_value.num = calc.pixels();
359 } 359 }
360 if (m_value.num < 0 && calc.isNonNegative()) 360 if (m_value.num < 0 && calc.isNonNegative())
361 m_value.num = 0; 361 m_value.num = 0;
362 break; 362 break;
363 } 363 }
364 case DeviceWidth: 364 case DeviceWidth:
365 case DeviceHeight: 365 case DeviceHeight:
366 case MaxSizeNone: 366 case MaxSizeNone:
367 ASSERT_NOT_REACHED(); 367 ASSERT_NOT_REACHED();
368 break; 368 break;
369 } 369 }
370 } 370 }
371 371
372 void CSSPrimitiveValue::init(const LengthSize& lengthSize, const RenderStyle& st yle) 372 void CSSPrimitiveValue::init(const LengthSize& lengthSize, const RenderStyle& st yle)
373 { 373 {
374 m_primitiveUnitType = CSS_PAIR; 374 m_primitiveUnitType = CSS_PAIR;
375 m_hasCachedCSSText = false; 375 m_hasCachedCSSText = false;
376 m_value.pair = Pair::create(create(lengthSize.width(), style.effectiveZoom() ), create(lengthSize.height(), style.effectiveZoom()), Pair::KeepIdenticalValues ).leakRef(); 376 m_value.pair = Pair::create(create(lengthSize.width()), create(lengthSize.he ight()), Pair::KeepIdenticalValues).leakRef();
377 } 377 }
378 378
379 void CSSPrimitiveValue::init(PassRefPtr<Rect> r) 379 void CSSPrimitiveValue::init(PassRefPtr<Rect> r)
380 { 380 {
381 m_primitiveUnitType = CSS_RECT; 381 m_primitiveUnitType = CSS_RECT;
382 m_hasCachedCSSText = false; 382 m_hasCachedCSSText = false;
383 m_value.rect = r.leakRef(); 383 m_value.rect = r.leakRef();
384 } 384 }
385 385
386 void CSSPrimitiveValue::init(PassRefPtr<Quad> quad) 386 void CSSPrimitiveValue::init(PassRefPtr<Quad> quad)
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 return -1.0; 645 return -1.0;
646 } 646 }
647 647
648 // We do not apply the zoom factor when we are computing the value of the fo nt-size property. The zooming 648 // We do not apply the zoom factor when we are computing the value of the fo nt-size property. The zooming
649 // for font sizes is much more complicated, since we have to worry about enf orcing the minimum font size preference 649 // for font sizes is much more complicated, since we have to worry about enf orcing the minimum font size preference
650 // as well as enforcing the implicit "smart minimum." 650 // as well as enforcing the implicit "smart minimum."
651 double result = getDoubleValue() * factor; 651 double result = getDoubleValue() * factor;
652 if (computingFontSize || isFontRelativeLength()) 652 if (computingFontSize || isFontRelativeLength())
653 return result; 653 return result;
654 654
655 return result * conversionData.zoom(); 655 return result;
656 } 656 }
657 657
658 void CSSPrimitiveValue::accumulateLengthArray(CSSLengthArray& lengthArray, doubl e multiplier) const 658 void CSSPrimitiveValue::accumulateLengthArray(CSSLengthArray& lengthArray, doubl e multiplier) const
659 { 659 {
660 ASSERT(lengthArray.size() == LengthUnitTypeCount); 660 ASSERT(lengthArray.size() == LengthUnitTypeCount);
661 661
662 if (m_primitiveUnitType == CSS_CALC) { 662 if (m_primitiveUnitType == CSS_CALC) {
663 cssCalcValue()->accumulateLengthArray(lengthArray, multiplier); 663 cssCalcValue()->accumulateLengthArray(lengthArray, multiplier);
664 return; 664 return;
665 } 665 }
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 visitor->trace(m_value.shape); 1351 visitor->trace(m_value.shape);
1352 break; 1352 break;
1353 default: 1353 default:
1354 break; 1354 break;
1355 } 1355 }
1356 #endif 1356 #endif
1357 CSSValue::traceAfterDispatch(visitor); 1357 CSSValue::traceAfterDispatch(visitor);
1358 } 1358 }
1359 1359
1360 } // namespace blink 1360 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/CSSPrimitiveValue.h ('k') | sky/engine/core/css/CSSToLengthConversionData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698