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...) Expand all 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 return true; | 480 return true; |
481 break; | 481 break; |
482 case StyleRuleBase::FontFace: | 482 case StyleRuleBase::FontFace: |
483 if (toStyleRuleFontFace(rule)->properties()->hasFailedOrCanceledSubr
esources()) | 483 if (toStyleRuleFontFace(rule)->properties()->hasFailedOrCanceledSubr
esources()) |
484 return true; | 484 return true; |
485 break; | 485 break; |
486 case StyleRuleBase::Media: | 486 case StyleRuleBase::Media: |
487 if (childRulesHaveFailedOrCanceledSubresources(toStyleRuleMedia(rule
)->childRules())) | 487 if (childRulesHaveFailedOrCanceledSubresources(toStyleRuleMedia(rule
)->childRules())) |
488 return true; | 488 return true; |
489 break; | 489 break; |
490 case StyleRuleBase::Region: | |
491 if (childRulesHaveFailedOrCanceledSubresources(toStyleRuleRegion(rul
e)->childRules())) | |
492 return true; | |
493 break; | |
494 case StyleRuleBase::Import: | 490 case StyleRuleBase::Import: |
495 ASSERT_NOT_REACHED(); | 491 ASSERT_NOT_REACHED(); |
496 case StyleRuleBase::Page: | 492 case StyleRuleBase::Page: |
497 case StyleRuleBase::Keyframes: | 493 case StyleRuleBase::Keyframes: |
498 case StyleRuleBase::Unknown: | 494 case StyleRuleBase::Unknown: |
499 case StyleRuleBase::Charset: | 495 case StyleRuleBase::Charset: |
500 case StyleRuleBase::Keyframe: | 496 case StyleRuleBase::Keyframe: |
501 case StyleRuleBase::Supports: | 497 case StyleRuleBase::Supports: |
502 case StyleRuleBase::Viewport: | 498 case StyleRuleBase::Viewport: |
503 case StyleRuleBase::Filter: | 499 case StyleRuleBase::Filter: |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 } | 611 } |
616 | 612 |
617 findFontFaceRulesFromRules(childRules(), fontFaceRules); | 613 findFontFaceRulesFromRules(childRules(), fontFaceRules); |
618 } | 614 } |
619 | 615 |
620 void StyleSheetContents::trace(Visitor*) | 616 void StyleSheetContents::trace(Visitor*) |
621 { | 617 { |
622 } | 618 } |
623 | 619 |
624 } | 620 } |
OLD | NEW |