| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 treeScopes.insertBefore(followingTreeScope, treeScope); | 139 treeScopes.insertBefore(followingTreeScope, treeScope); |
| 140 } | 140 } |
| 141 | 141 |
| 142 TreeScopeStyleSheetCollection* StyleEngine::ensureStyleSheetCollectionFor(TreeSc
ope& treeScope) | 142 TreeScopeStyleSheetCollection* StyleEngine::ensureStyleSheetCollectionFor(TreeSc
ope& treeScope) |
| 143 { | 143 { |
| 144 if (treeScope == m_document) | 144 if (treeScope == m_document) |
| 145 return &m_documentStyleSheetCollection; | 145 return &m_documentStyleSheetCollection; |
| 146 | 146 |
| 147 HashMap<TreeScope*, OwnPtr<TreeScopeStyleSheetCollection> >::AddResult resul
t = m_styleSheetCollectionMap.add(&treeScope, nullptr); | 147 HashMap<TreeScope*, OwnPtr<TreeScopeStyleSheetCollection> >::AddResult resul
t = m_styleSheetCollectionMap.add(&treeScope, nullptr); |
| 148 if (result.isNewEntry) | 148 if (result.isNewEntry) |
| 149 result.iterator->value = adoptPtr(new ShadowTreeStyleSheetCollection(toS
hadowRoot(treeScope))); | 149 result.storedValue->value = adoptPtr(new ShadowTreeStyleSheetCollection(
toShadowRoot(treeScope))); |
| 150 return result.iterator->value.get(); | 150 return result.storedValue->value.get(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 TreeScopeStyleSheetCollection* StyleEngine::styleSheetCollectionFor(TreeScope& t
reeScope) | 153 TreeScopeStyleSheetCollection* StyleEngine::styleSheetCollectionFor(TreeScope& t
reeScope) |
| 154 { | 154 { |
| 155 if (treeScope == m_document) | 155 if (treeScope == m_document) |
| 156 return &m_documentStyleSheetCollection; | 156 return &m_documentStyleSheetCollection; |
| 157 | 157 |
| 158 HashMap<TreeScope*, OwnPtr<TreeScopeStyleSheetCollection> >::iterator it = m
_styleSheetCollectionMap.find(&treeScope); | 158 HashMap<TreeScope*, OwnPtr<TreeScopeStyleSheetCollection> >::iterator it = m
_styleSheetCollectionMap.find(&treeScope); |
| 159 if (it == m_styleSheetCollectionMap.end()) | 159 if (it == m_styleSheetCollectionMap.end()) |
| 160 return 0; | 160 return 0; |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 PassRefPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const String& tex
t, TextPosition startPosition, bool createdByParser) | 561 PassRefPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const String& tex
t, TextPosition startPosition, bool createdByParser) |
| 562 { | 562 { |
| 563 RefPtr<CSSStyleSheet> styleSheet; | 563 RefPtr<CSSStyleSheet> styleSheet; |
| 564 | 564 |
| 565 e->document().styleEngine()->addPendingSheet(); | 565 e->document().styleEngine()->addPendingSheet(); |
| 566 | 566 |
| 567 if (!e->document().inQuirksMode()) { | 567 if (!e->document().inQuirksMode()) { |
| 568 AtomicString textContent(text); | 568 AtomicString textContent(text); |
| 569 | 569 |
| 570 HashMap<AtomicString, StyleSheetContents*>::AddResult result = textToShe
etCache().add(textContent, 0); | 570 HashMap<AtomicString, StyleSheetContents*>::AddResult result = textToShe
etCache().add(textContent, 0); |
| 571 if (result.isNewEntry || !result.iterator->value) { | 571 if (result.isNewEntry || !result.storedValue->value) { |
| 572 styleSheet = StyleEngine::parseSheet(e, text, startPosition, created
ByParser); | 572 styleSheet = StyleEngine::parseSheet(e, text, startPosition, created
ByParser); |
| 573 if (result.isNewEntry && styleSheet->contents()->maybeCacheable()) { | 573 if (result.isNewEntry && styleSheet->contents()->maybeCacheable()) { |
| 574 result.iterator->value = styleSheet->contents(); | 574 result.storedValue->value = styleSheet->contents(); |
| 575 sheetToTextCache().add(styleSheet->contents(), textContent); | 575 sheetToTextCache().add(styleSheet->contents(), textContent); |
| 576 } | 576 } |
| 577 } else { | 577 } else { |
| 578 ASSERT(result.iterator->value->maybeCacheable()); | 578 ASSERT(result.storedValue->value->maybeCacheable()); |
| 579 styleSheet = CSSStyleSheet::createInline(result.iterator->value, e,
startPosition); | 579 styleSheet = CSSStyleSheet::createInline(result.storedValue->value,
e, startPosition); |
| 580 } | 580 } |
| 581 } else { | 581 } else { |
| 582 // FIXME: currently we don't cache StyleSheetContents inQuirksMode. | 582 // FIXME: currently we don't cache StyleSheetContents inQuirksMode. |
| 583 styleSheet = StyleEngine::parseSheet(e, text, startPosition, createdByPa
rser); | 583 styleSheet = StyleEngine::parseSheet(e, text, startPosition, createdByPa
rser); |
| 584 } | 584 } |
| 585 | 585 |
| 586 ASSERT(styleSheet); | 586 ASSERT(styleSheet); |
| 587 styleSheet->setTitle(e->title()); | 587 styleSheet->setTitle(e->title()); |
| 588 return styleSheet; | 588 return styleSheet; |
| 589 } | 589 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 600 { | 600 { |
| 601 HashMap<StyleSheetContents*, AtomicString>::iterator it = sheetToTextCache()
.find(contents); | 601 HashMap<StyleSheetContents*, AtomicString>::iterator it = sheetToTextCache()
.find(contents); |
| 602 if (it == sheetToTextCache().end()) | 602 if (it == sheetToTextCache().end()) |
| 603 return; | 603 return; |
| 604 | 604 |
| 605 textToSheetCache().remove(it->value); | 605 textToSheetCache().remove(it->value); |
| 606 sheetToTextCache().remove(contents); | 606 sheetToTextCache().remove(contents); |
| 607 } | 607 } |
| 608 | 608 |
| 609 } | 609 } |
| OLD | NEW |