Changeset 102264 in webkit
- Timestamp:
- Dec 7, 2011 12:03:50 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r102263 r102264 1 2011-12-07 Adam Klein <adamk@chromium.org> 2 3 Layout Test inspector/debugger/dom-breakpoints.html fails on chromium linux debug with ENABLE(MUTATION_OBSERVERS) 4 https://bugs.webkit.org/show_bug.cgi?id=73919 5 6 Reviewed by Ojan Vafai. 7 8 Added test that no-op style mutations don't create MutationRecords. 9 10 * fast/mutation/observe-attributes-expected.txt: 11 * fast/mutation/observe-attributes.html: 12 1 13 2011-12-07 Ken Buchanan <kenrb@chromium.org> 2 14 -
trunk/LayoutTests/fast/mutation/observe-attributes-expected.txt
r102100 r102264 187 187 PASS mutations is null 188 188 189 Testing that a no-op style property mutation does not create Mutation Records. 190 PASS mutations is null 191 189 192 PASS successfullyParsed is true 190 193 -
trunk/LayoutTests/fast/mutation/observe-attributes.html
r102100 r102264 653 653 654 654 function testStyleAttributePropertyAccess() { 655 var svgDoc,div, path;655 var div, path; 656 656 var observer; 657 657 … … 705 705 706 706 function testStyleAttributePropertyAccessOldValue() { 707 var svgDoc,div, path;707 var div, path; 708 708 var observer; 709 709 … … 746 746 debug('...mutation record created.'); 747 747 748 shouldBe('mutations', 'null'); 749 750 observer.disconnect(); 751 debug(''); 752 runNextTest(); 753 } 754 755 start(); 756 } 757 758 function testStyleAttributePropertyAccessIgnoreNoop() { 759 var div, path; 760 var observer; 761 762 function start() { 763 debug('Testing that a no-op style property mutation does not create Mutation Records.'); 764 765 mutations = null; 766 observer = new WebKitMutationObserver(function(m) { 767 mutations = m; 768 }); 769 770 div = document.createElement('div'); 771 div.setAttribute('style', 'color: yellow; width: 100px; '); 772 observer.observe(div, { attributes: true }); 773 div.style.removeProperty('height'); 774 775 setTimeout(finish, 0); 776 } 777 778 function finish() { 748 779 shouldBe('mutations', 'null'); 749 780 … … 773 804 testAttributeFilterNonHTMLDocument, 774 805 testStyleAttributePropertyAccess, 775 testStyleAttributePropertyAccessOldValue 806 testStyleAttributePropertyAccessOldValue, 807 testStyleAttributePropertyAccessIgnoreNoop 776 808 ]; 777 809 var testIndex = 0; -
trunk/Source/WebCore/ChangeLog
r102263 r102264 1 2011-12-07 Adam Klein <adamk@chromium.org> 2 3 Layout Test inspector/debugger/dom-breakpoints.html fails on chromium linux debug with ENABLE(MUTATION_OBSERVERS) 4 https://bugs.webkit.org/show_bug.cgi?id=73919 5 6 Reviewed by Ojan Vafai. 7 8 Use StyleAttributeMutationScope to manage DOM breakpoints for style property changes. 9 10 Instead of calling InspectorInstrumentation::didInvalidateStyleAttr() 11 directly in setNeedsStyleRecalc, set a bool in the current 12 StyleAttributeMutationScope, and delay the call until the scope's 13 counter runs down to zero. This keeps the inspector JS from re-entering 14 CSSMutableStyleDeclaration until all StyleAttributeMutationScope work is done. 15 16 Also fix a small bug in StyleAttributeMutationScope, where 17 s_shouldDeliver wasn't getting reset properly to false. 18 19 * css/CSSMutableStyleDeclaration.cpp: 20 (WebCore::CSSMutableStyleDeclaration::setNeedsStyleRecalc): 21 1 22 2011-12-07 Ken Buchanan <kenrb@chromium.org> 2 23 -
trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp
r101970 r102264 46 46 namespace WebCore { 47 47 48 #if ENABLE(MUTATION_OBSERVERS)49 48 namespace { 50 49 … … 64 63 s_currentDecl = decl; 65 64 65 #if ENABLE(MUTATION_OBSERVERS) 66 66 if (!s_currentDecl->isInlineStyleDeclaration()) 67 67 return; … … 76 76 AtomicString oldValue = m_mutationRecipients->isOldValueRequested() ? inlineDecl->element()->getAttribute(HTMLNames::styleAttr) : nullAtom; 77 77 m_mutation = MutationRecord::createAttributes(inlineDecl->element(), HTMLNames::styleAttr, oldValue); 78 #endif 78 79 } 79 80 … … 84 85 return; 85 86 86 s_currentDecl = 0; 87 #if ENABLE(MUTATION_OBSERVERS) 87 88 if (m_mutation && s_shouldDeliver) 88 89 m_mutationRecipients->enqueueMutationRecord(m_mutation); 89 } 90 90 s_shouldDeliver = false; 91 #endif 92 93 if (!s_shouldNotifyInspector) { 94 s_currentDecl = 0; 95 return; 96 } 97 98 CSSInlineStyleDeclaration* inlineDecl = toCSSInlineStyleDeclaration(s_currentDecl); 99 s_currentDecl = 0; 100 s_shouldNotifyInspector = false; 101 if (inlineDecl->element()->document()) 102 InspectorInstrumentation::didInvalidateStyleAttr(inlineDecl->element()->document(), inlineDecl->element()); 103 } 104 105 #if ENABLE(MUTATION_OBSERVERS) 91 106 void enqueueMutationRecord() 92 107 { 93 108 s_shouldDeliver = true; 94 109 } 110 #endif 111 112 void didInvalidateStyleAttr() 113 { 114 ASSERT(s_currentDecl->isInlineStyleDeclaration()); 115 s_shouldNotifyInspector = true; 116 } 95 117 96 118 private: 97 119 static unsigned s_scopeCount; 98 120 static CSSMutableStyleDeclaration* s_currentDecl; 121 static bool s_shouldNotifyInspector; 122 #if ENABLE(MUTATION_OBSERVERS) 99 123 static bool s_shouldDeliver; 100 124 101 125 OwnPtr<MutationObserverInterestGroup> m_mutationRecipients; 102 126 RefPtr<MutationRecord> m_mutation; 127 #endif 103 128 }; 104 129 105 130 unsigned StyleAttributeMutationScope::s_scopeCount = 0; 106 131 CSSMutableStyleDeclaration* StyleAttributeMutationScope::s_currentDecl = 0; 132 bool StyleAttributeMutationScope::s_shouldNotifyInspector = false; 133 #if ENABLE(MUTATION_OBSERVERS) 107 134 bool StyleAttributeMutationScope::s_shouldDeliver = false; 135 #endif 108 136 109 137 } // namespace 110 #endif // ENABLE(MUTATION_OBSERVERS)111 138 112 139 CSSMutableStyleDeclaration::CSSMutableStyleDeclaration() … … 621 648 element->setNeedsStyleRecalc(InlineStyleChange); 622 649 element->invalidateStyleAttribute(); 623 if (Document* document = element->document()) 624 InspectorInstrumentation::didInvalidateStyleAttr(document, element); 650 StyleAttributeMutationScope(this).didInvalidateStyleAttr(); 625 651 } 626 652 return;
Note: See TracChangeset
for help on using the changeset viewer.