NightWhistler / HtmlSpanner

Android HTML rendering library with CSS support
http://nightwhistler.github.io/HtmlSpanner/
868 stars 209 forks source link

Disable CSS handling completely #41

Closed willwach closed 8 years ago

willwach commented 8 years ago

Many thanks for this fantastic lib.

I got a problem disabling CSS parsing. I'm setting setAllowStyling(false) and setUseColoursFromStyle(false), but in log it is writing "Looking for matching CSS rules for node".

Is there a flag where i can disable css parsing completely?

NightWhistler commented 8 years ago

CSS parsing is in fact disabled with those options.

Basically, HtmlSpanner needs to know how to display nodes, so it will look for style information and if none is found it will fall back to the default style. The styling options simply prevent the library from actually reading and parsing the CSS tree so that in effect you will always fall back on the default style. This is because the parsing and compiling of the CSS file is by far the most expensive operation. The lookup is almost a no-op.

Basically, the log statement is slightly misleading in that effect... it looks, but it will never find anything.