mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
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:
parent
211efd35d1
commit
4abda26e92
@ -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):
|
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):
|
for rule_index in range(rules.length):
|
||||||
rule = rules[rule_index]
|
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:
|
if rule.type is CSSRule.MEDIA_RULE:
|
||||||
process_rules(node, rule.cssRules, rule_address, sheet, sheet_index, all_properties, node_style, is_ancestor, ans)
|
process_rules(node, rule.cssRules, rule_address, sheet, sheet_index, all_properties, node_style, is_ancestor, ans)
|
||||||
continue
|
continue
|
||||||
if rule.type is not CSSRule.STYLE_RULE:
|
if rule.type is not CSSRule.STYLE_RULE:
|
||||||
|
if rule.type is CSSRule.NAMESPACE_RULE:
|
||||||
|
offset += 1
|
||||||
continue
|
continue
|
||||||
st = rule.selectorText
|
st = rule.selectorText
|
||||||
if not selector_matches(node, st):
|
if not selector_matches(node, st):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user