currently SVGs embedded in HTML have a white background
Created attachment 10359 [details]
a circle with no background defined
Created attachment 10360 [details]
html background with 'default' white svg background demonstrated
SVG background should be transparent in default
The spec agrees here:
Actually, I think this might be the default behavior of <object>, not of the svg which is causing the white background.
#5
Eric, sorry I suggested similar via IRC not the bug.
should we widen scope or where should we file the bug elsewhere?
cheers
moving to new bugs and widening scope to object from svg
following comment from MacDome:
firefox and opera give transparent backgrounds.
regression as reported in another bug
the later bug is #18964
*** Bug 18964 has been marked as a duplicate of this bug. ***
*** Bug 27078 has been marked as a duplicate of this bug. ***
*** Bug 17744 has been marked as a duplicate of this bug. ***
I have observed this with chromium-browser under Linux also. It doesn't seem to occur under Safari/Chrome on Windows.
The regression appears to be complete - confirmed in Google Chrome 3.0.195.21 and Safari for Windows 4.0.2 (530.19.1).
I think the title is false, because it's not just a problem of default background. Even if I set a background color to my svg object, the background is still white (where in firefox 3.5 the background color is applied)
I have a xhtml page, with the svg included this way :
<object id='module_txt_1' style='z-index:10; position: absolute; top:0px; left:0px; background:red;' type='image/svg+xml' data='../accueil/module.svg'></object>
#16
Matthieu that would be a separate bug, which may be dependent on this one.
You would need to check if the bug exists, and if not file a new one.
this bug relates to many types of object including java, svg etc....
it's not svg specific.
#17
In fact I think it's more like the 17744 bug, which has been merged with this bug... I will reopen it, I've tested the object tag in safari with another type (not svg) and everything was fine
Whole lotta arguing about which bug this is or isn't a duplicate of, and not a whole lot of people doing anything but closing all of them repeatedly for 4 years straight. Which one is the officially recognized bug?
Created attachment 45795 [details]
html background with 'default' white svg background demonstrated
updated reduced testcase, as broken...
#15 Jonathan,
I have widened the scope to all, as tested by me today nightly on intel leopard fails
#19 NSD,
I recognise your enthusiasm, however please bear in mind that its generally not helpful to add complaints as comments, they usually make it harder for coders to understand the issue. It is not uncommon for bugs to remain open for years.
this bug relates to the default background of the html <object> being transparent, not white.
other bugs that are not dupes, naturally differ in their descriptions.
Comment on attachment 45795 [details]
html background with 'default' white svg background demonstrated
linked content broken when webkit reorgandised
*** Bug 37416 has been marked as a duplicate of this bug. ***
Created attachment 68085 [details]
Reduced one-file test case using data: URL, no white should be visible
Created attachment 68095 [details]
Patch to make SVG documents embedded using <object>, <embed> have transparent backgrounds.
I'm not sure if it's correct for all object/embed frames to have a transparent background, so the attached patch only fixes this problem for SVG documents (HTML documents are already transparent). Note that this does not fix Bug 27078, which fails because the MIME type is not served as SVG in that test.
Do we need a pixel test for this? I'll need to re-learn how to do that...
Comment on attachment 68095 [details]
Patch to make SVG documents embedded using <object>, <embed> have transparent backgrounds.
Looks good, but needs a pixel test and a ChangeLog etry.
Created attachment 68181 [details]
This patch makes all backgrounds of SVG files served by reference in object, embed and iframes transparent.
This patch adds a test and fixes the case shown in Bug 27078 (a text/xml document with a SVG root).
Created attachment 68238 [details]
Test for text/xml documents with a <svg> root
Adding some Renderer guys to look at this patch as well. I'm not happy about the SVGNames include, but I guess we don't want to generalize the code to make background transparent for all document roots.
Comment on attachment 68181 [details]
This patch makes all backgrounds of SVG files served by reference in object, embed and iframes transparent.
SVGNames::svgTag includes the SVG namespace, so you don't need to do that extra comparison. Other than that looks fine to me.
Comment on attachment 68181 [details]
This patch makes all backgrounds of SVG files served by reference in object, embed and iframes transparent.
Actually I do have a good suggestion to make. I think you could add a method to Document to answer the question of whether or not you are an SVG document or have a document element that is <svg>. That would at least get the SVGNames stuff out of RenderBoxModelObject. You could make the Document method return a sane value even when SVG is not enabled. Then all the SVG-specific stuff could be in Document.
I liked your suggestion. The first question to answer is: If a document is served with MIME type text/xml, but it has a <svg> document root - is it a SVG Document?
If so, then it really seems that DOMImplementation::createDocument() should be modified so that, if it's an XML document but it parses out with a <svg> root, we should create a SVGDocument (and destroy the Document?). Any tips on the best way to do this without parsing the document twice?
The other option is to change isSVGDocument() to be similar to how isXHTMLDocument() is done, where a member bool can be set in the case of a Document parsing out with a <svg> root. The thing I'm worried about is returning true for isSVGDocument() and not actually _being_ a SVGDocument.
The final option is to just add a isDocumentRootSVG() function to Document() and return true when it's a <svg>. Is this what you're really suggesting? Just seems odd to have both functions returning different values...
FYI, I checked out the Document object at for various browsers. Remember, this is a text/xml that happens to have a <svg> root:
WebKit: Document (not a SVGDocument)
Mozilla: Document (not a SVGDocument)
IE9: Document (not a SVGDocument)
Opera: SVGDocument
Created attachment 68511 [details]
Patch for making SVG documents and XML documents with SVG root transparent when embedded by reference.
This addresses krit's and dhyatt's concern of including SVGNames in RenderBoxModelObject. This patch introduces Document::hasSVGRootNode() that can be used to determine if we are a SVG document or a XML document with a <svg> root.
Comment on attachment 68511 [details]
Patch for making SVG documents and XML documents with SVG root transparent when embedded by reference.
View in context:
> WebCore/dom/Document.cpp:2171
> +#endif
I don't think you need to cache this information. Asking if the documentElement() has the SVG tag name every time is fine. It's a quick check (it's AtomicString comparisons, which are very fast).
If you do still want to cache it, a better place would be in cacheDocumentElement().
> WebCore/dom/Document.h:388
> + virtual bool hasSVGRootNode() const { return m_hasSVGRootNode; }
I don't think this needs to be virtual, since the same check that works for non-SVG documents (checking the root node) should also work for SVG documents. It's faster to just do the root node tag check than it is to call a virtual function.
> WebCore/svg/SVGDocument.h:55
> + virtual bool hasSVGRootNode() const { return true; }
Just remove this.
Created attachment 68556 [details]
Patch addressing dhyatt's comments (no caching of hasSVGRootNode).
Addressed dyhatt's comments.
Attachment 68556 [details] did not pass style-queue:
Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
WebCore/dom/Document.h:388: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/dom/Document.cpp:4030: Place brace on its own line for function definitions. [whitespace/braces] [4]
Total errors found: 2 in 8 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 68556 [details]
Patch addressing dhyatt's comments (no caching of hasSVGRootNode).
r=me
Created attachment 68561 [details]
Patch with webkit style fixups.
Comment on attachment 68561 [details]
Patch with webkit style fixups.
Clearing flags on attachment: 68561
Committed r68198: <>
All reviewed patches have been landed. Closing bug.
*** Bug 48462 has been marked as a duplicate of this bug. ***