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, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 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) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "platform/fonts/FontCache.h" | 54 #include "platform/fonts/FontCache.h" |
55 | 55 |
56 namespace blink { | 56 namespace blink { |
57 | 57 |
58 using namespace HTMLNames; | 58 using namespace HTMLNames; |
59 | 59 |
60 StyleEngine::StyleEngine(Document& document) | 60 StyleEngine::StyleEngine(Document& document) |
61 : m_document(&document) | 61 : m_document(&document) |
62 , m_isMaster(!document.importsController() || document.importsController()->
master() == &document) | 62 , m_isMaster(!document.importsController() || document.importsController()->
master() == &document) |
63 , m_documentStyleSheetCollection(DocumentStyleSheetCollection::create(docume
nt)) | 63 , m_documentStyleSheetCollection(DocumentStyleSheetCollection::create(docume
nt)) |
64 // We don't need to create CSSFontSelector for imported document or | |
65 // HTMLTemplateElement's document, because those documents have no frame. | |
66 , m_fontSelector(document.frame() ? CSSFontSelector::create(&document) : nul
lptr) | |
67 { | 64 { |
68 if (m_fontSelector) | 65 m_fontSelector = CSSFontSelector::create(m_document); |
69 m_fontSelector->registerForInvalidationCallbacks(this); | 66 m_fontSelector->registerForInvalidationCallbacks(this); |
70 } | 67 } |
71 | 68 |
72 StyleEngine::~StyleEngine() | 69 StyleEngine::~StyleEngine() |
73 { | 70 { |
74 } | 71 } |
75 | 72 |
76 static bool isStyleElement(Node& node) | 73 static bool isStyleElement(Node& node) |
77 { | 74 { |
78 return isHTMLStyleElement(node) || isSVGStyleElement(node); | 75 return isHTMLStyleElement(node) || isSVGStyleElement(node); |
79 } | 76 } |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 m_resolver->appendAuthorStyleSheets(documentStyleSheetCollection()->activeAu
thorStyleSheets()); | 380 m_resolver->appendAuthorStyleSheets(documentStyleSheetCollection()->activeAu
thorStyleSheets()); |
384 for (TreeScope* treeScope : m_activeTreeScopes) { | 381 for (TreeScope* treeScope : m_activeTreeScopes) { |
385 if (TreeScopeStyleSheetCollection* collection = m_styleSheetCollectionMa
p.get(treeScope)) | 382 if (TreeScopeStyleSheetCollection* collection = m_styleSheetCollectionMa
p.get(treeScope)) |
386 m_resolver->appendAuthorStyleSheets(collection->activeAuthorStyleShe
ets()); | 383 m_resolver->appendAuthorStyleSheets(collection->activeAuthorStyleShe
ets()); |
387 } | 384 } |
388 m_resolver->finishAppendAuthorStyleSheets(); | 385 m_resolver->finishAppendAuthorStyleSheets(); |
389 } | 386 } |
390 | 387 |
391 void StyleEngine::createResolver() | 388 void StyleEngine::createResolver() |
392 { | 389 { |
393 TRACE_EVENT1("blink", "StyleEngine::createResolver", "frame", document().fra
me()); | |
394 // It is a programming error to attempt to resolve style on a Document | |
395 // which is not in a frame. Code which hits this should have checked | |
396 // Document::isActive() before calling into code which could get here. | |
397 | |
398 DCHECK(document().frame()); | |
399 | |
400 m_resolver = StyleResolver::create(*m_document); | 390 m_resolver = StyleResolver::create(*m_document); |
401 | 391 |
402 // A scoped style resolver for document will be created during | 392 // A scoped style resolver for document will be created during |
403 // appendActiveAuthorStyleSheets if needed. | 393 // appendActiveAuthorStyleSheets if needed. |
404 appendActiveAuthorStyleSheets(); | 394 appendActiveAuthorStyleSheets(); |
405 } | 395 } |
406 | 396 |
407 void StyleEngine::clearResolver() | 397 void StyleEngine::clearResolver() |
408 { | 398 { |
409 DCHECK(!document().inStyleRecalc()); | 399 DCHECK(!document().inStyleRecalc()); |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 | 832 |
843 DEFINE_TRACE_WRAPPERS(StyleEngine) | 833 DEFINE_TRACE_WRAPPERS(StyleEngine) |
844 { | 834 { |
845 for (auto sheet : m_injectedAuthorStyleSheets) { | 835 for (auto sheet : m_injectedAuthorStyleSheets) { |
846 visitor->traceWrappers(sheet); | 836 visitor->traceWrappers(sheet); |
847 } | 837 } |
848 visitor->traceWrappers(m_documentStyleSheetCollection); | 838 visitor->traceWrappers(m_documentStyleSheetCollection); |
849 } | 839 } |
850 | 840 |
851 } // namespace blink | 841 } // namespace blink |
OLD | NEW |