From d0825bca7fe65beaee391d30da42e937db621564 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Tue, 2 Feb 2010 14:57:50 +0000 Subject: Merge webkit.org at r54127 : Initial merge by git Change-Id: Ib661abb595522f50ea406f72d3a0ce17f7193c82 --- WebCore/css/CSSFontFace.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'WebCore/css/CSSFontFace.cpp') diff --git a/WebCore/css/CSSFontFace.cpp b/WebCore/css/CSSFontFace.cpp index 4d8da59..70cd9bb 100644 --- a/WebCore/css/CSSFontFace.cpp +++ b/WebCore/css/CSSFontFace.cpp @@ -77,8 +77,11 @@ void CSSFontFace::addSource(CSSFontFaceSource* source) source->setFontFace(this); } -void CSSFontFace::fontLoaded(CSSFontFaceSource*) +void CSSFontFace::fontLoaded(CSSFontFaceSource* source) { + if (source != m_activeSource) + return; + // FIXME: Can we assert that m_segmentedFontFaces is not empty? That may // require stopping in-progress font loading when the last // CSSSegmentedFontFace is removed. @@ -97,17 +100,22 @@ void CSSFontFace::fontLoaded(CSSFontFaceSource*) SimpleFontData* CSSFontFace::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic) { + m_activeSource = 0; if (!isValid()) return 0; - + ASSERT(!m_segmentedFontFaces.isEmpty()); CSSFontSelector* fontSelector = (*m_segmentedFontFaces.begin())->fontSelector(); - SimpleFontData* result = 0; - unsigned size = m_sources.size(); - for (unsigned i = 0; i < size && !result; i++) - result = m_sources[i]->getFontData(fontDescription, syntheticBold, syntheticItalic, fontSelector); - return result; + size_t size = m_sources.size(); + for (size_t i = 0; i < size; ++i) { + if (SimpleFontData* result = m_sources[i]->getFontData(fontDescription, syntheticBold, syntheticItalic, fontSelector)) { + m_activeSource = m_sources[i]; + return result; + } + } + + return 0; } } -- cgit v1.1