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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp

Issue 2392343005: Reflow comments in core/css (Closed)
Patch Set: Revert clang-format Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 const FontDescription& fontDescription) { 96 const FontDescription& fontDescription) {
97 if (!isValid()) 97 if (!isValid())
98 return nullptr; 98 return nullptr;
99 99
100 FontTraits desiredTraits = fontDescription.traits(); 100 FontTraits desiredTraits = fontDescription.traits();
101 FontCacheKey key = 101 FontCacheKey key =
102 fontDescription.cacheKey(FontFaceCreationParams(), desiredTraits); 102 fontDescription.cacheKey(FontFaceCreationParams(), desiredTraits);
103 103
104 RefPtr<SegmentedFontData>& fontData = 104 RefPtr<SegmentedFontData>& fontData =
105 m_fontDataTable.add(key, nullptr).storedValue->value; 105 m_fontDataTable.add(key, nullptr).storedValue->value;
106 if (fontData && fontData->numFaces()) 106 if (fontData && fontData->numFaces()) {
107 return fontData; // No release, we have a reference to an object in the cac he which should retain the ref count it has. 107 // No release, we have a reference to an object in the cache which should
108 // retain the ref count it has.
109 return fontData;
110 }
108 111
109 if (!fontData) 112 if (!fontData)
110 fontData = SegmentedFontData::create(); 113 fontData = SegmentedFontData::create();
111 114
112 FontDescription requestedFontDescription(fontDescription); 115 FontDescription requestedFontDescription(fontDescription);
113 requestedFontDescription.setTraits(m_traits); 116 requestedFontDescription.setTraits(m_traits);
114 requestedFontDescription.setSyntheticBold(m_traits.weight() < FontWeight600 && 117 requestedFontDescription.setSyntheticBold(m_traits.weight() < FontWeight600 &&
115 desiredTraits.weight() >= 118 desiredTraits.weight() >=
116 FontWeight600); 119 FontWeight600);
117 requestedFontDescription.setSyntheticItalic( 120 requestedFontDescription.setSyntheticItalic(
118 m_traits.style() == FontStyleNormal && 121 m_traits.style() == FontStyleNormal &&
119 desiredTraits.style() == FontStyleItalic); 122 desiredTraits.style() == FontStyleItalic);
120 123
121 for (FontFaceList::reverse_iterator it = m_fontFaces.rbegin(); 124 for (FontFaceList::reverse_iterator it = m_fontFaces.rbegin();
122 it != m_fontFaces.rend(); ++it) { 125 it != m_fontFaces.rend(); ++it) {
123 if (!(*it)->cssFontFace()->isValid()) 126 if (!(*it)->cssFontFace()->isValid())
124 continue; 127 continue;
125 if (RefPtr<SimpleFontData> faceFontData = 128 if (RefPtr<SimpleFontData> faceFontData =
126 (*it)->cssFontFace()->getFontData(requestedFontDescription)) { 129 (*it)->cssFontFace()->getFontData(requestedFontDescription)) {
127 ASSERT(!faceFontData->isSegmented()); 130 ASSERT(!faceFontData->isSegmented());
128 if (faceFontData->isCustomFont()) 131 if (faceFontData->isCustomFont())
129 fontData->appendFace(adoptRef(new FontDataForRangeSet( 132 fontData->appendFace(adoptRef(new FontDataForRangeSet(
130 faceFontData.release(), (*it)->cssFontFace()->ranges()))); 133 faceFontData.release(), (*it)->cssFontFace()->ranges())));
131 else 134 else
132 fontData->appendFace(adoptRef(new FontDataForRangeSetFromCache( 135 fontData->appendFace(adoptRef(new FontDataForRangeSetFromCache(
133 faceFontData.release(), (*it)->cssFontFace()->ranges()))); 136 faceFontData.release(), (*it)->cssFontFace()->ranges())));
134 } 137 }
135 } 138 }
136 if (fontData->numFaces()) 139 if (fontData->numFaces()) {
137 return fontData; // No release, we have a reference to an object in the cac he which should retain the ref count it has. 140 // No release, we have a reference to an object in the cache which should
141 // retain the ref count it has.
142 return fontData;
143 }
138 144
139 return nullptr; 145 return nullptr;
140 } 146 }
141 147
142 void CSSSegmentedFontFace::willUseFontData( 148 void CSSSegmentedFontFace::willUseFontData(
143 const FontDescription& fontDescription, 149 const FontDescription& fontDescription,
144 const String& text) { 150 const String& text) {
145 m_approximateCharacterCount += text.length(); 151 m_approximateCharacterCount += text.length();
146 for (FontFaceList::reverse_iterator it = m_fontFaces.rbegin(); 152 for (FontFaceList::reverse_iterator it = m_fontFaces.rbegin();
147 it != m_fontFaces.rend(); ++it) { 153 it != m_fontFaces.rend(); ++it) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 faces.append(fontFace); 188 faces.append(fontFace);
183 } 189 }
184 } 190 }
185 191
186 DEFINE_TRACE(CSSSegmentedFontFace) { 192 DEFINE_TRACE(CSSSegmentedFontFace) {
187 visitor->trace(m_fontSelector); 193 visitor->trace(m_fontSelector);
188 visitor->trace(m_fontFaces); 194 visitor->trace(m_fontFaces);
189 } 195 }
190 196
191 } // namespace blink 197 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPropertySourceData.h ('k') | third_party/WebKit/Source/core/css/CSSSelector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698