Changeset 150716 in webkit
- Timestamp:
- May 26, 2013 7:50:51 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150715 r150716 1 2013-05-26 Antti Koivisto <antti@apple.com> 2 3 Use Vector instead of custom linked list for font families 4 https://bugs.webkit.org/show_bug.cgi?id=116783 5 6 Reviewed by Andreas Kling. 7 8 Get rid of FontFamily and SharedFontFamily. 9 10 * accessibility/AccessibilityRenderObject.cpp: 11 (WebCore::AccessibilityRenderObject::hasSameFont): 12 * accessibility/atk/WebKitAccessibleInterfaceText.cpp: 13 (getAttributeSetForAccessibilityObject): 14 * css/CSSComputedStyleDeclaration.cpp: 15 (WebCore::fontFamilyFromStyle): 16 * css/DeprecatedStyleBuilder.cpp: 17 (WebCore::ApplyPropertyFontFamily::applyInheritValue): 18 (WebCore::ApplyPropertyFontFamily::applyInitialValue): 19 (WebCore::ApplyPropertyFontFamily::applyValue): 20 * css/StyleResolver.cpp: 21 (WebCore::StyleResolver::styleForDocument): 22 (WebCore::StyleResolver::initializeFontStyle): 23 * html/canvas/CanvasRenderingContext2D.cpp: 24 (WebCore::CanvasRenderingContext2D::font): 25 (WebCore::CanvasRenderingContext2D::setFont): 26 * page/PrintContext.cpp: 27 (WebCore::PrintContext::pageProperty): 28 * platform/efl/RenderThemeEfl.cpp: 29 (WebCore::RenderThemeEfl::systemFont): 30 * platform/graphics/Font.h: 31 (WebCore::Font::firstFamily): 32 (WebCore::Font::familyCount): 33 (WebCore::Font::familyAt): 34 * platform/graphics/FontCache.cpp: 35 (WebCore::FontCache::getFontData): 36 * platform/graphics/FontDescription.cpp: 37 (SameSizeAsFontDescription): 38 * platform/graphics/FontDescription.h: 39 (WebCore::FontDescription::FontDescription): 40 (WebCore::FontDescription::familyCount): 41 (WebCore::FontDescription::firstFamily): 42 (WebCore::FontDescription::familyAt): 43 (WebCore::FontDescription::families): 44 (WebCore::FontDescription::useFixedDefaultSize): 45 (WebCore::FontDescription::setOneFamily): 46 (WebCore::FontDescription::setFamilies): 47 (WebCore::FontDescription::adoptFamilies): 48 (WebCore::FontDescription::operator==): 49 * platform/graphics/FontFamily.cpp: 50 * platform/graphics/FontFamily.h: 51 * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp: 52 (PlatformCALayerWinInternal::displayCallback): 53 * platform/graphics/mac/FontCacheMac.mm: 54 (WebCore::FontCache::getSimilarFontPlatformData): 55 * platform/graphics/qt/FontCacheQt.cpp: 56 (WebCore::FontCache::getLastResortFallbackFont): 57 * platform/gtk/RenderThemeGtk.cpp: 58 (WebCore::RenderThemeGtk::systemFont): 59 * platform/mac/ThemeMac.mm: 60 (WebCore::ThemeMac::controlFont): 61 * platform/qt/RenderThemeQStyle.cpp: 62 (WebCore::RenderThemeQStyle::adjustButtonStyle): 63 * platform/text/transcoder/FontTranscoder.cpp: 64 (WebCore::FontTranscoder::converterType): 65 * platform/win/DragImageWin.cpp: 66 (WebCore::dragLabelFont): 67 * rendering/RenderText.cpp: 68 (WebCore::RenderText::styleDidChange): 69 * rendering/RenderTextControl.cpp: 70 (WebCore::RenderTextControl::computeIntrinsicLogicalWidths): 71 * rendering/RenderTextControlSingleLine.cpp: 72 (WebCore::RenderTextControlSingleLine::preferredContentLogicalWidth): 73 * rendering/RenderThemeMac.mm: 74 (WebCore::RenderThemeMac::systemFont): 75 (WebCore::RenderThemeMac::setFontFromControlSize): 76 * rendering/RenderThemeSafari.cpp: 77 (WebCore::RenderThemeSafari::systemFont): 78 (WebCore::RenderThemeSafari::setFontFromControlSize): 79 * rendering/RenderThemeWin.cpp: 80 (WebCore::fillFontDescription): 81 1 82 2013-05-26 Andreas Kling <akling@apple.com> 2 83 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r150525 r150716 3243 3243 return false; 3244 3244 3245 return m_renderer->style()->fontDescription().famil y() == renderer->style()->fontDescription().family();3245 return m_renderer->style()->fontDescription().families() == renderer->style()->fontDescription().families(); 3246 3246 } 3247 3247 -
trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp
r150525 r150716 254 254 } 255 255 256 String fontFamilyName = style->font().f amily().family().string();256 String fontFamilyName = style->font().firstFamily(); 257 257 if (fontFamilyName.left(8) == "-webkit-") 258 258 fontFamilyName = fontFamilyName.substring(8); -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r150554 r150716 1451 1451 1452 1452 static PassRefPtr<CSSValueList> fontFamilyFromStyle(RenderStyle* style) 1453 { 1454 const FontFamily& firstFamily = style->fontDescription().family(); 1453 { 1455 1454 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 1456 for ( const FontFamily* family = &firstFamily; family; family = family->next())1457 list->append(valueForFamily( family->family()));1455 for (unsigned i = 0; i < style->font().familyCount(); ++i) 1456 list->append(valueForFamily(style->font().familyAt(i))); 1458 1457 return list.release(); 1459 1458 } -
trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp
r150525 r150716 1 1 /* 2 2 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 665 666 666 667 fontDescription.setGenericFamily(parentFontDescription.genericFamily()); 667 fontDescription.setFamil y(parentFontDescription.firstFamily());668 fontDescription.setFamilies(parentFontDescription.families()); 668 669 fontDescription.setIsSpecifiedFont(parentFontDescription.isSpecifiedFont()); 669 670 styleResolver->setFontDescription(fontDescription); … … 680 681 styleResolver->setFontSize(fontDescription, styleResolver->fontSizeForKeyword(styleResolver->document(), CSSValueXxSmall + fontDescription.keywordSize() - 1, false)); 681 682 fontDescription.setGenericFamily(initialDesc.genericFamily()); 682 if (!initialDesc.firstFamily(). familyIsEmpty())683 fontDescription.setFamil y(initialDesc.firstFamily());683 if (!initialDesc.firstFamily().isEmpty()) 684 fontDescription.setFamilies(initialDesc.families()); 684 685 685 686 styleResolver->setFontDescription(fontDescription); … … 693 694 694 695 FontDescription fontDescription = styleResolver->style()->fontDescription(); 695 FontFamily& firstFamily = fontDescription.firstFamily();696 FontFamily* currFamily = 0;697 698 696 // Before mapping in a new font-family property, we should reset the generic family. 699 697 bool oldFamilyUsedFixedDefaultSize = fontDescription.useFixedDefaultSize(); 700 698 fontDescription.setGenericFamily(FontDescription::NoFamily); 701 699 700 Vector<AtomicString, 1> families; 702 701 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { 703 702 CSSValue* item = i.value(); … … 706 705 CSSPrimitiveValue* contentValue = static_cast<CSSPrimitiveValue*>(item); 707 706 AtomicString face; 708 Settings* settings = styleResolver->document()->settings();709 707 if (contentValue->isString()) 710 708 face = contentValue->getStringValue(); 711 else if ( settings) {709 else if (Settings* settings = styleResolver->document()->settings()) { 712 710 switch (contentValue->getIdent()) { 713 711 case CSSValueWebkitBody: … … 741 739 } 742 740 743 if (!face.isEmpty()) { 744 if (!currFamily) { 745 // Filling in the first family. 746 firstFamily.setFamily(face); 747 firstFamily.appendFamily(0); // Remove any inherited family-fallback list. 748 currFamily = &firstFamily; 749 fontDescription.setIsSpecifiedFont(fontDescription.genericFamily() == FontDescription::NoFamily); 750 } else { 751 RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create(); 752 newFamily->setFamily(face); 753 currFamily->appendFamily(newFamily); 754 currFamily = newFamily.get(); 755 } 756 } 757 } 758 759 // We can't call useFixedDefaultSize() until all new font families have been added 760 // If currFamily is non-zero then we set at least one family on this description. 761 if (currFamily) { 762 if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize) 763 styleResolver->setFontSize(fontDescription, styleResolver->fontSizeForKeyword(styleResolver->document(), CSSValueXxSmall + fontDescription.keywordSize() - 1, !oldFamilyUsedFixedDefaultSize)); 764 765 styleResolver->setFontDescription(fontDescription); 766 } 767 return; 741 if (face.isEmpty()) 742 continue; 743 if (families.isEmpty()) 744 fontDescription.setIsSpecifiedFont(fontDescription.genericFamily() == FontDescription::NoFamily); 745 families.append(face); 746 } 747 748 if (families.isEmpty()) 749 return; 750 fontDescription.adoptFamilies(families); 751 752 if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize) 753 styleResolver->setFontSize(fontDescription, styleResolver->fontSizeForKeyword(styleResolver->document(), CSSValueXxSmall + fontDescription.keywordSize() - 1, !oldFamilyUsedFixedDefaultSize)); 754 755 styleResolver->setFontDescription(fontDescription); 768 756 } 769 757 -
trunk/Source/WebCore/css/StyleResolver.cpp
r150387 r150716 921 921 if (!standardFont.isEmpty()) { 922 922 fontDescription.setGenericFamily(FontDescription::StandardFamily); 923 fontDescription.firstFamily().setFamily(standardFont); 924 fontDescription.firstFamily().appendFamily(0); 923 fontDescription.setOneFamily(standardFont); 925 924 } 926 925 fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); … … 3272 3271 fontDescription.setUsePrinterFont(document()->printing() || !settings->screenFontSubstitutionEnabled()); 3273 3272 const AtomicString& standardFontFamily = documentSettings()->standardFontFamily(); 3274 if (!standardFontFamily.isEmpty()) { 3275 fontDescription.firstFamily().setFamily(standardFontFamily); 3276 fontDescription.firstFamily().appendFamily(0); 3277 } 3273 if (!standardFontFamily.isEmpty()) 3274 fontDescription.setOneFamily(standardFontFamily); 3278 3275 fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); 3279 3276 setFontSize(fontDescription, fontSizeForKeyword(document(), CSSValueMedium, false)); -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r150137 r150716 1981 1981 serializedFont.appendLiteral("px"); 1982 1982 1983 const FontFamily& firstFontFamily = fontDescription.family(); 1984 for (const FontFamily* fontFamily = &firstFontFamily; fontFamily; fontFamily = fontFamily->next()) { 1985 if (fontFamily != &firstFontFamily) 1983 for (unsigned i = 0; i < state().m_font.familyCount(); ++i) { 1984 if (i) 1986 1985 serializedFont.append(','); 1987 1988 1986 // FIXME: We should append family directly to serializedFont rather than building a temporary string. 1989 String family = fontFamily->family();1987 String family = state().m_font.familyAt(i); 1990 1988 if (family.startsWith("-webkit-")) 1991 1989 family = family.substring(8); … … 2028 2026 newStyle->setFontDescription(computedStyle->fontDescription()); 2029 2027 else { 2030 FontFamily fontFamily;2031 fontFamily.setFamily(defaultFontFamily);2032 2033 2028 FontDescription defaultFontDescription; 2034 defaultFontDescription.set Family(fontFamily);2029 defaultFontDescription.setOneFamily(defaultFontFamily); 2035 2030 defaultFontDescription.setSpecifiedSize(defaultFontSize); 2036 2031 defaultFontDescription.setComputedSize(defaultFontSize); -
trunk/Source/WebCore/page/PrintContext.cpp
r133813 r150716 280 280 return String::number(style->fontDescription().computedPixelSize()); 281 281 if (!strcmp(propertyName, "font-family")) 282 return style->fontDescription().f amily().family().string();282 return style->fontDescription().firstFamily(); 283 283 if (!strcmp(propertyName, "size")) 284 284 return String::number(style->pageSize().width().value()) + ' ' + String::number(style->pageSize().height().value()); -
trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp
r147911 r150716 1019 1019 float fontSize = defaultFontSize; 1020 1020 1021 fontDescription. firstFamily().setFamily(fontFace);1021 fontDescription.setOneFamily(fontFace); 1022 1022 fontDescription.setSpecifiedSize(fontSize); 1023 1023 fontDescription.setIsAbsoluteSize(true); -
trunk/Source/WebCore/platform/graphics/Font.h
r147888 r150716 131 131 TypesettingFeatures typesettingFeatures() const { return m_typesettingFeatures; } 132 132 133 FontFamily& firstFamily() { return m_fontDescription.firstFamily(); } 134 const FontFamily& family() const { return m_fontDescription.family(); } 133 const AtomicString& firstFamily() const { return m_fontDescription.firstFamily(); } 134 unsigned familyCount() const { return m_fontDescription.familyCount(); } 135 const AtomicString& familyAt(unsigned i) const { return m_fontDescription.familyAt(i); } 135 136 136 137 FontItalic italic() const { return m_fontDescription.italic(); } -
trunk/Source/WebCore/platform/graphics/FontCache.cpp
r147889 r150716 1 1 /* 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2008, 2013 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 4 4 * … … 480 480 PassRefPtr<FontData> FontCache::getFontData(const Font& font, int& familyIndex, FontSelector* fontSelector) 481 481 { 482 ASSERT(familyIndex != cAllFamiliesScanned); 482 483 RefPtr<FontData> result; 483 484 484 int startIndex = familyIndex; 485 const FontFamily* startFamily = &font.fontDescription().family(); 486 for (int i = 0; startFamily && i < startIndex; i++) 487 startFamily = startFamily->next(); 488 const FontFamily* currFamily = startFamily; 489 while (currFamily && !result) { 490 familyIndex++; 491 if (currFamily->family().length()) { 492 if (fontSelector) 493 result = fontSelector->getFontData(font.fontDescription(), currFamily->family()); 494 495 if (!result) 496 result = getCachedFontData(font.fontDescription(), currFamily->family()); 497 } 498 currFamily = currFamily->next(); 499 } 500 501 if (!currFamily) 485 bool isFirst = !familyIndex; 486 int familyCount = font.familyCount(); 487 for (;familyIndex < familyCount && !result; ++familyIndex) { 488 const AtomicString& family = font.familyAt(familyIndex); 489 if (family.isEmpty()) 490 continue; 491 if (fontSelector) 492 result = fontSelector->getFontData(font.fontDescription(), family); 493 if (!result) 494 result = getCachedFontData(font.fontDescription(), family); 495 } 496 if (familyIndex == familyCount) 502 497 familyIndex = cAllFamiliesScanned; 503 498 504 if (!result) 499 if (!result) { 505 500 // We didn't find a font. Try to find a similar font using our own specific knowledge about our platform. 506 501 // For example on OS X, we know to map any families containing the words Arabic, Pashto, or Urdu to the 507 502 // Geeza Pro font. 508 503 result = getSimilarFontPlatformData(font); 509 510 if (!result && startIndex == 0) { 504 } 505 506 if (!result && isFirst) { 511 507 // If it's the primary font that we couldn't find, we try the following. In all other cases, we will 512 508 // just use per-character system fallback. 513 514 509 if (fontSelector) { 515 510 // Try the user's preferred standard font. … … 517 512 return data.release(); 518 513 } 519 520 514 // Still no result. Hand back our last resort fallback font. 521 515 result = getLastResortFallbackFont(font.fontDescription()); -
trunk/Source/WebCore/platform/graphics/FontDescription.cpp
r117868 r150716 1 1 /* 2 2 * Copyright (C) 2007 Nicholas Shanks <contact@nickshanks.com> 3 * Copyright (C) 2008 Apple Inc. All rights reserved.3 * Copyright (C) 2008, 2013 Apple Inc. All rights reserved. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 34 34 35 35 struct SameSizeAsFontDescription { 36 FontFamily familyList;36 Vector<AtomicString, 1> families; 37 37 RefPtr<FontFeatureSettings> m_featureSettings; 38 38 float sizes[2]; -
trunk/Source/WebCore/platform/graphics/FontDescription.h
r147888 r150716 3 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2013 Apple Inc. All rights reserved. 6 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 7 7 * … … 78 78 79 79 FontDescription() 80 : m_specifiedSize(0) 80 : m_families(1) 81 , m_specifiedSize(0) 81 82 , m_computedSize(0) 82 83 , m_orientation(Horizontal) … … 104 105 bool operator==(const FontDescription&) const; 105 106 bool operator!=(const FontDescription& other) const { return !(*this == other); } 106 107 const FontFamily& family() const { return m_familyList; } 108 FontFamily& firstFamily() { return m_familyList; } 107 108 unsigned familyCount() const { return m_families.size(); } 109 const AtomicString& firstFamily() const { return familyAt(0); } 110 const AtomicString& familyAt(unsigned i) const { return m_families[i]; } 111 const Vector<AtomicString, 1>& families() const { return m_families; } 112 109 113 float specifiedSize() const { return m_specifiedSize; } 110 114 float computedSize() const { return m_computedSize; } … … 119 123 bool usePrinterFont() const { return m_usePrinterFont; } 120 124 // only use fixed default size when there is only one font family, and that family is "monospace" 121 bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == monospaceFamily; }125 bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && familyCount() == 1 && firstFamily() == monospaceFamily; } 122 126 FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); } 123 127 Kerning kerning() const { return static_cast<Kerning>(m_kerning); } … … 138 142 FontDescription makeNormalFeatureSettings() const; 139 143 140 void setFamily(const FontFamily& family) { m_familyList = family; } 144 void setOneFamily(const AtomicString& family) { ASSERT(m_families.size() == 1); m_families[0] = family; } 145 void setFamilies(const Vector<AtomicString, 1>& families) { m_families = families; } 146 void adoptFamilies(Vector<AtomicString, 1>& families) { m_families.swap(families); } 141 147 void setComputedSize(float s) { m_computedSize = clampToFloat(s); } 142 148 void setSpecifiedSize(float s) { m_specifiedSize = clampToFloat(s); } … … 165 171 166 172 private: 167 FontFamily m_familyList; // The list of font families to be used.173 Vector<AtomicString, 1> m_families; 168 174 RefPtr<FontFeatureSettings> m_featureSettings; 169 175 … … 204 210 inline bool FontDescription::operator==(const FontDescription& other) const 205 211 { 206 return m_famil yList == other.m_familyList212 return m_families == other.m_families 207 213 && m_specifiedSize == other.m_specifiedSize 208 214 && m_computedSize == other.m_computedSize -
trunk/Source/WebCore/platform/graphics/FontFamily.cpp
r118177 r150716 1 /* 2 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 #include "config.h" 27 #include "FontFamily.h" 28 29 namespace WebCore { 30 31 bool operator==(const FontFamily& a, const FontFamily& b) 32 { 33 if (a.family() != b.family()) 34 return false; 35 const FontFamily* ap; 36 const FontFamily* bp; 37 for (ap = a.next(), bp = b.next(); ap != bp; ap = ap->next(), bp = bp->next()) { 38 if (!ap || !bp) 39 return false; 40 if (ap->family() != bp->family()) 41 return false; 42 } 43 return true; 44 } 45 46 } 1 // Remove me. -
trunk/Source/WebCore/platform/graphics/FontFamily.h
r149523 r150716 1 /* 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 #ifndef FontFamily_h 27 #define FontFamily_h 28 29 #include <wtf/RefCounted.h> 30 #include <wtf/RefPtr.h> 31 #include <wtf/text/AtomicString.h> 32 33 namespace WebCore { 34 35 class SharedFontFamily; 36 37 class FontFamily { 38 public: 39 FontFamily() { } 40 ~FontFamily(); 41 42 void setFamily(const AtomicString& family) { m_family = family; } 43 const AtomicString& family() const { return m_family; } 44 bool familyIsEmpty() const { return m_family.isEmpty(); } 45 46 const FontFamily* next() const; 47 48 void appendFamily(PassRefPtr<SharedFontFamily>); 49 PassRefPtr<SharedFontFamily> releaseNext(); 50 51 private: 52 AtomicString m_family; 53 RefPtr<SharedFontFamily> m_next; 54 }; 55 56 class SharedFontFamily : public FontFamily, public RefCounted<SharedFontFamily> { 57 public: 58 static PassRefPtr<SharedFontFamily> create() 59 { 60 return adoptRef(new SharedFontFamily); 61 } 62 63 private: 64 SharedFontFamily() { } 65 }; 66 67 bool operator==(const FontFamily&, const FontFamily&); 68 inline bool operator!=(const FontFamily& a, const FontFamily& b) { return !(a == b); } 69 70 inline FontFamily::~FontFamily() 71 { 72 // This code came from removed ListRefPtr to avoid possible overflowing the stack. 73 // FIXME: Do we really need it? 74 RefPtr<SharedFontFamily> reaper = m_next.release(); 75 while (reaper && reaper->hasOneRef()) 76 reaper = reaper->releaseNext(); // implicitly protects reaper->next, then derefs reaper 77 } 78 79 inline const FontFamily* FontFamily::next() const 80 { 81 return m_next.get(); 82 } 83 84 inline void FontFamily::appendFamily(PassRefPtr<SharedFontFamily> family) 85 { 86 m_next = family; 87 } 88 89 inline PassRefPtr<SharedFontFamily> FontFamily::releaseNext() 90 { 91 return m_next.release(); 92 } 93 94 } 95 96 #endif 1 // Remove me. -
trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp
r149716 r150716 125 125 metrics.cbSize = sizeof(metrics); 126 126 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0); 127 FontFamily family; 128 family.setFamily(metrics.lfSmCaptionFont.lfFaceName); 129 desc.setFamily(family); 127 desc.setOneFamily(metrics.lfSmCaptionFont.lfFaceName); 130 128 131 129 desc.setComputedSize(18); -
trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm
r147863 r150716 160 160 // match any name that contains "Arabic" to Geeza Pro. 161 161 RefPtr<SimpleFontData> simpleFontData; 162 const FontFamily* currFamily = &font.fontDescription().family(); 163 while (currFamily && !simpleFontData) { 164 if (currFamily->family().length()) { 165 static String* matchWords[3] = { new String("Arabic"), new String("Pashto"), new String("Urdu") }; 166 DEFINE_STATIC_LOCAL(AtomicString, geezaStr, ("Geeza Pro", AtomicString::ConstructFromLiteral)); 167 for (int j = 0; j < 3 && !simpleFontData; ++j) 168 if (currFamily->family().contains(*matchWords[j], false)) 169 simpleFontData = getCachedFontData(font.fontDescription(), geezaStr); 170 } 171 currFamily = currFamily->next(); 172 } 173 162 for (unsigned i = 0; i < font.familyCount(); ++i) { 163 const AtomicString& family = font.familyAt(i); 164 if (family.isEmpty()) 165 continue; 166 static String* matchWords[3] = { new String("Arabic"), new String("Pashto"), new String("Urdu") }; 167 DEFINE_STATIC_LOCAL(AtomicString, geezaStr, ("Geeza Pro", AtomicString::ConstructFromLiteral)); 168 for (int j = 0; j < 3 && !simpleFontData; ++j) 169 if (family.contains(*matchWords[j], false)) 170 simpleFontData = getCachedFontData(font.fontDescription(), geezaStr); 171 } 174 172 return simpleFontData.release(); 175 173 } -
trunk/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp
r147639 r150716 81 81 PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont(const FontDescription& fontDescription, ShouldRetain shouldRetain) 82 82 { 83 const AtomicString fallbackFamily = QFont(fontDescription.f amily().family()).lastResortFamily();83 const AtomicString fallbackFamily = QFont(fontDescription.firstFamily()).lastResortFamily(); 84 84 return getCachedFontData(new FontPlatformData(fontDescription, fallbackFamily), shouldRetain); 85 85 } -
trunk/Source/WebCore/platform/gtk/RenderThemeGtk.cpp
r149539 r150716 452 452 return; 453 453 454 fontDescription. firstFamily().setFamily(pango_font_description_get_family(pangoDescription));454 fontDescription.setOneFamily(pango_font_description_get_family(pangoDescription)); 455 455 456 456 int size = pango_font_description_get_size(pangoDescription) / PANGO_SCALE; -
trunk/Source/WebCore/platform/mac/ThemeMac.mm
r150530 r150716 608 608 609 609 NSFont* nsFont = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:controlSizeForFont(font)]]; 610 fontDescription. firstFamily().setFamily([nsFont webCoreFamilyName]);610 fontDescription.setOneFamily([nsFont webCoreFamilyName]); 611 611 fontDescription.setComputedSize([nsFont pointSize] * zoomFactor); 612 612 fontDescription.setSpecifiedSize([nsFont pointSize] * zoomFactor); -
trunk/Source/WebCore/platform/qt/RenderThemeQStyle.cpp
r150214 r150716 251 251 #endif 252 252 253 FontFamily fontFamily; 254 fontFamily.setFamily(m_buttonFontFamily); 255 fontDescription.setFamily(fontFamily); 253 fontDescription.setOneFamily(m_buttonFontFamily); 256 254 style->setFontDescription(fontDescription); 257 255 style->font().update(styleResolver->fontSelector()); -
trunk/Source/WebCore/platform/text/transcoder/FontTranscoder.cpp
r130612 r150716 63 63 FontTranscoder::ConverterType FontTranscoder::converterType(const FontDescription& fontDescription, const TextEncoding* encoding) const 64 64 { 65 const AtomicString& fontFamily = fontDescription.f amily().family().string();65 const AtomicString& fontFamily = fontDescription.firstFamily(); 66 66 if (!fontFamily.isNull()) { 67 67 HashMap<AtomicString, ConverterType>::const_iterator found = m_converterTypes.find(fontFamily); -
trunk/Source/WebCore/platform/win/DragImageWin.cpp
r147974 r150716 111 111 FontDescription description; 112 112 description.setWeight(bold ? FontWeightBold : FontWeightNormal); 113 114 FontFamily family; 115 family.setFamily(metrics.lfSmCaptionFont.lfFaceName); 116 description.setFamily(family); 113 description.setOneFamily(metrics.lfSmCaptionFont.lfFaceName); 117 114 description.setSpecifiedSize((float)size); 118 115 description.setComputedSize((float)size); -
trunk/Source/WebCore/rendering/RenderText.cpp
r150259 r150716 209 209 updateNeedsTranscoding(); 210 210 needsResetText = m_needsTranscoding; 211 } else if (oldStyle->font().needsTranscoding() != newStyle->font().needsTranscoding() || (newStyle->font().needsTranscoding() && oldStyle->font().f amily().family() != newStyle->font().family().family())) {211 } else if (oldStyle->font().needsTranscoding() != newStyle->font().needsTranscoding() || (newStyle->font().needsTranscoding() && oldStyle->font().firstFamily() != newStyle->font().firstFamily())) { 212 212 updateNeedsTranscoding(); 213 213 needsResetText = true; -
trunk/Source/WebCore/rendering/RenderTextControl.cpp
r149880 r150716 263 263 { 264 264 // Use average character width. Matches IE. 265 AtomicString family = style()->font().family().family();265 const AtomicString& family = style()->font().firstFamily(); 266 266 maxLogicalWidth = preferredContentLogicalWidth(const_cast<RenderTextControl*>(this)->getAvgCharWidth(family)); 267 267 if (RenderBox* innerTextRenderBox = innerTextElement()->renderBox()) -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
r148536 r150716 324 324 325 325 float maxCharWidth = 0.f; 326 AtomicString family = style()->font().family().family();326 const AtomicString& family = style()->font().firstFamily(); 327 327 // Since Lucida Grande is the default font, we want this to match the width 328 328 // of MS Shell Dlg, the default font for textareas in Firefox, Safari Win and -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r150715 r150716 652 652 cachedDesc->setIsAbsoluteSize(true); 653 653 cachedDesc->setGenericFamily(FontDescription::NoFamily); 654 cachedDesc-> firstFamily().setFamily([font webCoreFamilyName]);654 cachedDesc->setOneFamily([font webCoreFamilyName]); 655 655 cachedDesc->setSpecifiedSize([font pointSize]); 656 656 cachedDesc->setWeight(toFontWeight([fontManager weightOfFont:font])); … … 1059 1059 1060 1060 NSFont* font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:controlSize]]; 1061 fontDescription. firstFamily().setFamily([font webCoreFamilyName]);1061 fontDescription.setOneFamily([font webCoreFamilyName]); 1062 1062 fontDescription.setComputedSize([font pointSize] * style->effectiveZoom()); 1063 1063 fontDescription.setSpecifiedSize([font pointSize] * style->effectiveZoom()); -
trunk/Source/WebCore/rendering/RenderThemeSafari.cpp
r149716 r150716 240 240 cachedDesc->setIsAbsoluteSize(true); 241 241 cachedDesc->setGenericFamily(FontDescription::NoFamily); 242 cachedDesc-> firstFamily().setFamily("Lucida Grande");242 cachedDesc->setOneFamily("Lucida Grande"); 243 243 cachedDesc->setSpecifiedSize(fontSize); 244 244 cachedDesc->setWeight(FontWeightNormal); … … 391 391 392 392 float fontSize = systemFontSizeForControlSize(controlSize); 393 fontDescription. firstFamily().setFamily("Lucida Grande");393 fontDescription.setOneFamily("Lucida Grande"); 394 394 fontDescription.setComputedSize(fontSize); 395 395 fontDescription.setSpecifiedSize(fontSize); -
trunk/Source/WebCore/rendering/RenderThemeWin.cpp
r149284 r150716 286 286 fontDescription.setIsAbsoluteSize(true); 287 287 fontDescription.setGenericFamily(FontDescription::NoFamily); 288 fontDescription. firstFamily().setFamily(String(logFont.lfFaceName));288 fontDescription.setOneFamily(String(logFont.lfFaceName)); 289 289 fontDescription.setSpecifiedSize(fontSize); 290 290 fontDescription.setWeight(logFont.lfWeight >= 700 ? FontWeightBold : FontWeightNormal); // FIXME: Use real weight.
Note: See TracChangeset
for help on using the changeset viewer.