Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / elements / styles / styles-new-API.html
index c6db2c7..40a9b23 100644 (file)
@@ -150,7 +150,7 @@ function test()
                 InspectorTest.addResult("");
                 InspectorTest.addResult("=== Stylesheet-for-inline-style text ===");
                 InspectorTest.addResult(result);
-                CSSAgent.setStyleSheetText(inlineStyle.styleId.styleSheetId, "", setTextCallback);
+                CSSAgent.setStyleSheetText(inlineStyle.styleSheetId, "", setTextCallback);
             }
 
             function callback(error, inlineStyle, attributesStyle)
@@ -162,7 +162,7 @@ function test()
                 InspectorTest.addResult("");
                 InspectorTest.addResult("=== Attributes style for table ===");
                 InspectorTest.dumpStyle(attributesStyle);
-                CSSAgent.getStyleSheetText(inlineStyle.styleId.styleSheetId, textCallback.bind(this, inlineStyle));
+                CSSAgent.getStyleSheetText(inlineStyle.styleSheetId, textCallback.bind(this, inlineStyle));
             }
 
             function nodeCallback(node)
@@ -192,17 +192,27 @@ function test()
                 }
                 InspectorTest.addResult("");
                 InspectorTest.addResult("=== After style text set ===");
-                loadAndDumpStyleSheet(style.styleId.styleSheetId, next);
+                loadAndDumpStyleSheet(style.styleSheetId, next);
+            }
+
+            function collapseToStart(range)
+            {
+                return {
+                    startLine: range.startLine,
+                    startColumn: range.startColumn,
+                    endLine: range.startLine,
+                    endColumn: range.startColumn,
+                };
             }
 
             function setStyleText(rule)
             {
-                CSSAgent.setPropertyText(rule.style.styleId, 0, "", true);
-                CSSAgent.setPropertyText(rule.style.styleId, 0, "", true);
+                CSSAgent.setPropertyText(rule.style.styleSheetId, rule.style.cssProperties[1].range, "");
+                CSSAgent.setPropertyText(rule.style.styleSheetId, rule.style.cssProperties[0].range, "");
 
                 // This operation should not update the style as the new property text is not parsable.
-                CSSAgent.setPropertyText(rule.style.styleId, 0, "zzz;", false);
-                CSSAgent.setPropertyText(rule.style.styleId, 0, "color: white; background: black;", false, didSetStyleText);
+                CSSAgent.setPropertyText(rule.style.styleSheetId, collapseToStart(rule.style.range), "zzz;");
+                CSSAgent.setPropertyText(rule.style.styleSheetId, collapseToStart(rule.style.range), "color: white; background: black;", didSetStyleText);
             }
 
             function didSetSelector(error, rule)
@@ -214,12 +224,13 @@ function test()
                 }
                 InspectorTest.addResult("");
                 InspectorTest.addResult("=== After selector set ===");
-                loadAndDumpStyleSheet(rule.ruleId.styleSheetId, setStyleText.bind(this, rule));
+                loadAndDumpStyleSheet(rule.styleSheetId, setStyleText.bind(this, rule));
             }
 
             function setRuleSelector(rule)
             {
-                CSSAgent.setRuleSelector(rule.ruleId, "html *, body[foo=\"bar\"]", didSetSelector);
+                var orm = WebInspector.CSSRule.parsePayload(WebInspector.cssModel, rule);
+                CSSAgent.setRuleSelector(orm.styleSheetId, orm.selectorRange, "html *, body[foo=\"bar\"]", didSetSelector);
             }
 
             function onMatchedStylesForNode(error, matchedStyles)
@@ -293,7 +304,12 @@ function test()
                     InspectorTest.addResult("error: " + error);
                     return;
                 }
-                CSSAgent.setPropertyText(rule.style.styleId, 0, "font-family: serif;", false, didSetStyleText);
+                CSSAgent.setPropertyText(rule.style.styleSheetId, {
+                    startLine: rule.style.range.startLine,
+                    startColumn: rule.style.range.startColumn,
+                    endLine: rule.style.range.startLine,
+                    endColumn: rule.style.range.startColumn
+                }, "font-family: serif;", didSetStyleText);
             }
 
             function viaInspectorStyleSheetCreated(error, styleSheetId)
@@ -340,7 +356,7 @@ function test()
                     InspectorTest.completeTest();
                     return;
                 }
-                callback(WebInspector.CSSStyleDeclaration.parsePayload(payload));
+                callback(WebInspector.CSSStyleDeclaration.parsePayload(WebInspector.cssModel, payload));
             }
 
             function stylesCallback(error, matchedCSSRules)
@@ -359,8 +375,7 @@ function test()
                 // border-width: 0px;
                 // padding-top: 1px; [d]
 
-                var styleId = matchedCSSRules[1].rule.style.styleId;
-                var orm = WebInspector.CSSStyleDeclaration.parsePayload(matchedCSSRules[1].rule.style);
+                var orm = WebInspector.CSSStyleDeclaration.parsePayload(WebInspector.cssModel, matchedCSSRules[1].rule.style);
                 orm.propertyAt(0).setDisabled(true, step1);
 
                 function step1(orm)
@@ -370,12 +385,12 @@ function test()
 
                 function step2(orm)
                 {
-                    CSSAgent.setPropertyText(orm.id, 7, "font-size: 12px;", false, parseStylePayload.bind(null, step3));
+                    CSSAgent.setPropertyText(orm.styleSheetId, orm.propertyAt(7).range.collapseToStart(), "font-size: 12px;", parseStylePayload.bind(null, step3));
                 }
 
                 function step3(orm)
                 {
-                    CSSAgent.setPropertyText(orm.id, 9, "font-size: 14px;", false, parseStylePayload.bind(null, step4));
+                    CSSAgent.setPropertyText(orm.styleSheetId, orm.propertyAt(9).range.collapseToStart(), "font-size: 14px;", parseStylePayload.bind(null, step4));
                 }
 
                 function step4(orm)
@@ -385,7 +400,7 @@ function test()
 
                 function step5(orm)
                 {
-                    CSSAgent.setPropertyText(orm.id, 8, "border-width: 1px;", true, parseStylePayload.bind(null, step6));
+                    CSSAgent.setPropertyText(orm.styleSheetId, orm.propertyAt(8).range, "border-width: 1px;", parseStylePayload.bind(null, step6));
                 }
 
                 function step6(orm)
@@ -395,7 +410,7 @@ function test()
 
                 function step7(orm)
                 {
-                    CSSAgent.setPropertyText(orm.id, 3, "", true, parseStylePayload.bind(null, step8));
+                    CSSAgent.setPropertyText(orm.styleSheetId, orm.propertyAt(3).range, "", parseStylePayload.bind(null, step8));
                 }
 
                 function step8(orm)