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

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

Issue 68933007: Add CSSFontSelector::removeFontFaceRule() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Avoid double hash lookups Created 7 years, 1 month 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/CSSSegmentedFontFace.h ('k') | Source/core/css/CSSSegmentedFontFaceCache.h » ('j') | 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) 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 } 87 }
88 88
89 void CSSSegmentedFontFace::appendFontFace(PassRefPtr<CSSFontFace> fontFace) 89 void CSSSegmentedFontFace::appendFontFace(PassRefPtr<CSSFontFace> fontFace)
90 { 90 {
91 pruneTable(); 91 pruneTable();
92 fontFace->setSegmentedFontFace(this); 92 fontFace->setSegmentedFontFace(this);
93 m_fontFaces.append(fontFace); 93 m_fontFaces.append(fontFace);
94 } 94 }
95 95
96 void CSSSegmentedFontFace::removeFontFace(PassRefPtr<CSSFontFace> fontFace)
97 {
98 size_t index = m_fontFaces.find(fontFace);
99 if (index != kNotFound) {
100 pruneTable();
101 m_fontFaces.remove(index);
102 fontFace->clearSegmentedFontFace();
103 }
104 }
105
96 static void appendFontData(SegmentedFontData* newFontData, PassRefPtr<SimpleFont Data> prpFaceFontData, const CSSFontFace::UnicodeRangeSet& ranges) 106 static void appendFontData(SegmentedFontData* newFontData, PassRefPtr<SimpleFont Data> prpFaceFontData, const CSSFontFace::UnicodeRangeSet& ranges)
97 { 107 {
98 RefPtr<SimpleFontData> faceFontData = prpFaceFontData; 108 RefPtr<SimpleFontData> faceFontData = prpFaceFontData;
99 unsigned numRanges = ranges.size(); 109 unsigned numRanges = ranges.size();
100 if (!numRanges) { 110 if (!numRanges) {
101 newFontData->appendRange(FontDataRange(0, 0x7FFFFFFF, faceFontData)); 111 newFontData->appendRange(FontDataRange(0, 0x7FFFFFFF, faceFontData));
102 return; 112 return;
103 } 113 }
104 114
105 for (unsigned j = 0; j < numRanges; ++j) 115 for (unsigned j = 0; j < numRanges; ++j)
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 unsigned size = m_fontFaces.size(); 220 unsigned size = m_fontFaces.size();
211 for (unsigned i = 0; i < size; i++) { 221 for (unsigned i = 0; i < size; i++) {
212 RefPtr<FontFace> face = m_fontFaces[i]->fontFace(); 222 RefPtr<FontFace> face = m_fontFaces[i]->fontFace();
213 if (face && m_fontFaces[i]->ranges().intersectsWith(text)) 223 if (face && m_fontFaces[i]->ranges().intersectsWith(text))
214 fontFaces.append(face); 224 fontFaces.append(face);
215 } 225 }
216 return fontFaces; 226 return fontFaces;
217 } 227 }
218 228
219 } 229 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSSegmentedFontFace.h ('k') | Source/core/css/CSSSegmentedFontFaceCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698