Changeset 144025 in webkit
- Timestamp:
- Feb 26, 2013, 1:15:17 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/inspector/styles/styles-new-API-expected.txt (modified) (1 diff)
-
LayoutTests/inspector/styles/styles-new-API.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/inspector/InspectorCSSAgent.cpp (modified) (2 diffs)
-
Source/WebCore/inspector/InspectorStyleSheet.cpp (modified) (8 diffs)
-
Source/WebCore/inspector/InspectorStyleSheet.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r144024 r144025 1 2013-02-26 Alexander Pavlov <apavlov@chromium.org> 2 3 Web Inspector: CSSAgent.setStyleSheetText crashes on inline styles 4 https://bugs.webkit.org/show_bug.cgi?id=110359 5 6 Reviewed by Pavel Feldman. 7 8 * inspector/styles/styles-new-API-expected.txt: 9 * inspector/styles/styles-new-API.html: 10 1 11 2013-02-26 Tien-Ren Chen <trchen@chromium.org> 2 12 -
trunk/LayoutTests/inspector/styles/styles-new-API-expected.txt
r125399 r144025 134 134 === Attributes style for table === 135 135 ['width':'50%'] @[undefined-undefined] style 136 137 === Stylesheet-for-inline-style text === 138 139 140 === Stylesheet-for-inline-style modification result === 141 NotSupportedError 136 142 137 143 === All stylesheets === -
trunk/LayoutTests/inspector/styles/styles-new-API.html
r130511 r144025 119 119 InspectorTest.addResult("=== Attributes style for table ==="); 120 120 InspectorTest.dumpStyle(attributesStyle); 121 test_inlineStyleSheetModification(inlineStyle); 122 } 123 124 function nodeCallback(node) 125 { 126 CSSAgent.getInlineStylesForNode(node.id, callback); 127 } 128 InspectorTest.nodeWithId("thetable", nodeCallback); 129 } 130 131 function test_inlineStyleSheetModification(inlineStyle) 132 { 133 CSSAgent.getStyleSheetText(inlineStyle.styleId.styleSheetId, textCallback); 134 135 function textCallback(error, result) 136 { 137 InspectorTest.addResult(""); 138 InspectorTest.addResult("=== Stylesheet-for-inline-style text ==="); 139 InspectorTest.addResult(result); 140 CSSAgent.setStyleSheetText(inlineStyle.styleId.styleSheetId, "", setTextCallback); 141 } 142 143 function setTextCallback(error, result) 144 { 145 InspectorTest.addResult(""); 146 InspectorTest.addResult("=== Stylesheet-for-inline-style modification result ==="); 147 InspectorTest.addResult(error); 121 148 test_styleSheets(); 122 149 } 123 124 function nodeCallback(node)125 {126 CSSAgent.getInlineStylesForNode(node.id, callback);127 }128 InspectorTest.nodeWithId("thetable", nodeCallback);129 150 } 130 151 -
trunk/Source/WebCore/ChangeLog
r144024 r144025 1 2013-02-26 Alexander Pavlov <apavlov@chromium.org> 2 3 Web Inspector: CSSAgent.setStyleSheetText crashes on inline styles 4 https://bugs.webkit.org/show_bug.cgi?id=110359 5 6 Reviewed by Pavel Feldman. 7 8 * inspector/InspectorCSSAgent.cpp: 9 (WebCore::InspectorCSSAgent::SetStyleSheetTextAction::undo): Pass ExceptionCode into setText(). 10 (WebCore::InspectorCSSAgent::SetStyleSheetTextAction::redo): Ditto. 11 * inspector/InspectorStyleSheet.cpp: 12 (WebCore::InspectorStyleSheet::setText): Make use of checkPageStyleSheet(). 13 (WebCore::InspectorStyleSheet::setRuleSelector): Ditto. 14 (WebCore::InspectorStyleSheet::addRule): Ditto. 15 (WebCore::InspectorStyleSheet::deleteRule): Ditto. 16 (WebCore::InspectorStyleSheet::checkPageStyleSheet): 17 Return NOT_SUPPORTED_ERR if no m_pageStyleSheet. 18 (WebCore::InspectorStyleSheet::setStyleText): Check field directly. 19 * inspector/InspectorStyleSheet.h: 20 1 21 2013-02-26 Tien-Ren Chen <trchen@chromium.org> 2 22 -
trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp
r143333 r144025 319 319 } 320 320 321 virtual bool undo(ExceptionCode& )322 { 323 if (m_styleSheet->setText(m_oldText )) {321 virtual bool undo(ExceptionCode& ec) 322 { 323 if (m_styleSheet->setText(m_oldText, ec)) { 324 324 m_styleSheet->reparseStyleSheet(m_oldText); 325 325 return true; … … 328 328 } 329 329 330 virtual bool redo(ExceptionCode& )331 { 332 if (m_styleSheet->setText(m_text )) {330 virtual bool redo(ExceptionCode& ec) 331 { 332 if (m_styleSheet->setText(m_text, ec)) { 333 333 m_styleSheet->reparseStyleSheet(m_text); 334 334 return true; -
trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp
r143926 r144025 781 781 } 782 782 783 bool InspectorStyleSheet::setText(const String& text) 784 { 783 bool InspectorStyleSheet::setText(const String& text, ExceptionCode& ec) 784 { 785 if (!checkPageStyleSheet(ec)) 786 return false; 785 787 if (!m_parsedStyleSheet) 786 788 return false; … … 804 806 bool InspectorStyleSheet::setRuleSelector(const InspectorCSSId& id, const String& selector, ExceptionCode& ec) 805 807 { 808 if (!checkPageStyleSheet(ec)) 809 return false; 806 810 CSSStyleRule* rule = ruleForId(id); 807 811 if (!rule) { … … 838 842 CSSStyleRule* InspectorStyleSheet::addRule(const String& selector, ExceptionCode& ec) 839 843 { 844 if (!checkPageStyleSheet(ec)) 845 return 0; 840 846 if (!checkStyleRuleSelector(m_pageStyleSheet->ownerDocument(), selector)) { 841 847 ec = SYNTAX_ERR; … … 875 881 styleSheetText.appendLiteral(" {}"); 876 882 // Using setText() as this operation changes the style sheet rule set. 877 setText(styleSheetText.toString() );883 setText(styleSheetText.toString(), ASSERT_NO_EXCEPTION); 878 884 879 885 fireStyleSheetChanged(); … … 884 890 bool InspectorStyleSheet::deleteRule(const InspectorCSSId& id, ExceptionCode& ec) 885 891 { 892 if (!checkPageStyleSheet(ec)) 893 return false; 886 894 RefPtr<CSSStyleRule> rule = ruleForId(id); 887 895 if (!rule) { … … 909 917 String sheetText = m_parsedStyleSheet->text(); 910 918 sheetText.remove(sourceData->ruleHeaderRange.start, sourceData->ruleBodyRange.end - sourceData->ruleHeaderRange.start + 1); 911 setText(sheetText );919 setText(sheetText, ASSERT_NO_EXCEPTION); 912 920 fireStyleSheetChanged(); 913 921 return true; … … 1178 1186 } 1179 1187 1188 bool InspectorStyleSheet::checkPageStyleSheet(ExceptionCode& ec) const 1189 { 1190 if (!m_pageStyleSheet) { 1191 ec = NOT_SUPPORTED_ERR; 1192 return false; 1193 } 1194 return true; 1195 } 1196 1180 1197 bool InspectorStyleSheet::ensureParsedDataReady() 1181 1198 { … … 1223 1240 bool InspectorStyleSheet::setStyleText(CSSStyleDeclaration* style, const String& text) 1224 1241 { 1225 if (! pageStyleSheet())1242 if (!m_pageStyleSheet) 1226 1243 return false; 1227 1244 if (!ensureParsedDataReady()) -
trunk/Source/WebCore/inspector/InspectorStyleSheet.h
r138460 r144025 186 186 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); } 187 187 void reparseStyleSheet(const String&); 188 bool setText(const String& );188 bool setText(const String&, ExceptionCode&); 189 189 String ruleSelector(const InspectorCSSId&, ExceptionCode&); 190 190 bool setRuleSelector(const InspectorCSSId&, const String& selector, ExceptionCode&); … … 227 227 228 228 static void collectFlatRules(PassRefPtr<CSSRuleList>, CSSStyleRuleVector* result); 229 bool checkPageStyleSheet(ExceptionCode&) const; 229 230 bool ensureText() const; 230 231 bool ensureSourceData();
Note:
See TracChangeset
for help on using the changeset viewer.