| 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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 // It is not the original sheet anymore. | 572 // It is not the original sheet anymore. |
| 573 if (contents.isMutable()) | 573 if (contents.isMutable()) |
| 574 return false; | 574 return false; |
| 575 if (!contents.hasSyntacticallyValidCSSHeader()) | 575 if (!contents.hasSyntacticallyValidCSSHeader()) |
| 576 return false; | 576 return false; |
| 577 return true; | 577 return true; |
| 578 } | 578 } |
| 579 | 579 |
| 580 PassRefPtrWillBeRawPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const
String& text, TextPosition startPosition, bool createdByParser) | 580 PassRefPtrWillBeRawPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const
String& text, TextPosition startPosition, bool createdByParser) |
| 581 { | 581 { |
| 582 RefPtrWillBeRawPtr<CSSStyleSheet> styleSheet; | 582 RefPtrWillBeRawPtr<CSSStyleSheet> styleSheet = nullptr; |
| 583 | 583 |
| 584 e->document().styleEngine()->addPendingSheet(); | 584 e->document().styleEngine()->addPendingSheet(); |
| 585 | 585 |
| 586 if (!e->document().inQuirksMode()) { | 586 if (!e->document().inQuirksMode()) { |
| 587 AtomicString textContent(text); | 587 AtomicString textContent(text); |
| 588 | 588 |
| 589 HashMap<AtomicString, StyleSheetContents*>::AddResult result = m_textToS
heetCache.add(textContent, 0); | 589 HashMap<AtomicString, StyleSheetContents*>::AddResult result = m_textToS
heetCache.add(textContent, 0); |
| 590 if (result.isNewEntry || !result.storedValue->value) { | 590 if (result.isNewEntry || !result.storedValue->value) { |
| 591 styleSheet = StyleEngine::parseSheet(e, text, startPosition, created
ByParser); | 591 styleSheet = StyleEngine::parseSheet(e, text, startPosition, created
ByParser); |
| 592 if (result.isNewEntry && isCacheableForStyleElement(*styleSheet->con
tents())) { | 592 if (result.isNewEntry && isCacheableForStyleElement(*styleSheet->con
tents())) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 605 styleSheet = StyleEngine::parseSheet(e, text, startPosition, createdByPa
rser); | 605 styleSheet = StyleEngine::parseSheet(e, text, startPosition, createdByPa
rser); |
| 606 } | 606 } |
| 607 | 607 |
| 608 ASSERT(styleSheet); | 608 ASSERT(styleSheet); |
| 609 styleSheet->setTitle(e->title()); | 609 styleSheet->setTitle(e->title()); |
| 610 return styleSheet; | 610 return styleSheet; |
| 611 } | 611 } |
| 612 | 612 |
| 613 PassRefPtrWillBeRawPtr<CSSStyleSheet> StyleEngine::parseSheet(Element* e, const
String& text, TextPosition startPosition, bool createdByParser) | 613 PassRefPtrWillBeRawPtr<CSSStyleSheet> StyleEngine::parseSheet(Element* e, const
String& text, TextPosition startPosition, bool createdByParser) |
| 614 { | 614 { |
| 615 RefPtrWillBeRawPtr<CSSStyleSheet> styleSheet; | 615 RefPtrWillBeRawPtr<CSSStyleSheet> styleSheet = nullptr; |
| 616 styleSheet = CSSStyleSheet::createInline(e, KURL(), startPosition, e->docume
nt().inputEncoding()); | 616 styleSheet = CSSStyleSheet::createInline(e, KURL(), startPosition, e->docume
nt().inputEncoding()); |
| 617 styleSheet->contents()->parseStringAtPosition(text, startPosition, createdBy
Parser); | 617 styleSheet->contents()->parseStringAtPosition(text, startPosition, createdBy
Parser); |
| 618 return styleSheet; | 618 return styleSheet; |
| 619 } | 619 } |
| 620 | 620 |
| 621 void StyleEngine::removeSheet(StyleSheetContents* contents) | 621 void StyleEngine::removeSheet(StyleSheetContents* contents) |
| 622 { | 622 { |
| 623 HashMap<StyleSheetContents*, AtomicString>::iterator it = m_sheetToTextCache
.find(contents); | 623 HashMap<StyleSheetContents*, AtomicString>::iterator it = m_sheetToTextCache
.find(contents); |
| 624 if (it == m_sheetToTextCache.end()) | 624 if (it == m_sheetToTextCache.end()) |
| 625 return; | 625 return; |
| 626 | 626 |
| 627 m_textToSheetCache.remove(it->value); | 627 m_textToSheetCache.remove(it->value); |
| 628 m_sheetToTextCache.remove(contents); | 628 m_sheetToTextCache.remove(contents); |
| 629 } | 629 } |
| 630 | 630 |
| 631 void StyleEngine::trace(Visitor* visitor) | 631 void StyleEngine::trace(Visitor* visitor) |
| 632 { | 632 { |
| 633 visitor->trace(m_injectedAuthorStyleSheets); | 633 visitor->trace(m_injectedAuthorStyleSheets); |
| 634 visitor->trace(m_authorStyleSheets); | 634 visitor->trace(m_authorStyleSheets); |
| 635 visitor->trace(m_documentStyleSheetCollection); | 635 visitor->trace(m_documentStyleSheetCollection); |
| 636 visitor->trace(m_styleSheetCollectionMap); | 636 visitor->trace(m_styleSheetCollectionMap); |
| 637 } | 637 } |
| 638 | 638 |
| 639 } | 639 } |
| OLD | NEW |