Edit book: Live CSS: Fix @namespace rules causing jumping to rule definition to go to the wrong definition. Fixes #1978500 [Private bug](https://bugs.launchpad.net/calibre/+bug/1978500)

This commit is contained in:
Kovid Goyal 2022-06-16 12:49:56 +05:30
parent 211efd35d1
commit 4abda26e92
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -179,13 +179,16 @@ def selector_matches(node, selector):
def process_rules(node, rules, address, sheet, sheet_index, all_properties, node_style, is_ancestor, ans):
offset = 0
for rule_index in range(rules.length):
rule = rules[rule_index]
rule_address = address.concat(v'[rule_index]')
rule_address = address.concat(v'[rule_index - offset]')
if rule.type is CSSRule.MEDIA_RULE:
process_rules(node, rule.cssRules, rule_address, sheet, sheet_index, all_properties, node_style, is_ancestor, ans)
continue
if rule.type is not CSSRule.STYLE_RULE:
if rule.type is CSSRule.NAMESPACE_RULE:
offset += 1
continue
st = rule.selectorText
if not selector_matches(node, st):