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 29 matching lines...) Loading... |
40 | 40 |
41 DEFINE_GC_INFO(StyleSheetContents); | 41 DEFINE_GC_INFO(StyleSheetContents); |
42 | 42 |
43 // Rough size estimate for the memory cache. | 43 // Rough size estimate for the memory cache. |
44 unsigned StyleSheetContents::estimatedSizeInBytes() const | 44 unsigned StyleSheetContents::estimatedSizeInBytes() const |
45 { | 45 { |
46 // Note that this does not take into account size of the strings hanging fro
m various objects. | 46 // Note that this does not take into account size of the strings hanging fro
m various objects. |
47 // The assumption is that nearly all of of them are atomic and would exist a
nyway. | 47 // The assumption is that nearly all of of them are atomic and would exist a
nyway. |
48 unsigned size = sizeof(*this); | 48 unsigned size = sizeof(*this); |
49 | 49 |
50 // FIXME: This ignores the children of media and region rules. | 50 // FIXME: This ignores the children of media rules. |
51 // Most rules are StyleRules. | 51 // Most rules are StyleRules. |
52 size += ruleCount() * StyleRule::averageSizeInBytes(); | 52 size += ruleCount() * StyleRule::averageSizeInBytes(); |
53 | 53 |
54 for (unsigned i = 0; i < m_importRules.size(); ++i) { | 54 for (unsigned i = 0; i < m_importRules.size(); ++i) { |
55 if (StyleSheetContents* sheet = m_importRules[i]->styleSheet()) | 55 if (StyleSheetContents* sheet = m_importRules[i]->styleSheet()) |
56 size += sheet->estimatedSizeInBytes(); | 56 size += sheet->estimatedSizeInBytes(); |
57 } | 57 } |
58 return size; | 58 return size; |
59 } | 59 } |
60 | 60 |
(...skipping 413 matching lines...) Loading... |
474 return true; | 474 return true; |
475 break; | 475 break; |
476 case StyleRuleBase::FontFace: | 476 case StyleRuleBase::FontFace: |
477 if (toStyleRuleFontFace(rule)->properties()->hasFailedOrCanceledSubr
esources()) | 477 if (toStyleRuleFontFace(rule)->properties()->hasFailedOrCanceledSubr
esources()) |
478 return true; | 478 return true; |
479 break; | 479 break; |
480 case StyleRuleBase::Media: | 480 case StyleRuleBase::Media: |
481 if (childRulesHaveFailedOrCanceledSubresources(toStyleRuleMedia(rule
)->childRules())) | 481 if (childRulesHaveFailedOrCanceledSubresources(toStyleRuleMedia(rule
)->childRules())) |
482 return true; | 482 return true; |
483 break; | 483 break; |
484 case StyleRuleBase::Region: | |
485 if (childRulesHaveFailedOrCanceledSubresources(toStyleRuleRegion(rul
e)->childRules())) | |
486 return true; | |
487 break; | |
488 case StyleRuleBase::Import: | 484 case StyleRuleBase::Import: |
489 ASSERT_NOT_REACHED(); | 485 ASSERT_NOT_REACHED(); |
490 case StyleRuleBase::Page: | 486 case StyleRuleBase::Page: |
491 case StyleRuleBase::Keyframes: | 487 case StyleRuleBase::Keyframes: |
492 case StyleRuleBase::Unknown: | 488 case StyleRuleBase::Unknown: |
493 case StyleRuleBase::Charset: | 489 case StyleRuleBase::Charset: |
494 case StyleRuleBase::Keyframe: | 490 case StyleRuleBase::Keyframe: |
495 case StyleRuleBase::Supports: | 491 case StyleRuleBase::Supports: |
496 case StyleRuleBase::Viewport: | 492 case StyleRuleBase::Viewport: |
497 case StyleRuleBase::Filter: | 493 case StyleRuleBase::Filter: |
(...skipping 75 matching lines...) Loading... |
573 } | 569 } |
574 m_ruleSet.clear(); | 570 m_ruleSet.clear(); |
575 } | 571 } |
576 | 572 |
577 | 573 |
578 void StyleSheetContents::trace(Visitor*) | 574 void StyleSheetContents::trace(Visitor*) |
579 { | 575 { |
580 } | 576 } |
581 | 577 |
582 } | 578 } |
OLD | NEW |