- Revision
- 102264
- Author
- [email protected]
- Date
- 2011-12-07 12:03:50 -0800 (Wed, 07 Dec 2011)
Log Message
Layout Test inspector/debugger/dom-breakpoints.html fails on chromium linux debug with ENABLE(MUTATION_OBSERVERS)
https://bugs.webkit.org/show_bug.cgi?id=73919
Reviewed by Ojan Vafai.
Source/WebCore:
Use StyleAttributeMutationScope to manage DOM breakpoints for style property changes.
Instead of calling InspectorInstrumentation::didInvalidateStyleAttr()
directly in setNeedsStyleRecalc, set a bool in the current
StyleAttributeMutationScope, and delay the call until the scope's
counter runs down to zero. This keeps the inspector JS from re-entering
CSSMutableStyleDeclaration until all StyleAttributeMutationScope work is done.
Also fix a small bug in StyleAttributeMutationScope, where
s_shouldDeliver wasn't getting reset properly to false.
* css/CSSMutableStyleDeclaration.cpp:
(WebCore::CSSMutableStyleDeclaration::setNeedsStyleRecalc):
LayoutTests:
Added test that no-op style mutations don't create MutationRecords.
* fast/mutation/observe-attributes-expected.txt:
* fast/mutation/observe-attributes.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (102263 => 102264)
--- trunk/LayoutTests/ChangeLog 2011-12-07 20:01:27 UTC (rev 102263)
+++ trunk/LayoutTests/ChangeLog 2011-12-07 20:03:50 UTC (rev 102264)
@@ -1,3 +1,15 @@
+2011-12-07 Adam Klein <[email protected]>
+
+ Layout Test inspector/debugger/dom-breakpoints.html fails on chromium linux debug with ENABLE(MUTATION_OBSERVERS)
+ https://bugs.webkit.org/show_bug.cgi?id=73919
+
+ Reviewed by Ojan Vafai.
+
+ Added test that no-op style mutations don't create MutationRecords.
+
+ * fast/mutation/observe-attributes-expected.txt:
+ * fast/mutation/observe-attributes.html:
+
2011-12-07 Ken Buchanan <[email protected]>
Crash from multicol spans with layers
Modified: trunk/LayoutTests/fast/mutation/observe-attributes-expected.txt (102263 => 102264)
--- trunk/LayoutTests/fast/mutation/observe-attributes-expected.txt 2011-12-07 20:01:27 UTC (rev 102263)
+++ trunk/LayoutTests/fast/mutation/observe-attributes-expected.txt 2011-12-07 20:03:50 UTC (rev 102264)
@@ -186,6 +186,9 @@
...mutation record created.
PASS mutations is null
+Testing that a no-op style property mutation does not create Mutation Records.
+PASS mutations is null
+
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/mutation/observe-attributes.html (102263 => 102264)
--- trunk/LayoutTests/fast/mutation/observe-attributes.html 2011-12-07 20:01:27 UTC (rev 102263)
+++ trunk/LayoutTests/fast/mutation/observe-attributes.html 2011-12-07 20:03:50 UTC (rev 102264)
@@ -652,7 +652,7 @@
}
function testStyleAttributePropertyAccess() {
- var svgDoc, div, path;
+ var div, path;
var observer;
function start() {
@@ -704,7 +704,7 @@
}
function testStyleAttributePropertyAccessOldValue() {
- var svgDoc, div, path;
+ var div, path;
var observer;
function start() {
@@ -755,6 +755,37 @@
start();
}
+function testStyleAttributePropertyAccessIgnoreNoop() {
+ var div, path;
+ var observer;
+
+ function start() {
+ debug('Testing that a no-op style property mutation does not create Mutation Records.');
+
+ mutations = null;
+ observer = new WebKitMutationObserver(function(m) {
+ mutations = m;
+ });
+
+ div = document.createElement('div');
+ div.setAttribute('style', 'color: yellow; width: 100px; ');
+ observer.observe(div, { attributes: true });
+ div.style.removeProperty('height');
+
+ setTimeout(finish, 0);
+ }
+
+ function finish() {
+ shouldBe('mutations', 'null');
+
+ observer.disconnect();
+ debug('');
+ runNextTest();
+ }
+
+ start();
+}
+
var tests = [
testBasic,
testWrongType,
@@ -772,7 +803,8 @@
testAttributeFilterNonHTMLElement,
testAttributeFilterNonHTMLDocument,
testStyleAttributePropertyAccess,
- testStyleAttributePropertyAccessOldValue
+ testStyleAttributePropertyAccessOldValue,
+ testStyleAttributePropertyAccessIgnoreNoop
];
var testIndex = 0;
Modified: trunk/Source/WebCore/ChangeLog (102263 => 102264)
--- trunk/Source/WebCore/ChangeLog 2011-12-07 20:01:27 UTC (rev 102263)
+++ trunk/Source/WebCore/ChangeLog 2011-12-07 20:03:50 UTC (rev 102264)
@@ -1,3 +1,24 @@
+2011-12-07 Adam Klein <[email protected]>
+
+ Layout Test inspector/debugger/dom-breakpoints.html fails on chromium linux debug with ENABLE(MUTATION_OBSERVERS)
+ https://bugs.webkit.org/show_bug.cgi?id=73919
+
+ Reviewed by Ojan Vafai.
+
+ Use StyleAttributeMutationScope to manage DOM breakpoints for style property changes.
+
+ Instead of calling InspectorInstrumentation::didInvalidateStyleAttr()
+ directly in setNeedsStyleRecalc, set a bool in the current
+ StyleAttributeMutationScope, and delay the call until the scope's
+ counter runs down to zero. This keeps the inspector JS from re-entering
+ CSSMutableStyleDeclaration until all StyleAttributeMutationScope work is done.
+
+ Also fix a small bug in StyleAttributeMutationScope, where
+ s_shouldDeliver wasn't getting reset properly to false.
+
+ * css/CSSMutableStyleDeclaration.cpp:
+ (WebCore::CSSMutableStyleDeclaration::setNeedsStyleRecalc):
+
2011-12-07 Ken Buchanan <[email protected]>
Crash from multicol spans with layers
Modified: trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp (102263 => 102264)
--- trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp 2011-12-07 20:01:27 UTC (rev 102263)
+++ trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp 2011-12-07 20:03:50 UTC (rev 102264)
@@ -45,7 +45,6 @@
namespace WebCore {
-#if ENABLE(MUTATION_OBSERVERS)
namespace {
class StyleAttributeMutationScope {
@@ -63,6 +62,7 @@
ASSERT(!s_currentDecl);
s_currentDecl = decl;
+#if ENABLE(MUTATION_OBSERVERS)
if (!s_currentDecl->isInlineStyleDeclaration())
return;
@@ -75,6 +75,7 @@
AtomicString oldValue = m_mutationRecipients->isOldValueRequested() ? inlineDecl->element()->getAttribute(HTMLNames::styleAttr) : nullAtom;
m_mutation = MutationRecord::createAttributes(inlineDecl->element(), HTMLNames::styleAttr, oldValue);
+#endif
}
~StyleAttributeMutationScope()
@@ -83,31 +84,57 @@
if (s_scopeCount)
return;
- s_currentDecl = 0;
+#if ENABLE(MUTATION_OBSERVERS)
if (m_mutation && s_shouldDeliver)
m_mutationRecipients->enqueueMutationRecord(m_mutation);
+ s_shouldDeliver = false;
+#endif
+
+ if (!s_shouldNotifyInspector) {
+ s_currentDecl = 0;
+ return;
+ }
+
+ CSSInlineStyleDeclaration* inlineDecl = toCSSInlineStyleDeclaration(s_currentDecl);
+ s_currentDecl = 0;
+ s_shouldNotifyInspector = false;
+ if (inlineDecl->element()->document())
+ InspectorInstrumentation::didInvalidateStyleAttr(inlineDecl->element()->document(), inlineDecl->element());
}
+#if ENABLE(MUTATION_OBSERVERS)
void enqueueMutationRecord()
{
s_shouldDeliver = true;
}
+#endif
+ void didInvalidateStyleAttr()
+ {
+ ASSERT(s_currentDecl->isInlineStyleDeclaration());
+ s_shouldNotifyInspector = true;
+ }
+
private:
static unsigned s_scopeCount;
static CSSMutableStyleDeclaration* s_currentDecl;
+ static bool s_shouldNotifyInspector;
+#if ENABLE(MUTATION_OBSERVERS)
static bool s_shouldDeliver;
OwnPtr<MutationObserverInterestGroup> m_mutationRecipients;
RefPtr<MutationRecord> m_mutation;
+#endif
};
unsigned StyleAttributeMutationScope::s_scopeCount = 0;
CSSMutableStyleDeclaration* StyleAttributeMutationScope::s_currentDecl = 0;
+bool StyleAttributeMutationScope::s_shouldNotifyInspector = false;
+#if ENABLE(MUTATION_OBSERVERS)
bool StyleAttributeMutationScope::s_shouldDeliver = false;
+#endif
} // namespace
-#endif // ENABLE(MUTATION_OBSERVERS)
CSSMutableStyleDeclaration::CSSMutableStyleDeclaration()
: CSSStyleDeclaration(0)
@@ -620,8 +647,7 @@
else {
element->setNeedsStyleRecalc(InlineStyleChange);
element->invalidateStyleAttribute();
- if (Document* document = element->document())
- InspectorInstrumentation::didInvalidateStyleAttr(document, element);
+ StyleAttributeMutationScope(this).didInvalidateStyleAttr();
}
return;
}