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

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

Issue 204963002: Clean up setting font-family: initial value. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/resolver/FontBuilder.h ('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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 // Handle the zoom factor. 133 // Handle the zoom factor.
134 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescrip tion, effectiveZoom, fontDescription.specifiedSize())); 134 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescrip tion, effectiveZoom, fontDescription.specifiedSize()));
135 scope.set(fontDescription); 135 scope.set(fontDescription);
136 } 136 }
137 137
138 void FontBuilder::setFontFamilyInitial() 138 void FontBuilder::setFontFamilyInitial()
139 { 139 {
140 FontDescriptionChangeScope scope(this); 140 FontDescriptionChangeScope scope(this);
141 141
142 FontDescription initialDesc = FontDescription(); 142 scope.fontDescription().setGenericFamily(FontBuilder::initialGenericFamily() );
143
144 // We need to adjust the size to account for the generic family change from monospace to non-monospace.
145 if (scope.fontDescription().keywordSize() && scope.fontDescription().useFixe dDefaultSize())
146 scope.fontDescription().setSpecifiedSize(FontSize::fontSizeForKeyword(m_ document, CSSValueXxSmall + scope.fontDescription().keywordSize() - 1, false));
147 scope.fontDescription().setGenericFamily(initialDesc.genericFamily());
148 if (!initialDesc.firstFamily().familyIsEmpty())
149 scope.fontDescription().setFamily(initialDesc.firstFamily());
150 } 143 }
151 144
152 void FontBuilder::setFontFamilyInherit(const FontDescription& parentFontDescript ion) 145 void FontBuilder::setFontFamilyInherit(const FontDescription& parentFontDescript ion)
153 { 146 {
154 FontDescriptionChangeScope scope(this); 147 FontDescriptionChangeScope scope(this);
155 148
156 scope.fontDescription().setGenericFamily(parentFontDescription.genericFamily ()); 149 scope.fontDescription().setGenericFamily(parentFontDescription.genericFamily ());
157 scope.fontDescription().setFamily(parentFontDescription.family()); 150 scope.fontDescription().setFamily(parentFontDescription.family());
158 scope.fontDescription().setIsSpecifiedFont(parentFontDescription.isSpecified Font()); 151 scope.fontDescription().setIsSpecifiedFont(parentFontDescription.isSpecified Font());
159 } 152 }
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 FontOrientation fontOrientation; 669 FontOrientation fontOrientation;
677 NonCJKGlyphOrientation glyphOrientation; 670 NonCJKGlyphOrientation glyphOrientation;
678 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation) ; 671 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation) ;
679 fontDescription.setOrientation(fontOrientation); 672 fontDescription.setOrientation(fontOrientation);
680 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); 673 fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
681 documentStyle->setFontDescription(fontDescription); 674 documentStyle->setFontDescription(fontDescription);
682 documentStyle->font().update(fontSelector); 675 documentStyle->font().update(fontSelector);
683 } 676 }
684 677
685 } 678 }
OLDNEW
« no previous file with comments | « Source/core/css/resolver/FontBuilder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698