This commit is contained in:
Ryan VanderMeulen 2013-06-15 21:34:21 -04:00
Родитель 01cd405078 5cb0162f45
Коммит 36f9729a1c
214 изменённых файлов: 2326 добавлений и 942 удалений

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

@ -20,8 +20,6 @@ GARBAGE += $(MIDL_GENERATED_FILES)
FORCE_SHARED_LIB = 1 FORCE_SHARED_LIB = 1
SRCS_IN_OBJDIR = 1
# Please keep this list in sync with the moz.build file until the rest of this # Please keep this list in sync with the moz.build file until the rest of this
# Makefile is ported over. # Makefile is ported over.
MIDL_INTERFACES = \ MIDL_INTERFACES = \

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

@ -18,8 +18,6 @@ GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c
FORCE_SHARED_LIB = 1 FORCE_SHARED_LIB = 1
SRCS_IN_OBJDIR = 1
CSRCS = \ CSRCS = \
dlldata.c \ dlldata.c \
ISimpleDOMNode_p.c \ ISimpleDOMNode_p.c \

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

@ -3612,6 +3612,7 @@ function mimeTypeIsTextBased(aMimeType)
aMimeType.endsWith("+xml") || aMimeType.endsWith("+xml") ||
aMimeType == "application/x-javascript" || aMimeType == "application/x-javascript" ||
aMimeType == "application/javascript" || aMimeType == "application/javascript" ||
aMimeType == "application/json" ||
aMimeType == "application/xml" || aMimeType == "application/xml" ||
aMimeType == "mozilla.application/cached-xul"; aMimeType == "mozilla.application/cached-xul";
} }

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

@ -22,6 +22,7 @@
this.popup._input = this; this.popup._input = this;
]]> ]]>
</constructor> </constructor>
<method name="openPopup"> <method name="openPopup">
<body> <body>
<![CDATA[ <![CDATA[
@ -37,6 +38,21 @@
]]> ]]>
</body> </body>
</method> </method>
<method name="formatValue">
<body>
<![CDATA[
BrowserUI.formatURI();
]]>
</body>
</method>
<method name="trimValue">
<parameter name="aURL"/>
<body><![CDATA[
return BrowserUI.trimURL(aURL);
]]></body>
</method>
</implementation> </implementation>
<handlers> <handlers>

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

@ -97,7 +97,11 @@ var BrowserUI = {
window.addEventListener("MozImprecisePointer", this, true); window.addEventListener("MozImprecisePointer", this, true);
Services.prefs.addObserver("browser.cache.disk_cache_ssl", this, false); Services.prefs.addObserver("browser.cache.disk_cache_ssl", this, false);
Services.prefs.addObserver("browser.urlbar.formatting.enabled", this, false);
Services.prefs.addObserver("browser.urlbar.trimURLs", this, false);
Services.obs.addObserver(this, "metro_viewstate_changed", false); Services.obs.addObserver(this, "metro_viewstate_changed", false);
this._edit.inputField.controllers.insertControllerAt(0, this._copyCutURIController);
// Init core UI modules // Init core UI modules
ContextUI.init(); ContextUI.init();
@ -239,11 +243,20 @@ var BrowserUI = {
getDisplayURI: function(browser) { getDisplayURI: function(browser) {
let uri = browser.currentURI; let uri = browser.currentURI;
let spec = uri.spec;
try { try {
uri = gURIFixup.createExposableURI(uri); spec = gURIFixup.createExposableURI(uri).spec;
} catch (ex) {} } catch (ex) {}
return uri.spec; try {
let charset = browser.characterSet;
let textToSubURI = Cc["@mozilla.org/intl/texttosuburi;1"].
getService(Ci.nsITextToSubURI);
spec = textToSubURI.unEscapeNonAsciiURI(charset, spec);
} catch (ex) {}
return spec;
}, },
/** /**
@ -560,6 +573,12 @@ var BrowserUI = {
case "browser.cache.disk_cache_ssl": case "browser.cache.disk_cache_ssl":
this._sslDiskCacheEnabled = Services.prefs.getBoolPref(aData); this._sslDiskCacheEnabled = Services.prefs.getBoolPref(aData);
break; break;
case "browser.urlbar.formatting.enabled":
this._formattingEnabled = Services.prefs.getBookPref(aData);
break;
case "browser.urlbar.trimURLs":
this._mayTrimURLs = Services.prefs.getBoolPref(aData);
break;
} }
break; break;
case "metro_viewstate_changed": case "metro_viewstate_changed":
@ -650,11 +669,120 @@ var BrowserUI = {
Elements.urlbarState.setAttribute("mode", "view"); Elements.urlbarState.setAttribute("mode", "view");
}, },
_trimURL: function _trimURL(aURL) {
// This function must not modify the given URL such that calling
// nsIURIFixup::createFixupURI with the result will produce a different URI.
return aURL /* remove single trailing slash for http/https/ftp URLs */
.replace(/^((?:http|https|ftp):\/\/[^/]+)\/$/, "$1")
/* remove http:// unless the host starts with "ftp\d*\." or contains "@" */
.replace(/^http:\/\/((?!ftp\d*\.)[^\/@]+(?:\/|$))/, "$1");
},
trimURL: function trimURL(aURL) {
return this.mayTrimURLs ? this._trimURL(aURL) : aURL;
},
_setURI: function _setURI(aURL) { _setURI: function _setURI(aURL) {
this._edit.value = aURL; this._edit.value = aURL;
this.lastKnownGoodURL = aURL; this.lastKnownGoodURL = aURL;
}, },
_getSelectedURIForClipboard: function _getSelectedURIForClipboard() {
// Grab the actual input field's value, not our value, which could include moz-action:
let inputVal = this._edit.inputField.value;
let selectedVal = inputVal.substring(this._edit.selectionStart, this._edit.electionEnd);
// If the selection doesn't start at the beginning or doesn't span the full domain or
// the URL bar is modified, nothing else to do here.
if (this._edit.selectionStart > 0 || this._edit.valueIsTyped)
return selectedVal;
// The selection doesn't span the full domain if it doesn't contain a slash and is
// followed by some character other than a slash.
if (!selectedVal.contains("/")) {
let remainder = inputVal.replace(selectedVal, "");
if (remainder != "" && remainder[0] != "/")
return selectedVal;
}
let uriFixup = Cc["@mozilla.org/docshell/urifixup;1"].getService(Ci.nsIURIFixup);
let uri;
try {
uri = uriFixup.createFixupURI(inputVal, Ci.nsIURIFixup.FIXUP_FLAG_USE_UTF8);
} catch (e) {}
if (!uri)
return selectedVal;
// Only copy exposable URIs
try {
uri = uriFixup.createExposableURI(uri);
} catch (ex) {}
// If the entire URL is selected, just use the actual loaded URI.
if (inputVal == selectedVal) {
// ... but only if isn't a javascript: or data: URI, since those
// are hard to read when encoded
if (!uri.schemeIs("javascript") && !uri.schemeIs("data")) {
// Parentheses are known to confuse third-party applications (bug 458565).
selectedVal = uri.spec.replace(/[()]/g, function (c) escape(c));
}
return selectedVal;
}
// Just the beginning of the URL is selected, check for a trimmed value
let spec = uri.spec;
let trimmedSpec = this.trimURL(spec);
if (spec != trimmedSpec) {
// Prepend the portion that trimURL removed from the beginning.
// This assumes trimURL will only truncate the URL at
// the beginning or end (or both).
let trimmedSegments = spec.split(trimmedSpec);
selectedVal = trimmedSegments[0] + selectedVal;
}
return selectedVal;
},
_copyCutURIController: {
doCommand: function(aCommand) {
let urlbar = BrowserUI._edit;
let val = BrowserUI._getSelectedURIForClipboard();
if (!val)
return;
if (aCommand == "cmd_cut" && this.isCommandEnabled(aCommand)) {
let start = urlbar.selectionStart;
let end = urlbar.selectionEnd;
urlbar.inputField.value = urlbar.inputField.value.substring(0, start) +
urlbar.inputField.value.substring(end);
urlbar.selectionStart = urlbar.selectionEnd = start;
}
Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper)
.copyString(val, document);
},
supportsCommand: function(aCommand) {
switch (aCommand) {
case "cmd_copy":
case "cmd_cut":
return true;
}
return false;
},
isCommandEnabled: function(aCommand) {
let urlbar = BrowserUI._edit;
return this.supportsCommand(aCommand) &&
(aCommand != "cmd_cut" || !urlbar.readOnly) &&
urlbar.selectionStart < urlbar.selectionEnd;
},
onEvent: function(aEventName) {}
},
_urlbarClicked: function _urlbarClicked() { _urlbarClicked: function _urlbarClicked() {
// If the urlbar is not already focused, focus it and select the contents. // If the urlbar is not already focused, focus it and select the contents.
if (Elements.urlbarState.getAttribute("mode") != "edit") if (Elements.urlbarState.getAttribute("mode") != "edit")
@ -662,6 +790,7 @@ var BrowserUI = {
}, },
_editURI: function _editURI(aShouldDismiss) { _editURI: function _editURI(aShouldDismiss) {
this._clearURIFormatting();
this._edit.focus(); this._edit.focus();
this._edit.select(); this._edit.select();
@ -671,11 +800,77 @@ var BrowserUI = {
ContextUI.dismissTabs(); ContextUI.dismissTabs();
}, },
formatURI: function formatURI() {
if (!this.formattingEnabled ||
Elements.urlbarState.getAttribute("mode") == "edit")
return;
let controller = this._edit.editor.selectionController;
let selection = controller.getSelection(controller.SELECTION_URLSECONDARY);
selection.removeAllRanges();
let textNode = this._edit.editor.rootElement.firstChild;
let value = textNode.textContent;
let protocol = value.match(/^[a-z\d.+\-]+:(?=[^\d])/);
if (protocol &&
["http:", "https:", "ftp:"].indexOf(protocol[0]) == -1)
return;
let matchedURL = value.match(/^((?:[a-z]+:\/\/)?(?:[^\/]+@)?)(.+?)(?::\d+)?(?:\/|$)/);
if (!matchedURL)
return;
let [, preDomain, domain] = matchedURL;
let baseDomain = domain;
let subDomain = "";
// getBaseDomainFromHost doesn't recognize IPv6 literals in brackets as IPs (bug 667159)
if (domain[0] != "[") {
try {
baseDomain = Services.eTLD.getBaseDomainFromHost(domain);
if (!domain.endsWith(baseDomain)) {
// getBaseDomainFromHost converts its resultant to ACE.
let IDNService = Cc["@mozilla.org/network/idn-service;1"]
.getService(Ci.nsIIDNService);
baseDomain = IDNService.convertACEtoUTF8(baseDomain);
}
} catch (e) {}
}
if (baseDomain != domain) {
subDomain = domain.slice(0, -baseDomain.length);
}
let rangeLength = preDomain.length + subDomain.length;
if (rangeLength) {
let range = document.createRange();
range.setStart(textNode, 0);
range.setEnd(textNode, rangeLength);
selection.addRange(range);
}
let startRest = preDomain.length + domain.length;
if (startRest < value.length) {
let range = document.createRange();
range.setStart(textNode, startRest);
range.setEnd(textNode, value.length);
selection.addRange(range);
}
},
_clearURIFormatting: function _clearURIFormatting() {
if (!this.formattingEnabled)
return;
let controller = this._edit.editor.selectionController;
let selection = controller.getSelection(controller.SELECTION_URLSECONDARY);
selection.removeAllRanges();
},
_urlbarBlurred: function _urlbarBlurred() { _urlbarBlurred: function _urlbarBlurred() {
let state = Elements.urlbarState; let state = Elements.urlbarState;
if (state.getAttribute("mode") == "edit") if (state.getAttribute("mode") == "edit")
state.removeAttribute("mode"); state.removeAttribute("mode");
this._updateToolbar(); this._updateToolbar();
this.formatURI();
}, },
_closeOrQuit: function _closeOrQuit() { _closeOrQuit: function _closeOrQuit() {
@ -959,6 +1154,24 @@ var BrowserUI = {
return this._sslDiskCacheEnabled; return this._sslDiskCacheEnabled;
}, },
_formattingEnabled: null,
get formattingEnabled() {
if (this._formattingEnabled === null) {
this._formattingEnabled = Services.prefs.getBoolPref("browser.urlbar.formatting.enabled");
}
return this._formattingEnabled;
},
_mayTrimURLs: null,
get mayTrimURLs() {
if (this._mayTrimURLs === null) {
this._mayTrimURLs = Services.prefs.getBoolPref("browser.urlbar.trimURLs");
}
return this._mayTrimURLs;
},
supportsCommand : function(cmd) { supportsCommand : function(cmd) {
var isSupported = false; var isSupported = false;
switch (cmd) { switch (cmd) {

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

@ -261,6 +261,8 @@ pref("places.favicons.optimizeToDimension", 25);
// various and sundry awesomebar prefs (should remove/re-evaluate // various and sundry awesomebar prefs (should remove/re-evaluate
// these once bug 447900 is fixed) // these once bug 447900 is fixed)
pref("browser.urlbar.trimURLs", true);
pref("browser.urlbar.formatting.enabled", true);
pref("browser.urlbar.clickSelectsAll", true); pref("browser.urlbar.clickSelectsAll", true);
pref("browser.urlbar.doubleClickSelectsAll", true); pref("browser.urlbar.doubleClickSelectsAll", true);
pref("browser.urlbar.autoFill", false); pref("browser.urlbar.autoFill", false);

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

@ -308,6 +308,12 @@ documenttab[selected] .documenttab-selection {
padding: 0 !important; padding: 0 !important;
} }
#urlbar-edit > hbox > .textbox-input-box > .textbox-input:invalid {
/* Hide error glow around the address bar that shows by default
* when URLs are made invalid by trmming. */
box-shadow: none !important;
}
/* Combined stop-reload button */ /* Combined stop-reload button */
#tool-reload { #tool-reload {
list-style-image: url("chrome://browser/skin/images/reload.png"); list-style-image: url("chrome://browser/skin/images/reload.png");

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

@ -47,15 +47,15 @@
border-radius: 5px; border-radius: 5px;
position: absolute; position: absolute;
background: #0095dd; background: #0095dd;
left:0px; left: 0;
top:0px; top: 0;
} }
@keyframes orbit { @keyframes orbit {
0% { 0% {
opacity: 1; opacity: 1;
z-index:99; z-index: 99;
transform: rotate(180deg); transform: rotate(180deg);
animation-timing-function: ease-out; animation-timing-function: ease-out;
} }
@ -64,39 +64,34 @@
opacity: 1; opacity: 1;
transform: rotate(300deg); transform: rotate(300deg);
animation-timing-function: linear; animation-timing-function: linear;
origin:0%;
} }
30% { 30% {
opacity: 1; opacity: 1;
transform:rotate(410deg); transform: rotate(410deg);
animation-timing-function: ease-in-out; animation-timing-function: ease-in-out;
origin:7%;
} }
39% { 39% {
opacity: 1; opacity: 1;
transform: rotate(645deg); transform: rotate(645deg);
animation-timing-function: linear; animation-timing-function: linear;
origin:30%;
} }
70% { 70% {
opacity: 1; opacity: 1;
transform: rotate(770deg); transform: rotate(770deg);
animation-timing-function: ease-out; animation-timing-function: ease-out;
origin:39%;
} }
75% { 75% {
opacity: 1; opacity: 1;
transform: rotate(900deg); transform: rotate(900deg);
animation-timing-function: ease-out; animation-timing-function: ease-out;
origin:70%;
} }
76%, 100% { 76%, 100% {
opacity: 0; opacity: 0;
transform:rotate(900deg); transform: rotate(900deg);
} }
} }

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

@ -120,7 +120,7 @@ function prompt(aWindowID, aCallID, aAudioRequested, aVideoRequested, aDevices)
} }
let contentWindow = Services.wm.getOuterWindowWithId(aWindowID); let contentWindow = Services.wm.getOuterWindowWithId(aWindowID);
let host = contentWindow.document.documentURIObject.asciiHost; let host = contentWindow.document.documentURIObject.host;
let browser = getBrowserForWindow(contentWindow); let browser = getBrowserForWindow(contentWindow);
let chromeDoc = browser.ownerDocument; let chromeDoc = browser.ownerDocument;
let chromeWin = chromeDoc.defaultView; let chromeWin = chromeDoc.defaultView;

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

@ -17,18 +17,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=777467
SpecialPowers.addPermission("browser", true, document); SpecialPowers.addPermission("browser", true, document);
SpecialPowers.addPermission("embed-apps", true, document); SpecialPowers.addPermission("embed-apps", true, document);
var previousPrefs = {
mozBrowserFramesEnabled: undefined,
oop_by_default: undefined,
};
try {
previousPrefs.mozBrowserFramesEnabled = SpecialPowers.getBoolPref('dom.mozBrowserFramesEnabled');
} catch(e) {}
try {
previousPrefs.oop_by_default = SpecialPowers.getBoolPref('dom.ipc.browser_frames.oop_by_default');
} catch(e) {}
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true); SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", false); SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", false);
</script> </script>
@ -66,13 +54,8 @@ addLoadEvent(function() {
} }
// Cleanup. // Cleanup.
if (previousPrefs.mozBrowserFramesEnabled !== undefined) { SpecialPowers.clearUserPref('dom.mozBrowserFramesEnabled');
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', previousPrefs.mozBrowserFramesEnabled); SpecialPowers.clearUserPref('dom.ipc.browser_frames.oop_by_default');
}
if (previousPrefs.oop_by_default !== undefined) {
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", previousPrefs.oop_by_default);
}
SpecialPowers.removePermission("browser", window.document); SpecialPowers.removePermission("browser", window.document);
SpecialPowers.removePermission("embed-apps", window.document); SpecialPowers.removePermission("embed-apps", window.document);

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

@ -44,19 +44,6 @@ using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::dom::ipc; using namespace mozilla::dom::ipc;
static bool
IsChromeProcess()
{
nsCOMPtr<nsIXULRuntime> rt = do_GetService("@mozilla.org/xre/runtime;1");
if (!rt)
return true;
uint32_t type;
rt->GetProcessType(&type);
return type == nsIXULRuntime::PROCESS_TYPE_DEFAULT;
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsFrameMessageManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsFrameMessageManager)
uint32_t count = tmp->mListeners.Length(); uint32_t count = tmp->mListeners.Length();
for (uint32_t i = 0; i < count; i++) { for (uint32_t i = 0; i < count; i++) {
@ -836,7 +823,8 @@ nsFrameMessageManager::Disconnect(bool aRemoveFromParent)
nsresult nsresult
NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult) NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult)
{ {
NS_ENSURE_TRUE(IsChromeProcess(), NS_ERROR_NOT_AVAILABLE); NS_ENSURE_TRUE(XRE_GetProcessType() == GeckoProcessType_Default,
NS_ERROR_NOT_AVAILABLE);
nsFrameMessageManager* mm = new nsFrameMessageManager(nullptr, nsFrameMessageManager* mm = new nsFrameMessageManager(nullptr,
nullptr, nullptr,
nullptr, nullptr,
@ -1387,7 +1375,8 @@ NS_NewParentProcessMessageManager(nsIMessageBroadcaster** aResult)
{ {
NS_ASSERTION(!nsFrameMessageManager::sParentProcessManager, NS_ASSERTION(!nsFrameMessageManager::sParentProcessManager,
"Re-creating sParentProcessManager"); "Re-creating sParentProcessManager");
NS_ENSURE_TRUE(IsChromeProcess(), NS_ERROR_NOT_AVAILABLE); NS_ENSURE_TRUE(XRE_GetProcessType() == GeckoProcessType_Default,
NS_ERROR_NOT_AVAILABLE);
nsRefPtr<nsFrameMessageManager> mm = new nsFrameMessageManager(nullptr, nsRefPtr<nsFrameMessageManager> mm = new nsFrameMessageManager(nullptr,
nullptr, nullptr,
nullptr, nullptr,
@ -1432,7 +1421,7 @@ NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult)
"Re-creating sChildProcessManager"); "Re-creating sChildProcessManager");
MessageManagerCallback* cb; MessageManagerCallback* cb;
if (IsChromeProcess()) { if (XRE_GetProcessType() == GeckoProcessType_Default) {
cb = new SameChildProcessMessageManagerCallback(); cb = new SameChildProcessMessageManagerCallback();
} else { } else {
cb = new ChildProcessMessageManagerCallback(); cb = new ChildProcessMessageManagerCallback();

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

@ -32,9 +32,9 @@ function testHTMLDocuments(ids, isXHTML) {
is(docType1.ownerDocument, doc1, "docType should have ownerDocument!"); is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
ok(!doc1.documentElement, "Document shouldn't have document element!"); ok(!doc1.documentElement, "Document shouldn't have document element!");
is(doc1.body, null, "Shouldn't have .body!"); is(doc1.body, null, "Shouldn't have .body!");
ok(doc1 instanceof SpecialPowers.Ci.nsIDOMHTMLDocument, ok(doc1 instanceof HTMLDocument,
"Document should be an HTML document!"); "Document should be an HTML document!");
ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMSVGDocument), ok(!(doc1 instanceof SVGDocument),
"Document shouldn't be an SVG document!"); "Document shouldn't be an SVG document!");
var docType2 = var docType2 =
@ -68,9 +68,9 @@ function testSVGDocument() {
var doc1 = document.implementation.createDocument(null, null, docType1); var doc1 = document.implementation.createDocument(null, null, docType1);
is(docType1.ownerDocument, doc1, "docType should have ownerDocument!"); is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
ok(!doc1.documentElement, "Document shouldn't have document element!"); ok(!doc1.documentElement, "Document shouldn't have document element!");
ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMHTMLDocument), ok(!(doc1 instanceof HTMLDocument),
"Document shouldn't be an HTML document!"); "Document shouldn't be an HTML document!");
ok(doc1 instanceof SpecialPowers.Ci.nsIDOMSVGDocument, ok(doc1 instanceof SVGDocument,
"Document should be an SVG document!"); "Document should be an SVG document!");
// SVG documents have .rootElement. // SVG documents have .rootElement.
@ -95,9 +95,9 @@ function testFooBarDocument() {
var doc1 = document.implementation.createDocument(null, null, docType1); var doc1 = document.implementation.createDocument(null, null, docType1);
is(docType1.ownerDocument, doc1, "docType should have ownerDocument!"); is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
ok(!doc1.documentElement, "Document shouldn't have document element!"); ok(!doc1.documentElement, "Document shouldn't have document element!");
ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMHTMLDocument), ok(!(doc1 instanceof HTMLDocument),
"Document shouldn't be an HTML document!"); "Document shouldn't be an HTML document!");
ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMSVGDocument), ok(!(doc1 instanceof SVGDocument),
"Document shouldn't be an SVG document!"); "Document shouldn't be an SVG document!");
var docType2 = var docType2 =
@ -112,9 +112,9 @@ function testFooBarDocument() {
function testNullDocTypeDocument() { function testNullDocTypeDocument() {
var doc1 = document.implementation.createDocument(null, null, null); var doc1 = document.implementation.createDocument(null, null, null);
ok(!doc1.documentElement, "Document shouldn't have document element!"); ok(!doc1.documentElement, "Document shouldn't have document element!");
ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMHTMLDocument), ok(!(doc1 instanceof HTMLDocument),
"Document shouldn't be an HTML document!"); "Document shouldn't be an HTML document!");
ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMSVGDocument), ok(!(doc1 instanceof SVGDocument),
"Document shouldn't be an SVG document!"); "Document shouldn't be an SVG document!");
var doc2 = document.implementation.createDocument("FooBarNS", var doc2 = document.implementation.createDocument("FooBarNS",

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

@ -777,8 +777,6 @@ function test22()
waitTest22 = true; waitTest22 = true;
const pref_open = "network.websocket.timeout.open"; const pref_open = "network.websocket.timeout.open";
var oldpref_open_value = 20;
oldpref_open_value = SpecialPowers.getIntPref(pref_open);
SpecialPowers.setIntPref(pref_open, 5); SpecialPowers.setIntPref(pref_open, 5);
var ws = CreateTestWS("ws://sub2.test2.example.org/tests/content/base/test/file_websocket", "test-22"); var ws = CreateTestWS("ws://sub2.test2.example.org/tests/content/base/test/file_websocket", "test-22");
@ -791,7 +789,7 @@ function test22()
maybeFinished(); maybeFinished();
}; };
SpecialPowers.setIntPref(pref_open, oldpref_open_value); SpecialPowers.clearUserPref(pref_open);
doTest(23); doTest(23);
} }

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

@ -7,7 +7,6 @@
#include "mozilla/dom/HTMLIFrameElement.h" #include "mozilla/dom/HTMLIFrameElement.h"
#include "mozilla/dom/HTMLIFrameElementBinding.h" #include "mozilla/dom/HTMLIFrameElementBinding.h"
#include "nsIDOMSVGDocument.h"
#include "nsMappedAttributes.h" #include "nsMappedAttributes.h"
#include "nsAttrValueInlines.h" #include "nsAttrValueInlines.h"
#include "nsError.h" #include "nsError.h"

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

@ -28,7 +28,7 @@ HTMLLabelElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aScope)
return HTMLLabelElementBinding::Wrap(aCx, aScope, this); return HTMLLabelElementBinding::Wrap(aCx, aScope, this);
} }
// nsISupports // nsISupports
NS_IMPL_ADDREF_INHERITED(HTMLLabelElement, Element) NS_IMPL_ADDREF_INHERITED(HTMLLabelElement, Element)
@ -171,27 +171,26 @@ HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
dragDistance.y > CLICK_DISTANCE || dragDistance.y > CLICK_DISTANCE ||
dragDistance.y < -CLICK_DISTANCE; dragDistance.y < -CLICK_DISTANCE;
} }
// Don't click the for-content if we did drag-select text or if we // Don't click the for-content if we did drag-select text or if we
// have a kbd modifier (which adjusts a selection), or if it's a // have a kbd modifier (which adjusts a selection).
// double click (we already forwarded the first click event). if (dragSelect || event->IsShift() || event->IsControl() ||
if (dragSelect || event->clickCount > 1 || event->IsAlt() || event->IsMeta()) {
event->IsShift() || event->IsControl() || event->IsAlt() ||
event->IsMeta()) {
break; break;
} }
// Only set focus on the first click of multiple clicks to prevent
nsIFocusManager* fm = nsFocusManager::GetFocusManager(); // to prevent immediate de-focus.
if (fm) { if (event->clickCount <= 1) {
// Use FLAG_BYMOVEFOCUS here so that the label is scrolled to. nsIFocusManager* fm = nsFocusManager::GetFocusManager();
// Also, within HTMLInputElement::PostHandleEvent, inputs will if (fm) {
// be selected only when focused via a key or when the navigation // Use FLAG_BYMOVEFOCUS here so that the label is scrolled to.
// flag is used and we want to select the text on label clicks as // Also, within HTMLInputElement::PostHandleEvent, inputs will
// well. // be selected only when focused via a key or when the navigation
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(content); // flag is used and we want to select the text on label clicks as
fm->SetFocus(elem, nsIFocusManager::FLAG_BYMOVEFOCUS); // well.
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(content);
fm->SetFocus(elem, nsIFocusManager::FLAG_BYMOVEFOCUS);
}
} }
// Dispatch a new click event to |content| // Dispatch a new click event to |content|
// (For compatibility with IE, we do only left click. If // (For compatibility with IE, we do only left click. If
// we wanted to interpret the HTML spec very narrowly, we // we wanted to interpret the HTML spec very narrowly, we

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

@ -13,7 +13,6 @@
#include "nsIPluginDocument.h" #include "nsIPluginDocument.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsIDOMSVGDocument.h"
#include "nsIScriptError.h" #include "nsIScriptError.h"
#include "nsIWidget.h" #include "nsIWidget.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"

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

@ -19,6 +19,7 @@ namespace mozilla {
* for regular audio contexts, and the rate requested by the web content * for regular audio contexts, and the rate requested by the web content
* for offline audio contexts. * for offline audio contexts.
* Each chunk in the track is a single block of WEBAUDIO_BLOCK_SIZE samples. * Each chunk in the track is a single block of WEBAUDIO_BLOCK_SIZE samples.
* Note: This must be a different value than MEDIA_STREAM_DEST_TRACK_ID
*/ */
static const int AUDIO_NODE_STREAM_TRACK_ID = 1; static const int AUDIO_NODE_STREAM_TRACK_ID = 1;
@ -235,23 +236,6 @@ AudioNodeStream::SetChannelMixingParametersImpl(uint32_t aNumberOfChannels,
mChannelInterpretation = aChannelInterpretation; mChannelInterpretation = aChannelInterpretation;
} }
StreamBuffer::Track*
AudioNodeStream::EnsureTrack()
{
StreamBuffer::Track* track = mBuffer.FindTrack(AUDIO_NODE_STREAM_TRACK_ID);
if (!track) {
nsAutoPtr<MediaSegment> segment(new AudioSegment());
for (uint32_t j = 0; j < mListeners.Length(); ++j) {
MediaStreamListener* l = mListeners[j];
l->NotifyQueuedTrackChanges(Graph(), AUDIO_NODE_STREAM_TRACK_ID, mSampleRate, 0,
MediaStreamListener::TRACK_EVENT_CREATED,
*segment);
}
track = &mBuffer.AddTrack(AUDIO_NODE_STREAM_TRACK_ID, mSampleRate, 0, segment.forget());
}
return track;
}
bool bool
AudioNodeStream::AllInputsFinished() const AudioNodeStream::AllInputsFinished() const
{ {
@ -399,7 +383,7 @@ AudioNodeStream::ProduceOutput(GraphTime aFrom, GraphTime aTo)
FinishOutput(); FinishOutput();
} }
StreamBuffer::Track* track = EnsureTrack(); StreamBuffer::Track* track = EnsureTrack(AUDIO_NODE_STREAM_TRACK_ID, mSampleRate);
AudioSegment* segment = track->Get<AudioSegment>(); AudioSegment* segment = track->Get<AudioSegment>();
@ -460,7 +444,7 @@ AudioNodeStream::ProduceOutput(GraphTime aFrom, GraphTime aTo)
TrackTicks TrackTicks
AudioNodeStream::GetCurrentPosition() AudioNodeStream::GetCurrentPosition()
{ {
return EnsureTrack()->Get<AudioSegment>()->GetDuration(); return EnsureTrack(AUDIO_NODE_STREAM_TRACK_ID, mSampleRate)->Get<AudioSegment>()->GetDuration();
} }
void void
@ -470,7 +454,7 @@ AudioNodeStream::FinishOutput()
return; return;
} }
StreamBuffer::Track* track = EnsureTrack(); StreamBuffer::Track* track = EnsureTrack(AUDIO_NODE_STREAM_TRACK_ID, mSampleRate);
track->SetEnded(); track->SetEnded();
FinishOnGraphThread(); FinishOnGraphThread();

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

@ -116,7 +116,6 @@ public:
protected: protected:
void FinishOutput(); void FinishOutput();
StreamBuffer::Track* EnsureTrack();
void ObtainInputBlock(AudioChunk& aTmpChunk, uint32_t aPortIndex); void ObtainInputBlock(AudioChunk& aTmpChunk, uint32_t aPortIndex);
// The engine that will generate output for this node. // The engine that will generate output for this node.

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

@ -8,6 +8,7 @@
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "mozilla/dom/MediaStreamBinding.h" #include "mozilla/dom/MediaStreamBinding.h"
#include "mozilla/dom/LocalMediaStreamBinding.h" #include "mozilla/dom/LocalMediaStreamBinding.h"
#include "mozilla/dom/AudioNode.h"
#include "MediaStreamGraph.h" #include "MediaStreamGraph.h"
#include "AudioStreamTrack.h" #include "AudioStreamTrack.h"
#include "VideoStreamTrack.h" #include "VideoStreamTrack.h"
@ -39,6 +40,15 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(DOMMediaStream)
NS_IMPL_ISUPPORTS_INHERITED1(DOMLocalMediaStream, DOMMediaStream, NS_IMPL_ISUPPORTS_INHERITED1(DOMLocalMediaStream, DOMMediaStream,
nsIDOMLocalMediaStream) nsIDOMLocalMediaStream)
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(DOMAudioNodeMediaStream, DOMMediaStream,
mStreamNode)
NS_IMPL_ADDREF_INHERITED(DOMAudioNodeMediaStream, DOMMediaStream)
NS_IMPL_RELEASE_INHERITED(DOMAudioNodeMediaStream, DOMMediaStream)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DOMAudioNodeMediaStream)
NS_INTERFACE_MAP_END_INHERITING(DOMMediaStream)
class DOMMediaStream::StreamListener : public MediaStreamListener { class DOMMediaStream::StreamListener : public MediaStreamListener {
public: public:
StreamListener(DOMMediaStream* aStream) StreamListener(DOMMediaStream* aStream)
@ -346,3 +356,18 @@ DOMLocalMediaStream::CreateTrackUnionStream(nsIDOMWindow* aWindow,
stream->InitTrackUnionStream(aWindow, aHintContents); stream->InitTrackUnionStream(aWindow, aHintContents);
return stream.forget(); return stream.forget();
} }
DOMAudioNodeMediaStream::DOMAudioNodeMediaStream(AudioNode* aNode)
: mStreamNode(aNode)
{
}
already_AddRefed<DOMAudioNodeMediaStream>
DOMAudioNodeMediaStream::CreateTrackUnionStream(nsIDOMWindow* aWindow,
AudioNode* aNode,
TrackTypeHints aHintContents)
{
nsRefPtr<DOMAudioNodeMediaStream> stream = new DOMAudioNodeMediaStream(aNode);
stream->InitTrackUnionStream(aWindow, aHintContents);
return stream.forget();
}

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

@ -33,6 +33,7 @@ namespace mozilla {
class MediaStream; class MediaStream;
namespace dom { namespace dom {
class AudioNode;
class MediaStreamTrack; class MediaStreamTrack;
class AudioStreamTrack; class AudioStreamTrack;
class VideoStreamTrack; class VideoStreamTrack;
@ -206,6 +207,29 @@ public:
CreateTrackUnionStream(nsIDOMWindow* aWindow, TrackTypeHints aHintContents = 0); CreateTrackUnionStream(nsIDOMWindow* aWindow, TrackTypeHints aHintContents = 0);
}; };
class DOMAudioNodeMediaStream : public DOMMediaStream
{
typedef dom::AudioNode AudioNode;
public:
DOMAudioNodeMediaStream(AudioNode* aNode);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DOMAudioNodeMediaStream, DOMMediaStream)
/**
* Create a DOMAudioNodeMediaStream whose underlying stream is a TrackUnionStream.
*/
static already_AddRefed<DOMAudioNodeMediaStream>
CreateTrackUnionStream(nsIDOMWindow* aWindow,
AudioNode* aNode,
TrackTypeHints aHintContents = 0);
private:
// If this object wraps a stream owned by an AudioNode, we need to ensure that
// the node isn't cycle-collected too early.
nsRefPtr<AudioNode> mStreamNode;
};
} }
#endif /* NSDOMMEDIASTREAM_H_ */ #endif /* NSDOMMEDIASTREAM_H_ */

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

@ -1525,6 +1525,23 @@ MediaStream::FinishOnGraphThread()
GraphImpl()->FinishStream(this); GraphImpl()->FinishStream(this);
} }
StreamBuffer::Track*
MediaStream::EnsureTrack(TrackID aTrackId, TrackRate aSampleRate)
{
StreamBuffer::Track* track = mBuffer.FindTrack(aTrackId);
if (!track) {
nsAutoPtr<MediaSegment> segment(new AudioSegment());
for (uint32_t j = 0; j < mListeners.Length(); ++j) {
MediaStreamListener* l = mListeners[j];
l->NotifyQueuedTrackChanges(Graph(), aTrackId, aSampleRate, 0,
MediaStreamListener::TRACK_EVENT_CREATED,
*segment);
}
track = &mBuffer.AddTrack(aTrackId, aSampleRate, 0, segment.forget());
}
return track;
}
void void
MediaStream::RemoveAllListenersImpl() MediaStream::RemoveAllListenersImpl()
{ {

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

@ -277,9 +277,11 @@ public:
, mMainThreadDestroyed(false) , mMainThreadDestroyed(false)
, mGraph(nullptr) , mGraph(nullptr)
{ {
MOZ_COUNT_CTOR(MediaStream);
} }
virtual ~MediaStream() virtual ~MediaStream()
{ {
MOZ_COUNT_DTOR(MediaStream);
NS_ASSERTION(mMainThreadDestroyed, "Should have been destroyed already"); NS_ASSERTION(mMainThreadDestroyed, "Should have been destroyed already");
NS_ASSERTION(mMainThreadListeners.IsEmpty(), NS_ASSERTION(mMainThreadListeners.IsEmpty(),
"All main thread listeners should have been removed"); "All main thread listeners should have been removed");
@ -431,6 +433,8 @@ public:
bool HasCurrentData() { return mHasCurrentData; } bool HasCurrentData() { return mHasCurrentData; }
StreamBuffer::Track* EnsureTrack(TrackID aTrack, TrackRate aSampleRate);
void ApplyTrackDisabling(TrackID aTrackID, MediaSegment* aSegment); void ApplyTrackDisabling(TrackID aTrackID, MediaSegment* aSegment);
DOMMediaStream* GetWrapper() DOMMediaStream* GetWrapper()

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

@ -26,6 +26,7 @@ class TrackUnionStream : public ProcessedMediaStream {
public: public:
TrackUnionStream(DOMMediaStream* aWrapper) : TrackUnionStream(DOMMediaStream* aWrapper) :
ProcessedMediaStream(aWrapper), ProcessedMediaStream(aWrapper),
mFilterCallback(nullptr),
mMaxTrackID(0) {} mMaxTrackID(0) {}
virtual void RemoveInput(MediaInputPort* aPort) virtual void RemoveInput(MediaInputPort* aPort)
@ -75,7 +76,7 @@ public:
break; break;
} }
} }
if (!found) { if (!found && (!mFilterCallback || mFilterCallback(tracks.get()))) {
bool trackFinished = false; bool trackFinished = false;
uint32_t mapIndex = AddTrack(mInputs[i], tracks.get(), aFrom); uint32_t mapIndex = AddTrack(mInputs[i], tracks.get(), aFrom);
CopyTrackData(tracks.get(), mapIndex, aFrom, aTo, &trackFinished); CopyTrackData(tracks.get(), mapIndex, aFrom, aTo, &trackFinished);
@ -107,7 +108,16 @@ public:
} }
} }
// Consumers may specify a filtering callback to apply to every input track.
// Returns true to allow the track to act as an input; false to reject it entirely.
typedef bool (*TrackIDFilterCallback)(StreamBuffer::Track*);
void SetTrackIDFilter(TrackIDFilterCallback aCallback) {
mFilterCallback = aCallback;
}
protected: protected:
TrackIDFilterCallback mFilterCallback;
// Only non-ended tracks are allowed to persist in this map. // Only non-ended tracks are allowed to persist in this map.
struct TrackMapEntry { struct TrackMapEntry {
MediaInputPort* mInputPort; MediaInputPort* mInputPort;

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

@ -71,6 +71,7 @@ EXPORTS += [
'SharedBuffer.h', 'SharedBuffer.h',
'StreamBuffer.h', 'StreamBuffer.h',
'TimeVarying.h', 'TimeVarying.h',
'TrackUnionStream.h',
'VideoFrameContainer.h', 'VideoFrameContainer.h',
'VideoSegment.h', 'VideoSegment.h',
'VideoUtils.h', 'VideoUtils.h',

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

@ -17,6 +17,8 @@
#include "MPAPI.h" #include "MPAPI.h"
#define MAX_DROPPED_FRAMES 25 #define MAX_DROPPED_FRAMES 25
// Try not to spend more than this much time in a single call to DecodeVideoFrame.
#define MAX_VIDEO_DECODE_SECONDS 3.0
using namespace android; using namespace android;
@ -156,8 +158,10 @@ bool MediaOmxReader::DecodeVideoFrame(bool &aKeyframeSkip,
aTimeThreshold = mVideoSeekTimeUs; aTimeThreshold = mVideoSeekTimeUs;
} }
// Read next frame TimeStamp start = TimeStamp::Now();
while (true) {
// Read next frame. Don't let this loop run for too long.
while ((TimeStamp::Now() - start) < TimeDuration::FromSeconds(MAX_VIDEO_DECODE_SECONDS)) {
MPAPI::VideoFrame frame; MPAPI::VideoFrame frame;
frame.mGraphicBuffer = nullptr; frame.mGraphicBuffer = nullptr;
frame.mShouldSkip = false; frame.mShouldSkip = false;
@ -165,22 +169,23 @@ bool MediaOmxReader::DecodeVideoFrame(bool &aKeyframeSkip,
mVideoQueue.Finish(); mVideoQueue.Finish();
return false; return false;
} }
doSeek = false;
// Ignore empty buffer which stagefright media read will sporadically return // Ignore empty buffer which stagefright media read will sporadically return
if (frame.mSize == 0 && !frame.mGraphicBuffer) { if (frame.mSize == 0 && !frame.mGraphicBuffer) {
return true; continue;
} }
parsed++; parsed++;
if (frame.mShouldSkip && mSkipCount < MAX_DROPPED_FRAMES) { if (frame.mShouldSkip && mSkipCount < MAX_DROPPED_FRAMES) {
mSkipCount++; mSkipCount++;
return true; continue;
} }
mSkipCount = 0; mSkipCount = 0;
mVideoSeekTimeUs = -1; mVideoSeekTimeUs = -1;
doSeek = aKeyframeSkip = false; aKeyframeSkip = false;
nsIntRect picture = mPicture; nsIntRect picture = mPicture;
if (frame.Y.mWidth != mInitialFrame.width || if (frame.Y.mWidth != mInitialFrame.width ||

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

@ -117,7 +117,6 @@ MOCHITEST_FILES = \
test_too_many_elements.html \ test_too_many_elements.html \
test_volume.html \ test_volume.html \
test_video_to_canvas.html \ test_video_to_canvas.html \
use_large_cache.js \
test_audiowrite.html \ test_audiowrite.html \
test_mozHasAudio.html \ test_mozHasAudio.html \
test_source_media.html \ test_source_media.html \

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

@ -8,7 +8,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=462957
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="manifest.js"></script> <script type="text/javascript" src="manifest.js"></script>
<script type="application/javascript" src="use_large_cache.js"></script>
</head> </head>
<body> <body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=462957">Mozilla Bug 462957</a> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=462957">Mozilla Bug 462957</a>
@ -85,8 +84,11 @@ function startTest(test, token) {
document.body.appendChild(v); document.body.appendChild(v);
} }
manager.runTests(gSeekTests, startTest); SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
function beginTest() {
manager.runTests(gSeekTests, startTest);
}
</script> </script>
</pre> </pre>
</body> </body>

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

@ -8,7 +8,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=493187
<title>Bug 493187 - enter HAVE_FUTURE_DATA when seeking within buffered data even if new data isn't arriving</title> <title>Bug 493187 - enter HAVE_FUTURE_DATA when seeking within buffered data even if new data isn't arriving</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="use_large_cache.js"></script>
<script type="text/javascript" src="manifest.js"></script> <script type="text/javascript" src="manifest.js"></script>
</head> </head>
<body> <body>
@ -62,8 +61,11 @@ function startTest(test, token) {
document.body.appendChild(v); document.body.appendChild(v);
} }
manager.runTests(gSeekTests, startTest); SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
function beginTest() {
manager.runTests(gSeekTests, startTest);
}
</script> </script>
</pre> </pre>
</body> </body>

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

@ -33,24 +33,17 @@ function IsWindows7() {
} }
function getMediaPref(name) { function getMediaPref(name) {
// Can't use SpecialPowers.getBoolPref because it throws when pref isn't
// present, and for example on non-Windows systems the WMF prefs won't be
// present.
var pref = false; var pref = false;
var prefService = SpecialPowers.wrap(SpecialPowers.Components)
.classes["@mozilla.org/preferences-service;1"]
.getService(SpecialPowers.Ci.nsIPrefService);
var branch = prefService.getBranch("media.");
try { try {
pref = branch.getBoolPref(name); pref = SpecialPowers.getBoolPref(name);
} catch(ex) { } } catch(ex) { }
return pref; return pref;
} }
var haveMp4 = (getMediaPref("windows-media-foundation.enabled") && IsWindowsVistaOrLater()) || var haveMp4 = (getMediaPref("media.windows-media-foundation.enabled") && IsWindowsVistaOrLater()) ||
getMediaPref("omx.enabled") || getMediaPref("media.omx.enabled") ||
getMediaPref("gstreamer.enabled"); getMediaPref("media.gstreamer.enabled");
// TODO: Add "getMediaPref("plugins.enabled")" once MP4 works on Gingerbread. // TODO: Add "getMediaPref("media.plugins.enabled")" once MP4 works on Gingerbread.
check_mp4(document.getElementById('v'), haveMp4); check_mp4(document.getElementById('v'), haveMp4);

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

@ -1,4 +1,4 @@
<!DOCTYPE HTML> hg diff<!DOCTYPE HTML>
<html> <html>
<!-- <!--
https://bugzilla.mozilla.org/show_bug.cgi?id=479863 https://bugzilla.mozilla.org/show_bug.cgi?id=479863
@ -32,17 +32,20 @@ window.onload = function() {
we've got the first frame. we've got the first frame.
*/ */
var resource = getPlayableVideo(gSeekTests); var resource = getPlayableVideo(gSeekTests);
if (resource != null) {
for (var i=0; i<20; ++i) { SimpleTest.waitForExplicitFinish();
var v = document.createElement("video"); SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
v.src = resource.name; function beginTest() {
document.body.appendChild(v); if (resource != null) {
for (var i=0; i<20; ++i) {
var v = document.createElement("video");
v.src = resource.name;
document.body.appendChild(v);
}
} else {
todo(false, "No types supported");
} }
SimpleTest.waitForExplicitFinish();
} else {
todo(false, "No types supported");
} }
</script> </script>

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

@ -4,7 +4,6 @@
<title>Media test: unknown/invalid formats raise decode error</title> <title>Media test: unknown/invalid formats raise decode error</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="use_large_cache.js"></script>
<script type="text/javascript" src="manifest.js"></script> <script type="text/javascript" src="manifest.js"></script>
</head> </head>
<body> <body>
@ -44,8 +43,11 @@ function startTest(test, token) {
v.src = test.name; // implicitly starts a load. v.src = test.name; // implicitly starts a load.
} }
manager.runTests(gDecodeErrorTests, startTest); SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
function beginTest() {
manager.runTests(gDecodeErrorTests, startTest);
}
</script> </script>
</pre> </pre>
</body> </body>

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

@ -8,7 +8,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=548523
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="manifest.js"></script> <script type="text/javascript" src="manifest.js"></script>
<script type="text/javascript" src="use_large_cache.js"></script>
</head> </head>
<body> <body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=548523">Mozilla Bug 548523</a> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=548523">Mozilla Bug 548523</a>
@ -568,8 +567,11 @@ function startTest(test, token) {
} }
var twiceTests = tests.concat(tests); var twiceTests = tests.concat(tests);
manager.runTests(twiceTests, startTest); SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
function beginTest() {
manager.runTests(twiceTests, startTest);
}
</script> </script>
</pre> </pre>
</body> </body>

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

@ -7,7 +7,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=479863
<title>Test for Bug 479863</title> <title>Test for Bug 479863</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="use_large_cache.js"></script>
</head> </head>
<body> <body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=479863">Mozilla Bug 479863</a> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=479863">Mozilla Bug 479863</a>
@ -70,17 +69,21 @@ function suspended(event) {
} }
var key = Math.random(); var key = Math.random();
for (var i = 1; i <= 6; ++i) {
var id = "v" + i;
var v = document.getElementById(id);
suspendCount[id] = 0;
v.addEventListener("suspend", suspended, false);
// Treat "load" as "suspend" for now, it means the same thing: we
// stopped the download.
v.addEventListener("load", suspended, false);
v.src = "seek.ogv?key=" + key + "&id=" + id;
}
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
function beginTest() {
for (var i = 1; i <= 6; ++i) {
var id = "v" + i;
var v = document.getElementById(id);
suspendCount[id] = 0;
v.addEventListener("suspend", suspended, false);
// Treat "load" as "suspend" for now, it means the same thing: we
// stopped the download.
v.addEventListener("load", suspended, false);
v.src = "seek.ogv?key=" + key + "&id=" + id;
}
}
</script> </script>
</pre> </pre>
</body> </body>

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

@ -8,7 +8,6 @@
</head> </head>
<body> <body>
<pre id="test"> <pre id="test">
<script src="use_large_cache.js"></script>
<script class="testbody" type="text/javascript"> <script class="testbody" type="text/javascript">
var manager = new MediaTestManager; var manager = new MediaTestManager;
@ -40,8 +39,11 @@ function startTest(test, token) {
document.body.appendChild(v); document.body.appendChild(v);
} }
manager.runTests(gProgressTests, startTest); SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
function beginTest() {
manager.runTests(gProgressTests, startTest);
}
</script> </script>
</pre> </pre>
</body> </body>

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

@ -9,7 +9,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=486646
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script> <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="use_large_cache.js"></script>
<script type="text/javascript" src="manifest.js"></script> <script type="text/javascript" src="manifest.js"></script>
</head> </head>
<body> <body>
@ -56,8 +55,11 @@ function startTest(test, token) {
document.body.appendChild(v); document.body.appendChild(v);
} }
manager.runTests(gSmallTests, startTest); SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
function beginTest() {
manager.runTests(gSmallTests, startTest);
}
</script> </script>
</pre> </pre>

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

@ -1,14 +0,0 @@
(function() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
// Set cache size to something large
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
var branch = prefService.getBranch("media.");
var oldSize = branch.getIntPref("cache_size");
branch.setIntPref("cache_size", 40000);
window.addEventListener("unload", function() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
branch.setIntPref("cache_size", oldSize);
}, false);
})();

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

@ -24,6 +24,7 @@
#include "ScriptProcessorNode.h" #include "ScriptProcessorNode.h"
#include "ChannelMergerNode.h" #include "ChannelMergerNode.h"
#include "ChannelSplitterNode.h" #include "ChannelSplitterNode.h"
#include "MediaStreamAudioDestinationNode.h"
#include "WaveShaperNode.h" #include "WaveShaperNode.h"
#include "WaveTable.h" #include "WaveTable.h"
#include "ConvolverNode.h" #include "ConvolverNode.h"
@ -204,6 +205,14 @@ bool IsValidBufferSize(uint32_t aBufferSize) {
} }
already_AddRefed<MediaStreamAudioDestinationNode>
AudioContext::CreateMediaStreamDestination()
{
nsRefPtr<MediaStreamAudioDestinationNode> node =
new MediaStreamAudioDestinationNode(this);
return node.forget();
}
already_AddRefed<ScriptProcessorNode> already_AddRefed<ScriptProcessorNode>
AudioContext::CreateScriptProcessor(uint32_t aBufferSize, AudioContext::CreateScriptProcessor(uint32_t aBufferSize,
uint32_t aNumberOfInputChannels, uint32_t aNumberOfInputChannels,

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

@ -51,6 +51,7 @@ class DelayNode;
class DynamicsCompressorNode; class DynamicsCompressorNode;
class GainNode; class GainNode;
class GlobalObject; class GlobalObject;
class MediaStreamAudioDestinationNode;
class OfflineRenderSuccessCallback; class OfflineRenderSuccessCallback;
class PannerNode; class PannerNode;
class ScriptProcessorNode; class ScriptProcessorNode;
@ -125,6 +126,9 @@ public:
CreateBuffer(JSContext* aJSContext, ArrayBuffer& aBuffer, CreateBuffer(JSContext* aJSContext, ArrayBuffer& aBuffer,
bool aMixToMono, ErrorResult& aRv); bool aMixToMono, ErrorResult& aRv);
already_AddRefed<MediaStreamAudioDestinationNode>
CreateMediaStreamDestination();
already_AddRefed<ScriptProcessorNode> already_AddRefed<ScriptProcessorNode>
CreateScriptProcessor(uint32_t aBufferSize, CreateScriptProcessor(uint32_t aBufferSize,
uint32_t aNumberOfInputChannels, uint32_t aNumberOfInputChannels,

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

@ -0,0 +1,95 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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/. */
#include "MediaStreamAudioDestinationNode.h"
#include "mozilla/dom/AudioStreamTrack.h"
#include "mozilla/dom/MediaStreamAudioDestinationNodeBinding.h"
#include "AudioNodeEngine.h"
#include "AudioNodeStream.h"
#include "DOMMediaStream.h"
#include "TrackUnionStream.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(MediaStreamAudioDestinationNode, AudioNode, mDOMStream)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(MediaStreamAudioDestinationNode)
NS_INTERFACE_MAP_END_INHERITING(AudioNode)
NS_IMPL_ADDREF_INHERITED(MediaStreamAudioDestinationNode, AudioNode)
NS_IMPL_RELEASE_INHERITED(MediaStreamAudioDestinationNode, AudioNode)
// This must be a different value than AUDIO_NODE_STREAM_TRACK_ID
static const int MEDIA_STREAM_DEST_TRACK_ID = 2;
class MediaStreamDestinationEngine : public AudioNodeEngine {
public:
MediaStreamDestinationEngine(AudioNode* aNode, ProcessedMediaStream* aOutputStream)
: AudioNodeEngine(aNode)
, mOutputStream(aOutputStream)
{
MOZ_ASSERT(mOutputStream);
}
virtual void ProduceAudioBlock(AudioNodeStream* aStream,
const AudioChunk& aInput,
AudioChunk* aOutput,
bool* aFinished) MOZ_OVERRIDE
{
*aOutput = aInput;
StreamBuffer::Track* track = mOutputStream->EnsureTrack(MEDIA_STREAM_DEST_TRACK_ID,
aStream->SampleRate());
AudioSegment* segment = track->Get<AudioSegment>();
segment->AppendAndConsumeChunk(aOutput);
}
private:
ProcessedMediaStream* mOutputStream;
};
// This callback is used to ensure that only the audio data for this track is audible
static bool FilterAudioNodeStreamTrack(StreamBuffer::Track* aTrack)
{
return aTrack->GetID() == MEDIA_STREAM_DEST_TRACK_ID;
}
MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AudioContext* aContext)
: AudioNode(aContext,
2,
ChannelCountMode::Explicit,
ChannelInterpretation::Speakers)
, mDOMStream(DOMAudioNodeMediaStream::CreateTrackUnionStream(GetOwner(),
this,
DOMMediaStream::HINT_CONTENTS_AUDIO))
{
TrackUnionStream* tus = static_cast<TrackUnionStream*>(mDOMStream->GetStream());
MOZ_ASSERT(tus == mDOMStream->GetStream()->AsProcessedStream());
tus->SetTrackIDFilter(FilterAudioNodeStreamTrack);
MediaStreamDestinationEngine* engine = new MediaStreamDestinationEngine(this, tus);
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
mPort = tus->AllocateInputPort(mStream, 0);
}
void
MediaStreamAudioDestinationNode::DestroyMediaStream()
{
AudioNode::DestroyMediaStream();
if (mPort) {
mPort->Destroy();
mPort = nullptr;
}
}
JSObject*
MediaStreamAudioDestinationNode::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{
return MediaStreamAudioDestinationNodeBinding::Wrap(aCx, aScope, this);
}
}
}

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

@ -0,0 +1,48 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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/. */
#ifndef MediaStreamAudioDestinationNode_h_
#define MediaStreamAudioDestinationNode_h_
#include "AudioNode.h"
namespace mozilla {
class DOMMediaStream;
namespace dom {
class MediaStreamAudioDestinationNode : public AudioNode
{
public:
explicit MediaStreamAudioDestinationNode(AudioContext* aContext);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MediaStreamAudioDestinationNode, AudioNode)
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
virtual uint16_t NumberOfOutputs() const MOZ_FINAL MOZ_OVERRIDE
{
return 0;
}
virtual void DestroyMediaStream() MOZ_OVERRIDE;
DOMMediaStream* DOMStream() const
{
return mDOMStream;
}
private:
nsRefPtr<DOMMediaStream> mDOMStream;
nsRefPtr<MediaInputPort> mPort;
};
}
}
#endif

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

@ -39,6 +39,7 @@ EXPORTS.mozilla.dom += [
'DynamicsCompressorNode.h', 'DynamicsCompressorNode.h',
'EnableWebAudioCheck.h', 'EnableWebAudioCheck.h',
'GainNode.h', 'GainNode.h',
'MediaStreamAudioDestinationNode.h',
'OfflineAudioCompletionEvent.h', 'OfflineAudioCompletionEvent.h',
'PannerNode.h', 'PannerNode.h',
'ScriptProcessorNode.h', 'ScriptProcessorNode.h',
@ -65,6 +66,7 @@ CPP_SOURCES += [
'EnableWebAudioCheck.cpp', 'EnableWebAudioCheck.cpp',
'GainNode.cpp', 'GainNode.cpp',
'MediaBufferDecoder.cpp', 'MediaBufferDecoder.cpp',
'MediaStreamAudioDestinationNode.cpp',
'OfflineAudioCompletionEvent.cpp', 'OfflineAudioCompletionEvent.cpp',
'PannerNode.cpp', 'PannerNode.cpp',
'ScriptProcessorNode.cpp', 'ScriptProcessorNode.cpp',

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

@ -62,6 +62,7 @@ MOCHITEST_FILES := \
test_gainNodeInLoop.html \ test_gainNodeInLoop.html \
test_maxChannelCount.html \ test_maxChannelCount.html \
test_mediaDecoding.html \ test_mediaDecoding.html \
test_mediaStreamAudioDestinationNode.html \
test_mixingRules.html \ test_mixingRules.html \
test_nodeToParamConnection.html \ test_nodeToParamConnection.html \
test_OfflineAudioContext.html \ test_OfflineAudioContext.html \

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

@ -0,0 +1,46 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test MediaStreamAudioDestinationNode</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<audio id="audioelem"></audio>
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
var context = new AudioContext();
var buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
}
var source = context.createBufferSource();
source.buffer = buffer;
var dest = context.createMediaStreamDestination();
source.connect(dest);
var elem = document.getElementById('audioelem');
elem.mozSrcObject = dest.stream;
elem.onloadedmetadata = function() {
ok(true, "got metadata event");
setTimeout(function() {
is(elem.played.length, 1, "should have a played interval");
is(elem.played.start(0), 0, "should have played immediately");
isnot(elem.played.end(0), 0, "should have played for a non-zero interval");
SpecialPowers.clearUserPref("media.webaudio.enabled");
SimpleTest.finish();
}, 2000);
};
source.start(0);
elem.play();
});
</script>

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

@ -170,6 +170,7 @@ function synthCleanup() {
.getService(SpecialPowers.Ci.nsISyncMessageSender); .getService(SpecialPowers.Ci.nsISyncMessageSender);
mm.sendSyncMessage('test:SpeechSynthesis:ipcSynthCleanup'); mm.sendSyncMessage('test:SpeechSynthesis:ipcSynthCleanup');
} }
SpecialPowers.clearUserPref("media.webspeech.synth.enabled");
} }
function synthTestQueue(aTestArgs, aEndFunc) { function synthTestQueue(aTestArgs, aEndFunc) {

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

@ -10,7 +10,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=525444
<script type="application/javascript" src="common.js"></script> <script type="application/javascript" src="common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head> </head>
<body onunload="synthCleanup();"> <body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=650295">Mozilla Bug 650295</a> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=650295">Mozilla Bug 650295</a>
<p id="display"></p> <p id="display"></p>
<div id="content" style="display: none"> <div id="content" style="display: none">

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

@ -10,7 +10,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=525444
<script type="application/javascript" src="common.js"></script> <script type="application/javascript" src="common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head> </head>
<body onunload="synthCleanup();"> <body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=525444">Mozilla Bug 525444</a> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=525444">Mozilla Bug 525444</a>
<p id="display"></p> <p id="display"></p>
<div id="content" style="display: none"> <div id="content" style="display: none">

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

@ -10,7 +10,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295
<script type="application/javascript" src="common.js"></script> <script type="application/javascript" src="common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head> </head>
<body onunload="synthCleanup();"> <body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=650295">Mozilla Bug 650295</a> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=650295">Mozilla Bug 650295</a>
<p id="display"></p> <p id="display"></p>
<div id="content" style="display: none"> <div id="content" style="display: none">

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

@ -50,7 +50,7 @@ SVGAElement::SVGAElement(already_AddRefed<nsINodeInfo> aNodeInfo)
{ {
} }
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGAElement::Href() SVGAElement::Href()
{ {
return mStringAttributes[HREF].ToDOMAnimatedString(this); return mStringAttributes[HREF].ToDOMAnimatedString(this);
@ -79,7 +79,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAElement)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGAElement::Target() SVGAElement::Target()
{ {
return mStringAttributes[TARGET].ToDOMAnimatedString(this); return mStringAttributes[TARGET].ToDOMAnimatedString(this);

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

@ -66,8 +66,8 @@ public:
bool aNotify) MOZ_OVERRIDE; bool aNotify) MOZ_OVERRIDE;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> Href(); already_AddRefed<SVGAnimatedString> Href();
already_AddRefed<nsIDOMSVGAnimatedString> Target(); already_AddRefed<SVGAnimatedString> Target();
void GetDownload(nsAString & aDownload); void GetDownload(nsAString & aDownload);
void SetDownload(const nsAString & aDownload, ErrorResult& rv); void SetDownload(const nsAString & aDownload, ErrorResult& rv);

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

@ -36,7 +36,7 @@ SVGAltGlyphElement::SVGAltGlyphElement(already_AddRefed<nsINodeInfo> aNodeInfo)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAltGlyphElement) NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAltGlyphElement)
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGAltGlyphElement::Href() SVGAltGlyphElement::Href()
{ {
return mStringAttributes[HREF].ToDOMAnimatedString(this); return mStringAttributes[HREF].ToDOMAnimatedString(this);

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

@ -33,7 +33,7 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> Href(); already_AddRefed<SVGAnimatedString> Href();
void GetGlyphRef(nsAString & aGlyphRef); void GetGlyphRef(nsAString & aGlyphRef);
void SetGlyphRef(const nsAString & aGlyphRef, ErrorResult& rv); void SetGlyphRef(const nsAString & aGlyphRef, ErrorResult& rv);
void GetFormat(nsAString & aFormat); void GetFormat(nsAString & aFormat);

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

@ -0,0 +1,20 @@
/* -*- Mode: C++; 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/. */
#include "mozilla/dom/SVGAnimatedString.h"
#include "mozilla/dom/SVGAnimatedStringBinding.h"
namespace mozilla {
namespace dom {
JSObject*
SVGAnimatedString::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope)
{
return SVGAnimatedStringBinding::Wrap(aCx, aScope, this);
}
} // namespace dom
} // namespace mozilla

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

@ -0,0 +1,43 @@
/* -*- Mode: C++; 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/. */
#ifndef mozilla_dom_SVGAnimatedString_h
#define mozilla_dom_SVGAnimatedString_h
#include "nsSVGElement.h"
namespace mozilla {
namespace dom {
class SVGAnimatedString : public nsISupports,
public nsWrapperCache
{
public:
SVGAnimatedString(nsSVGElement* aSVGElement)
: mSVGElement(aSVGElement)
{
SetIsDOMBinding();
}
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
// WebIDL
nsSVGElement* GetParentObject() const
{
return mSVGElement;
}
virtual void GetBaseVal(nsAString& aResult) = 0;
virtual void SetBaseVal(const nsAString& aValue) = 0;
virtual void GetAnimVal(nsAString& aResult) = 0;
nsRefPtr<nsSVGElement> mSVGElement;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_SVGAnimatedString_h

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

@ -50,13 +50,13 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEBlendElement)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// nsIDOMSVGFEBlendElement methods // nsIDOMSVGFEBlendElement methods
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFEBlendElement::In1() SVGFEBlendElement::In1()
{ {
return mStringAttributes[IN1].ToDOMAnimatedString(this); return mStringAttributes[IN1].ToDOMAnimatedString(this);
} }
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFEBlendElement::In2() SVGFEBlendElement::In2()
{ {
return mStringAttributes[IN2].ToDOMAnimatedString(this); return mStringAttributes[IN2].ToDOMAnimatedString(this);

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

@ -48,8 +48,8 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1(); already_AddRefed<SVGAnimatedString> In1();
already_AddRefed<nsIDOMSVGAnimatedString> In2(); already_AddRefed<SVGAnimatedString> In2();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> Mode(); already_AddRefed<nsIDOMSVGAnimatedEnumeration> Mode();
protected: protected:

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

@ -57,7 +57,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEColorMatrixElement)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFEColorMatrixElement::In1() SVGFEColorMatrixElement::In1()
{ {
return mStringAttributes[IN1].ToDOMAnimatedString(this); return mStringAttributes[IN1].ToDOMAnimatedString(this);

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

@ -49,7 +49,7 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1(); already_AddRefed<SVGAnimatedString> In1();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> Type(); already_AddRefed<nsIDOMSVGAnimatedEnumeration> Type();
already_AddRefed<DOMSVGAnimatedNumberList> Values(); already_AddRefed<DOMSVGAnimatedNumberList> Values();

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

@ -30,7 +30,7 @@ nsSVGElement::StringInfo SVGFEComponentTransferElement::sStringInfo[2] =
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEComponentTransferElement) NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEComponentTransferElement)
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFEComponentTransferElement::In1() SVGFEComponentTransferElement::In1()
{ {
return mStringAttributes[IN1].ToDOMAnimatedString(this); return mStringAttributes[IN1].ToDOMAnimatedString(this);

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

@ -42,7 +42,7 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1(); already_AddRefed<SVGAnimatedString> In1();
protected: protected:
virtual bool OperatesOnPremultipledAlpha(int32_t) MOZ_OVERRIDE { return false; } virtual bool OperatesOnPremultipledAlpha(int32_t) MOZ_OVERRIDE { return false; }

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

@ -55,13 +55,13 @@ nsSVGElement::StringInfo SVGFECompositeElement::sStringInfo[3] =
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFECompositeElement) NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFECompositeElement)
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFECompositeElement::In1() SVGFECompositeElement::In1()
{ {
return mStringAttributes[IN1].ToDOMAnimatedString(this); return mStringAttributes[IN1].ToDOMAnimatedString(this);
} }
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFECompositeElement::In2() SVGFECompositeElement::In2()
{ {
return mStringAttributes[IN2].ToDOMAnimatedString(this); return mStringAttributes[IN2].ToDOMAnimatedString(this);

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

@ -55,8 +55,8 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1(); already_AddRefed<SVGAnimatedString> In1();
already_AddRefed<nsIDOMSVGAnimatedString> In2(); already_AddRefed<SVGAnimatedString> In2();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> Operator(); already_AddRefed<nsIDOMSVGAnimatedEnumeration> Operator();
already_AddRefed<nsIDOMSVGAnimatedNumber> K1(); already_AddRefed<nsIDOMSVGAnimatedNumber> K1();
already_AddRefed<nsIDOMSVGAnimatedNumber> K2(); already_AddRefed<nsIDOMSVGAnimatedNumber> K2();

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

@ -85,7 +85,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEConvolveMatrixElement)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFEConvolveMatrixElement::In1() SVGFEConvolveMatrixElement::In1()
{ {
return mStringAttributes[IN1].ToDOMAnimatedString(this); return mStringAttributes[IN1].ToDOMAnimatedString(this);

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

@ -58,7 +58,7 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1(); already_AddRefed<SVGAnimatedString> In1();
already_AddRefed<nsIDOMSVGAnimatedInteger> OrderX(); already_AddRefed<nsIDOMSVGAnimatedInteger> OrderX();
already_AddRefed<nsIDOMSVGAnimatedInteger> OrderY(); already_AddRefed<nsIDOMSVGAnimatedInteger> OrderY();
already_AddRefed<DOMSVGAnimatedNumberList> KernelMatrix(); already_AddRefed<DOMSVGAnimatedNumberList> KernelMatrix();

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

@ -25,7 +25,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEDiffuseLightingElement)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFEDiffuseLightingElement::In1() SVGFEDiffuseLightingElement::In1()
{ {
return mStringAttributes[IN1].ToDOMAnimatedString(this); return mStringAttributes[IN1].ToDOMAnimatedString(this);

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

@ -35,7 +35,7 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1(); already_AddRefed<SVGAnimatedString> In1();
already_AddRefed<nsIDOMSVGAnimatedNumber> SurfaceScale(); already_AddRefed<nsIDOMSVGAnimatedNumber> SurfaceScale();
already_AddRefed<nsIDOMSVGAnimatedNumber> DiffuseConstant(); already_AddRefed<nsIDOMSVGAnimatedNumber> DiffuseConstant();
already_AddRefed<nsIDOMSVGAnimatedNumber> KernelUnitLengthX(); already_AddRefed<nsIDOMSVGAnimatedNumber> KernelUnitLengthX();

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

@ -65,13 +65,13 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEDisplacementMapElement)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFEDisplacementMapElement::In1() SVGFEDisplacementMapElement::In1()
{ {
return mStringAttributes[IN1].ToDOMAnimatedString(this); return mStringAttributes[IN1].ToDOMAnimatedString(this);
} }
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFEDisplacementMapElement::In2() SVGFEDisplacementMapElement::In2()
{ {
return mStringAttributes[IN2].ToDOMAnimatedString(this); return mStringAttributes[IN2].ToDOMAnimatedString(this);

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

@ -49,8 +49,8 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1(); already_AddRefed<SVGAnimatedString> In1();
already_AddRefed<nsIDOMSVGAnimatedString> In2(); already_AddRefed<SVGAnimatedString> In2();
already_AddRefed<nsIDOMSVGAnimatedNumber> Scale(); already_AddRefed<nsIDOMSVGAnimatedNumber> Scale();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> XChannelSelector(); already_AddRefed<nsIDOMSVGAnimatedEnumeration> XChannelSelector();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> YChannelSelector(); already_AddRefed<nsIDOMSVGAnimatedEnumeration> YChannelSelector();

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

@ -37,7 +37,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEGaussianBlurElement)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFEGaussianBlurElement::In1() SVGFEGaussianBlurElement::In1()
{ {
return mStringAttributes[IN1].ToDOMAnimatedString(this); return mStringAttributes[IN1].ToDOMAnimatedString(this);

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

@ -50,7 +50,7 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1(); already_AddRefed<SVGAnimatedString> In1();
already_AddRefed<nsIDOMSVGAnimatedNumber> StdDeviationX(); already_AddRefed<nsIDOMSVGAnimatedNumber> StdDeviationX();
already_AddRefed<nsIDOMSVGAnimatedNumber> StdDeviationY(); already_AddRefed<nsIDOMSVGAnimatedNumber> StdDeviationY();
void SetStdDeviation(float stdDeviationX, float stdDeviationY); void SetStdDeviation(float stdDeviationX, float stdDeviationY);

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

@ -175,7 +175,7 @@ SVGFEImageElement::IntrinsicState() const
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEImageElement) NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEImageElement)
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFEImageElement::Href() SVGFEImageElement::Href()
{ {
return mStringAttributes[HREF].ToDOMAnimatedString(this); return mStringAttributes[HREF].ToDOMAnimatedString(this);

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

@ -65,7 +65,7 @@ public:
void MaybeLoadSVGImage(); void MaybeLoadSVGImage();
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> Href(); already_AddRefed<SVGAnimatedString> Href();
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio(); already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
private: private:

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

@ -37,7 +37,7 @@ SVGFEMergeNodeElement::AttributeAffectsRendering(int32_t aNameSpaceID,
return aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::in; return aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::in;
} }
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFEMergeNodeElement::In1() SVGFEMergeNodeElement::In1()
{ {
return mStringAttributes[IN1].ToDOMAnimatedString(this); return mStringAttributes[IN1].ToDOMAnimatedString(this);

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

@ -37,7 +37,7 @@ public:
const nsSVGString* GetIn1() { return &mStringAttributes[IN1]; } const nsSVGString* GetIn1() { return &mStringAttributes[IN1]; }
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1(); already_AddRefed<SVGAnimatedString> In1();
protected: protected:
virtual StringAttributesInfo GetStringInfo() MOZ_OVERRIDE; virtual StringAttributesInfo GetStringInfo() MOZ_OVERRIDE;

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

@ -58,7 +58,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEMorphologyElement)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// SVGFEMorphologyElement methods // SVGFEMorphologyElement methods
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFEMorphologyElement::In1() SVGFEMorphologyElement::In1()
{ {
return mStringAttributes[IN1].ToDOMAnimatedString(this); return mStringAttributes[IN1].ToDOMAnimatedString(this);

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

@ -50,7 +50,7 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1(); already_AddRefed<SVGAnimatedString> In1();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> Operator(); already_AddRefed<nsIDOMSVGAnimatedEnumeration> Operator();
already_AddRefed<nsIDOMSVGAnimatedNumber> RadiusX(); already_AddRefed<nsIDOMSVGAnimatedNumber> RadiusX();
already_AddRefed<nsIDOMSVGAnimatedNumber> RadiusY(); already_AddRefed<nsIDOMSVGAnimatedNumber> RadiusY();

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

@ -39,7 +39,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEOffsetElement)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFEOffsetElement::In1() SVGFEOffsetElement::In1()
{ {
return mStringAttributes[IN1].ToDOMAnimatedString(this); return mStringAttributes[IN1].ToDOMAnimatedString(this);

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

@ -49,7 +49,7 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1(); already_AddRefed<SVGAnimatedString> In1();
already_AddRefed<nsIDOMSVGAnimatedNumber> Dx(); already_AddRefed<nsIDOMSVGAnimatedNumber> Dx();
already_AddRefed<nsIDOMSVGAnimatedNumber> Dy(); already_AddRefed<nsIDOMSVGAnimatedNumber> Dy();

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

@ -23,7 +23,7 @@ SVGFESpecularLightingElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aSc
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFESpecularLightingElement) NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFESpecularLightingElement)
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFESpecularLightingElement::In1() SVGFESpecularLightingElement::In1()
{ {
return mStringAttributes[IN1].ToDOMAnimatedString(this); return mStringAttributes[IN1].ToDOMAnimatedString(this);

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

@ -41,7 +41,7 @@ public:
int32_t aNameSpaceID, nsIAtom* aAttribute) const; int32_t aNameSpaceID, nsIAtom* aAttribute) const;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1(); already_AddRefed<SVGAnimatedString> In1();
already_AddRefed<nsIDOMSVGAnimatedNumber> SurfaceScale(); already_AddRefed<nsIDOMSVGAnimatedNumber> SurfaceScale();
already_AddRefed<nsIDOMSVGAnimatedNumber> SpecularConstant(); already_AddRefed<nsIDOMSVGAnimatedNumber> SpecularConstant();
already_AddRefed<nsIDOMSVGAnimatedNumber> SpecularExponent(); already_AddRefed<nsIDOMSVGAnimatedNumber> SpecularExponent();

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

@ -31,7 +31,7 @@ nsSVGElement::StringInfo SVGFETileElement::sStringInfo[2] =
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFETileElement) NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFETileElement)
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFETileElement::In1() SVGFETileElement::In1()
{ {
return mStringAttributes[IN1].ToDOMAnimatedString(this); return mStringAttributes[IN1].ToDOMAnimatedString(this);

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

@ -49,7 +49,7 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1(); already_AddRefed<SVGAnimatedString> In1();
protected: protected:
virtual StringAttributesInfo GetStringInfo() MOZ_OVERRIDE; virtual StringAttributesInfo GetStringInfo() MOZ_OVERRIDE;

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

@ -125,7 +125,7 @@ SVGFilterElement::SetFilterRes(uint32_t filterResX, uint32_t filterResY)
mIntegerPairAttributes[FILTERRES].SetBaseValues(filterResX, filterResY, this); mIntegerPairAttributes[FILTERRES].SetBaseValues(filterResX, filterResY, this);
} }
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGFilterElement::Href() SVGFilterElement::Href()
{ {
return mStringAttributes[HREF].ToDOMAnimatedString(this); return mStringAttributes[HREF].ToDOMAnimatedString(this);

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

@ -57,7 +57,7 @@ public:
already_AddRefed<nsIDOMSVGAnimatedInteger> FilterResX(); already_AddRefed<nsIDOMSVGAnimatedInteger> FilterResX();
already_AddRefed<nsIDOMSVGAnimatedInteger> FilterResY(); already_AddRefed<nsIDOMSVGAnimatedInteger> FilterResY();
void SetFilterRes(uint32_t filterResX, uint32_t filterResY); void SetFilterRes(uint32_t filterResX, uint32_t filterResY);
already_AddRefed<nsIDOMSVGAnimatedString> Href(); already_AddRefed<SVGAnimatedString> Href();
protected: protected:

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

@ -93,7 +93,7 @@ SVGGradientElement::SpreadMethod()
return mEnumAttributes[SPREADMETHOD].ToDOMAnimatedEnum(this); return mEnumAttributes[SPREADMETHOD].ToDOMAnimatedEnum(this);
} }
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGGradientElement::Href() SVGGradientElement::Href()
{ {
return mStringAttributes[HREF].ToDOMAnimatedString(this); return mStringAttributes[HREF].ToDOMAnimatedString(this);

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

@ -62,7 +62,7 @@ public:
already_AddRefed<nsIDOMSVGAnimatedEnumeration> GradientUnits(); already_AddRefed<nsIDOMSVGAnimatedEnumeration> GradientUnits();
already_AddRefed<SVGAnimatedTransformList> GradientTransform(); already_AddRefed<SVGAnimatedTransformList> GradientTransform();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> SpreadMethod(); already_AddRefed<nsIDOMSVGAnimatedEnumeration> SpreadMethod();
already_AddRefed<nsIDOMSVGAnimatedString> Href(); already_AddRefed<SVGAnimatedString> Href();
protected: protected:
virtual EnumAttributesInfo GetEnumInfo() MOZ_OVERRIDE; virtual EnumAttributesInfo GetEnumInfo() MOZ_OVERRIDE;

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

@ -103,7 +103,7 @@ SVGImageElement::PreserveAspectRatio()
return ratio.forget(); return ratio.forget();
} }
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGImageElement::Href() SVGImageElement::Href()
{ {
return mStringAttributes[HREF].ToDOMAnimatedString(this); return mStringAttributes[HREF].ToDOMAnimatedString(this);

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

@ -73,7 +73,7 @@ public:
already_AddRefed<SVGAnimatedLength> Width(); already_AddRefed<SVGAnimatedLength> Width();
already_AddRefed<SVGAnimatedLength> Height(); already_AddRefed<SVGAnimatedLength> Height();
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio(); already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
already_AddRefed<nsIDOMSVGAnimatedString> Href(); already_AddRefed<SVGAnimatedString> Href();
protected: protected:
nsresult LoadSVGImage(bool aForce, bool aNotify); nsresult LoadSVGImage(bool aForce, bool aNotify);

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

@ -78,7 +78,7 @@ SVGMPathElement::~SVGMPathElement()
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGMPathElement) NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGMPathElement)
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGMPathElement::Href() SVGMPathElement::Href()
{ {
return mStringAttributes[HREF].ToDOMAnimatedString(this); return mStringAttributes[HREF].ToDOMAnimatedString(this);

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

@ -62,7 +62,7 @@ public:
SVGPathElement* GetReferencedPath(); SVGPathElement* GetReferencedPath();
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> Href(); already_AddRefed<SVGAnimatedString> Href();
protected: protected:
class PathReference : public nsReferencedElement { class PathReference : public nsReferencedElement {

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

@ -125,7 +125,7 @@ SVGPatternElement::Height()
return mLengthAttributes[ATTR_HEIGHT].ToDOMAnimatedLength(this); return mLengthAttributes[ATTR_HEIGHT].ToDOMAnimatedLength(this);
} }
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGPatternElement::Href() SVGPatternElement::Href()
{ {
return mStringAttributes[HREF].ToDOMAnimatedString(this); return mStringAttributes[HREF].ToDOMAnimatedString(this);

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

@ -63,7 +63,7 @@ public:
already_AddRefed<SVGAnimatedLength> Y(); already_AddRefed<SVGAnimatedLength> Y();
already_AddRefed<SVGAnimatedLength> Width(); already_AddRefed<SVGAnimatedLength> Width();
already_AddRefed<SVGAnimatedLength> Height(); already_AddRefed<SVGAnimatedLength> Height();
already_AddRefed<nsIDOMSVGAnimatedString> Href(); already_AddRefed<SVGAnimatedString> Href();
protected: protected:

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

@ -98,7 +98,7 @@ SVGScriptElement::SetCrossOrigin(const nsAString & aOrigin, ErrorResult& rv)
rv = SetAttr(kNameSpaceID_None, nsGkAtoms::crossorigin, aOrigin, true); rv = SetAttr(kNameSpaceID_None, nsGkAtoms::crossorigin, aOrigin, true);
} }
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGScriptElement::Href() SVGScriptElement::Href()
{ {
return mStringAttributes[HREF].ToDOMAnimatedString(this); return mStringAttributes[HREF].ToDOMAnimatedString(this);

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

@ -69,7 +69,7 @@ public:
void SetType(const nsAString & aType, ErrorResult& rv); void SetType(const nsAString & aType, ErrorResult& rv);
void GetCrossOrigin(nsAString & aOrigin); void GetCrossOrigin(nsAString & aOrigin);
void SetCrossOrigin(const nsAString & aOrigin, ErrorResult& rv); void SetCrossOrigin(const nsAString & aOrigin, ErrorResult& rv);
already_AddRefed<nsIDOMSVGAnimatedString> Href(); already_AddRefed<SVGAnimatedString> Href();
protected: protected:
virtual StringAttributesInfo GetStringInfo() MOZ_OVERRIDE; virtual StringAttributesInfo GetStringInfo() MOZ_OVERRIDE;

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

@ -70,7 +70,7 @@ SVGTextPathElement::SVGTextPathElement(already_AddRefed<nsINodeInfo> aNodeInfo)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGTextPathElement) NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGTextPathElement)
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGTextPathElement::Href() SVGTextPathElement::Href()
{ {
return mStringAttributes[HREF].ToDOMAnimatedString(this); return mStringAttributes[HREF].ToDOMAnimatedString(this);

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

@ -55,7 +55,7 @@ public:
already_AddRefed<SVGAnimatedLength> StartOffset(); already_AddRefed<SVGAnimatedLength> StartOffset();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> Method(); already_AddRefed<nsIDOMSVGAnimatedEnumeration> Method();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> Spacing(); already_AddRefed<nsIDOMSVGAnimatedEnumeration> Spacing();
already_AddRefed<nsIDOMSVGAnimatedString> Href(); already_AddRefed<SVGAnimatedString> Href();
protected: protected:

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

@ -115,12 +115,10 @@ SVGUseElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
return NS_FAILED(rv1) ? rv1 : rv2; return NS_FAILED(rv1) ? rv1 : rv2;
} }
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<SVGAnimatedString>
SVGUseElement::Href() SVGUseElement::Href()
{ {
nsCOMPtr<nsIDOMSVGAnimatedString> href; return mStringAttributes[HREF].ToDOMAnimatedString(this);
mStringAttributes[HREF].ToDOMAnimatedString(getter_AddRefs(href), this);
return href.forget();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

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

@ -70,7 +70,7 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
// WebIDL // WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> Href(); already_AddRefed<SVGAnimatedString> Href();
already_AddRefed<SVGAnimatedLength> X(); already_AddRefed<SVGAnimatedLength> X();
already_AddRefed<SVGAnimatedLength> Y(); already_AddRefed<SVGAnimatedLength> Y();
already_AddRefed<SVGAnimatedLength> Width(); already_AddRefed<SVGAnimatedLength> Width();

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

@ -25,6 +25,7 @@ EXPORTS.mozilla.dom += [
'SVGAnimatedBoolean.h', 'SVGAnimatedBoolean.h',
'SVGAnimatedLength.h', 'SVGAnimatedLength.h',
'SVGAnimatedRect.h', 'SVGAnimatedRect.h',
'SVGAnimatedString.h',
'SVGAnimatedTransformList.h', 'SVGAnimatedTransformList.h',
'SVGAnimationElement.h', 'SVGAnimationElement.h',
'SVGCircleElement.h', 'SVGCircleElement.h',
@ -122,6 +123,7 @@ CPP_SOURCES += [
'SVGAnimatedPointList.cpp', 'SVGAnimatedPointList.cpp',
'SVGAnimatedPreserveAspectRatio.cpp', 'SVGAnimatedPreserveAspectRatio.cpp',
'SVGAnimatedRect.cpp', 'SVGAnimatedRect.cpp',
'SVGAnimatedString.cpp',
'SVGAnimatedTransformList.cpp', 'SVGAnimatedTransformList.cpp',
'SVGAnimationElement.cpp', 'SVGAnimationElement.cpp',
'SVGAttrValueWrapper.cpp', 'SVGAttrValueWrapper.cpp',

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

@ -7,22 +7,54 @@
#include "nsSVGElement.h" #include "nsSVGElement.h"
#include "nsSMILValue.h" #include "nsSMILValue.h"
#include "SMILStringType.h" #include "SMILStringType.h"
#include "mozilla/dom/SVGAnimatedString.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom;
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGClass::DOMAnimatedString, mSVGElement) struct DOMAnimatedString MOZ_FINAL : public SVGAnimatedString
{
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMAnimatedString)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGClass::DOMAnimatedString) DOMAnimatedString(nsSVGClass* aVal, nsSVGElement* aSVGElement)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGClass::DOMAnimatedString) : SVGAnimatedString(aSVGElement)
, mVal(aVal)
{}
DOMCI_DATA(SVGAnimatedClass, nsSVGClass::DOMAnimatedString) nsSVGClass* mVal; // kept alive because it belongs to content
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGClass::DOMAnimatedString) void GetBaseVal(nsAString& aResult) MOZ_OVERRIDE
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedString) {
mVal->GetBaseValue(aResult, mSVGElement);
}
void SetBaseVal(const nsAString& aValue) MOZ_OVERRIDE
{
mVal->SetBaseValue(aValue, mSVGElement, true);
}
void GetAnimVal(nsAString& aResult) MOZ_OVERRIDE;
};
NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMAnimatedString, mSVGElement)
NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMAnimatedString)
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMAnimatedString)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMAnimatedString)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGAnimatedString)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
already_AddRefed<SVGAnimatedString>
nsSVGClass::ToDOMAnimatedString(nsSVGElement* aSVGElement)
{
nsRefPtr<DOMAnimatedString> result = new DOMAnimatedString(this, aSVGElement);
return result.forget();
}
/* Implementation */ /* Implementation */
void void
@ -72,12 +104,11 @@ nsSVGClass::SetAnimValue(const nsAString& aValue, nsSVGElement *aSVGElement)
aSVGElement->DidAnimateClass(); aSVGElement->DidAnimateClass();
} }
NS_IMETHODIMP void
nsSVGClass::DOMAnimatedString::GetAnimVal(nsAString& aResult) DOMAnimatedString::GetAnimVal(nsAString& aResult)
{ {
mSVGElement->FlushAnimations(); mSVGElement->FlushAnimations();
mVal->GetAnimValue(aResult, mSVGElement); mVal->GetAnimValue(aResult, mSVGElement);
return NS_OK;
} }
nsISMILAttr* nsISMILAttr*

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

@ -9,13 +9,18 @@
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
#include "nsError.h" #include "nsError.h"
#include "nsIDOMSVGAnimatedString.h"
#include "nsISMILAttr.h" #include "nsISMILAttr.h"
#include "nsString.h" #include "nsString.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
class nsSVGElement; class nsSVGElement;
namespace mozilla {
namespace dom {
class SVGAnimatedString;
}
}
class nsSVGClass class nsSVGClass
{ {
@ -34,18 +39,8 @@ public:
bool IsAnimated() const bool IsAnimated() const
{ return !!mAnimVal; } { return !!mAnimVal; }
already_AddRefed<nsIDOMSVGAnimatedString> already_AddRefed<mozilla::dom::SVGAnimatedString>
ToDOMAnimatedString(nsSVGElement* aSVGElement) ToDOMAnimatedString(nsSVGElement* aSVGElement);
{
nsRefPtr<DOMAnimatedString> result = new DOMAnimatedString(this, aSVGElement);
return result.forget();
}
nsresult ToDOMAnimatedString(nsIDOMSVGAnimatedString **aResult,
nsSVGElement *aSVGElement)
{
*aResult = ToDOMAnimatedString(aSVGElement).get();
return NS_OK;
}
// Returns a new nsISMILAttr object that the caller must delete // Returns a new nsISMILAttr object that the caller must delete
nsISMILAttr* ToSMILAttr(nsSVGElement *aSVGElement); nsISMILAttr* ToSMILAttr(nsSVGElement *aSVGElement);
@ -55,24 +50,6 @@ private:
nsAutoPtr<nsString> mAnimVal; nsAutoPtr<nsString> mAnimVal;
public: public:
struct DOMAnimatedString MOZ_FINAL : public nsIDOMSVGAnimatedString
{
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedString)
DOMAnimatedString(nsSVGClass *aVal, nsSVGElement *aSVGElement)
: mVal(aVal), mSVGElement(aSVGElement) {}
nsSVGClass* mVal; // kept alive because it belongs to content
nsRefPtr<nsSVGElement> mSVGElement;
NS_IMETHOD GetBaseVal(nsAString& aResult) MOZ_OVERRIDE
{ mVal->GetBaseValue(aResult, mSVGElement); return NS_OK; }
NS_IMETHOD SetBaseVal(const nsAString& aValue) MOZ_OVERRIDE
{ mVal->SetBaseValue(aValue, mSVGElement, true); return NS_OK; }
NS_IMETHOD GetAnimVal(nsAString& aResult) MOZ_OVERRIDE;
};
struct SMILString : public nsISMILAttr struct SMILString : public nsISMILAttr
{ {
public: public:

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше