Bug 1016145 - Load the non-SVG user-agent style sheets for non-SVG documents served as image/svg+xml. r=bz

--HG--
extra : rebase_source : e48c0a6041a38fd1d056ad510268c5df23bf225e
This commit is contained in:
Jonathan Watt 2014-06-05 01:01:39 +01:00
parent 326e3bfa88
commit 75a5163270
6 changed files with 23 additions and 12 deletions

View File

@ -3951,17 +3951,6 @@ nsDocument::InsertChildAt(nsIContent* aKid, uint32_t aIndex,
return doInsertChildAt(aKid, aIndex, aNotify, mChildren);
}
nsresult
nsDocument::AppendChildTo(nsIContent* aKid, bool aNotify)
{
// Make sure to _not_ call the subclass InsertChildAt here. If
// subclasses wanted to hook into this stuff, they would have
// overridden AppendChildTo.
// XXXbz maybe this should just be a non-virtual method on nsINode?
// Feels that way to me...
return nsDocument::InsertChildAt(aKid, GetChildCount(), aNotify);
}
void
nsDocument::RemoveChildAt(uint32_t aIndex, bool aNotify)
{

View File

@ -889,7 +889,6 @@ public:
virtual uint32_t GetChildCount() const MOZ_OVERRIDE;
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify) MOZ_OVERRIDE;
virtual nsresult AppendChildTo(nsIContent* aKid, bool aNotify);
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE
{

View File

@ -65,6 +65,21 @@ SVGDocument::GetRootElement(ErrorResult& aRv)
return static_cast<nsSVGElement*>(root);
}
nsresult
SVGDocument::InsertChildAt(nsIContent* aKid, uint32_t aIndex, bool aNotify)
{
nsresult rv = XMLDocument::InsertChildAt(aKid, aIndex, aNotify);
if (NS_SUCCEEDED(rv) && aKid->IsElement() && !aKid->IsSVG()) {
// We can get here when well formed XML with a non-SVG root element is
// served with the SVG MIME type, for example. In that case we need to load
// the non-SVG UA sheets or else we can get bugs like bug 1016145.
EnsureNonSVGUserAgentStyleSheetsLoaded();
}
return rv;
}
nsresult
SVGDocument::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
{

View File

@ -28,6 +28,8 @@ public:
mType = eSVG;
}
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify) MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
// WebIDL API

View File

@ -0,0 +1,5 @@
<!-- svg mime type but html root -->
<html xmlns="http://www.w3.org/1999/xhtml">
<body style="display: table-column-group;" />
</html>

View File

@ -184,4 +184,5 @@ load 974746-1.svg
load 979407-1.svg
load 979407-2.svg
load 993443.svg
load 1016145.svg