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

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

Issue 983073002: Make font-size-adjust animatable. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase expectations for bug2886-2.html Created 5 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
« no previous file with comments | « Source/core/css/resolver/AnimatedStyleBuilder.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * Copyright (C) 2015 Collabora Ltd. All rights reserved. 5 * Copyright (C) 2015 Collabora Ltd. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 328 }
329 329
330 void FontBuilder::updateAdjustedSize(FontDescription& fontDescription, const Lay outStyle& style, FontSelector* fontSelector) 330 void FontBuilder::updateAdjustedSize(FontDescription& fontDescription, const Lay outStyle& style, FontSelector* fontSelector)
331 { 331 {
332 const float sizeAdjust = fontDescription.sizeAdjust(); 332 const float sizeAdjust = fontDescription.sizeAdjust();
333 const float specifiedSize = fontDescription.specifiedSize(); 333 const float specifiedSize = fontDescription.specifiedSize();
334 if (!sizeAdjust || !specifiedSize) 334 if (!sizeAdjust || !specifiedSize)
335 return; 335 return;
336 336
337 // We need to create a temporal Font to get xHeight of a primary font. 337 // We need to create a temporal Font to get xHeight of a primary font.
338 // The aspect value is based on the xHeight of the font for the computed fon t size,
339 // so we need to reset the adjustment.
340 fontDescription.setAdjustedSize(0);
341
338 Font font(fontDescription); 342 Font font(fontDescription);
339 font.update(fontSelector); 343 font.update(fontSelector);
340 if (!font.fontMetrics().hasXHeight()) 344 if (!font.fontMetrics().hasXHeight())
341 return; 345 return;
342 346
343 float aspectValue = font.fontMetrics().xHeight() / specifiedSize; 347 float aspectValue = font.fontMetrics().xHeight() / specifiedSize;
344 float adjustedSize = (sizeAdjust / aspectValue) * specifiedSize; 348 float adjustedSize = (sizeAdjust / aspectValue) * specifiedSize;
345 adjustedSize = getComputedSizeFromSpecifiedSize(fontDescription, style.effec tiveZoom(), adjustedSize); 349 adjustedSize = getComputedSizeFromSpecifiedSize(fontDescription, style.effec tiveZoom(), adjustedSize);
346 350
347 float multiplier = style.textAutosizingMultiplier(); 351 float multiplier = style.textAutosizingMultiplier();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 FontOrientation fontOrientation; 429 FontOrientation fontOrientation;
426 NonCJKGlyphOrientation glyphOrientation; 430 NonCJKGlyphOrientation glyphOrientation;
427 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation) ; 431 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation) ;
428 fontDescription.setOrientation(fontOrientation); 432 fontDescription.setOrientation(fontOrientation);
429 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); 433 fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
430 documentStyle.setFontDescription(fontDescription); 434 documentStyle.setFontDescription(fontDescription);
431 documentStyle.font().update(fontSelector); 435 documentStyle.font().update(fontSelector);
432 } 436 }
433 437
434 } 438 }
OLDNEW
« no previous file with comments | « Source/core/css/resolver/AnimatedStyleBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698