summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/StyleSheetContents.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
commit3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch)
tree73dc228333948738bbe02976cacca8cd382bc978 /Source/WebCore/css/StyleSheetContents.cpp
parentb32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff)
downloadqtwebkit-3749d61e1f7a59f5ec5067e560af1eb610c82015.tar.gz
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Source/WebCore/css/StyleSheetContents.cpp')
-rw-r--r--Source/WebCore/css/StyleSheetContents.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/Source/WebCore/css/StyleSheetContents.cpp b/Source/WebCore/css/StyleSheetContents.cpp
index 970c828ca..292debb94 100644
--- a/Source/WebCore/css/StyleSheetContents.cpp
+++ b/Source/WebCore/css/StyleSheetContents.cpp
@@ -26,6 +26,7 @@
#include "CSSStyleSheet.h"
#include "CachedCSSStyleSheet.h"
#include "Document.h"
+#include "MemoryInstrumentation.h"
#include "Node.h"
#include "SecurityOrigin.h"
#include "StylePropertySet.h"
@@ -409,6 +410,46 @@ void StyleSheetContents::addSubresourceStyleURLs(ListHashSet<KURL>& urls)
}
}
+static bool childRulesHaveFailedOrCanceledSubresources(const Vector<RefPtr<StyleRuleBase> >& rules)
+{
+ for (unsigned i = 0; i < rules.size(); ++i) {
+ const StyleRuleBase* rule = rules[i].get();
+ switch (rule->type()) {
+ case StyleRuleBase::Style:
+ if (static_cast<const StyleRule*>(rule)->properties()->hasFailedOrCanceledSubresources())
+ return true;
+ break;
+ case StyleRuleBase::FontFace:
+ if (static_cast<const StyleRuleFontFace*>(rule)->properties()->hasFailedOrCanceledSubresources())
+ return true;
+ break;
+ case StyleRuleBase::Media:
+ if (childRulesHaveFailedOrCanceledSubresources(static_cast<const StyleRuleMedia*>(rule)->childRules()))
+ return true;
+ break;
+ case StyleRuleBase::Region:
+ if (childRulesHaveFailedOrCanceledSubresources(static_cast<const StyleRuleRegion*>(rule)->childRules()))
+ return true;
+ break;
+ case StyleRuleBase::Import:
+ ASSERT_NOT_REACHED();
+ case StyleRuleBase::Page:
+ case StyleRuleBase::Keyframes:
+ case StyleRuleBase::Unknown:
+ case StyleRuleBase::Charset:
+ case StyleRuleBase::Keyframe:
+ break;
+ }
+ }
+ return false;
+}
+
+bool StyleSheetContents::hasFailedOrCanceledSubresources() const
+{
+ ASSERT(isCacheable());
+ return childRulesHaveFailedOrCanceledSubresources(m_childRules);
+}
+
StyleSheetContents* StyleSheetContents::parentStyleSheet() const
{
return m_ownerRule ? m_ownerRule->parentStyleSheet() : 0;
@@ -441,4 +482,16 @@ void StyleSheetContents::removedFromMemoryCache()
m_isInMemoryCache = false;
}
+void StyleSheetContents::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ info.addMember(m_originalURL);
+ info.addMember(m_finalURL);
+ info.addMember(m_encodingFromCharsetRule);
+ info.addVector(m_importRules);
+ info.addInstrumentedVector(m_childRules);
+ info.addHashMap(m_namespaces);
+ info.addVector(m_clients);
+}
+
}