Bug 1224121 - change getRelativeRuleLine to return 0 for line-less rules; r=heycam

This commit is contained in:
Tom Tromey 2015-11-17 09:02:34 -07:00
parent 044ddb3a84
commit c8f7d8ae2d
2 changed files with 3 additions and 1 deletions

View File

@ -318,7 +318,7 @@ inDOMUtils::GetRelativeRuleLine(nsIDOMCSSRule* aRule, uint32_t* _retval)
uint32_t lineNumber = rule->GetLineNumber();
CSSStyleSheet* sheet = rule->GetStyleSheet();
if (sheet) {
if (sheet && lineNumber != 0) {
nsINode* owningNode = sheet->GetOwnerNode();
if (owningNode) {
nsCOMPtr<nsIStyleSheetLinkingElement> link =

View File

@ -34,10 +34,12 @@
{ sheetNo: 1, ruleNo: 0, lineNo: 2, columnNo: 15 },
{ sheetNo: 1, ruleNo: 1, lineNo: 8, columnNo: 5 },
{ sheetNo: 2, ruleNo: 0, lineNo: 1, columnNo: 1 },
{ sheetNo: 2, ruleNo: 1, lineNo: 0, columnNo: 1 },
{ sheetNo: 3, ruleNo: 0, lineNo: 5, columnNo: 6 },
];
function doTest() {
document.styleSheets[2].insertRule("body{}", 1);
for (let test of tests) {
let sheet = document.styleSheets[test.sheetNo];
let rule = sheet.cssRules[test.ruleNo];