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

Side by Side Diff: Source/core/svg/SVGFontFaceElement.cpp

Issue 198783006: Hold SVGFontFaceElement in SVGDocumentExtensions until StyleRecalc is finished (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 return InsertionDone; 324 return InsertionDone;
325 } 325 }
326 326
327 void SVGFontFaceElement::removedFrom(ContainerNode* rootParent) 327 void SVGFontFaceElement::removedFrom(ContainerNode* rootParent)
328 { 328 {
329 SVGElement::removedFrom(rootParent); 329 SVGElement::removedFrom(rootParent);
330 330
331 if (rootParent->inDocument()) { 331 if (rootParent->inDocument()) {
332 m_fontElement = 0; 332 m_fontElement = 0;
333 document().accessSVGExtensions().unregisterSVGFontFaceElement(this); 333 document().accessSVGExtensions().unregisterSVGFontFaceElement(this);
334
334 // FIXME: HTMLTemplateElement's document or imported document can be ac tive? 335 // FIXME: HTMLTemplateElement's document or imported document can be ac tive?
335 // If so, we also need to check whether fontSelector() is nullptr or not . 336 // If so, we also need to check whether fontSelector() is nullptr or not .
336 // Otherwise, we will use just document().isActive() here. 337 // Otherwise, we will use just document().isActive() here.
337 if (document().isActive() && document().styleEngine()->fontSelector()) 338 RecalcStyleTime recalcTime = RecalcStyleDeferred;
339 if (document().isActive() && document().styleEngine()->fontSelector()) {
338 document().styleEngine()->fontSelector()->fontFaceCache()->remove(m_ fontFaceRule.get()); 340 document().styleEngine()->fontSelector()->fontFaceCache()->remove(m_ fontFaceRule.get());
341 // This SVGFontFaceElement might be referred from some render style.
342 // If this SVGFontFaceElement is used via the render style before re calc style,
343 // heap-use-after-free will occur. We need to quickly update render style.
344 recalcTime = RecalcStyleImmediately;
esprehn 2014/03/17 17:12:01 This is bad, it means if you have a bunch of fonts
tasak 2014/03/18 02:23:04 I agree that this is a bad solution.
345 }
339 m_fontFaceRule->mutableProperties().clear(); 346 m_fontFaceRule->mutableProperties().clear();
340 347 document().styleResolverChanged(recalcTime);
341 document().styleResolverChanged(RecalcStyleDeferred);
342 } else 348 } else
343 ASSERT(!m_fontElement); 349 ASSERT(!m_fontElement);
344 } 350 }
345 351
346 void SVGFontFaceElement::childrenChanged(bool changedByParser, Node* beforeChang e, Node* afterChange, int childCountDelta) 352 void SVGFontFaceElement::childrenChanged(bool changedByParser, Node* beforeChang e, Node* afterChange, int childCountDelta)
347 { 353 {
348 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil dCountDelta); 354 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil dCountDelta);
349 rebuildFontFace(); 355 rebuildFontFace();
350 } 356 }
351 357
352 } // namespace WebCore 358 } // namespace WebCore
353 359
354 #endif // ENABLE(SVG_FONTS) 360 #endif // ENABLE(SVG_FONTS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698