OLD | NEW |
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 { | 82 { |
83 ASSERT(m_document && m_document->settings()); | 83 ASSERT(m_document && m_document->settings()); |
84 if (!m_document || !m_document->settings()) | 84 if (!m_document || !m_document->settings()) |
85 return; | 85 return; |
86 | 86 |
87 FontDescriptionChangeScope scope(this); | 87 FontDescriptionChangeScope scope(this); |
88 | 88 |
89 scope.reset(); | 89 scope.reset(); |
90 scope.fontDescription().setGenericFamily(FontDescription::StandardFamily); | 90 scope.fontDescription().setGenericFamily(FontDescription::StandardFamily); |
91 scope.fontDescription().setUsePrinterFont(m_document->printing()); | 91 scope.fontDescription().setUsePrinterFont(m_document->printing()); |
92 const AtomicString& standardFontFamily = m_document->settings()->standardFon
tFamily(); | 92 const AtomicString& standardFontFamily = m_document->settings()->genericFont
FamilySettings().standard(); |
93 if (!standardFontFamily.isEmpty()) { | 93 if (!standardFontFamily.isEmpty()) { |
94 scope.fontDescription().firstFamily().setFamily(standardFontFamily); | 94 scope.fontDescription().firstFamily().setFamily(standardFontFamily); |
95 scope.fontDescription().firstFamily().appendFamily(0); | 95 scope.fontDescription().firstFamily().appendFamily(0); |
96 } | 96 } |
97 scope.fontDescription().setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1)
; | 97 scope.fontDescription().setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1)
; |
98 setSize(scope.fontDescription(), effectiveZoom, FontSize::fontSizeForKeyword
(m_document, CSSValueMedium, false)); | 98 setSize(scope.fontDescription(), effectiveZoom, FontSize::fontSizeForKeyword
(m_document, CSSValueMedium, false)); |
99 } | 99 } |
100 | 100 |
101 void FontBuilder::inheritFrom(const FontDescription& fontDescription) | 101 void FontBuilder::inheritFrom(const FontDescription& fontDescription) |
102 { | 102 { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 if (!item->isPrimitiveValue()) | 176 if (!item->isPrimitiveValue()) |
177 continue; | 177 continue; |
178 CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item); | 178 CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item); |
179 AtomicString face; | 179 AtomicString face; |
180 Settings* settings = m_document->settings(); | 180 Settings* settings = m_document->settings(); |
181 if (contentValue->isString()) { | 181 if (contentValue->isString()) { |
182 face = contentValue->getStringValue(); | 182 face = contentValue->getStringValue(); |
183 } else if (settings) { | 183 } else if (settings) { |
184 switch (contentValue->getValueID()) { | 184 switch (contentValue->getValueID()) { |
185 case CSSValueWebkitBody: | 185 case CSSValueWebkitBody: |
186 face = settings->standardFontFamily(); | 186 face = settings->genericFontFamilySettings().standard(); |
187 break; | 187 break; |
188 case CSSValueSerif: | 188 case CSSValueSerif: |
189 face = FontFamilyNames::webkit_serif; | 189 face = FontFamilyNames::webkit_serif; |
190 scope.fontDescription().setGenericFamily(FontDescription::SerifF
amily); | 190 scope.fontDescription().setGenericFamily(FontDescription::SerifF
amily); |
191 break; | 191 break; |
192 case CSSValueSansSerif: | 192 case CSSValueSansSerif: |
193 face = FontFamilyNames::webkit_sans_serif; | 193 face = FontFamilyNames::webkit_sans_serif; |
194 scope.fontDescription().setGenericFamily(FontDescription::SansSe
rifFamily); | 194 scope.fontDescription().setGenericFamily(FontDescription::SansSe
rifFamily); |
195 break; | 195 break; |
196 case CSSValueCursive: | 196 case CSSValueCursive: |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 style->font().update(fontSelector); | 636 style->font().update(fontSelector); |
637 m_fontDirty = false; | 637 m_fontDirty = false; |
638 } | 638 } |
639 | 639 |
640 void FontBuilder::createFontForDocument(PassRefPtr<FontSelector> fontSelector, R
enderStyle* documentStyle) | 640 void FontBuilder::createFontForDocument(PassRefPtr<FontSelector> fontSelector, R
enderStyle* documentStyle) |
641 { | 641 { |
642 FontDescription fontDescription = FontDescription(); | 642 FontDescription fontDescription = FontDescription(); |
643 fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle->
locale())); | 643 fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle->
locale())); |
644 if (Settings* settings = m_document->settings()) { | 644 if (Settings* settings = m_document->settings()) { |
645 fontDescription.setUsePrinterFont(m_document->printing()); | 645 fontDescription.setUsePrinterFont(m_document->printing()); |
646 const AtomicString& standardFont = settings->standardFontFamily(fontDesc
ription.script()); | 646 const AtomicString& standardFont = settings->genericFontFamilySettings()
.standard(fontDescription.script()); |
647 if (!standardFont.isEmpty()) { | 647 if (!standardFont.isEmpty()) { |
648 fontDescription.setGenericFamily(FontDescription::StandardFamily); | 648 fontDescription.setGenericFamily(FontDescription::StandardFamily); |
649 fontDescription.firstFamily().setFamily(standardFont); | 649 fontDescription.firstFamily().setFamily(standardFont); |
650 fontDescription.firstFamily().appendFamily(0); | 650 fontDescription.firstFamily().appendFamily(0); |
651 } | 651 } |
652 fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); | 652 fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); |
653 int size = FontSize::fontSizeForKeyword(m_document, CSSValueMedium, fals
e); | 653 int size = FontSize::fontSizeForKeyword(m_document, CSSValueMedium, fals
e); |
654 fontDescription.setSpecifiedSize(size); | 654 fontDescription.setSpecifiedSize(size); |
655 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDes
cription, documentStyle->effectiveZoom(), size)); | 655 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDes
cription, documentStyle->effectiveZoom(), size)); |
656 } else { | 656 } else { |
657 fontDescription.setUsePrinterFont(m_document->printing()); | 657 fontDescription.setUsePrinterFont(m_document->printing()); |
658 } | 658 } |
659 | 659 |
660 FontOrientation fontOrientation; | 660 FontOrientation fontOrientation; |
661 NonCJKGlyphOrientation glyphOrientation; | 661 NonCJKGlyphOrientation glyphOrientation; |
662 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation)
; | 662 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation)
; |
663 fontDescription.setOrientation(fontOrientation); | 663 fontDescription.setOrientation(fontOrientation); |
664 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); | 664 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); |
665 documentStyle->setFontDescription(fontDescription); | 665 documentStyle->setFontDescription(fontDescription); |
666 documentStyle->font().update(fontSelector); | 666 documentStyle->font().update(fontSelector); |
667 } | 667 } |
668 | 668 |
669 } | 669 } |
OLD | NEW |