Title: [98844] trunk/Source/WebCore
- Revision
- 98844
- Author
- an...@apple.com
- Date
- 2011-10-31 04:23:34 -0700 (Mon, 31 Oct 2011)
Log Message
https://bugs.webkit.org/show_bug.cgi?id=71012
Use StringHasher to generate the matched declaration cache hash
Reviewed by Sam Weinig.
Make sure the MatchedStyleDeclarations are fully zero-initialized as we calculate a hash over a raw memory array of these.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::MatchedStyleDeclaration::MatchedStyleDeclaration):
(WebCore::CSSStyleSelector::addMatchedDeclaration):
* css/CSSStyleSelector.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (98843 => 98844)
--- trunk/Source/WebCore/ChangeLog 2011-10-31 10:28:34 UTC (rev 98843)
+++ trunk/Source/WebCore/ChangeLog 2011-10-31 11:23:34 UTC (rev 98844)
@@ -1,3 +1,17 @@
+2011-10-31 Antti Koivisto <an...@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=71012
+ Use StringHasher to generate the matched declaration cache hash
+
+ Reviewed by Sam Weinig.
+
+ Make sure the MatchedStyleDeclarations are fully zero-initialized as we calculate a hash over a raw memory array of these.
+
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::MatchedStyleDeclaration::MatchedStyleDeclaration):
+ (WebCore::CSSStyleSelector::addMatchedDeclaration):
+ * css/CSSStyleSelector.h:
+
2011-10-31 Carlos Garcia Campos <cgar...@igalia.com>
Unreviewed. Fix make distcheck build.
Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (98843 => 98844)
--- trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-10-31 10:28:34 UTC (rev 98843)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-10-31 11:23:34 UTC (rev 98844)
@@ -593,9 +593,18 @@
#endif
}
-void CSSStyleSelector::addMatchedDeclaration(CSSMutableStyleDeclaration* decl, unsigned linkMatchType)
+CSSStyleSelector::MatchedStyleDeclaration::MatchedStyleDeclaration()
+{
+ // Make sure all memory is zero initializes as we calculate hash over the bytes of this object.
+ memset(this, 0, sizeof(*this));
+}
+
+void CSSStyleSelector::addMatchedDeclaration(CSSMutableStyleDeclaration* styleDeclaration, unsigned linkMatchType)
{
- m_matchedDecls.append(MatchedStyleDeclaration(decl, linkMatchType));
+ m_matchedDecls.grow(m_matchedDecls.size() + 1);
+ MatchedStyleDeclaration& newDeclaration = m_matchedDecls.last();
+ newDeclaration.styleDeclaration = styleDeclaration;
+ newDeclaration.linkMatchType = linkMatchType;
}
void CSSStyleSelector::matchRules(RuleSet* rules, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules)
Modified: trunk/Source/WebCore/css/CSSStyleSelector.h (98843 => 98844)
--- trunk/Source/WebCore/css/CSSStyleSelector.h 2011-10-31 10:28:34 UTC (rev 98843)
+++ trunk/Source/WebCore/css/CSSStyleSelector.h 2011-10-31 11:23:34 UTC (rev 98844)
@@ -330,7 +330,7 @@
void loadPendingImages();
struct MatchedStyleDeclaration {
- MatchedStyleDeclaration(CSSMutableStyleDeclaration* decl, unsigned type) : styleDeclaration(decl), linkMatchType(type) { }
+ MatchedStyleDeclaration();
CSSMutableStyleDeclaration* styleDeclaration;
unsigned linkMatchType;
};
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes