OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
9 * Copyright (C) 2013 Google Inc. All rights reserved. | 9 * Copyright (C) 2013 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 continue; | 59 continue; |
60 | 60 |
61 collection.appendSheetForList(sheet); | 61 collection.appendSheetForList(sheet); |
62 if (candidate.canBeActivated(nullAtom)) | 62 if (candidate.canBeActivated(nullAtom)) |
63 collection.appendActiveStyleSheet(toCSSStyleSheet(sheet)); | 63 collection.appendActiveStyleSheet(toCSSStyleSheet(sheet)); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 void ShadowTreeStyleSheetCollection::updateActiveStyleSheets(StyleEngine& engine
, StyleResolverUpdateMode updateMode) | 67 void ShadowTreeStyleSheetCollection::updateActiveStyleSheets(StyleEngine& engine
, StyleResolverUpdateMode updateMode) |
68 { | 68 { |
69 StyleSheetCollection collection; | 69 // StyleSheetCollection is GarbageCollected<>, allocate it on the heap. |
70 collectStyleSheets(engine, collection); | 70 StyleSheetCollection* collection = StyleSheetCollection::create(); |
| 71 collectStyleSheets(engine, *collection); |
71 | 72 |
72 StyleSheetChange change; | 73 StyleSheetChange change; |
73 analyzeStyleSheetChange(updateMode, collection, change); | 74 analyzeStyleSheetChange(updateMode, collection->activeAuthorStyleSheets(), c
hange); |
74 | 75 |
75 if (StyleResolver* styleResolver = engine.resolver()) { | 76 if (StyleResolver* styleResolver = engine.resolver()) { |
76 if (change.styleResolverUpdateType != Additive) { | 77 if (change.styleResolverUpdateType != Additive) { |
77 // We should not destroy StyleResolver when we find any stylesheet u
pdate in a shadow tree. | 78 // We should not destroy StyleResolver when we find any stylesheet u
pdate in a shadow tree. |
78 // In this case, we will reset rulesets created from style elements
in the shadow tree. | 79 // In this case, we will reset rulesets created from style elements
in the shadow tree. |
79 styleResolver->resetAuthorStyle(treeScope()); | 80 styleResolver->resetAuthorStyle(treeScope()); |
80 styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleShe
ets); | 81 styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleShe
ets); |
81 styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAutho
rStyleSheets()); | 82 styleResolver->lazyAppendAuthorStyleSheets(0, collection->activeAuth
orStyleSheets()); |
82 } else { | 83 } else { |
83 styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets
.size(), collection.activeAuthorStyleSheets()); | 84 styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets
.size(), collection->activeAuthorStyleSheets()); |
84 } | 85 } |
85 } | 86 } |
86 if (change.requiresFullStyleRecalc) | 87 if (change.requiresFullStyleRecalc) |
87 toShadowRoot(treeScope().rootNode()).host().setNeedsStyleRecalc(SubtreeS
tyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::ActiveStylesh
eetsUpdate)); | 88 toShadowRoot(treeScope().rootNode()).host().setNeedsStyleRecalc(SubtreeS
tyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::ActiveStylesh
eetsUpdate)); |
88 | 89 |
89 collection.swap(*this); | 90 collection->swap(*this); |
| 91 collection->dispose(); |
90 } | 92 } |
91 | 93 |
92 } // namespace blink | 94 } // namespace blink |
OLD | NEW |