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

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

Issue 472893004: Apply the text autosizing multiplier in FontBuilder::updateComputedSize. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/text-autosizing/inherited-multiplier-expected.html ('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 * 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 12 matching lines...) Expand all
23 #include "config.h" 23 #include "config.h"
24 #include "core/css/resolver/FontBuilder.h" 24 #include "core/css/resolver/FontBuilder.h"
25 25
26 #include "core/css/CSSCalculationValue.h" 26 #include "core/css/CSSCalculationValue.h"
27 #include "core/css/CSSToLengthConversionData.h" 27 #include "core/css/CSSToLengthConversionData.h"
28 #include "core/css/FontSize.h" 28 #include "core/css/FontSize.h"
29 #include "core/frame/LocalFrame.h" 29 #include "core/frame/LocalFrame.h"
30 #include "core/frame/Settings.h" 30 #include "core/frame/Settings.h"
31 #include "core/rendering/RenderTheme.h" 31 #include "core/rendering/RenderTheme.h"
32 #include "core/rendering/RenderView.h" 32 #include "core/rendering/RenderView.h"
33 #include "core/rendering/TextAutosizer.h"
33 #include "platform/fonts/FontDescription.h" 34 #include "platform/fonts/FontDescription.h"
34 #include "platform/text/LocaleToScriptMapping.h" 35 #include "platform/text/LocaleToScriptMapping.h"
35 36
36 namespace blink { 37 namespace blink {
37 38
38 // FIXME: This scoping class is a short-term fix to minimize the changes in 39 // FIXME: This scoping class is a short-term fix to minimize the changes in
39 // Font-constructing logic. 40 // Font-constructing logic.
40 class FontDescriptionChangeScope { 41 class FontDescriptionChangeScope {
41 STACK_ALLOCATED(); 42 STACK_ALLOCATED();
42 public: 43 public:
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 scope.fontDescription().specifiedSize() * fixedScaleFactor; 527 scope.fontDescription().specifiedSize() * fixedScaleFactor;
527 } 528 }
528 529
529 setSize(scope.fontDescription(), style->effectiveZoom(), size); 530 setSize(scope.fontDescription(), style->effectiveZoom(), size);
530 } 531 }
531 532
532 void FontBuilder::updateComputedSize(RenderStyle* style, const RenderStyle* pare ntStyle) 533 void FontBuilder::updateComputedSize(RenderStyle* style, const RenderStyle* pare ntStyle)
533 { 534 {
534 FontDescriptionChangeScope scope(this); 535 FontDescriptionChangeScope scope(this);
535 536
536 scope.fontDescription().setComputedSize(getComputedSizeFromSpecifiedSize(sco pe.fontDescription(), style->effectiveZoom(), scope.fontDescription().specifiedS ize())); 537 float computedSize = getComputedSizeFromSpecifiedSize(scope.fontDescription( ), style->effectiveZoom(), scope.fontDescription().specifiedSize());
538 float multiplier = style->textAutosizingMultiplier();
539 if (multiplier > 1)
540 computedSize = TextAutosizer::computeAutosizedFontSize(computedSize, mul tiplier);
541
542 scope.fontDescription().setComputedSize(computedSize);
537 } 543 }
538 544
539 // FIXME: style param should come first 545 // FIXME: style param should come first
540 void FontBuilder::createFont(PassRefPtrWillBeRawPtr<FontSelector> fontSelector, const RenderStyle* parentStyle, RenderStyle* style) 546 void FontBuilder::createFont(PassRefPtrWillBeRawPtr<FontSelector> fontSelector, const RenderStyle* parentStyle, RenderStyle* style)
541 { 547 {
542 if (!m_fontDirty) 548 if (!m_fontDirty)
543 return; 549 return;
544 550
545 updateComputedSize(style, parentStyle); 551 updateComputedSize(style, parentStyle);
546 checkForGenericFamilyChange(style, parentStyle); 552 checkForGenericFamilyChange(style, parentStyle);
(...skipping 16 matching lines...) Expand all
563 FontOrientation fontOrientation; 569 FontOrientation fontOrientation;
564 NonCJKGlyphOrientation glyphOrientation; 570 NonCJKGlyphOrientation glyphOrientation;
565 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation) ; 571 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation) ;
566 fontDescription.setOrientation(fontOrientation); 572 fontDescription.setOrientation(fontOrientation);
567 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); 573 fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
568 documentStyle->setFontDescription(fontDescription); 574 documentStyle->setFontDescription(fontDescription);
569 documentStyle->font().update(fontSelector); 575 documentStyle->font().update(fontSelector);
570 } 576 }
571 577
572 } 578 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/text-autosizing/inherited-multiplier-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698