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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 m_fontBuilder->didChangeFontParameters(m_fontBuilder->m_style->setFontDe
scription(m_fontDescription)); | 55 m_fontBuilder->didChangeFontParameters(m_fontBuilder->m_style->setFontDe
scription(m_fontDescription)); |
56 } | 56 } |
57 | 57 |
58 private: | 58 private: |
59 FontBuilder* m_fontBuilder; | 59 FontBuilder* m_fontBuilder; |
60 FontDescription m_fontDescription; | 60 FontDescription m_fontDescription; |
61 }; | 61 }; |
62 | 62 |
63 FontBuilder::FontBuilder() | 63 FontBuilder::FontBuilder() |
64 : m_document(0) | 64 : m_document(0) |
65 , m_useSVGZoomRules(false) | |
66 , m_fontSizehasViewportUnits(false) | 65 , m_fontSizehasViewportUnits(false) |
67 , m_style(0) | 66 , m_style(0) |
68 , m_fontDirty(false) | 67 , m_fontDirty(false) |
69 { | 68 { |
70 } | 69 } |
71 | 70 |
72 void FontBuilder::initForStyleResolve(const Document& document, RenderStyle* sty
le, bool useSVGZoomRules) | 71 void FontBuilder::initForStyleResolve(const Document& document, RenderStyle* sty
le) |
73 { | 72 { |
74 ASSERT(document.frame()); | 73 ASSERT(document.frame()); |
75 m_document = &document; | 74 m_document = &document; |
76 m_useSVGZoomRules = useSVGZoomRules; | |
77 m_style = style; | 75 m_style = style; |
78 m_fontDirty = false; | 76 m_fontDirty = false; |
79 } | 77 } |
80 | 78 |
81 inline static void setFontFamilyToStandard(FontDescription& fontDescription, con
st Document* document) | 79 inline static void setFontFamilyToStandard(FontDescription& fontDescription, con
st Document* document) |
82 { | 80 { |
83 if (!document || !document->settings()) | 81 if (!document || !document->settings()) |
84 return; | 82 return; |
85 | 83 |
86 fontDescription.setGenericFamily(FontDescription::StandardFamily); | 84 fontDescription.setGenericFamily(FontDescription::StandardFamily); |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 } | 521 } |
524 | 522 |
525 void FontBuilder::setSize(FontDescription& fontDescription, float effectiveZoom,
float size) | 523 void FontBuilder::setSize(FontDescription& fontDescription, float effectiveZoom,
float size) |
526 { | 524 { |
527 fontDescription.setSpecifiedSize(size); | 525 fontDescription.setSpecifiedSize(size); |
528 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescrip
tion, effectiveZoom, size)); | 526 fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescrip
tion, effectiveZoom, size)); |
529 } | 527 } |
530 | 528 |
531 float FontBuilder::getComputedSizeFromSpecifiedSize(FontDescription& fontDescrip
tion, float effectiveZoom, float specifiedSize) | 529 float FontBuilder::getComputedSizeFromSpecifiedSize(FontDescription& fontDescrip
tion, float effectiveZoom, float specifiedSize) |
532 { | 530 { |
533 float zoomFactor = 1.0f; | 531 float zoomFactor = effectiveZoom; |
534 if (!m_useSVGZoomRules) { | 532 // FIXME: Why is this here!!!!?! |
535 zoomFactor = effectiveZoom; | 533 if (LocalFrame* frame = m_document->frame()) |
536 // FIXME: Why is this here!!!!?! | 534 zoomFactor *= frame->textZoomFactor(); |
537 if (LocalFrame* frame = m_document->frame()) | |
538 zoomFactor *= frame->textZoomFactor(); | |
539 } | |
540 | 535 |
541 return FontSize::getComputedSizeFromSpecifiedSize(m_document, zoomFactor, fo
ntDescription.isAbsoluteSize(), specifiedSize); | 536 return FontSize::getComputedSizeFromSpecifiedSize(m_document, zoomFactor, fo
ntDescription.isAbsoluteSize(), specifiedSize); |
542 } | 537 } |
543 | 538 |
544 static void getFontAndGlyphOrientation(const RenderStyle* style, FontOrientation
& fontOrientation, NonCJKGlyphOrientation& glyphOrientation) | 539 static void getFontAndGlyphOrientation(const RenderStyle* style, FontOrientation
& fontOrientation, NonCJKGlyphOrientation& glyphOrientation) |
545 { | 540 { |
546 if (style->isHorizontalWritingMode()) { | 541 if (style->isHorizontalWritingMode()) { |
547 fontOrientation = Horizontal; | 542 fontOrientation = Horizontal; |
548 glyphOrientation = NonCJKGlyphOrientationVerticalRight; | 543 glyphOrientation = NonCJKGlyphOrientationVerticalRight; |
549 return; | 544 return; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 FontOrientation fontOrientation; | 660 FontOrientation fontOrientation; |
666 NonCJKGlyphOrientation glyphOrientation; | 661 NonCJKGlyphOrientation glyphOrientation; |
667 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation)
; | 662 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation)
; |
668 fontDescription.setOrientation(fontOrientation); | 663 fontDescription.setOrientation(fontOrientation); |
669 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); | 664 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); |
670 documentStyle->setFontDescription(fontDescription); | 665 documentStyle->setFontDescription(fontDescription); |
671 documentStyle->font().update(fontSelector); | 666 documentStyle->font().update(fontSelector); |
672 } | 667 } |
673 | 668 |
674 } | 669 } |
OLD | NEW |