зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1293786 - Part 1: Remove SVGDocument interface. r=heycam,smaug
MozReview-Commit-ID: 6AOtRtB7Tvl
This commit is contained in:
Родитель
7e51b6806f
Коммит
22f105c045
|
@ -21,7 +21,7 @@ const TEST_CASES = [
|
|||
},
|
||||
{
|
||||
input: '(new DOMParser()).parseFromString("<svg></svg>", "image/svg+xml")',
|
||||
output: "SVGDocument",
|
||||
output: "XMLDocument",
|
||||
inspectable: true,
|
||||
},
|
||||
];
|
||||
|
|
|
@ -34,8 +34,6 @@ function testHTMLDocuments(ids, isXHTML) {
|
|||
is(doc1.body, null, "Shouldn't have .body!");
|
||||
ok(doc1 instanceof HTMLDocument,
|
||||
"Document should be an HTML document!");
|
||||
ok(!(doc1 instanceof SVGDocument),
|
||||
"Document shouldn't be an SVG document!");
|
||||
|
||||
var docType2 =
|
||||
document.implementation.createDocumentType(isXHTML ? "html" : "HTML",
|
||||
|
@ -70,11 +68,11 @@ function testSVGDocument() {
|
|||
ok(!doc1.documentElement, "Document shouldn't have document element!");
|
||||
ok(!(doc1 instanceof HTMLDocument),
|
||||
"Document shouldn't be an HTML document!");
|
||||
ok(doc1 instanceof SVGDocument,
|
||||
"Document should be an SVG document!");
|
||||
ok(doc1 instanceof XMLDocument,
|
||||
"Document should be an XML document!");
|
||||
|
||||
// SVG documents have .rootElement.
|
||||
ok("rootElement" in doc1, "No .rootElement in document");
|
||||
// SVG documents have .documentElement.
|
||||
ok("documentElement" in doc1, "No .documentElement in document");
|
||||
|
||||
var docType2 =
|
||||
document.implementation.createDocumentType("svg",
|
||||
|
@ -83,8 +81,7 @@ function testSVGDocument() {
|
|||
var doc2 = document.implementation.createDocument("http://www.w3.org/2000/svg",
|
||||
"svg", docType2);
|
||||
ok(doc2.documentElement, "Document should have document element!");
|
||||
ok(doc2.rootElement, "Should have .rootElement in document");
|
||||
is(doc2.rootElement.localName, "svg", "Wrong .rootElement!");
|
||||
is(doc2.documentElement.localName, "svg", "Wrong .documentElement!");
|
||||
}
|
||||
|
||||
function testFooBarDocument() {
|
||||
|
@ -97,8 +94,6 @@ function testFooBarDocument() {
|
|||
ok(!doc1.documentElement, "Document shouldn't have document element!");
|
||||
ok(!(doc1 instanceof HTMLDocument),
|
||||
"Document shouldn't be an HTML document!");
|
||||
ok(!(doc1 instanceof SVGDocument),
|
||||
"Document shouldn't be an SVG document!");
|
||||
|
||||
var docType2 =
|
||||
document.implementation.createDocumentType("FooBar", "FooBar", null);
|
||||
|
@ -114,8 +109,6 @@ function testNullDocTypeDocument() {
|
|||
ok(!doc1.documentElement, "Document shouldn't have document element!");
|
||||
ok(!(doc1 instanceof HTMLDocument),
|
||||
"Document shouldn't be an HTML document!");
|
||||
ok(!(doc1 instanceof SVGDocument),
|
||||
"Document shouldn't be an SVG document!");
|
||||
|
||||
var doc2 = document.implementation.createDocument("FooBarNS",
|
||||
"FooBar", null);
|
||||
|
|
|
@ -23,16 +23,11 @@ var dp = new DOMParser();
|
|||
var d = dp.parseFromString("<?xml version='1.0'?><svg xmlns='http://www.w3.org/2000/svg'></svg>",
|
||||
"image/svg+xml");
|
||||
|
||||
ok(d instanceof SVGDocument, "Should have created an SVG document.");
|
||||
ok("rootElement" in d, "Should have created an SVG document, which has .rootElement.");
|
||||
ok(d instanceof XMLDocument, "Should have created an XML document.");
|
||||
ok("documentElement" in d, "Should have created an XML document, which has .documentElement.");
|
||||
is(d.documentElement.localName, "svg", "Root element should be svg.");
|
||||
is(d.documentElement.namespaceURI, "http://www.w3.org/2000/svg",
|
||||
"Root element should be in svg namespace.");
|
||||
|
||||
dp = new DOMParser();
|
||||
d = dp.parseFromString("<?xml version='1.0'?><svg xmlns='http://www.w3.org/2000/svg'></svg>",
|
||||
"text/xml");
|
||||
ok(!(d instanceof SVGDocument), "Should not have created an SVG document!");
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "nsIDOMSVGElement.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsSVGElement.h"
|
||||
#include "mozilla/dom/SVGDocumentBinding.h"
|
||||
#include "mozilla/StyleSheet.h"
|
||||
#include "mozilla/StyleSheetInlines.h"
|
||||
|
||||
|
@ -35,39 +34,6 @@ namespace dom {
|
|||
//----------------------------------------------------------------------
|
||||
// nsISupports methods:
|
||||
|
||||
void
|
||||
SVGDocument::GetDomain(nsAString& aDomain, ErrorResult& aRv)
|
||||
{
|
||||
SetDOMStringToNull(aDomain);
|
||||
|
||||
if (mDocumentURI) {
|
||||
nsAutoCString domain;
|
||||
nsresult rv = mDocumentURI->GetHost(domain);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
if (domain.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
CopyUTF8toUTF16(domain, aDomain);
|
||||
}
|
||||
}
|
||||
|
||||
nsSVGElement*
|
||||
SVGDocument::GetRootElement(ErrorResult& aRv)
|
||||
{
|
||||
Element* root = nsDocument::GetRootElement();
|
||||
if (!root) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!root->IsSVGElement()) {
|
||||
aRv.Throw(NS_NOINTERFACE);
|
||||
return nullptr;
|
||||
}
|
||||
return static_cast<nsSVGElement*>(root);
|
||||
}
|
||||
|
||||
nsresult
|
||||
SVGDocument::InsertChildAt(nsIContent* aKid, uint32_t aIndex, bool aNotify)
|
||||
{
|
||||
|
@ -192,12 +158,6 @@ SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded()
|
|||
EndUpdate(UPDATE_STYLE);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
SVGDocument::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return SVGDocumentBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -33,10 +33,6 @@ public:
|
|||
bool aNotify) override;
|
||||
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
|
||||
|
||||
// WebIDL API
|
||||
void GetDomain(nsAString& aDomain, ErrorResult& aRv);
|
||||
nsSVGElement* GetRootElement(ErrorResult& aRv);
|
||||
|
||||
virtual SVGDocument* AsSVGDocument() override {
|
||||
return this;
|
||||
}
|
||||
|
@ -44,8 +40,6 @@ public:
|
|||
private:
|
||||
void EnsureNonSVGUserAgentStyleSheetsLoaded();
|
||||
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
bool mHasLoadedNonSVGUserAgentStyleSheets;
|
||||
};
|
||||
|
||||
|
|
|
@ -1123,8 +1123,6 @@ var interfaceNamesInGlobalScope =
|
|||
"SVGDefsElement",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"SVGDescElement",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"SVGDocument",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"SVGElement",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is:
|
||||
* dom/interfaces/svg/nsIDOMSVGDocument.idl
|
||||
*/
|
||||
|
||||
interface SVGDocument : Document {
|
||||
[Throws]
|
||||
readonly attribute DOMString domain;
|
||||
[Pure, Throws]
|
||||
readonly attribute SVGElement? rootElement;
|
||||
};
|
|
@ -464,7 +464,6 @@ WEBIDL_FILES = [
|
|||
'SVGComponentTransferFunctionElement.webidl',
|
||||
'SVGDefsElement.webidl',
|
||||
'SVGDescElement.webidl',
|
||||
'SVGDocument.webidl',
|
||||
'SVGElement.webidl',
|
||||
'SVGEllipseElement.webidl',
|
||||
'SVGFEBlendElement.webidl',
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
function handleLoad(event)
|
||||
{
|
||||
var root = document.removeChild(document.rootElement);
|
||||
if (document.rootElement == null) { // this shouldn't crash
|
||||
var root = document.removeChild(document.documentElement);
|
||||
if (document.documentElement == null) { // this shouldn't crash
|
||||
document.appendChild(root);
|
||||
document.getElementById('rect').setAttribute('fill', 'lime');
|
||||
}
|
||||
|
|
До Ширина: | Высота: | Размер: 724 B После Ширина: | Высота: | Размер: 732 B |
|
@ -12,6 +12,3 @@
|
|||
[createDocument test 185: null,"",DocumentType node]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 186: null,"",DocumentType node]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -18,3 +18,9 @@
|
|||
[XMLDocument interface for incorrectly parsed document with type application/xhtml+xml]
|
||||
expected: FAIL
|
||||
|
||||
[XMLDocument interface for correctly parsed document with type image/svg+xml]
|
||||
expected: FAIL
|
||||
|
||||
[XMLDocument interface for incorrectly parsed document with type image/svg+xml]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче