View HTML: add CSS helpers with long-press

Move View html code from ReaderHighlight to a new
dedicated module.
Long-press on an element or its text in the HTML will
show a popup with a list of selectors related to this
element that can be copied to clipboard (to be pasted
in Find or in a Book style tweak).
2 addtional buttons in this popup allow seeing all the
CSS rulesets in all stylesheets that would be matched by
this element, which should make it easier understanding
the publisher stylesheets and using or creating style
tweaks.
This commit is contained in:
poire-z
2023-03-05 13:54:25 +01:00
parent 945a1cc76f
commit eeb3c08457
3 changed files with 438 additions and 122 deletions

View File

@@ -937,6 +937,10 @@ function CreDocument:getHTMLFromXPointers(xp0, xp1, flags, from_root_node)
end
end
function CreDocument:getStylesheetsMatchingRulesets(node_dataindex)
return self._document:getStylesheetsMatchingRulesets(node_dataindex)
end
function CreDocument:getNormalizedXPointer(xp)
-- Returns false when xpointer is not found in the DOM.
-- When requested DOM version >= getDomVersionWithNormalizedXPointers,