| 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 15 matching lines...) Expand all Loading... |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "config.h" | 28 #include "config.h" |
| 29 #include "core/dom/StyleEngine.h" | 29 #include "core/dom/StyleEngine.h" |
| 30 | 30 |
| 31 #include "HTMLNames.h" | 31 #include "HTMLNames.h" |
| 32 #include "SVGNames.h" | 32 #include "SVGNames.h" |
| 33 #include "core/css/CSSStyleSheet.h" | 33 #include "core/css/CSSStyleSheet.h" |
| 34 #include "core/css/StyleInvalidationAnalysis.h" | 34 #include "core/css/StyleInvalidationAnalysis.h" |
| 35 #include "core/css/StyleSheetContents.h" | 35 #include "core/css/StyleSheetContents.h" |
| 36 #include "core/css/resolver/StyleResolver.h" | |
| 37 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 38 #include "core/dom/Element.h" | 37 #include "core/dom/Element.h" |
| 39 #include "core/dom/ProcessingInstruction.h" | 38 #include "core/dom/ProcessingInstruction.h" |
| 40 #include "core/dom/ShadowTreeStyleSheetCollection.h" | 39 #include "core/dom/ShadowTreeStyleSheetCollection.h" |
| 41 #include "core/dom/shadow/ShadowRoot.h" | 40 #include "core/dom/shadow/ShadowRoot.h" |
| 42 #include "core/html/HTMLIFrameElement.h" | 41 #include "core/html/HTMLIFrameElement.h" |
| 43 #include "core/html/HTMLLinkElement.h" | 42 #include "core/html/HTMLLinkElement.h" |
| 44 #include "core/html/HTMLStyleElement.h" | 43 #include "core/html/HTMLStyleElement.h" |
| 45 #include "core/inspector/InspectorInstrumentation.h" | 44 #include "core/inspector/InspectorInstrumentation.h" |
| 46 #include "core/page/Page.h" | 45 #include "core/page/Page.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 ASSERT(collection); | 348 ASSERT(collection); |
| 350 collection->updateActiveStyleSheets(this, updateMode); | 349 collection->updateActiveStyleSheets(this, updateMode); |
| 351 if (!collection->hasStyleSheetCandidateNodes()) | 350 if (!collection->hasStyleSheetCandidateNodes()) |
| 352 treeScopesRemoved.add(treeScope); | 351 treeScopesRemoved.add(treeScope); |
| 353 } | 352 } |
| 354 if (!treeScopesRemoved.isEmpty()) | 353 if (!treeScopesRemoved.isEmpty()) |
| 355 for (HashSet<TreeScope*>::iterator it = treeScopesRemoved.begin(); i
t != treeScopesRemoved.end(); ++it) | 354 for (HashSet<TreeScope*>::iterator it = treeScopesRemoved.begin(); i
t != treeScopesRemoved.end(); ++it) |
| 356 m_activeTreeScopes.remove(*it); | 355 m_activeTreeScopes.remove(*it); |
| 357 m_dirtyTreeScopes.clear(); | 356 m_dirtyTreeScopes.clear(); |
| 358 } | 357 } |
| 359 | |
| 360 if (StyleResolver* styleResolver = m_document.styleResolverIfExists()) { | |
| 361 styleResolver->finishAppendAuthorStyleSheets(); | |
| 362 resetCSSFeatureFlags(styleResolver->ruleFeatureSet()); | |
| 363 } | |
| 364 | |
| 365 m_needsUpdateActiveStylesheetsOnStyleRecalc = false; | 358 m_needsUpdateActiveStylesheetsOnStyleRecalc = false; |
| 366 activeStyleSheetsUpdatedForInspector(); | 359 activeStyleSheetsUpdatedForInspector(); |
| 367 m_usesRemUnits = m_documentStyleSheetCollection.usesRemUnits(); | 360 m_usesRemUnits = m_documentStyleSheetCollection.usesRemUnits(); |
| 368 | 361 |
| 369 if (m_needsDocumentStyleSheetsUpdate || updateMode == FullStyleUpdate) { | 362 if (m_needsDocumentStyleSheetsUpdate || updateMode == FullStyleUpdate) { |
| 370 m_document.notifySeamlessChildDocumentsOfStylesheetUpdate(); | 363 m_document.notifySeamlessChildDocumentsOfStylesheetUpdate(); |
| 371 m_needsDocumentStyleSheetsUpdate = false; | 364 m_needsDocumentStyleSheetsUpdate = false; |
| 372 } | 365 } |
| 373 | 366 |
| 374 return requiresFullStyleRecalc; | 367 return requiresFullStyleRecalc; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 | 416 |
| 424 void StyleEngine::createResolver() | 417 void StyleEngine::createResolver() |
| 425 { | 418 { |
| 426 // It is a programming error to attempt to resolve style on a Document | 419 // It is a programming error to attempt to resolve style on a Document |
| 427 // which is not in a frame. Code which hits this should have checked | 420 // which is not in a frame. Code which hits this should have checked |
| 428 // Document::isActive() before calling into code which could get here. | 421 // Document::isActive() before calling into code which could get here. |
| 429 | 422 |
| 430 ASSERT(m_document.frame()); | 423 ASSERT(m_document.frame()); |
| 431 | 424 |
| 432 m_resolver = adoptPtr(new StyleResolver(m_document)); | 425 m_resolver = adoptPtr(new StyleResolver(m_document)); |
| 433 combineCSSFeatureFlags(m_resolver->ruleFeatureSet()); | 426 combineCSSFeatureFlags(m_resolver->ensureRuleFeatureSet()); |
| 434 } | 427 } |
| 435 | 428 |
| 436 void StyleEngine::clearResolver() | 429 void StyleEngine::clearResolver() |
| 437 { | 430 { |
| 438 m_resolver.clear(); | 431 m_resolver.clear(); |
| 439 } | 432 } |
| 440 | 433 |
| 441 unsigned StyleEngine::resolverAccessCount() const | 434 unsigned StyleEngine::resolverAccessCount() const |
| 442 { | 435 { |
| 443 return m_resolver ? m_resolver->accessCount() : 0; | 436 return m_resolver ? m_resolver->accessCount() : 0; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 471 return !m_didCalculateResolver && !haveStylesheetsLoaded(); | 464 return !m_didCalculateResolver && !haveStylesheetsLoaded(); |
| 472 } | 465 } |
| 473 | 466 |
| 474 bool StyleEngine::resolverChanged(StyleResolverUpdateMode mode) | 467 bool StyleEngine::resolverChanged(StyleResolverUpdateMode mode) |
| 475 { | 468 { |
| 476 m_didCalculateResolver = true; | 469 m_didCalculateResolver = true; |
| 477 return updateActiveStyleSheets(mode); | 470 return updateActiveStyleSheets(mode); |
| 478 } | 471 } |
| 479 | 472 |
| 480 } | 473 } |
| OLD | NEW |