4 <link rel=
"stylesheet" href=
"../styles/resources/styles-source-offsets.css">
6 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
7 <script src=
"../../../http/tests/inspector/elements-test.js"></script>
12 function dumpStyleData(ruleOrStyle
)
14 var isRule
= !!(ruleOrStyle
.style
);
18 if (ruleOrStyle
.origin
!== "regular")
20 style
= ruleOrStyle
.style
;
21 var selectorRanges
= [];
22 var selectors
= ruleOrStyle
.selectorList
.selectors
;
23 var firstRange
= selectors
[0].range
;
24 var lastRange
= selectors
[selectors
.length
- 1].range
;
25 var range
= { startLine
: firstRange
.startLine
, startColumn
: firstRange
.startColumn
, endLine
: lastRange
.endLine
, endColumn
: lastRange
.endColumn
};
26 header
= ruleOrStyle
.selectorList
.text
+ ": " + (range
? InspectorTest
.rangeText(range
) : "");
29 header
= "element.style:";
31 InspectorTest
.addResult(header
+ " " + InspectorTest
.rangeText(style
.range
));
32 var allProperties
= style
.cssProperties
;
33 for (var i
= 0; i
< allProperties
.length
; ++i
) {
34 var property
= allProperties
[i
];
37 InspectorTest
.addResult("['" + property
.name
+ "':'" + property
.value
+ "'" + (property
.important
? " !important" : "") + (("parsedOk" in property
) ? " non-parsed" : "") +"] @" + InspectorTest
.rangeText(property
.range
));
41 InspectorTest
.selectNodeWithId("mainBody", step1
);
45 InspectorTest
.CSSAgent
.getMatchedStylesForNode(node
.id
, onMatchedStyles
)
48 function onMatchedStyles(error
, inlineStyle
, attributeStyle
, matchedCSSRules
)
50 for (var i
= 0; i
< matchedCSSRules
.length
; ++i
)
51 dumpStyleData(matchedCSSRules
[i
].rule
);
52 dumpStyleData(inlineStyle
);
53 InspectorTest
.completeTest();
62 text-decoration: none; /* at least one valid property is necessary for WebCore to match a rule */
63 badproperty:
1badvalue1;
69 <body id=
"mainBody" class=
"main1 main2 mainpage" onload=
"runTest()" style=
"font-weight: normal; width: 80%">
71 Tests that proper data and start/end offset positions are reported for CSS style declarations and properties.