| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 if (scope == m_document) | 273 if (scope == m_document) |
| 274 return; | 274 return; |
| 275 m_dirtyTreeScopes.add(&scope); | 275 m_dirtyTreeScopes.add(&scope); |
| 276 } | 276 } |
| 277 | 277 |
| 278 PassRefPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const String& tex
t) | 278 PassRefPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const String& tex
t) |
| 279 { | 279 { |
| 280 RefPtr<CSSStyleSheet> styleSheet; | 280 RefPtr<CSSStyleSheet> styleSheet; |
| 281 AtomicString textContent(text); | 281 AtomicString textContent(text); |
| 282 | 282 |
| 283 HashMap<AtomicString, RawPtr<StyleSheetContents> >::AddResult result = m_tex
tToSheetCache.add(textContent, nullptr); | 283 HashMap<AtomicString, StyleSheetContents*>::AddResult result = m_textToSheet
Cache.add(textContent, nullptr); |
| 284 if (result.isNewEntry || !result.storedValue->value) { | 284 if (result.isNewEntry || !result.storedValue->value) { |
| 285 styleSheet = CSSStyleSheet::create(e, KURL()); | 285 styleSheet = CSSStyleSheet::create(e, KURL()); |
| 286 styleSheet->contents()->parseString(text); | 286 styleSheet->contents()->parseString(text); |
| 287 if (result.isNewEntry) { | 287 if (result.isNewEntry) { |
| 288 result.storedValue->value = styleSheet->contents(); | 288 result.storedValue->value = styleSheet->contents(); |
| 289 m_sheetToTextCache.add(styleSheet->contents(), textContent); | 289 m_sheetToTextCache.add(styleSheet->contents(), textContent); |
| 290 } | 290 } |
| 291 } else { | 291 } else { |
| 292 StyleSheetContents* contents = result.storedValue->value; | 292 StyleSheetContents* contents = result.storedValue->value; |
| 293 ASSERT(contents); | 293 ASSERT(contents); |
| 294 styleSheet = CSSStyleSheet::create(contents, e); | 294 styleSheet = CSSStyleSheet::create(contents, e); |
| 295 } | 295 } |
| 296 | 296 |
| 297 ASSERT(styleSheet); | 297 ASSERT(styleSheet); |
| 298 return styleSheet; | 298 return styleSheet; |
| 299 } | 299 } |
| 300 | 300 |
| 301 void StyleEngine::removeSheet(StyleSheetContents* contents) | 301 void StyleEngine::removeSheet(StyleSheetContents* contents) |
| 302 { | 302 { |
| 303 HashMap<RawPtr<StyleSheetContents>, AtomicString>::iterator it = m_sheetToTe
xtCache.find(contents); | 303 HashMap<StyleSheetContents*, AtomicString>::iterator it = m_sheetToTextCache
.find(contents); |
| 304 if (it == m_sheetToTextCache.end()) | 304 if (it == m_sheetToTextCache.end()) |
| 305 return; | 305 return; |
| 306 | 306 |
| 307 m_textToSheetCache.remove(it->value); | 307 m_textToSheetCache.remove(it->value); |
| 308 m_sheetToTextCache.remove(contents); | 308 m_sheetToTextCache.remove(contents); |
| 309 } | 309 } |
| 310 | 310 |
| 311 // TODO(esprehn): This walks the entire document to collect features, instead | 311 // TODO(esprehn): This walks the entire document to collect features, instead |
| 312 // we should store features per scope and get rid of the global set. | 312 // we should store features per scope and get rid of the global set. |
| 313 static void collectFeatures(TreeScope& scope, RuleFeatureSet& features, HashSet<
const StyleSheetContents*> visitedSharedStyleSheetContents) | 313 static void collectFeatures(TreeScope& scope, RuleFeatureSet& features, HashSet<
const StyleSheetContents*> visitedSharedStyleSheetContents) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 326 } | 326 } |
| 327 | 327 |
| 328 void StyleEngine::fontsNeedUpdate(CSSFontSelector*) | 328 void StyleEngine::fontsNeedUpdate(CSSFontSelector*) |
| 329 { | 329 { |
| 330 if (m_resolver) | 330 if (m_resolver) |
| 331 m_resolver->invalidateMatchedPropertiesCache(); | 331 m_resolver->invalidateMatchedPropertiesCache(); |
| 332 m_document->setNeedsStyleRecalc(SubtreeStyleChange); | 332 m_document->setNeedsStyleRecalc(SubtreeStyleChange); |
| 333 } | 333 } |
| 334 | 334 |
| 335 } | 335 } |
| OLD | NEW |