Backed out 3 changesets (bug 1293786) for wpt unexpected passes and fails

Backed out changeset f8911c81ee9a (bug 1293786)
Backed out changeset 8cba8a0a730c (bug 1293786)
Backed out changeset 5c60775f445e (bug 1293786)
This commit is contained in:
Phil Ringnalda 2016-09-28 20:39:16 -07:00
Родитель 10dd75211d
Коммит 40fd25db11
13 изменённых файлов: 88 добавлений и 31 удалений

Просмотреть файл

@ -21,7 +21,7 @@ const TEST_CASES = [
},
{
input: '(new DOMParser()).parseFromString("<svg></svg>", "image/svg+xml")',
output: "XMLDocument",
output: "SVGDocument",
inspectable: true,
},
];

Просмотреть файл

@ -252,7 +252,7 @@
#include "mozilla/StyleSetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "mozilla/DocLoadingTimelineMarker.h"
#include "nsISpeculativeConnect.h"
@ -3038,16 +3038,6 @@ nsDocument::GetAnimations(nsTArray<RefPtr<Animation>>& aAnimations)
root->GetAnimations(filter, aAnimations);
}
SVGSVGElement*
nsIDocument::GetSVGRootElement() const
{
Element* root = GetRootElement();
if (!root || !root->IsSVGElement(nsGkAtoms::svg)) {
return nullptr;
}
return static_cast<SVGSVGElement*>(root);
}
/* Return true if the document is in the focused top-level window, and is an
* ancestor of the focused DOMWindow. */
NS_IMETHODIMP

Просмотреть файл

@ -148,7 +148,6 @@ class ProcessingInstruction;
class Promise;
class StyleSheetList;
class SVGDocument;
class SVGSVGElement;
class Touch;
class TouchList;
class TreeWalker;
@ -2329,8 +2328,6 @@ public:
virtual void GetAnimations(
nsTArray<RefPtr<mozilla::dom::Animation>>& aAnimations) = 0;
mozilla::dom::SVGSVGElement* GetSVGRootElement() const;
nsresult ScheduleFrameRequestCallback(mozilla::dom::FrameRequestCallback& aCallback,
int32_t *aHandle);
void CancelFrameRequestCallback(int32_t aHandle);

Просмотреть файл

@ -34,6 +34,8 @@ 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",
@ -68,11 +70,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 XMLDocument,
"Document should be an XML document!");
ok(doc1 instanceof SVGDocument,
"Document should be an SVG document!");
// SVG documents have .documentElement.
ok("documentElement" in doc1, "No .documentElement in document");
// SVG documents have .rootElement.
ok("rootElement" in doc1, "No .rootElement in document");
var docType2 =
document.implementation.createDocumentType("svg",
@ -81,7 +83,8 @@ function testSVGDocument() {
var doc2 = document.implementation.createDocument("http://www.w3.org/2000/svg",
"svg", docType2);
ok(doc2.documentElement, "Document should have document element!");
is(doc2.documentElement.localName, "svg", "Wrong .documentElement!");
ok(doc2.rootElement, "Should have .rootElement in document");
is(doc2.rootElement.localName, "svg", "Wrong .rootElement!");
}
function testFooBarDocument() {
@ -94,6 +97,8 @@ 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);
@ -109,6 +114,8 @@ 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,11 +23,16 @@ 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 XMLDocument, "Should have created an XML document.");
ok("documentElement" in d, "Should have created an XML document, which has .documentElement.");
ok(d instanceof SVGDocument, "Should have created an SVG document.");
ok("rootElement" in d, "Should have created an SVG document, which has .rootElement.");
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,6 +19,7 @@
#include "nsIDOMSVGElement.h"
#include "mozilla/dom/Element.h"
#include "nsSVGElement.h"
#include "mozilla/dom/SVGDocumentBinding.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
@ -34,6 +35,39 @@ 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)
{
@ -158,6 +192,12 @@ 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,6 +33,10 @@ 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;
}
@ -40,6 +44,8 @@ public:
private:
void EnsureNonSVGUserAgentStyleSheetsLoaded();
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
bool mHasLoadedNonSVGUserAgentStyleSheets;
};

Просмотреть файл

@ -30,7 +30,7 @@ function runTests()
{
var svg = $("svg");
var doc = svg.contentWindow.document;
var rootElement = doc.documentElement;
var rootElement = doc.rootElement;
var tests = [
new Test("unknown", false),

Просмотреть файл

@ -1123,6 +1123,8 @@ 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!

Просмотреть файл

@ -327,12 +327,6 @@ partial interface Document {
sequence<Animation> getAnimations();
};
// https://svgwg.org/svg2-draft/struct.html#InterfaceDocumentExtensions
partial interface Document {
[BinaryName="SVGRootElement"]
readonly attribute SVGSVGElement? rootElement;
};
// Mozilla extensions of various sorts
partial interface Document {
// nsIDOMDocumentXBL. Wish we could make these [ChromeOnly], but

Просмотреть файл

@ -0,0 +1,15 @@
/* -*- 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,6 +464,7 @@ 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.documentElement);
if (document.documentElement == null) { // this shouldn't crash
var root = document.removeChild(document.rootElement);
if (document.rootElement == null) { // this shouldn't crash
document.appendChild(root);
document.getElementById('rect').setAttribute('fill', 'lime');
}

До

Ширина:  |  Высота:  |  Размер: 732 B

После

Ширина:  |  Высота:  |  Размер: 724 B