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

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: 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
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 // To get an accurate x-height from a font cache while animation, we need to reset adjustedSize
rune 2015/03/06 10:08:06 ... while animating ...
changseok 2015/03/08 06:16:56 Done.
339 // before creating a Font. Because a retrived font data from the cache is ba sed on a FontCacheKey
340 // and which is affected by effectiveFontSize.
rune 2015/03/06 10:08:05 -and
changseok 2015/03/08 06:16:56 Done.
341 fontDescription.setAdjustedSize(0);
rune 2015/03/06 10:08:06 This is necessary in general to get the correct re
changseok 2015/03/08 06:16:56 Yes correct. thanks for the summary =)
342
338 Font font(fontDescription); 343 Font font(fontDescription);
339 font.update(fontSelector); 344 font.update(fontSelector);
340 if (!font.fontMetrics().hasXHeight()) 345 if (!font.fontMetrics().hasXHeight())
341 return; 346 return;
342 347
343 float aspectValue = font.fontMetrics().xHeight() / specifiedSize; 348 float aspectValue = font.fontMetrics().xHeight() / specifiedSize;
344 float adjustedSize = (sizeAdjust / aspectValue) * specifiedSize; 349 float adjustedSize = (sizeAdjust / aspectValue) * specifiedSize;
345 adjustedSize = getComputedSizeFromSpecifiedSize(fontDescription, style.effec tiveZoom(), adjustedSize); 350 adjustedSize = getComputedSizeFromSpecifiedSize(fontDescription, style.effec tiveZoom(), adjustedSize);
346 351
347 float multiplier = style.textAutosizingMultiplier(); 352 float multiplier = style.textAutosizingMultiplier();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 FontOrientation fontOrientation; 430 FontOrientation fontOrientation;
426 NonCJKGlyphOrientation glyphOrientation; 431 NonCJKGlyphOrientation glyphOrientation;
427 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation) ; 432 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation) ;
428 fontDescription.setOrientation(fontOrientation); 433 fontDescription.setOrientation(fontOrientation);
429 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); 434 fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
430 documentStyle.setFontDescription(fontDescription); 435 documentStyle.setFontDescription(fontDescription);
431 documentStyle.font().update(fontSelector); 436 documentStyle.font().update(fontSelector);
432 } 437 }
433 438
434 } 439 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698