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

Side by Side Diff: sky/engine/core/css/resolver/FontBuilder.cpp

Issue 788883005: Remove REM units. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * Copyright (C) 2013 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 { 269 {
270 return size * 1.2f; 270 return size * 1.2f;
271 } 271 }
272 272
273 static float smallerFontSize(float size) 273 static float smallerFontSize(float size)
274 { 274 {
275 return size / 1.2f; 275 return size / 1.2f;
276 } 276 }
277 277
278 // FIXME: Have to pass RenderStyles here for calc/computed values. This shouldn' t be neecessary. 278 // FIXME: Have to pass RenderStyles here for calc/computed values. This shouldn' t be neecessary.
279 void FontBuilder::setFontSizeValue(CSSValue* value, RenderStyle* parentStyle, co nst RenderStyle* rootElementStyle) 279 void FontBuilder::setFontSizeValue(CSSValue* value, RenderStyle* parentStyle)
280 { 280 {
281 if (!value->isPrimitiveValue()) 281 if (!value->isPrimitiveValue())
282 return; 282 return;
283 283
284 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 284 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
285 285
286 FontDescriptionChangeScope scope(this); 286 FontDescriptionChangeScope scope(this);
287 287
288 scope.fontDescription().setKeywordSize(0); 288 scope.fontDescription().setKeywordSize(0);
289 float parentSize = 0; 289 float parentSize = 0;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 321
322 scope.fontDescription().setIsAbsoluteSize(parentIsAbsoluteSize && (value ID == CSSValueLarger || valueID == CSSValueSmaller)); 322 scope.fontDescription().setIsAbsoluteSize(parentIsAbsoluteSize && (value ID == CSSValueLarger || valueID == CSSValueSmaller));
323 } else { 323 } else {
324 scope.fontDescription().setIsAbsoluteSize(parentIsAbsoluteSize || !(prim itiveValue->isPercentage() || primitiveValue->isFontRelativeLength())); 324 scope.fontDescription().setIsAbsoluteSize(parentIsAbsoluteSize || !(prim itiveValue->isPercentage() || primitiveValue->isFontRelativeLength()));
325 if (primitiveValue->isPercentage()) { 325 if (primitiveValue->isPercentage()) {
326 size = (primitiveValue->getFloatValue() * parentSize) / 100.0f; 326 size = (primitiveValue->getFloatValue() * parentSize) / 100.0f;
327 } else { 327 } else {
328 // If we have viewport units the conversion will mark the parent sty le as having viewport units. 328 // If we have viewport units the conversion will mark the parent sty le as having viewport units.
329 bool parentHasViewportUnits = parentStyle->hasViewportUnits(); 329 bool parentHasViewportUnits = parentStyle->hasViewportUnits();
330 parentStyle->setHasViewportUnits(false); 330 parentStyle->setHasViewportUnits(false);
331 CSSToLengthConversionData conversionData(parentStyle, rootElementSty le, m_document->renderView(), true); 331 CSSToLengthConversionData conversionData(parentStyle, m_document->re nderView(), true);
332 if (primitiveValue->isLength()) 332 if (primitiveValue->isLength())
333 size = primitiveValue->computeLength<float>(conversionData); 333 size = primitiveValue->computeLength<float>(conversionData);
334 else if (primitiveValue->isCalculatedPercentageWithLength()) 334 else if (primitiveValue->isCalculatedPercentageWithLength())
335 size = primitiveValue->cssCalcValue()->toCalcValue(conversionDat a)->evaluate(parentSize); 335 size = primitiveValue->cssCalcValue()->toCalcValue(conversionDat a)->evaluate(parentSize);
336 else 336 else
337 ASSERT_NOT_REACHED(); 337 ASSERT_NOT_REACHED();
338 m_fontSizehasViewportUnits = parentStyle->hasViewportUnits(); 338 m_fontSizehasViewportUnits = parentStyle->hasViewportUnits();
339 parentStyle->setHasViewportUnits(parentHasViewportUnits); 339 parentStyle->setHasViewportUnits(parentHasViewportUnits);
340 } 340 }
341 } 341 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 FontOrientation fontOrientation; 526 FontOrientation fontOrientation;
527 NonCJKGlyphOrientation glyphOrientation; 527 NonCJKGlyphOrientation glyphOrientation;
528 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation) ; 528 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation) ;
529 fontDescription.setOrientation(fontOrientation); 529 fontDescription.setOrientation(fontOrientation);
530 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); 530 fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
531 documentStyle->setFontDescription(fontDescription); 531 documentStyle->setFontDescription(fontDescription);
532 documentStyle->font().update(fontSelector); 532 documentStyle->font().update(fontSelector);
533 } 533 }
534 534
535 } 535 }
OLDNEW
« no previous file with comments | « sky/engine/core/css/resolver/FontBuilder.h ('k') | sky/engine/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698