| 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 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 // Rough size estimate for the memory cache. | 41 // Rough size estimate for the memory cache. |
| 42 unsigned StyleSheetContents::estimatedSizeInBytes() const | 42 unsigned StyleSheetContents::estimatedSizeInBytes() const |
| 43 { | 43 { |
| 44 // Note that this does not take into account size of the strings hanging fro
m various objects. | 44 // Note that this does not take into account size of the strings hanging fro
m various objects. |
| 45 // The assumption is that nearly all of of them are atomic and would exist a
nyway. | 45 // The assumption is that nearly all of of them are atomic and would exist a
nyway. |
| 46 unsigned size = sizeof(*this); | 46 unsigned size = sizeof(*this); |
| 47 | 47 |
| 48 // FIXME: This ignores the children of media and region rules. | 48 // FIXME: This ignores the children of media rules. |
| 49 // Most rules are StyleRules. | 49 // Most rules are StyleRules. |
| 50 size += ruleCount() * StyleRule::averageSizeInBytes(); | 50 size += ruleCount() * StyleRule::averageSizeInBytes(); |
| 51 | 51 |
| 52 for (unsigned i = 0; i < m_importRules.size(); ++i) { | 52 for (unsigned i = 0; i < m_importRules.size(); ++i) { |
| 53 if (StyleSheetContents* sheet = m_importRules[i]->styleSheet()) | 53 if (StyleSheetContents* sheet = m_importRules[i]->styleSheet()) |
| 54 size += sheet->estimatedSizeInBytes(); | 54 size += sheet->estimatedSizeInBytes(); |
| 55 } | 55 } |
| 56 return size; | 56 return size; |
| 57 } | 57 } |
| 58 | 58 |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 return true; | 471 return true; |
| 472 break; | 472 break; |
| 473 case StyleRuleBase::FontFace: | 473 case StyleRuleBase::FontFace: |
| 474 if (toStyleRuleFontFace(rule)->properties()->hasFailedOrCanceledSubr
esources()) | 474 if (toStyleRuleFontFace(rule)->properties()->hasFailedOrCanceledSubr
esources()) |
| 475 return true; | 475 return true; |
| 476 break; | 476 break; |
| 477 case StyleRuleBase::Media: | 477 case StyleRuleBase::Media: |
| 478 if (childRulesHaveFailedOrCanceledSubresources(toStyleRuleMedia(rule
)->childRules())) | 478 if (childRulesHaveFailedOrCanceledSubresources(toStyleRuleMedia(rule
)->childRules())) |
| 479 return true; | 479 return true; |
| 480 break; | 480 break; |
| 481 case StyleRuleBase::Region: | |
| 482 if (childRulesHaveFailedOrCanceledSubresources(toStyleRuleRegion(rul
e)->childRules())) | |
| 483 return true; | |
| 484 break; | |
| 485 case StyleRuleBase::Import: | 481 case StyleRuleBase::Import: |
| 486 ASSERT_NOT_REACHED(); | 482 ASSERT_NOT_REACHED(); |
| 487 case StyleRuleBase::Page: | 483 case StyleRuleBase::Page: |
| 488 case StyleRuleBase::Keyframes: | 484 case StyleRuleBase::Keyframes: |
| 489 case StyleRuleBase::Unknown: | 485 case StyleRuleBase::Unknown: |
| 490 case StyleRuleBase::Charset: | 486 case StyleRuleBase::Charset: |
| 491 case StyleRuleBase::Keyframe: | 487 case StyleRuleBase::Keyframe: |
| 492 case StyleRuleBase::Supports: | 488 case StyleRuleBase::Supports: |
| 493 case StyleRuleBase::Viewport: | 489 case StyleRuleBase::Viewport: |
| 494 case StyleRuleBase::Filter: | 490 case StyleRuleBase::Filter: |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 // See the StyleResolver calls in ScopedStyleResolver::addRulesFromSheet. | 562 // See the StyleResolver calls in ScopedStyleResolver::addRulesFromSheet. |
| 567 for (size_t i = 0; i < m_clients.size(); ++i) { | 563 for (size_t i = 0; i < m_clients.size(); ++i) { |
| 568 if (Document* document = m_clients[i]->ownerDocument()) | 564 if (Document* document = m_clients[i]->ownerDocument()) |
| 569 document->styleEngine()->clearResolver(); | 565 document->styleEngine()->clearResolver(); |
| 570 } | 566 } |
| 571 m_ruleSet.clear(); | 567 m_ruleSet.clear(); |
| 572 } | 568 } |
| 573 | 569 |
| 574 | 570 |
| 575 } | 571 } |
| OLD | NEW |