Changeset 102071 in webkit
- Timestamp:
- Dec 5, 2011, 5:03:53 PM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
css/CSSFontSelector.cpp (modified) (6 diffs)
-
css/CSSFontSelector.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r102067 r102071 1 2011-12-05 Darin Adler <darin@apple.com> 2 3 Change CSSFontSelector to use HashMap<OwnPtr> 4 https://bugs.webkit.org/show_bug.cgi?id=73781 5 6 Reviewed by Dan Bernstein. 7 8 * css/CSSFontSelector.cpp: 9 (WebCore::CSSFontSelector::~CSSFontSelector): Removed calls to deleteAllValues. 10 (WebCore::CSSFontSelector::addFontFaceRule): Updated to use OwnPtr instead of raw 11 pointer for the entry in m_fontFaces and m_locallyInstalledFontFaces. 12 (WebCore::CSSFontSelector::getFontData): Updated to use OwnPtr instead of raw 13 pointer for the entry in m_fonts. Also removed an unneeded std:: prefix. 14 15 * css/CSSFontSelector.h: Made m_fontFaces, m_locallyInstalledFontFaces, and m_fonts 16 be HashMap<OwnPtr>. 17 1 18 2011-12-05 Adam Klein <adamk@chromium.org> 2 19 -
trunk/Source/WebCore/css/CSSFontSelector.cpp
r101858 r102071 57 57 #endif 58 58 59 using namespace std; 60 59 61 namespace WebCore { 60 62 … … 75 77 clearDocument(); 76 78 fontCache()->removeClient(this); 77 deleteAllValues(m_fontFaces);78 deleteAllValues(m_locallyInstalledFontFaces);79 deleteAllValues(m_fonts);80 79 } 81 80 … … 321 320 continue; 322 321 323 Vector<RefPtr<CSSFontFace> >* familyFontFaces = m_fontFaces.get(familyName);322 OwnPtr<Vector<RefPtr<CSSFontFace> > >& familyFontFaces = m_fontFaces.add(familyName, nullptr).first->second; 324 323 if (!familyFontFaces) { 325 familyFontFaces = new Vector<RefPtr<CSSFontFace> >; 326 m_fontFaces.set(familyName, familyFontFaces); 324 familyFontFaces = adoptPtr(new Vector<RefPtr<CSSFontFace> >); 327 325 328 326 ASSERT(!m_locallyInstalledFontFaces.contains(familyName)); 329 Vector<RefPtr<CSSFontFace> >* familyLocallyInstalledFaces;330 327 331 328 Vector<unsigned> locallyInstalledFontsTraitsMasks; 332 329 fontCache()->getTraitsInFamily(familyName, locallyInstalledFontsTraitsMasks); 333 unsigned numLocallyInstalledFaces = locallyInstalledFontsTraitsMasks.size(); 334 if (numLocallyInstalledFaces) { 335 familyLocallyInstalledFaces = new Vector<RefPtr<CSSFontFace> >; 336 m_locallyInstalledFontFaces.set(familyName, familyLocallyInstalledFaces); 330 if (unsigned numLocallyInstalledFaces = locallyInstalledFontsTraitsMasks.size()) { 331 OwnPtr<Vector<RefPtr<CSSFontFace> > > familyLocallyInstalledFaces = adoptPtr(new Vector<RefPtr<CSSFontFace> >); 337 332 338 333 for (unsigned i = 0; i < numLocallyInstalledFaces; ++i) { … … 342 337 familyLocallyInstalledFaces->append(locallyInstalledFontFace); 343 338 } 339 340 m_locallyInstalledFontFaces.set(familyName, familyLocallyInstalledFaces.release()); 344 341 } 345 342 } … … 523 520 } 524 521 525 HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >* segmentedFontFaceCache = m_fonts.get(family); 526 if (!segmentedFontFaceCache) { 527 segmentedFontFaceCache = new HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >; 528 m_fonts.set(family, segmentedFontFaceCache); 529 } 522 OwnPtr<HashMap<unsigned, RefPtr<CSSSegmentedFontFace> > >& segmentedFontFaceCache = m_fonts.add(family, nullptr).first->second; 523 if (!segmentedFontFaceCache) 524 segmentedFontFaceCache = adoptPtr(new HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >); 530 525 531 526 FontTraitsMask traitsMask = fontDescription.traitsMask(); 532 527 533 RefPtr<CSSSegmentedFontFace> face = segmentedFontFaceCache->get(traitsMask); 534 528 RefPtr<CSSSegmentedFontFace>& face = segmentedFontFaceCache->add(traitsMask, 0).first->second; 535 529 if (!face) { 536 530 face = CSSSegmentedFontFace::create(this); 537 segmentedFontFaceCache->set(traitsMask, face); 531 538 532 // Collect all matching faces and sort them in order of preference. 539 533 Vector<CSSFontFace*, 32> candidateFontFaces; … … 568 562 569 563 desiredTraitsMaskForComparison = traitsMask; 570 st d::stable_sort(candidateFontFaces.begin(), candidateFontFaces.end(), compareFontFaces);564 stable_sort(candidateFontFaces.begin(), candidateFontFaces.end(), compareFontFaces); 571 565 unsigned numCandidates = candidateFontFaces.size(); 572 566 for (unsigned i = 0; i < numCandidates; ++i) -
trunk/Source/WebCore/css/CSSFontSelector.h
r101858 r102071 79 79 80 80 Document* m_document; 81 HashMap<String, Vector<RefPtr<CSSFontFace> >*, CaseFoldingHash> m_fontFaces;82 HashMap<String, Vector<RefPtr<CSSFontFace> >*, CaseFoldingHash> m_locallyInstalledFontFaces;83 HashMap<String, HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >*, CaseFoldingHash> m_fonts;81 HashMap<String, OwnPtr<Vector<RefPtr<CSSFontFace> > >, CaseFoldingHash> m_fontFaces; 82 HashMap<String, OwnPtr<Vector<RefPtr<CSSFontFace> > >, CaseFoldingHash> m_locallyInstalledFontFaces; 83 HashMap<String, OwnPtr<HashMap<unsigned, RefPtr<CSSSegmentedFontFace> > >, CaseFoldingHash> m_fonts; 84 84 HashSet<FontSelectorClient*> m_clients; 85 85
Note:
See TracChangeset
for help on using the changeset viewer.