Title: [119782] trunk/Source/WebCore
- Revision
- 119782
- Author
- commit-qu...@webkit.org
- Date
- 2012-06-07 19:06:16 -0700 (Thu, 07 Jun 2012)
Log Message
Improve the performance of pushScope in StyleResolver
https://bugs.webkit.org/show_bug.cgi?id=88222
Patch by Takashi Sakamoto <ta...@google.com> on 2012-06-07
Reviewed by Hajime Morita.
As setupScopeStack always sets m_scopeStackParent to be NULL,
m_scopeStack is never reused. m_scopeStackParent should be the last
element of m_scopeStack.
No new tests, because fast/css/style-scoped/ uses pushScope,
popScope and setupScopeStack and checks whether there exists
any crash bug or not. And this patch doesn't change any behavior
of scoped author syltes.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::setupScopeStack):
Modified to set m_scopeSackParent to be the last element of
m_scopeStack.
(WebCore::StyleResolver::popScope):
Modified to remove the last element if m_scopeStack is not empty and
the last element of m_scopeStack has the same scope as the scoping
element given by the argument.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (119781 => 119782)
--- trunk/Source/WebCore/ChangeLog 2012-06-08 01:35:51 UTC (rev 119781)
+++ trunk/Source/WebCore/ChangeLog 2012-06-08 02:06:16 UTC (rev 119782)
@@ -1,3 +1,28 @@
+2012-06-07 Takashi Sakamoto <ta...@google.com>
+
+ Improve the performance of pushScope in StyleResolver
+ https://bugs.webkit.org/show_bug.cgi?id=88222
+
+ Reviewed by Hajime Morita.
+
+ As setupScopeStack always sets m_scopeStackParent to be NULL,
+ m_scopeStack is never reused. m_scopeStackParent should be the last
+ element of m_scopeStack.
+
+ No new tests, because fast/css/style-scoped/ uses pushScope,
+ popScope and setupScopeStack and checks whether there exists
+ any crash bug or not. And this patch doesn't change any behavior
+ of scoped author syltes.
+
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::setupScopeStack):
+ Modified to set m_scopeSackParent to be the last element of
+ m_scopeStack.
+ (WebCore::StyleResolver::popScope):
+ Modified to remove the last element if m_scopeStack is not empty and
+ the last element of m_scopeStack has the same scope as the scoping
+ element given by the argument.
+
2012-06-07 Mark Pilgrim <pilg...@chromium.org>
[Chromium] Move didStartWorkerRunLoop to Platform.h
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (119781 => 119782)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2012-06-08 01:35:51 UTC (rev 119781)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2012-06-08 02:06:16 UTC (rev 119782)
@@ -559,10 +559,10 @@
ASSERT(!m_scopedAuthorStyles.isEmpty());
m_scopeStack.shrink(0);
- for (; parent; parent = parent->parentOrHostNode()) {
- RuleSet* ruleSet = ruleSetForScope(parent);
+ for (const ContainerNode* scope = parent; scope; scope = scope->parentOrHostNode()) {
+ RuleSet* ruleSet = ruleSetForScope(scope);
if (ruleSet)
- m_scopeStack.append(ScopeStackFrame(parent, ruleSet));
+ m_scopeStack.append(ScopeStackFrame(scope, ruleSet));
}
m_scopeStack.reverse();
m_scopeStackParent = parent;
@@ -593,7 +593,8 @@
{
// Only bother to update the scoping element stack if it is consistent.
if (scopeStackIsConsistent(scope)) {
- m_scopeStack.removeLast();
+ if (!m_scopeStack.isEmpty() && m_scopeStack.last().m_scope == scope)
+ m_scopeStack.removeLast();
m_scopeStackParent = scope->parentOrHostNode();
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes