| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 void StyleSheetContents::clientLoadStarted(CSSStyleSheet* sheet) | 536 void StyleSheetContents::clientLoadStarted(CSSStyleSheet* sheet) |
| 537 { | 537 { |
| 538 ASSERT(m_completedClients.contains(sheet)); | 538 ASSERT(m_completedClients.contains(sheet)); |
| 539 m_completedClients.remove(sheet); | 539 m_completedClients.remove(sheet); |
| 540 m_loadingClients.add(sheet); | 540 m_loadingClients.add(sheet); |
| 541 } | 541 } |
| 542 | 542 |
| 543 void StyleSheetContents::removeSheetFromCache(Document* document) | 543 void StyleSheetContents::removeSheetFromCache(Document* document) |
| 544 { | 544 { |
| 545 ASSERT(document); | 545 ASSERT(document); |
| 546 document->styleEngine()->removeSheet(this); | 546 document->styleEngine().removeSheet(this); |
| 547 } | 547 } |
| 548 | 548 |
| 549 void StyleSheetContents::addedToMemoryCache() | 549 void StyleSheetContents::addedToMemoryCache() |
| 550 { | 550 { |
| 551 ASSERT(!m_isInMemoryCache); | 551 ASSERT(!m_isInMemoryCache); |
| 552 ASSERT(isCacheable()); | 552 ASSERT(isCacheable()); |
| 553 m_isInMemoryCache = true; | 553 m_isInMemoryCache = true; |
| 554 } | 554 } |
| 555 | 555 |
| 556 void StyleSheetContents::removedFromMemoryCache() | 556 void StyleSheetContents::removedFromMemoryCache() |
| (...skipping 15 matching lines...) Expand all Loading... |
| 572 m_ruleSet = RuleSet::create(); | 572 m_ruleSet = RuleSet::create(); |
| 573 m_ruleSet->addRulesFromSheet(this, medium, addRuleFlags); | 573 m_ruleSet->addRulesFromSheet(this, medium, addRuleFlags); |
| 574 } | 574 } |
| 575 return *m_ruleSet.get(); | 575 return *m_ruleSet.get(); |
| 576 } | 576 } |
| 577 | 577 |
| 578 static void clearResolvers(WillBeHeapHashSet<RawPtrWillBeWeakMember<CSSStyleShee
t> >& clients) | 578 static void clearResolvers(WillBeHeapHashSet<RawPtrWillBeWeakMember<CSSStyleShee
t> >& clients) |
| 579 { | 579 { |
| 580 for (const auto& sheet : clients) { | 580 for (const auto& sheet : clients) { |
| 581 if (Document* document = sheet->ownerDocument()) | 581 if (Document* document = sheet->ownerDocument()) |
| 582 document->styleEngine()->clearResolver(); | 582 document->styleEngine().clearResolver(); |
| 583 } | 583 } |
| 584 } | 584 } |
| 585 | 585 |
| 586 void StyleSheetContents::clearRuleSet() | 586 void StyleSheetContents::clearRuleSet() |
| 587 { | 587 { |
| 588 if (StyleSheetContents* parentSheet = parentStyleSheet()) | 588 if (StyleSheetContents* parentSheet = parentStyleSheet()) |
| 589 parentSheet->clearRuleSet(); | 589 parentSheet->clearRuleSet(); |
| 590 | 590 |
| 591 // Don't want to clear the StyleResolver if the RuleSet hasn't been created | 591 // Don't want to clear the StyleResolver if the RuleSet hasn't been created |
| 592 // since we only clear the StyleResolver so that it's members are properly | 592 // since we only clear the StyleResolver so that it's members are properly |
| 593 // updated in ScopedStyleResolver::addRulesFromSheet. | 593 // updated in ScopedStyleResolver::addRulesFromSheet. |
| 594 if (!m_ruleSet) | 594 if (!m_ruleSet) |
| 595 return; | 595 return; |
| 596 | 596 |
| 597 // Clearing the ruleSet means we need to recreate the styleResolver data str
uctures. | 597 // Clearing the ruleSet means we need to recreate the styleResolver data str
uctures. |
| 598 // See the StyleResolver calls in ScopedStyleResolver::addRulesFromSheet. | 598 // See the StyleResolver calls in ScopedStyleResolver::addRulesFromSheet. |
| 599 clearResolvers(m_loadingClients); | 599 clearResolvers(m_loadingClients); |
| 600 clearResolvers(m_completedClients); | 600 clearResolvers(m_completedClients); |
| 601 m_ruleSet.clear(); | 601 m_ruleSet.clear(); |
| 602 } | 602 } |
| 603 | 603 |
| 604 static void removeFontFaceRules(WillBeHeapHashSet<RawPtrWillBeWeakMember<CSSStyl
eSheet> >& clients, const StyleRuleFontFace* fontFaceRule) | 604 static void removeFontFaceRules(WillBeHeapHashSet<RawPtrWillBeWeakMember<CSSStyl
eSheet> >& clients, const StyleRuleFontFace* fontFaceRule) |
| 605 { | 605 { |
| 606 for (const auto& sheet : clients) { | 606 for (const auto& sheet : clients) { |
| 607 if (Node* ownerNode = sheet->ownerNode()) | 607 if (Node* ownerNode = sheet->ownerNode()) |
| 608 ownerNode->document().styleEngine()->removeFontFaceRules(WillBeHeapV
ector<RawPtrWillBeMember<const StyleRuleFontFace> >(1, fontFaceRule)); | 608 ownerNode->document().styleEngine().removeFontFaceRules(WillBeHeapVe
ctor<RawPtrWillBeMember<const StyleRuleFontFace>>(1, fontFaceRule)); |
| 609 } | 609 } |
| 610 } | 610 } |
| 611 | 611 |
| 612 void StyleSheetContents::notifyRemoveFontFaceRule(const StyleRuleFontFace* fontF
aceRule) | 612 void StyleSheetContents::notifyRemoveFontFaceRule(const StyleRuleFontFace* fontF
aceRule) |
| 613 { | 613 { |
| 614 StyleSheetContents* root = rootStyleSheet(); | 614 StyleSheetContents* root = rootStyleSheet(); |
| 615 removeFontFaceRules(root->m_loadingClients, fontFaceRule); | 615 removeFontFaceRules(root->m_loadingClients, fontFaceRule); |
| 616 removeFontFaceRules(root->m_completedClients, fontFaceRule); | 616 removeFontFaceRules(root->m_completedClients, fontFaceRule); |
| 617 } | 617 } |
| 618 | 618 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 649 visitor->trace(m_ownerRule); | 649 visitor->trace(m_ownerRule); |
| 650 visitor->trace(m_importRules); | 650 visitor->trace(m_importRules); |
| 651 visitor->trace(m_childRules); | 651 visitor->trace(m_childRules); |
| 652 visitor->trace(m_loadingClients); | 652 visitor->trace(m_loadingClients); |
| 653 visitor->trace(m_completedClients); | 653 visitor->trace(m_completedClients); |
| 654 visitor->trace(m_ruleSet); | 654 visitor->trace(m_ruleSet); |
| 655 #endif | 655 #endif |
| 656 } | 656 } |
| 657 | 657 |
| 658 } | 658 } |
| OLD | NEW |