On 14/09/2023 14:43, Michael Drake wrote:
Hi Michael,

On Tue, 12 Sept 2023 at 23:45, Michael Orlitzky <mich...@orlitzky.com> wrote:

    I dumped the new properties into the default level, but this raises
    a question: should libcss use a different CSS level for SVG?

Good question. What do you think John-Mark?

I'm not sure it's necessary -- libcss will simply expose any and all properties it knows about (and apply the cascade as appropriate). However, it is not responsible for applying the resulting computed styles to the document -- that is up to the client. A non-SVG-aware client would never look at them and thus would be none the wiser as to their existence. Obviously an SVG-aware client would look at them.

The only potentially difficult case would be an SVG-aware client that is applying CSS to something that isn't an SVG. However, the client itself would have to deal with that by ensuring it ignored these properties when the document it's dealing with is not an SVG.


3. I copied the css_select_handler and css_unit_ctx from netsurf into
    svgtiny.c. Thankfully, I didn't have to think about the unit
    conversions at all because opacity is a float. The select handler
    callbacks were tedious, but most of them can be copied from netsurf
    with minimal changes, fudging interned string names and replacing
    html-only function calls. I wound up copying the user data handler
    too. Who knows if any of this stuff works, but it hasn't crashed.

    Ultimately, since netsurf uses libsvgtiny, copy-pasting the select
    handler wouldn't be a great solution. I think it would make sense
    to factor out the libdom/libcss integration into something like a
    libdom-css that provides a generic css_select_handler
    implementation.

I agree, it would be better to have a shared implementation of the
LibCSS/LibDOM integration. Either as a LibDOM-CSS or maybe as
an optional LibDOM binding for LibCSS, a bit like LibDOM has
the Hubbub/LibXML bindings. What do you think John-Mark?

I have no strong view, other than to observe that the code in NetSurf itself is licensed under GPLv2, and not MIT/Expat (as used by most of the libraries), so simply copying it probably isn't the right answer. I don't recall who has contributed to that code, but any relicensing thereof would need their permission.

Note also that, as with the SVG-specific properties, the expectation was always that various parts of the selection handler would have to be document-format aware (e.g. extracting the presentational hints from an HTML document is not something that would be wanted when processing some other document format).


John-Mark.
_______________________________________________
netsurf-dev mailing list -- netsurf-dev@netsurf-browser.org
To unsubscribe send an email to netsurf-dev-le...@netsurf-browser.org

Reply via email to