--HG--
rename : content/svg/content/src/nsSVGFilters.cpp => content/svg/content/src/SVGFEColorMatrixElement.cpp
rename : content/svg/content/src/nsSVGFilters.cpp => content/svg/content/src/SVGFEColorMatrixElement.h
rename : content/svg/content/src/nsSVGFilters.cpp => content/svg/content/src/SVGFECompositeElement.cpp
rename : content/svg/content/src/nsSVGFilters.cpp => content/svg/content/src/SVGFECompositeElement.h
This commit is contained in:
Jan de Mooij 2013-03-20 12:54:47 +01:00
Родитель bb861fb262 bad9d055b1
Коммит b72b9048cd
431 изменённых файлов: 8041 добавлений и 3697 удалений

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

@ -15,4 +15,8 @@
#
# Note: The description below will be part of the error message shown to users.
#
Bug 851920 - Resources removed from the pre-processing chain are still dependant on MOZ_PROFILING/MOZ_TELEMETRY*
# *** Important! ***
# If changing this file you must manually clobber immediately before landing,
# (due to bug 837323), using: https://secure.pub.build.mozilla.org/clobberer/
#
Bug 851908 - The WebIDL build system still has some problems.

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

@ -128,9 +128,9 @@ gboolean fireRootAccessibleAddedCB(gpointer data)
}
bool
ApplicationAccessibleWrap::AppendChild(Accessible* aChild)
ApplicationAccessibleWrap::InsertChildAt(uint32_t aIdx, Accessible* aChild)
{
if (!ApplicationAccessible::AppendChild(aChild))
if (!ApplicationAccessible::InsertChildAt(aIdx, aChild))
return false;
AtkObject* atkAccessible = AccessibleWrap::GetAtkObject(aChild);

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

@ -20,7 +20,7 @@ public:
// Accessible
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
virtual bool AppendChild(Accessible* aChild);
virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) MOZ_OVERRIDE;
virtual bool RemoveChild(Accessible* aChild);
/**

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

@ -369,7 +369,8 @@ DocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
{
// Ignore temporary, hiding, resource documents and documents without
// docshell.
if (aDocument->IsInitialDocument() || !aDocument->IsVisible() ||
if (aDocument->IsInitialDocument() ||
!aDocument->IsVisibleConsideringAncestors() ||
aDocument->IsResourceDoc() || !aDocument->IsActive())
return nullptr;

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

@ -166,6 +166,7 @@ LogDocState(nsIDocument* aDocumentNode)
printf(", %sinitial", aDocumentNode->IsInitialDocument() ? "" : "not ");
printf(", %sshowing", aDocumentNode->IsShowing() ? "" : "not ");
printf(", %svisible", aDocumentNode->IsVisible() ? "" : "not ");
printf(", %svisible considering ancestors", aDocumentNode->IsVisibleConsideringAncestors() ? "" : "not ");
printf(", %sactive", aDocumentNode->IsActive() ? "" : "not ");
printf(", %sresource", aDocumentNode->IsResourceDoc() ? "" : "not ");
printf(", has %srole content",

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

@ -2639,41 +2639,31 @@ Accessible::InvalidateChildren()
SetChildrenFlag(eChildrenUninitialized);
}
bool
Accessible::AppendChild(Accessible* aChild)
{
if (!aChild)
return false;
if (!mChildren.AppendElement(aChild))
return false;
if (!nsAccUtils::IsEmbeddedObject(aChild))
SetChildrenFlag(eMixedChildren);
aChild->BindToParent(this, mChildren.Length() - 1);
return true;
}
bool
Accessible::InsertChildAt(uint32_t aIndex, Accessible* aChild)
{
if (!aChild)
return false;
if (!mChildren.InsertElementAt(aIndex, aChild))
return false;
if (aIndex == mChildren.Length()) {
if (!mChildren.AppendElement(aChild))
return false;
for (uint32_t idx = aIndex + 1; idx < mChildren.Length(); idx++) {
NS_ASSERTION(mChildren[idx]->mIndexInParent == idx - 1, "Accessible child index doesn't match");
mChildren[idx]->mIndexInParent = idx;
} else {
if (!mChildren.InsertElementAt(aIndex, aChild))
return false;
for (uint32_t idx = aIndex + 1; idx < mChildren.Length(); idx++) {
NS_ASSERTION(mChildren[idx]->mIndexInParent == idx - 1, "Accessible child index doesn't match");
mChildren[idx]->mIndexInParent = idx;
}
mEmbeddedObjCollector = nullptr;
}
if (!nsAccUtils::IsEmbeddedObject(aChild))
SetChildrenFlag(eMixedChildren);
mEmbeddedObjCollector = nullptr;
aChild->BindToParent(this, aIndex);
return true;
}

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

@ -333,7 +333,8 @@ public:
/**
* Append/insert/remove a child. Return true if operation was successful.
*/
virtual bool AppendChild(Accessible* aChild);
bool AppendChild(Accessible* aChild)
{ return InsertChildAt(mChildren.Length(), aChild); }
virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild);
virtual bool RemoveChild(Accessible* aChild);

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

@ -43,13 +43,6 @@ LeafAccessible::ChildAtPoint(int32_t aX, int32_t aY,
return this;
}
bool
LeafAccessible::AppendChild(Accessible* aChild)
{
NS_NOTREACHED("AppendChild called on leaf accessible!");
return false;
}
bool
LeafAccessible::InsertChildAt(uint32_t aIndex, Accessible* aChild)
{

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

@ -34,8 +34,6 @@ public:
// Accessible
virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
EWhichChildAtPoint aWhichChild);
virtual bool AppendChild(Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL;
virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL;
virtual bool RemoveChild(Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL;

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

@ -149,8 +149,10 @@ OuterDocAccessible::InvalidateChildren()
}
bool
OuterDocAccessible::AppendChild(Accessible* aAccessible)
OuterDocAccessible::InsertChildAt(uint32_t aIdx, Accessible* aAccessible)
{
NS_ASSERTION(aAccessible->IsDoc(),
"OuterDocAccessible should only have document child!");
// We keep showing the old document for a bit after creating the new one,
// and while building the new DOM and frame tree. That's done on purpose
// to avoid weird flashes of default background color.
@ -159,7 +161,7 @@ OuterDocAccessible::AppendChild(Accessible* aAccessible)
if (mChildren.Length())
mChildren[0]->Shutdown();
if (!AccessibleWrap::AppendChild(aAccessible))
if (!AccessibleWrap::InsertChildAt(0, aAccessible))
return false;
#ifdef A11Y_LOG

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

@ -42,7 +42,7 @@ public:
EWhichChildAtPoint aWhichChild);
virtual void InvalidateChildren();
virtual bool AppendChild(Accessible* aAccessible);
virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) MOZ_OVERRIDE;
virtual bool RemoveChild(Accessible* aAccessible);
// ActionAccessible

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

@ -49,7 +49,7 @@ public: // construction, destruction
virtual void Shutdown ();
virtual void InvalidateChildren();
virtual bool AppendChild(Accessible* aAccessible);
virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) MOZ_OVERRIDE;
virtual bool RemoveChild(Accessible* aAccessible);
virtual nsresult HandleAccEvent(AccEvent* aEvent);

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

@ -198,14 +198,13 @@ AccessibleWrap::InvalidateChildren()
}
bool
AccessibleWrap::AppendChild(Accessible* aAccessible)
AccessibleWrap::InsertChildAt(uint32_t aIdx, Accessible* aAccessible)
{
bool appended = Accessible::AppendChild(aAccessible);
if (appended && mNativeObject)
bool inserted = Accessible::InsertChildAt(aIdx, aAccessible);
if (inserted && mNativeObject)
[mNativeObject appendChild:aAccessible];
return appended;
return inserted;
}
bool

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

@ -19,11 +19,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
src="editabletext.js"></script>
<script type="application/javascript">
if (navigator.platform.startsWith("Mac")) {
SimpleTest.expectAssertions(0, 1);
} else {
SimpleTest.expectAssertions(1);
}
function addTestEditable(aID, aTestRun, aTrailChar)
{

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

@ -24,9 +24,6 @@
<script type="application/javascript">
<![CDATA[
if (navigator.platform.startsWith("Linux")) {
SimpleTest.expectAssertions(1);
}
////////////////////////////////////////////////////////////////////////////
// Helpers

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

@ -22,10 +22,6 @@
<script type="application/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(1, 2);
} else if (navigator.platform.startsWith("Linux")) {
SimpleTest.expectAssertions(1);
} else if (navigator.platform.startsWith("Mac")) {
SimpleTest.expectAssertions(0, 1);
}

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

@ -507,6 +507,8 @@ function isContentEditable(element) {
function getJSON(element) {
let type = element.type || "";
let value = element.value || "";
let max = element.max || "";
let min = element.min || "";
// Treat contenteditble element as a special text area field
if (isContentEditable(element)) {
@ -550,7 +552,9 @@ function getJSON(element) {
"value": value,
"inputmode": inputmode,
"selectionStart": range[0],
"selectionEnd": range[1]
"selectionEnd": range[1],
"max": max,
"min": min
};
}

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

@ -113,7 +113,9 @@
@BINPATH@/application.ini
@BINPATH@/platform.ini
#ifndef XP_OS2
#ifndef MOZ_FOLD_LIBS
@BINPATH@/@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
#endif
#else
@BINPATH@/mozsqlt3@DLL_SUFFIX@
#endif

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

@ -10,4 +10,13 @@ run-mozilla.sh
#endif
defaults/preferences/services-sync.js
defaults/preferences/healthreport-prefs.js
components/dom_sms.xpt
components/dom_sms.xpt
#ifdef MOZ_FOLD_LIBS
@DLL_PREFIX@nspr4@DLL_SUFFIX@
@DLL_PREFIX@plds4@DLL_SUFFIX@
@DLL_PREFIX@plc4@DLL_SUFFIX@
@DLL_PREFIX@ssl3@DLL_SUFFIX@
@DLL_PREFIX@smime3@DLL_SUFFIX@
@DLL_PREFIX@nssutil3@DLL_SUFFIX@
@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
#endif

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

@ -3924,7 +3924,7 @@
// Call updateCurrentBrowser to make sure the URL bar is up to date
// for our new tab after we've done swapBrowsersAndCloseOther.
this.updateCurrentBrowser(true);
this.tabbrowser.updateCurrentBrowser(true);
} else {
// Pass true to disallow dropping javascript: or data: urls
let url;

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

@ -152,6 +152,7 @@ _BROWSER_FILES = \
browser_bug749738.js \
browser_bug763468_perwindowpb.js \
browser_bug767836_perwindowpb.js \
browser_bug771331.js \
browser_bug783614.js \
browser_bug797677.js \
browser_bug816527.js \

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

@ -0,0 +1,82 @@
const HTML_NS = "http://www.w3.org/1999/xhtml";
const INPUT_ID = "input1";
const FORM1_ID = "form1";
const FORM2_ID = "form2";
const CHANGE_INPUT_ID = "input2";
function test() {
waitForExplicitFinish();
let tab = gBrowser.selectedTab =
gBrowser.addTab("data:text/html;charset=utf-8," +
"<html><body>" +
"<form id='" + FORM1_ID + "'><input id='" + CHANGE_INPUT_ID + "'></form>" +
"<form id='" + FORM2_ID + "'></form>" +
"</body></html>");
tab.linkedBrowser.addEventListener("load", tabLoad, true);
}
function unexpectedContentEvent(evt) {
ok(false, "Received a " + evt.type + " event on content");
}
var gDoc = null;
function tabLoad() {
let tab = gBrowser.selectedTab;
tab.linkedBrowser.removeEventListener("load", tabLoad, true);
gDoc = gBrowser.selectedBrowser.contentDocument;
// These events shouldn't escape to content.
gDoc.addEventListener("DOMFormHasPassword", unexpectedContentEvent, false);
gDoc.defaultView.setTimeout(test_inputAdd, 0);
}
function test_inputAdd() {
gBrowser.addEventListener("DOMFormHasPassword", test_inputAddHandler, false);
let input = gDoc.createElementNS(HTML_NS, "input");
input.setAttribute("type", "password");
input.setAttribute("id", INPUT_ID);
input.setAttribute("data-test", "unique-attribute");
gDoc.getElementById(FORM1_ID).appendChild(input);
info("Done appending the input element");
}
function test_inputAddHandler(evt) {
gBrowser.removeEventListener(evt.type, test_inputAddHandler, false);
is(evt.target.id, FORM1_ID,
evt.type + " event targets correct form element (added password element)");
gDoc.defaultView.setTimeout(test_inputChangeForm, 0);
}
function test_inputChangeForm() {
gBrowser.addEventListener("DOMFormHasPassword", test_inputChangeFormHandler, false);
let input = gDoc.getElementById(INPUT_ID);
input.setAttribute("form", FORM2_ID);
}
function test_inputChangeFormHandler(evt) {
gBrowser.removeEventListener(evt.type, test_inputChangeFormHandler, false);
is(evt.target.id, FORM2_ID,
evt.type + " event targets correct form element (changed form)");
gDoc.defaultView.setTimeout(test_inputChangesType, 0);
}
function test_inputChangesType() {
gBrowser.addEventListener("DOMFormHasPassword", test_inputChangesTypeHandler, false);
let input = gDoc.getElementById(CHANGE_INPUT_ID);
input.setAttribute("type", "password");
}
function test_inputChangesTypeHandler(evt) {
gBrowser.removeEventListener(evt.type, test_inputChangesTypeHandler, false);
is(evt.target.id, FORM1_ID,
evt.type + " event targets correct form element (changed type)");
gDoc.defaultView.setTimeout(completeTest, 0);
}
function completeTest() {
ok(true, "Test completed");
gDoc.removeEventListener("DOMFormHasPassword", unexpectedContentEvent, false);
gBrowser.removeCurrentTab();
finish();
}

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

@ -9,6 +9,8 @@ ac_add_options --enable-codesighs
ac_add_options --disable-install-strip
ac_add_options --enable-signmar
ac_add_options --enable-profiling
ac_add_options --enable-instruments
ac_add_options --enable-dtrace
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics

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

@ -149,7 +149,7 @@ let profilerDefinition = {
accesskey: l10n("profiler.accesskey", profilerStrings),
key: l10n("profiler.commandkey", profilerStrings),
ordinal: 4,
modifiers: osString == "Darwin" ? "accel,alt" : "accel,shift",
modifiers: "shift",
killswitch: "devtools.profiler.enabled",
url: "chrome://browser/content/profiler.xul",
label: l10n("profiler.label", profilerStrings),

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

@ -7,8 +7,8 @@ function test()
requestLongerTimeout(2);
let inspector, searchBox, state, panel;
let panelOpeningStates = [0, 3, 14, 17];
let panelClosingStates = [2, 13, 16];
let panelOpeningStates = [0, 3, 9, 14, 17];
let panelClosingStates = [2, 8, 13, 16];
// The various states of the inspector: [key, query]
// [

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

@ -54,7 +54,7 @@ function onStart() {
let [win, doc] = getProfileInternals();
let stopButton = doc.querySelector(".controlPane #stopWrapper button");
stopButton.click();
setTimeout(function () stopButton.click(), 100);
});
}
@ -75,11 +75,7 @@ function onParsed() {
}
ok(sample.length > 0, "We have some items displayed");
if (navigator.platform.contains("Win")) {
todo(false, "First percentage is 100%: Disabled on Windows for intermittent failures, see bug 822287.");
} else {
is(sample[0].innerHTML, "100.0%", "First percentage is 100%");
}
is(sample[0].innerHTML, "100.0%", "First percentage is 100%");
attemptTearDown();
}

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

@ -17,6 +17,15 @@
#ifdef MOZ_STATIC_JS
@DLL_PREFIX@mozjs@DLL_SUFFIX@
#endif
#ifdef MOZ_FOLD_LIBS
@DLL_PREFIX@nspr4@DLL_SUFFIX@
@DLL_PREFIX@plds4@DLL_SUFFIX@
@DLL_PREFIX@plc4@DLL_SUFFIX@
@DLL_PREFIX@ssl3@DLL_SUFFIX@
@DLL_PREFIX@smime3@DLL_SUFFIX@
@DLL_PREFIX@nssutil3@DLL_SUFFIX@
@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
#endif
LICENSE
browserconfig.properties
chrome/US.jar

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

@ -390,8 +390,6 @@ social.turnOn.accesskey=T
social.error.message=%1$S is unable to connect with %2$S right now.
social.error.tryAgain.label=Try Again
social.error.tryAgain.accesskey=T
social.error.ok.label=OK
social.error.ok.accesskey=O
social.error.closeSidebar.label=Close This Sidebar
social.error.closeSidebar.accesskey=C

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

@ -17,7 +17,7 @@ profiler.label=Profiler
# LOCALIZATION NOTE (profiler.commandkey, profiler.accesskey)
# Used for the menuitem in the tool menu
profiler.commandkey=Y
profiler.commandkey=VK_F5
profiler.accesskey=P
# LOCALIZATION NOTE (profiler.tooltip):
@ -81,4 +81,4 @@ profiler.loading=Loading profile…
# LOCALIZATION NOTE (profiler.alreadyRunning)
# This string is displayed in the profiler whenever there is already
# another running profile. Users can run only one profile at a time.
profiler.alreadyRunning=Profiler is already running. If you want to run this profile stop Profile %S first.
profiler.alreadyRunning=Profiler is already running. If you want to run this profile stop Profile %S first.

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

@ -32,12 +32,12 @@
// as richgrid is adopting multi-select behavior, but select/selected are already being
// used to describe triggering the default action of a tile
if (this._selectedItem){
this._selectedItem.selected = false;
this._selectedItem.removeAttribute("selected");
this._selectedItem = null;
}
for (let childItem of this.selectedItems) {
childItem.selected = false;
childItem.removeAttribute("selected");
}
// reset context actions
this._contextActions = null;
@ -53,8 +53,12 @@
if ("single" == this.getAttribute("seltype")) {
this.clearSelection();
}
anItem.selected = !wasSelected;
this._selectedItem = wasSelected ? null : anItem;
if(anItem.selected) {
anItem.removeAttribute("selected");
} else {
anItem.setAttribute("selected", true);
}
this._fireOnSelectionChange();
]]>
</body>
@ -506,16 +510,10 @@
onset="this._backgroundimage = val; this.setBackgroundImage();"
onget="return this._backgroundimage;" />
<property name="selected"
onget="return this.getAttribute('selected') == 'true';"
onset="this.setAttribute('selected', val);"/>
onget="return this.getAttribute('selected') == 'true';" />
<constructor>
<![CDATA[
// Bindings don't get bound until the item is displayed,
// so we have to reset the background color/image when we get
// created.
this.setColor();
this.setBackgroundImage();
]]>
</constructor>
@ -534,7 +532,7 @@
<method name="setColor">
<body>
<![CDATA[
if (this.color != undefined) {
if (this._color != undefined) {
this._box.parentNode.setAttribute("customColorPresent", "true");
this._box.style.backgroundColor = this.color;
} else {
@ -547,7 +545,7 @@
<method name="setBackgroundImage">
<body>
<![CDATA[
if (this.backgroundImage != undefined) {
if (this._backgroundImage != undefined) {
this._box.parentNode.setAttribute("customImagePresent", "true");
this._box.style.backgroundImage = this.backgroundImage;
} else {

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

@ -225,6 +225,9 @@ BookmarksView.prototype = {
aItem.color = color;
return;
}
if (!aIconUri) {
return;
}
let url = Services.io.newURI(aIconUri.spec.replace("moz-anno:favicon:",""), "", null)
let ca = Components.classes["@mozilla.org/places/colorAnalyzer;1"]
.getService(Components.interfaces.mozIColorAnalyzer);

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

@ -118,7 +118,6 @@ let ScriptContexts = {};
["TopSitesView", "chrome://browser/content/TopSites.js"],
["TopSitesSnappedView", "chrome://browser/content/TopSites.js"],
["TopSitesStartView", "chrome://browser/content/TopSites.js"],
["InputSourceHelper", "chrome://browser/content/input.js"],
["Sanitizer", "chrome://browser/content/sanitize.js"],
["SSLExceptions", "chrome://browser/content/exceptions.js"],
#ifdef MOZ_SERVICES_SYNC

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

@ -591,8 +591,16 @@ var BrowserUI = {
_updateButtons: function _updateButtons() {
let browser = Browser.selectedBrowser;
this._back.setAttribute("disabled", !browser.canGoBack);
this._forward.setAttribute("disabled", !browser.canGoForward);
if (browser.canGoBack) {
this._back.removeAttribute("disabled");
} else {
this._back.setAttribute("disabled", true);
}
if (browser.canGoForward) {
this._forward.removeAttribute("disabled");
} else {
this._forward.setAttribute("disabled", true);
}
},
_updateToolbar: function _updateToolbar() {
@ -1601,7 +1609,7 @@ var DialogUI = {
let currentNode;
let nodeIterator = xhr.responseXML.createNodeIterator(xhr.responseXML, NodeFilter.SHOW_TEXT, null, false);
while (currentNode = nodeIterator.nextNode()) {
while (!!(currentNode = nodeIterator.nextNode())) {
let trimmed = currentNode.nodeValue.replace(/^\s\s*/, "").replace(/\s\s*$/, "");
if (!trimmed.length)
currentNode.parentNode.removeChild(currentNode);

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

@ -101,7 +101,11 @@ var MasterPasswordUI = {
let buttonOk = this._dialog.getElementsByAttribute("class", "prompt-buttons")[0].firstChild;
let isPasswordValid = this._secModuleDB.isFIPSEnabled ? (newPasswordValue1 != "" && newPasswordValue1 == newPasswordValue2)
: (newPasswordValue1 == newPasswordValue2);
buttonOk.setAttribute("disabled", !isPasswordValid);
if (isPasswordValid) {
buttonOk.removeAttribute("disabled");
} else {
buttonOk.setAttribute("disabled", true);
}
return isPasswordValid;
},

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

@ -1154,20 +1154,8 @@ var GestureModule = {
* versus an imprecise one (touch).
*/
var InputSourceHelper = {
_isPrecise: false,
_treatMouseAsTouch: false,
get isPrecise() {
return this._isPrecise;
},
get treatMouseAsTouch() {
return this._treatMouseAsTouch;
},
set treatMouseAsTouch(aVal) {
this._treatMouseAsTouch = aVal;
},
isPrecise: false,
treatMouseAsTouch: false,
init: function ish_init() {
// debug feature, make all input imprecise
@ -1186,15 +1174,15 @@ var InputSourceHelper = {
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_PEN:
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_ERASER:
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_CURSOR:
if (!this._isPrecise && !this.treatMouseAsTouch) {
this._isPrecise = true;
if (!this.isPrecise && !this.treatMouseAsTouch) {
this.isPrecise = true;
this._fire("MozPrecisePointer");
}
break;
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH:
if (this._isPrecise) {
this._isPrecise = false;
if (this.isPrecise) {
this.isPrecise = false;
this._fire("MozImprecisePointer");
}
break;
@ -1205,7 +1193,7 @@ var InputSourceHelper = {
if (this.treatMouseAsTouch) {
this._fire("MozImprecisePointer");
} else {
if (this._isPrecise) {
if (this.isPrecise) {
this._fire("MozPrecisePointer");
} else {
this._fire("MozImprecisePointer");

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

@ -43,7 +43,7 @@
/* in non-tabsonly mode the navigation bar and tab tray float over content. In
tabsonly mode they are always visible and offset content. */
#tray:not([tabsonly=true]) {
#tray:not([tabsonly]) {
position: fixed;
}
@ -96,7 +96,7 @@
#tabs > .tabs-scrollbox > .scrollbutton-up:active {
-moz-image-region: rect(14px 152px 62px 108px) !important;
}
#tabs > .tabs-scrollbox > .scrollbutton-up[disabled="true"] {
#tabs > .tabs-scrollbox > .scrollbutton-up[disabled] {
-moz-image-region: rect(15px 196px 63px 152px) !important;
}
@ -110,7 +110,7 @@
#tabs > .tabs-scrollbox > .scrollbutton-down:active {
-moz-image-region: rect(72px 152px 120px 108px) !important;
}
#tabs > .tabs-scrollbox > .scrollbutton-down[disabled="true"] {
#tabs > .tabs-scrollbox > .scrollbutton-down[disabled] {
-moz-image-region: rect(73px 196px 121px 152px) !important;
}
@ -127,13 +127,13 @@
}
}
#tray:not([tabsonly=true]) documenttab > .documenttab-container {
#tray:not([tabsonly]) documenttab > .documenttab-container {
animation: open-documenttab;
animation-duration: 0.4s;
animation-timing-function: ease-out;
}
#tray:not([tabsonly=true]) .documenttab-favicon {
#tray:not([tabsonly]) .documenttab-favicon {
visibility: collapse;
}
@ -166,7 +166,7 @@
background: transparent -moz-image-rect(url("chrome://browser/skin/images/tab-overlay.png"), 0%, 100%, 50%, 0%) 50% 50% no-repeat;
}
documenttab[selected=true] .documenttab-selection {
documenttab[selected] .documenttab-selection {
background: transparent -moz-image-rect(url("chrome://browser/skin/images/tab-overlay.png"), 50%, 100%, 100%, 0%) 50% 50% no-repeat;
}
@ -183,58 +183,58 @@ documenttab[selected=true] .documenttab-selection {
display: none;
}
#tray[tabsonly=true] {
#tray[tabsonly] {
transform: none !important;
}
#tray[tabsonly=true] #tabs {
#tray[tabsonly] #tabs {
-moz-padding-start: @metro_spacing_small@;
}
#tray[tabsonly=true] #tabs-controls {
#tray[tabsonly] #tabs-controls {
-moz-box-align: center;
-moz-box-orient: horizontal;
-moz-box-pack: end;
margin: 0;
}
#tray[tabsonly=true] #tabs-controls toolbarbutton {
#tray[tabsonly] #tabs-controls toolbarbutton {
margin-top: 0;
margin-bottom: 0;
}
#tray[tabsonly=true] documenttab {
#tray[tabsonly] documenttab {
height: @toolbar_height@;
margin: 0 -@tab_compression@;
}
#tray[tabsonly=true] documenttab:first-child {
#tray[tabsonly] documenttab:first-child {
-moz-margin-start: 0;
}
#tray[tabsonly=true] documenttab:last-child {
#tray[tabsonly] documenttab:last-child {
-moz-margin-end: 0;
}
#tray[tabsonly=true] .documenttab-thumbnail,
#tray[tabsonly=true] .documenttab-selection,
#tray[tabsonly=true] .documenttab-crop {
#tray[tabsonly] .documenttab-thumbnail,
#tray[tabsonly] .documenttab-selection,
#tray[tabsonly] .documenttab-crop {
visibility: collapse;
}
#tray[tabsonly=true] .documenttab-container {
#tray[tabsonly] .documenttab-container {
display: -moz-box;
-moz-box-orient: horizontal;
-moz-box-align: center;
padding: 0 @tab_spacing@;
}
#tray[tabsonly=true] .documenttab-favicon {
#tray[tabsonly] .documenttab-favicon {
-moz-margin-start: @metro_spacing_normal@;
-moz-margin-end: @metro_spacing_snormal@;
}
#tray[tabsonly=true] .documenttab-title {
#tray[tabsonly] .documenttab-title {
padding: 0;
margin: 0;
height: auto;
@ -244,14 +244,14 @@ documenttab[selected=true] .documenttab-selection {
width: @tab_inner_width@;
}
#tray[tabsonly=true] .documenttab-close {
#tray[tabsonly] .documenttab-close {
list-style-image: url("chrome://browser/skin/images/closetab-tab.png");
position: relative;
padding: 0 !important;
z-index: 1;
}
#tray[tabsonly=true] documenttab[selected=true] {
#tray[tabsonly] documenttab[selected=true] {
background-color: @panel_light_color@;
background-image: url("chrome://browser/skin/images/tab-selection-left.png"),
url("chrome://browser/skin/images/tab-selection-right.png"),
@ -260,7 +260,7 @@ documenttab[selected=true] .documenttab-selection {
background-repeat: no-repeat, no-repeat, repeat;
}
#tray[tabsonly=true] documenttab[selected=true] .documenttab-close {
#tray[tabsonly] documenttab[selected=true] .documenttab-close {
list-style-image: url("chrome://browser/skin/images/closetab-tabselected.png");
}
@ -277,7 +277,7 @@ documenttab[selected=true] .documenttab-selection {
display: none;
}
#tray[tabsonly=true] documenttab[selected=true] .documenttab-title {
#tray[tabsonly] documenttab[selected=true] .documenttab-title {
color: #000;
}
@ -356,7 +356,7 @@ documenttab[selected=true] .documenttab-selection {
max-height: 48px !important;
}
#back-button[disabled="true"] {
#back-button[disabled] {
-moz-image-region: rect(0 96px 48px 48px);
}
@ -377,7 +377,7 @@ documenttab[selected=true] .documenttab-selection {
margin: -1px 0 1px 0 !important;
}
#unified-back-forward-button > #forward-button[disabled="true"] {
#unified-back-forward-button > #forward-button[disabled] {
opacity: 0;
}
@ -402,12 +402,12 @@ documenttab[selected=true] .documenttab-selection {
transition: margin-left @forward_transition_length@ ease-out;
}
#unified-back-forward-button[forwarddisabled="true"] + #urlbar-container {
#unified-back-forward-button[forwarddisabled] + #urlbar-container {
clip-path: url("chrome://browser/content/browser.xul#back-button-clip-path");
padding-left: @clipped_url_back_width@;
}
#unified-back-forward-button[forwarddisabled="true"] + #urlbar-container > #urlbar {
#unified-back-forward-button[forwarddisabled] + #urlbar-container > #urlbar {
margin-left: -@forward_width@;
}
@ -481,18 +481,18 @@ documenttab[selected=true] .documenttab-selection {
/* Hide the tab toggle if we're showing classic tabs or we're snap-viewed. */
#toolbar[viewstate="snapped"],
#tray[tabsonly=true] #toolbar {
#tray[tabsonly] #toolbar {
background: @panel_light_color@ @panel_light_background@;
-moz-padding-end: 0;
}
#toolbar-container[viewstate="snapped"],
#tray[tabsonly=true] #toolbar-container {
#tray[tabsonly] #toolbar-container {
-moz-padding-end: 0;
}
#toolbar-transition[viewstate="snapped"],
#tray[tabsonly=true] #toolbar-transition {
#tray[tabsonly] #toolbar-transition {
visibility: collapse;
}
@ -540,7 +540,7 @@ appbar toolbarbutton {
background-color: transparent;
}
appbar toolbarbutton[disabled="true"] {
appbar toolbarbutton[disabled] {
visibility: collapse;
}
@ -610,7 +610,7 @@ appbar toolbarbutton[disabled="true"] {
#pin-button:active {
-moz-image-region: rect(80px, 240px, 120px, 200px) !important;
}
#pin-button[checked="true"] {
#pin-button[checked] {
-moz-image-region: rect(0px, 280px, 40px, 240px) !important;
}
@ -621,7 +621,7 @@ appbar toolbarbutton[disabled="true"] {
-moz-image-region: rect(40px, 360px, 80px, 320px) !important;
}
#star-button:active,
#star-button[checked="true"] {
#star-button[checked] {
-moz-image-region: rect(80px, 360px, 120px, 320px) !important;
}
@ -793,7 +793,7 @@ setting[type="directory"] > .preferences-alignment {
-moz-box-pack: center;
}
#panel-close-button[disabled="true"] {
#panel-close-button[disabled] {
-moz-image-region: rect(0 96px 48px 48px);
}
@ -833,7 +833,7 @@ setting[type="directory"] > .preferences-alignment {
/* Context Menu ------------------------------------------------------------ */
#context-commands richlistitem[disabled="true"] {
#context-commands richlistitem[disabled] {
display: none;
}
@ -916,7 +916,7 @@ setting[type="directory"] > .preferences-alignment {
border: @border_width_tiny@ solid rgba(255, 255, 255, 0.4) !important;
}
.scroller[panning="true"] {
.scroller[panning] {
opacity: 1;
}

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

@ -58,7 +58,7 @@ xul|window xul|scrollbar[orient="horizontal"] xul|thumb {
min-height: 6px !important;
}
xul|window xul|*[panning="true"] xul|scrollbar {
xul|window xul|*[panning] xul|scrollbar {
opacity: 1;
}
@ -218,7 +218,7 @@ select[size="1"][disabled] {
input[type="button"][disabled],
input[type="submit"][disabled],
input[type="reset"][disabled],
button[disabled="true"] {
button[disabled] {
padding: 0 7px 0 7px;
background: transparent -moz-linear-gradient(top, rgba(255,255,255,0.4) 0, rgba(235,235,235,0.4) 3px, rgba(185,185,185,0.4) 100%);
}

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

@ -14,7 +14,7 @@
}
#content-navigator[type="find"],
#content-navigator[type="form"]:not([disabled="true"]) {
#content-navigator[type="form"]:not([disabled]) {
display: -moz-box;
}
@ -175,7 +175,7 @@
/* force the autorepeat buttons to create a 'padding' when collapsed */
#form-helper-suggestions > autorepeatbutton[collapsed="true"],
#form-helper-suggestions > autorepeatbutton[disabled="true"] {
#form-helper-suggestions > autorepeatbutton[disabled] {
visibility: hidden;
}

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

@ -38,8 +38,8 @@ menulist {
border-radius: 0;
}
textbox[disabled="true"],
menulist[disabled="true"] {
textbox[disabled],
menulist[disabled] {
border-color: @field_disabled_foreground_color@ !important;
color: @field_disabled_foreground_color@;
}
@ -171,7 +171,7 @@ menulist {
transform: translateY(-@metro_spacing_normal@);
}
.menu-container[showing="true"] {
.menu-container[showing] {
opacity: 1;
transform: none;
transition: all ease-out 0.2s;
@ -352,28 +352,28 @@ richlistitem description.normal-bold {
font-weight: bold;
}
richlistitem[selected="true"] {
richlistitem[selected] {
color: black;
background-color: white;
}
richlistitem:hover:active:not([selected="true"]):not([nohighlight="true"]) {
richlistitem:hover:active:not([selected]) {
background-color: #8db8d8;
}
richlistitem.section-header,
richlistitem[selected="true"].section-header {
richlistitem[selected].section-header {
font-weight: bold;
color: #000;
background-color: lightgray;
}
richlistitem[selected="true"] .hide-on-select,
richlistitem[selected] .hide-on-select,
richlistitem .show-on-select {
visibility: collapse;
}
richlistitem[selected="true"] .show-on-select,
richlistitem[selected] .show-on-select,
richlistitem .hide-on-select {
visibility: visible;
}
@ -469,7 +469,7 @@ richgriditem .richgrid-item-content {
background: #fff;
}
richgriditem[selected="true"] .richgrid-item-content {
richgriditem[selected] .richgrid-item-content {
border: @metro_border_xthick@ solid @selected_color@;
padding: @metro_spacing_xxsmall@;
}
@ -485,7 +485,7 @@ richgriditem .richgrid-icon-box {
}
richgriditem[customColorPresent="true"] {
richgriditem[customColorPresent] {
color: #f1f1f1;
}
richgriditem[customImagePresent] {
@ -493,7 +493,7 @@ richgriditem[customImagePresent] {
}
richgriditem[customColorPresent="true"] .richgrid-icon-box {
richgriditem[customColorPresent] .richgrid-icon-box {
opacity: 0.8;
background-color: #fff;
}

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

@ -3317,7 +3317,16 @@ private void CancelNotification()
try
{
pProc = Runtime.getRuntime().exec(this.getSuArgs("pm install -r " + sApp + " Cleanup;exit"));
// on android 4.2 and above, we want to pass the "-d" argument to pm so that version
// downgrades are allowed... (option unsupported in earlier versions)
String sPmCmd;
if (android.os.Build.VERSION.SDK_INT >= 17) { // JELLY_BEAN_MR1
sPmCmd = "pm install -r -d " + sApp + " Cleanup;exit";
} else {
sPmCmd = "pm install -r " + sApp + " Cleanup;exit";
}
pProc = Runtime.getRuntime().exec(this.getSuArgs(sPmCmd));
RedirOutputThread outThrd3 = new RedirOutputThread(pProc, out);
outThrd3.start();
try {

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

@ -67,7 +67,7 @@
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_ZN3xpc18CreateGlobalObjectEP9JSContextP7JSClassP12nsIPrincipal
fun:_ZN3xpc18CreateGlobalObjectEP9JSContextP7JSClassP12nsIPrincipalm
...
}
{
@ -202,6 +202,14 @@
fun:_ZN22nsComponentManagerImpl16RegisterCIDEntryEPKN7mozilla6Module8CIDEntryEPNS_11KnownModuleE
...
}
{
Bug 794372
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_ZN22nsComponentManagerImpl22RegisterCIDEntryLockedEPKN7mozilla6Module8CIDEntryEPNS_11KnownModuleE
...
}
{
Bug 794374
Memcheck:Leak
@ -293,12 +301,3 @@
fun:_ZN7mozilla3dom7workers13WorkerPrivate9DoRunLoopEP9JSContext
...
}
{
Bug 824647
Memcheck:Leak
fun:malloc
...
fun:_ZN12_GLOBAL__N_112HistogramGetEPKcjjjjPPN4base9HistogramE
fun:_ZN12_GLOBAL__N_113TelemetryImpl13HistogramFromERK19nsACString_internalS3_P9JSContextPN2JS5ValueE
...
}

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

@ -1725,6 +1725,18 @@ if test -n "$MOZ_SHARK"; then
AC_DEFINE(MOZ_SHARK)
fi
dnl ========================================================
dnl instruments
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(instruments,
[ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
MOZ_INSTRUMENTS=1,
MOZ_INSTRUMENTS= )
if test -n "$MOZ_INSTRUMENTS"; then
MOZ_PROFILING=1
AC_DEFINE(MOZ_INSTRUMENTS)
fi
dnl ========================================================
dnl callgrind
dnl ========================================================
@ -8505,6 +8517,7 @@ AC_SUBST(MOZ_JSDEBUGGER)
AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
AC_SUBST(MOZ_JPROF)
AC_SUBST(MOZ_SHARK)
AC_SUBST(MOZ_INSTRUMENTS)
AC_SUBST(MOZ_CALLGRIND)
AC_SUBST(MOZ_VTUNE)
AC_SUBST(MOZ_ETW)

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

@ -1551,6 +1551,13 @@ public:
* OnPageHide having been called and OnPageShow not yet having been called)
*/
bool IsVisible() const { return mVisible; }
/**
* Return whether the document and all its ancestors are visible in the sense of
* pageshow / hide.
*/
bool IsVisibleConsideringAncestors() const;
/**
* Return true when this document is active, i.e., the active document
* in a content viewer.

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

@ -284,7 +284,7 @@ public:
// - HTMLFrameSetElement: mRowSpecs, mColSpecs
// - nsHTMLInputElement: mInputData, mFiles, mFileList, mStaticDocfileList
// - nsHTMLMapElement: mAreas
// - nsHTMLMediaElement: many!
// - HTMLMediaElement: many!
// - nsHTMLOutputElement: mDefaultValue, mTokenList
// - nsHTMLRowElement: mCells
// - nsHTMLSelectElement: mOptions, mRestoreState
@ -360,7 +360,7 @@ public:
/** data nodes (comments, PIs, text). Nodes of this type always
returns a non-null value for nsIContent::GetText() */
eDATA_NODE = 1 << 8,
/** nsHTMLMediaElement */
/** HTMLMediaElement */
eMEDIA = 1 << 9,
/** animation elements */
eANIMATION = 1 << 10,

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

@ -168,7 +168,7 @@
#include "nsIBidiKeyboard.h"
#endif
#ifdef MOZ_MEDIA
#include "nsHTMLMediaElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#endif
extern "C" int MOZ_XMLTranslateEntity(const char* ptr, const char* end,

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

@ -147,7 +147,7 @@
#include "nsHtml5TreeOpExecutor.h"
#include "nsIDOMElementReplaceEvent.h"
#ifdef MOZ_MEDIA
#include "nsHTMLMediaElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#endif // MOZ_MEDIA
#ifdef MOZ_WEBRTC
#include "IPeerConnection.h"
@ -1922,6 +1922,19 @@ nsIDocument::GetExtraPropertyTable(uint16_t aCategory)
return mExtraPropertyTables[aCategory - 1];
}
bool
nsIDocument::IsVisibleConsideringAncestors() const
{
const nsIDocument *parent = this;
do {
if (!parent->IsVisible()) {
return false;
}
} while ((parent = parent->GetParentDocument()));
return true;
}
void
nsDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup)
{
@ -3966,7 +3979,7 @@ NotifyActivityChanged(nsIContent *aContent, void *aUnused)
#ifdef MOZ_MEDIA
nsCOMPtr<nsIDOMHTMLMediaElement> domMediaElem(do_QueryInterface(aContent));
if (domMediaElem) {
nsHTMLMediaElement* mediaElem = static_cast<nsHTMLMediaElement*>(aContent);
HTMLMediaElement* mediaElem = static_cast<HTMLMediaElement*>(aContent);
mediaElem->NotifyOwnerDocumentActivityChanged();
}
#endif
@ -8942,7 +8955,7 @@ NotifyAudioAvailableListener(nsIContent *aContent, void *aUnused)
#ifdef MOZ_MEDIA
nsCOMPtr<nsIDOMHTMLMediaElement> domMediaElem(do_QueryInterface(aContent));
if (domMediaElem) {
nsHTMLMediaElement* mediaElem = static_cast<nsHTMLMediaElement*>(aContent);
HTMLMediaElement* mediaElem = static_cast<HTMLMediaElement*>(aContent);
mediaElem->NotifyAudioAvailableListener();
}
#endif

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

@ -25,7 +25,7 @@
#include "nsBindingManager.h"
#include "nsGenericHTMLElement.h"
#ifdef MOZ_MEDIA
#include "nsHTMLMediaElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#endif // MOZ_MEDIA
#include "nsWrapperCacheInlines.h"
#include "nsObjectLoadingContent.h"
@ -508,7 +508,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
#ifdef MOZ_MEDIA
nsCOMPtr<nsIDOMHTMLMediaElement> domMediaElem(do_QueryInterface(aNode));
if (domMediaElem) {
nsHTMLMediaElement* mediaElem = static_cast<nsHTMLMediaElement*>(aNode);
HTMLMediaElement* mediaElem = static_cast<HTMLMediaElement*>(aNode);
mediaElem->NotifyOwnerDocumentActivityChanged();
}
#endif

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

@ -12,7 +12,6 @@
#include "nsCOMPtr.h"
#include "nsIScriptElement.h"
#include "nsIURI.h"
#include "nsCOMArray.h"
#include "nsTArray.h"
#include "nsAutoPtr.h"
@ -20,6 +19,7 @@
#include "nsIStreamLoader.h"
class nsScriptLoadRequest;
class nsIURI;
//////////////////////////////////////////////////////////////
// Script loader implementation

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

@ -17,7 +17,6 @@
#include "nsIDOMLinkStyle.h"
#include "nsIStyleSheetLinkingElement.h"
#include "nsCSSStyleSheet.h"
#include "nsIURI.h"
#include "nsTArray.h"
#include "mozilla/CORSMode.h"
@ -28,6 +27,7 @@
#define ALTERNATE 0x00000010
class nsIDocument;
class nsIURI;
class nsStyleLinkElement : public nsIDOMLinkStyle,
public nsIStyleSheetLinkingElement

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

@ -93,7 +93,7 @@
#include "XPCQuickStubs.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/HTMLImageElement.h"
#include "nsHTMLVideoElement.h"
#include "mozilla/dom/HTMLVideoElement.h"
#include "mozilla/dom/CanvasRenderingContext2DBinding.h"
#ifdef USE_SKIA
@ -1447,7 +1447,7 @@ CanvasRenderingContext2D::CreatePattern(const HTMLImageOrCanvasOrVideoElement& e
} else if (element.IsHTMLImageElement()) {
htmlElement = &element.GetAsHTMLImageElement();
} else {
htmlElement = element.GetAsHTMLVideoElement();
htmlElement = &element.GetAsHTMLVideoElement();
}
// The canvas spec says that createPattern should use the first frame
@ -2940,7 +2940,7 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
HTMLImageElement* img = &image.GetAsHTMLImageElement();
element = img;
} else {
nsHTMLVideoElement* video = image.GetAsHTMLVideoElement();
HTMLVideoElement* video = &image.GetAsHTMLVideoElement();
element = video;
}

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

@ -11,7 +11,7 @@
#include "mozilla/RefPtr.h"
#include "nsColor.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsHTMLVideoElement.h"
#include "mozilla/dom/HTMLVideoElement.h"
#include "CanvasUtils.h"
#include "gfxFont.h"
#include "mozilla/ErrorResult.h"

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

@ -34,9 +34,9 @@ function testCanvasDrawImage(v) {
try {
var data = ctx.getImageData(0, 0, 1, 1);
ok(true, "drawImage '" + v.src + "' then getImageData with crossorigin='" + v.crossorigin + "' worked");
ok(true, "drawImage '" + v.src + "' then getImageData with crossOrigin='" + v.crossOrigin + "' worked");
} catch(error) {
ok(!v.crossorigin && error.name === "SecurityError", "drawImage '" + v.src + "' then getImageData with crossorigin='" + v.crossorigin + "' failed");
ok(!v.crossOrigin && error.name === "SecurityError", "drawImage '" + v.src + "' then getImageData with crossOrigin='" + v.crossOrigin + "' failed");
v.tainted = true;
}
}
@ -49,9 +49,9 @@ function testCanvasCreatePattern(v) {
try {
var data = ctx.getImageData(0, 0, 1, 1);
ok(true, "createPattern '" + v.src + "' then getImageData with crossorigin='" + v.crossorigin + "' worked");
ok(true, "createPattern '" + v.src + "' then getImageData with crossOrigin='" + v.crossOrigin + "' worked");
} catch(error) {
ok(!v.crossorigin && error.name === "SecurityError", "createPattern '" + v.src + "' then getImageData with crossorigin='" + v.crossorigin + "' failed");
ok(!v.crossOrigin && error.name === "SecurityError", "createPattern '" + v.src + "' then getImageData with crossOrigin='" + v.crossOrigin + "' failed");
v.tainted = true;
}
}
@ -62,9 +62,9 @@ function testWebGL(v) {
try {
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, v);
ok(true, "createTexture from '" + v.src + "' with crossorigin='" + v.crossorigin + "' worked");
ok(true, "createTexture from '" + v.src + "' with crossOrigin='" + v.crossOrigin + "' worked");
} catch (error) {
ok(!v.crossorigin && error.name === "SecurityError", "createTexture from '" + v.src + "' with crossorigin='" + v.crossorigin + "' failed");
ok(!v.crossOrigin && error.name === "SecurityError", "createTexture from '" + v.src + "' with crossOrigin='" + v.crossOrigin + "' failed");
v.tainted = true;
}
}
@ -78,12 +78,12 @@ function testTaintedCanvas(v) {
var data = ctx.getImageData(0, 0, 1, 1);
ok(false, "changing the CORS mode should not allow reading data from remote videos");
} catch (error) {
ok(error.name === "SecurityError", "changing the CORS mode, drawImage '" + v.src + "' then getImageData with crossorigin='" + v.crossorigin + "' failed");
ok(error.name === "SecurityError", "changing the CORS mode, drawImage '" + v.src + "' then getImageData with crossOrigin='" + v.crossOrigin + "' failed");
}
}
function vidDataSuccess(e) {
ok(!e.target.error, "Load '" + e.target.src + "' with crossorigin='" + e.target.crossorigin + "'");
ok(!e.target.error, "Load '" + e.target.src + "' with crossOrigin='" + e.target.crossOrigin + "'");
testCanvasDrawImage(e.target);
testCanvasCreatePattern(e.target);
@ -92,7 +92,7 @@ function vidDataSuccess(e) {
}
// If we change the CORS mode after loading the file without CORS it should still throw a security error
if (e.target.tainted) {
e.target.crossorigin = "anonymous";
e.target.crossOrigin = "anonymous";
testTaintedCanvas(e.target);
}
@ -100,13 +100,13 @@ function vidDataSuccess(e) {
}
function vidLoadFailure(e) {
ok(false, "Load '" + e.target.src + "' with crossorigin='" + e.target.crossorigin + "'");
ok(false, "Load '" + e.target.src + "' with crossOrigin='" + e.target.crossOrigin + "'");
doneTest(e);
}
function vidErrorSuccess(e) {
ok(e.target.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED,
"Load '" + e.target.src + "' with crossorigin='" + e.target.crossorigin + "'");
"Load '" + e.target.src + "' with crossOrigin='" + e.target.crossOrigin + "'");
doneTest(e);
}
@ -114,10 +114,10 @@ function startTest(test, token) {
var v = document.createElement('video');
if (test.cors === "just-crossOrigin-without-value") {
var div = document.createElement('div');
div.innerHTML="<video crossorigin>";
div.innerHTML="<video crossOrigin>";
v = div.children[0];
} else if (test.cors !== "missing-value-default") {
v.crossorigin = test.cors;
v.crossOrigin = test.cors;
}
v.token = token;
manager.started(token);

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

@ -180,6 +180,39 @@ nsDOMMouseEvent::InitFromCtor(const nsAString& aType,
return NS_OK;
}
already_AddRefed<nsDOMMouseEvent>
nsDOMMouseEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
const nsAString& aType,
const mozilla::dom::MouseEventInit& aParam,
mozilla::ErrorResult& aRv)
{
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.Get());
nsRefPtr<nsDOMMouseEvent> e = new nsDOMMouseEvent(t, nullptr, nullptr);
e->SetIsDOMBinding();
bool trusted = e->Init(t);
e->InitMouseEvent(aType, aParam.mBubbles, aParam.mCancelable,
aParam.mView, aParam.mDetail, aParam.mScreenX,
aParam.mScreenY, aParam.mClientX, aParam.mClientY,
aParam.mCtrlKey, aParam.mAltKey, aParam.mShiftKey,
aParam.mMetaKey, aParam.mButton, aParam.mRelatedTarget,
aRv);
e->SetTrusted(trusted);
switch (e->mEvent->eventStructType) {
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_WHEEL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
static_cast<nsMouseEvent_base*>(e->mEvent)->buttons = aParam.mButtons;
break;
default:
break;
}
return e.forget();
}
NS_IMETHODIMP
nsDOMMouseEvent::InitNSMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
nsIDOMWindow *aView, int32_t aDetail, int32_t aScreenX,
@ -203,6 +236,13 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetButton(uint16_t* aButton)
{
NS_ENSURE_ARG_POINTER(aButton);
*aButton = Button();
return NS_OK;
}
uint16_t
nsDOMMouseEvent::Button()
{
switch(mEvent->eventStructType)
{
case NS_MOUSE_EVENT:
@ -210,20 +250,24 @@ nsDOMMouseEvent::GetButton(uint16_t* aButton)
case NS_WHEEL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
*aButton = static_cast<nsMouseEvent_base*>(mEvent)->button;
break;
return static_cast<nsMouseEvent_base*>(mEvent)->button;
default:
NS_WARNING("Tried to get mouse button for non-mouse event!");
*aButton = nsMouseEvent::eLeftButton;
break;
return nsMouseEvent::eLeftButton;
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMMouseEvent::GetButtons(uint16_t* aButtons)
{
NS_ENSURE_ARG_POINTER(aButtons);
*aButtons = Buttons();
return NS_OK;
}
uint16_t
nsDOMMouseEvent::Buttons()
{
switch(mEvent->eventStructType)
{
case NS_MOUSE_EVENT:
@ -231,22 +275,25 @@ nsDOMMouseEvent::GetButtons(uint16_t* aButtons)
case NS_WHEEL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
*aButtons = static_cast<nsMouseEvent_base*>(mEvent)->buttons;
break;
return static_cast<nsMouseEvent_base*>(mEvent)->buttons;
default:
MOZ_NOT_REACHED("Tried to get mouse buttons for non-mouse event!");
*aButtons = 0;
break;
return 0;
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
{
NS_ENSURE_ARG_POINTER(aRelatedTarget);
*aRelatedTarget = nullptr;
nsISupports* relatedTarget = nullptr;
*aRelatedTarget = GetRelatedTarget().get();
return NS_OK;
}
already_AddRefed<mozilla::dom::EventTarget>
nsDOMMouseEvent::GetRelatedTarget()
{
nsCOMPtr<mozilla::dom::EventTarget> relatedTarget;
switch(mEvent->eventStructType)
{
case NS_MOUSE_EVENT:
@ -254,7 +301,7 @@ nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
case NS_WHEEL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
relatedTarget = static_cast<nsMouseEvent_base*>(mEvent)->relatedTarget;
relatedTarget = do_QueryInterface(static_cast<nsMouseEvent_base*>(mEvent)->relatedTarget);
break;
default:
break;
@ -264,22 +311,22 @@ nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
nsCOMPtr<nsIContent> content = do_QueryInterface(relatedTarget);
if (content && content->ChromeOnlyAccess() &&
!nsContentUtils::CanAccessNativeAnon()) {
relatedTarget = content->FindFirstNonChromeOnlyAccessContent();
if (!relatedTarget) {
return NS_OK;
}
relatedTarget = do_QueryInterface(content->FindFirstNonChromeOnlyAccessContent());
}
CallQueryInterface(relatedTarget, aRelatedTarget);
if (relatedTarget) {
relatedTarget = relatedTarget->GetTargetForDOMEvent();
}
return relatedTarget.forget();
}
return NS_OK;
return nullptr;
}
NS_IMETHODIMP
nsDOMMouseEvent::GetMozMovementX(int32_t* aMovementX)
{
NS_ENSURE_ARG_POINTER(aMovementX);
*aMovementX = GetMovementPoint().x;
*aMovementX = MozMovementX();
return NS_OK;
}
@ -288,7 +335,7 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetMozMovementY(int32_t* aMovementY)
{
NS_ENSURE_ARG_POINTER(aMovementY);
*aMovementY = GetMovementPoint().y;
*aMovementY = MozMovementY();
return NS_OK;
}
@ -296,49 +343,73 @@ nsDOMMouseEvent::GetMozMovementY(int32_t* aMovementY)
NS_METHOD nsDOMMouseEvent::GetScreenX(int32_t* aScreenX)
{
NS_ENSURE_ARG_POINTER(aScreenX);
*aScreenX = nsDOMEvent::GetScreenCoords(mPresContext,
mEvent,
mEvent->refPoint).x;
*aScreenX = ScreenX();
return NS_OK;
}
int32_t
nsDOMMouseEvent::ScreenX()
{
return nsDOMEvent::GetScreenCoords(mPresContext,
mEvent,
mEvent->refPoint).x;
}
NS_IMETHODIMP
nsDOMMouseEvent::GetScreenY(int32_t* aScreenY)
{
NS_ENSURE_ARG_POINTER(aScreenY);
*aScreenY = nsDOMEvent::GetScreenCoords(mPresContext,
mEvent,
mEvent->refPoint).y;
*aScreenY = ScreenY();
return NS_OK;
}
int32_t
nsDOMMouseEvent::ScreenY()
{
return nsDOMEvent::GetScreenCoords(mPresContext,
mEvent,
mEvent->refPoint).y;
}
NS_METHOD nsDOMMouseEvent::GetClientX(int32_t* aClientX)
{
NS_ENSURE_ARG_POINTER(aClientX);
*aClientX = nsDOMEvent::GetClientCoords(mPresContext,
mEvent,
mEvent->refPoint,
mClientPoint).x;
*aClientX = ClientX();
return NS_OK;
}
int32_t
nsDOMMouseEvent::ClientX()
{
return nsDOMEvent::GetClientCoords(mPresContext,
mEvent,
mEvent->refPoint,
mClientPoint).x;
}
NS_IMETHODIMP
nsDOMMouseEvent::GetClientY(int32_t* aClientY)
{
NS_ENSURE_ARG_POINTER(aClientY);
*aClientY = nsDOMEvent::GetClientCoords(mPresContext,
mEvent,
mEvent->refPoint,
mClientPoint).y;
*aClientY = ClientY();
return NS_OK;
}
int32_t
nsDOMMouseEvent::ClientY()
{
return nsDOMEvent::GetClientCoords(mPresContext,
mEvent,
mEvent->refPoint,
mClientPoint).y;
}
NS_IMETHODIMP
nsDOMMouseEvent::GetAltKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = static_cast<nsInputEvent*>(mEvent)->IsAlt();
*aIsDown = AltKey();
return NS_OK;
}
@ -346,7 +417,7 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetCtrlKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = static_cast<nsInputEvent*>(mEvent)->IsControl();
*aIsDown = CtrlKey();
return NS_OK;
}
@ -354,7 +425,7 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetShiftKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = static_cast<nsInputEvent*>(mEvent)->IsShift();
*aIsDown = ShiftKey();
return NS_OK;
}
@ -362,7 +433,7 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetMetaKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = static_cast<nsInputEvent*>(mEvent)->IsMeta();
*aIsDown = MetaKey();
return NS_OK;
}
@ -372,7 +443,7 @@ nsDOMMouseEvent::GetModifierState(const nsAString& aKey,
{
NS_ENSURE_ARG_POINTER(aState);
*aState = GetModifierStateInternal(aKey);
*aState = GetModifierState(aKey);
return NS_OK;
}
@ -391,7 +462,7 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetMozPressure(float* aPressure)
{
NS_ENSURE_ARG_POINTER(aPressure);
*aPressure = static_cast<nsMouseEvent_base*>(mEvent)->pressure;
*aPressure = MozPressure();
return NS_OK;
}
@ -399,7 +470,7 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetMozInputSource(uint16_t* aInputSource)
{
NS_ENSURE_ARG_POINTER(aInputSource);
*aInputSource = static_cast<nsMouseEvent_base*>(mEvent)->inputSource;
*aInputSource = MozInputSource();
return NS_OK;
}
@ -409,5 +480,6 @@ nsresult NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
nsInputEvent *aEvent)
{
nsDOMMouseEvent* it = new nsDOMMouseEvent(aOwner, aPresContext, aEvent);
it->SetIsDOMBinding();
return CallQueryInterface(it, aInstancePtrResult);
}

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

@ -8,6 +8,7 @@
#include "nsIDOMMouseEvent.h"
#include "nsDOMUIEvent.h"
#include "mozilla/dom/MouseEventBinding.h"
class nsEvent;
@ -27,8 +28,92 @@ public:
// Forward to base class
NS_FORWARD_TO_NSDOMUIEVENT
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE
{
return mozilla::dom::MouseEventBinding::Wrap(aCx, aScope, this);
}
virtual nsresult InitFromCtor(const nsAString& aType,
JSContext* aCx, JS::Value* aVal);
// Web IDL binding methods
int32_t ScreenX();
int32_t ScreenY();
int32_t ClientX();
int32_t ClientY();
bool CtrlKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsControl();
}
bool ShiftKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsShift();
}
bool AltKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsAlt();
}
bool MetaKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsMeta();
}
uint16_t Button();
uint16_t Buttons();
already_AddRefed<mozilla::dom::EventTarget> GetRelatedTarget();
void InitMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
nsIDOMWindow* aView, int32_t aDetail, int32_t aScreenX,
int32_t aScreenY, int32_t aClientX, int32_t aClientY,
bool aCtrlKey, bool aAltKey, bool aShiftKey,
bool aMetaKey, uint16_t aButton,
mozilla::dom::EventTarget *aRelatedTarget,
mozilla::ErrorResult& aRv)
{
aRv = InitMouseEvent(aType, aCanBubble, aCancelable,
aView, aDetail, aScreenX, aScreenY,
aClientX, aClientY, aCtrlKey, aAltKey,
aShiftKey, aMetaKey, aButton,
aRelatedTarget);
}
bool GetModifierState(const nsAString& aKeyArg)
{
return GetModifierStateInternal(aKeyArg);
}
static already_AddRefed<nsDOMMouseEvent> Constructor(const mozilla::dom::GlobalObject& aGlobal,
const nsAString& aType,
const mozilla::dom::MouseEventInit& aParam,
mozilla::ErrorResult& aRv);
int32_t MozMovementX()
{
return GetMovementPoint().x;
}
int32_t MozMovementY()
{
return GetMovementPoint().y;
}
float MozPressure() const
{
return static_cast<nsMouseEvent_base*>(mEvent)->pressure;
}
uint16_t MozInputSource() const
{
return static_cast<nsMouseEvent_base*>(mEvent)->inputSource;
}
void InitNSMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
nsIDOMWindow *aView, int32_t aDetail, int32_t aScreenX,
int32_t aScreenY, int32_t aClientX, int32_t aClientY,
bool aCtrlKey, bool aAltKey, bool aShiftKey,
bool aMetaKey, uint16_t aButton,
mozilla::dom::EventTarget *aRelatedTarget,
float aPressure, uint16_t aInputSource,
mozilla::ErrorResult& aRv)
{
aRv = InitNSMouseEvent(aType, aCanBubble, aCancelable,
aView, aDetail, aScreenX, aScreenY,
aClientX, aClientY, aCtrlKey, aAltKey,
aShiftKey, aMetaKey, aButton,
aRelatedTarget, aPressure, aInputSource);
}
protected:
// Specific implementation for a mouse event.
virtual nsresult Which(uint32_t* aWhich);

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

@ -0,0 +1,78 @@
/* -*- 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 mozilla_dom_HTMLAudioElement_h
#define mozilla_dom_HTMLAudioElement_h
#include "nsIDOMHTMLAudioElement.h"
#include "nsIJSNativeInitializer.h"
#include "mozilla/dom/HTMLMediaElement.h"
typedef uint16_t nsMediaNetworkState;
typedef uint16_t nsMediaReadyState;
namespace mozilla {
namespace dom {
class HTMLAudioElement : public HTMLMediaElement,
public nsIDOMHTMLAudioElement,
public nsIJSNativeInitializer
{
public:
HTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~HTMLAudioElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLMediaElement
using HTMLMediaElement::GetPaused;
NS_FORWARD_NSIDOMHTMLMEDIAELEMENT(HTMLMediaElement::)
// nsIDOMHTMLAudioElement
NS_DECL_NSIDOMHTMLAUDIOELEMENT
// nsIJSNativeInitializer
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aContext,
JSObject* aObj, uint32_t argc, jsval* argv);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsresult SetAcceptHeader(nsIHttpChannel* aChannel);
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
// WebIDL
static already_AddRefed<HTMLAudioElement> Audio(const GlobalObject& global,
ErrorResult& aRv);
static already_AddRefed<HTMLAudioElement> Audio(const GlobalObject& global,
const nsAString& src,
ErrorResult& aRv);
void MozSetup(uint32_t aChannels, uint32_t aRate, ErrorResult& aRv);
uint32_t MozWriteAudio(JSContext* aCx, JS::Value aData, ErrorResult& aRv);
uint64_t MozCurrentSampleOffset(ErrorResult& aRv);
protected:
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_HTMLAudioElement_h

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

@ -3,8 +3,8 @@
/* 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/. */
#if !defined(nsHTMLMediaElement_h__)
#define nsHTMLMediaElement_h__
#ifndef mozilla_dom_HTMLMediaElement_h
#define mozilla_dom_HTMLMediaElement_h
#include "nsIDOMHTMLMediaElement.h"
#include "nsGenericHTMLElement.h"
@ -27,6 +27,8 @@
#include "DecoderTraits.h"
#include "MediaMetadataManager.h"
#include "AudioChannelAgent.h"
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
// Define to output information on decoding and painting framerate
/* #define DEBUG_FRAME_RATE 1 */
@ -39,10 +41,15 @@ class MediaResource;
class MediaDecoder;
}
class nsHTMLMediaElement : public nsGenericHTMLElement,
public nsIObserver,
public mozilla::MediaDecoderOwner,
public nsIAudioChannelAgentCallback
namespace mozilla {
namespace dom {
class MediaError;
class HTMLMediaElement : public nsGenericHTMLElement,
public nsIObserver,
public MediaDecoderOwner,
public nsIAudioChannelAgentCallback
{
public:
typedef mozilla::TimeStamp TimeStamp;
@ -52,16 +59,13 @@ public:
typedef mozilla::MediaResource MediaResource;
typedef mozilla::MediaDecoderOwner MediaDecoderOwner;
typedef mozilla::MetadataTags MetadataTags;
typedef mozilla::AudioStream AudioStream;
typedef mozilla::MediaDecoder MediaDecoder;
typedef mozilla::DOMMediaStream DOMMediaStream;
mozilla::CORSMode GetCORSMode() {
CORSMode GetCORSMode() {
return mCORSMode;
}
nsHTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsHTMLMediaElement();
HTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~HTMLMediaElement();
/**
* This is used when the browser is constructing a video element to play
@ -82,13 +86,13 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLMediaElement,
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLMediaElement,
nsGenericHTMLElement)
virtual bool ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
// SetAttr override. C++ is stupid, so have to override both
// overloaded methods.
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
@ -194,7 +198,7 @@ public:
// Called by the media decoder and the video frame to get the
// ImageContainer containing the video data.
virtual VideoFrameContainer* GetVideoFrameContainer() MOZ_FINAL MOZ_OVERRIDE;
ImageContainer* GetImageContainer();
layers::ImageContainer* GetImageContainer();
// Called by the video frame to get the print surface, if this is
// a static document and we're not actually playing video
@ -255,7 +259,7 @@ public:
// Returns the CanPlayStatus indicating if we can handle the
// full MIME type including the optional codecs parameter.
static mozilla::CanPlayStatus GetCanPlay(const nsAString& aType);
static CanPlayStatus GetCanPlay(const nsAString& aType);
/**
* Called when a child source element is added to this media element. This
@ -296,7 +300,7 @@ public:
*/
bool GetPlayedOrSeeked() const { return mHasPlayedOrSeeked; }
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
nsresult CopyInnerTo(Element* aDest);
/**
* Sets the Accept header on the HTTP channel to the required
@ -318,12 +322,194 @@ public:
*/
virtual void FireTimeUpdate(bool aPeriodic) MOZ_FINAL MOZ_OVERRIDE;
MediaStream* GetSrcMediaStream()
MediaStream* GetSrcMediaStream() const
{
NS_ASSERTION(mSrcStream, "Don't call this when not playing a stream");
return mSrcStream->GetStream();
}
// WebIDL
MediaError* GetError() const
{
return mError;
}
// XPCOM GetSrc() is OK
void SetSrc(const nsAString& aSrc, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::src, aSrc, aRv);
}
// XPCOM GetCurrentSrc() is OK
// XPCOM GetCrossorigin() is OK
void SetCrossOrigin(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::crossorigin, aValue, aRv);
}
uint16_t NetworkState() const
{
return mNetworkState;
}
// XPCOM GetPreload() is OK
void SetPreload(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::preload, aValue, aRv);
}
already_AddRefed<TimeRanges> Buffered() const;
// XPCOM Load() is OK
// XPCOM CanPlayType() is OK
uint16_t ReadyState() const
{
return mReadyState;
}
bool Seeking() const;
double CurrentTime() const;
void SetCurrentTime(double aCurrentTime, ErrorResult& aRv);
double Duration() const;
bool Paused() const
{
return mPaused;
}
double DefaultPlaybackRate() const
{
return mDefaultPlaybackRate;
}
void SetDefaultPlaybackRate(double aDefaultPlaybackRate, ErrorResult& aRv);
double PlaybackRate() const
{
return mPlaybackRate;
}
void SetPlaybackRate(double aPlaybackRate, ErrorResult& aRv);
already_AddRefed<TimeRanges> Played();
already_AddRefed<TimeRanges> Seekable() const;
bool Ended();
bool Autoplay() const
{
return GetBoolAttr(nsGkAtoms::autoplay);
}
void SetAutoplay(bool aValue, ErrorResult& aRv)
{
SetHTMLBoolAttr(nsGkAtoms::autoplay, aValue, aRv);
}
bool Loop() const
{
return GetBoolAttr(nsGkAtoms::loop);
}
void SetLoop(bool aValue, ErrorResult& aRv)
{
SetHTMLBoolAttr(nsGkAtoms::loop, aValue, aRv);
}
void Play(ErrorResult& aRv);
void Pause(ErrorResult& aRv);
bool Controls() const
{
return GetBoolAttr(nsGkAtoms::controls);
}
void SetControls(bool aValue, ErrorResult& aRv)
{
SetHTMLBoolAttr(nsGkAtoms::controls, aValue, aRv);
}
double Volume() const
{
return mVolume;
}
void SetVolume(double aVolume, ErrorResult& aRv);
bool Muted() const
{
return mMuted;
}
// XPCOM SetMuted() is OK
bool DefaultMuted() const
{
return GetBoolAttr(nsGkAtoms::muted);
}
void SetDefaultMuted(bool aMuted, ErrorResult& aRv)
{
SetHTMLBoolAttr(nsGkAtoms::muted, aMuted, aRv);
}
already_AddRefed<DOMMediaStream> GetMozSrcObject() const;
void SetMozSrcObject(DOMMediaStream& aValue);
double InitialTime();
bool MozPreservesPitch() const
{
return mPreservesPitch;
}
// XPCOM MozPreservesPitch() is OK
bool MozAutoplayEnabled() const
{
return mAutoplayEnabled;
}
already_AddRefed<DOMMediaStream> MozCaptureStream(ErrorResult& aRv);
already_AddRefed<DOMMediaStream> MozCaptureStreamUntilEnded(ErrorResult& aRv);
bool MozAudioCaptured() const
{
return mAudioCaptured;
}
uint32_t GetMozChannels(ErrorResult& aRv) const;
uint32_t GetMozSampleRate(ErrorResult& aRv) const;
uint32_t GetMozFrameBufferLength(ErrorResult& aRv) const;
void SetMozFrameBufferLength(uint32_t aValue, ErrorResult& aRv);
JSObject* MozGetMetadata(JSContext* aCx, ErrorResult& aRv);
void MozLoadFrom(HTMLMediaElement& aOther, ErrorResult& aRv);
double MozFragmentEnd();
// XPCOM GetMozAudioChannelType() is OK
void SetMozAudioChannelType(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::mozaudiochannel, aValue, aRv);
}
protected:
class MediaLoadListener;
class StreamListener;
@ -334,13 +520,13 @@ protected:
class WakeLockBoolWrapper {
public:
WakeLockBoolWrapper(bool val = false) : mValue(val), mOuter(NULL), mWakeLock(NULL) {}
void SetOuter(nsHTMLMediaElement* outer) { mOuter = outer; }
operator bool() { return mValue; }
void SetOuter(HTMLMediaElement* outer) { mOuter = outer; }
operator bool() const { return mValue; }
WakeLockBoolWrapper& operator=(bool val);
bool operator !() const { return !mValue; }
private:
bool mValue;
nsHTMLMediaElement* mOuter;
HTMLMediaElement* mOuter;
nsCOMPtr<nsIDOMMozWakeLock> mWakeLock;
};
@ -415,7 +601,7 @@ protected:
* Call this to find a media element with the same NodePrincipal and mLoadingSrc
* set to aURI, and with a decoder on which Load() has been called.
*/
nsHTMLMediaElement* LookupMediaElementURITable(nsIURI* aURI);
HTMLMediaElement* LookupMediaElementURITable(nsIURI* aURI);
/**
* Shutdown and clear mDecoder and maintain associated invariants.
@ -595,9 +781,9 @@ protected:
*/
void SuspendOrResumeElement(bool aPauseElement, bool aSuspendEvents);
// Get the nsHTMLMediaElement object if the decoder is being used from an
// Get the HTMLMediaElement object if the decoder is being used from an
// HTML media element, and null otherwise.
virtual nsHTMLMediaElement* GetMediaElement() MOZ_FINAL MOZ_OVERRIDE
virtual HTMLMediaElement* GetMediaElement() MOZ_FINAL MOZ_OVERRIDE
{
return this;
}
@ -654,7 +840,7 @@ protected:
nsCOMPtr<nsIChannel> mChannel;
// Error attribute
nsCOMPtr<nsIDOMMediaError> mError;
nsRefPtr<MediaError> mError;
// The current media load ID. This is incremented every time we start a
// new load. Async events note the ID when they're first sent, and only fire
@ -771,7 +957,7 @@ protected:
nsAutoPtr<AudioStream> mAudioStream;
// Range of time played.
mozilla::dom::TimeRanges mPlayed;
TimeRanges mPlayed;
// Stores the time at the start of the current 'played' range.
double mCurrentPlayRangeStart;
@ -880,7 +1066,7 @@ protected:
bool mMediaSecurityVerified;
// The CORS mode when loading the media element
mozilla::CORSMode mCORSMode;
CORSMode mCORSMode;
// True if the media has an audio track
bool mHasAudio;
@ -889,7 +1075,7 @@ protected:
bool mDownloadSuspendedByCache;
// Audio Channel Type.
mozilla::dom::AudioChannelType mAudioChannelType;
AudioChannelType mAudioChannelType;
// The audiochannel has been suspended.
bool mChannelSuspended;
@ -901,4 +1087,7 @@ protected:
nsCOMPtr<nsIAudioChannelAgent> mAudioChannelAgent;
};
#endif
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_HTMLMediaElement_h

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

@ -0,0 +1,120 @@
/* -*- 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 mozilla_dom_HTMLVideoElement_h
#define mozilla_dom_HTMLVideoElement_h
#include "nsIDOMHTMLVideoElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
namespace mozilla {
namespace dom {
class HTMLVideoElement : public HTMLMediaElement,
public nsIDOMHTMLVideoElement
{
public:
HTMLVideoElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~HTMLVideoElement();
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLVideoElement, video)
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLMediaElement
using HTMLMediaElement::GetPaused;
NS_FORWARD_NSIDOMHTMLMEDIAELEMENT(HTMLMediaElement::)
// nsIDOMHTMLVideoElement
NS_DECL_NSIDOMHTMLVIDEOELEMENT
virtual bool ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
// Set size with the current video frame's height and width.
// If there is no video frame, returns NS_ERROR_FAILURE.
nsresult GetVideoSize(nsIntSize* size);
virtual nsresult SetAcceptHeader(nsIHttpChannel* aChannel);
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
// WebIDL
uint32_t Width() const
{
return GetIntAttr(nsGkAtoms::width, 0);
}
void SetWidth(uint32_t aValue, ErrorResult& aRv)
{
SetHTMLIntAttr(nsGkAtoms::width, aValue, aRv);
}
uint32_t Height() const
{
return GetIntAttr(nsGkAtoms::height, 0);
}
void SetHeight(uint32_t aValue, ErrorResult& aRv)
{
SetHTMLIntAttr(nsGkAtoms::height, aValue, aRv);
}
uint32_t VideoWidth() const
{
return mMediaSize.width == -1 ? 0 : mMediaSize.width;
}
uint32_t VideoHeight() const
{
return mMediaSize.height == -1 ? 0 : mMediaSize.height;
}
// XPCOM GetPoster is OK
void SetPoster(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::poster, aValue, aRv);
}
uint32_t MozParsedFrames() const;
uint32_t MozDecodedFrames() const;
uint32_t MozPresentedFrames() const;
uint32_t MozPaintedFrames();
double MozFrameDelay();
bool MozHasAudio() const;
protected:
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_HTMLVideoElement_h

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

@ -21,9 +21,6 @@ EXPORTS = \
nsIRadioGroupContainer.h \
nsITextControlElement.h \
nsFormSubmission.h \
nsHTMLAudioElement.h \
nsHTMLMediaElement.h \
nsHTMLVideoElement.h \
nsIHTMLCollection.h \
$(NULL)
@ -31,6 +28,9 @@ EXPORTS_NAMESPACES = mozilla/dom
EXPORTS_mozilla/dom = \
HTMLCanvasElement.h \
HTMLMediaElement.h \
HTMLAudioElement.h \
HTMLVideoElement.h \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -1,55 +0,0 @@
/* -*- 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/. */
#if !defined(nsHTMLAudioElement_h__)
#define nsHTMLAudioElement_h__
#include "nsIDOMHTMLAudioElement.h"
#include "nsIJSNativeInitializer.h"
#include "nsHTMLMediaElement.h"
typedef uint16_t nsMediaNetworkState;
typedef uint16_t nsMediaReadyState;
class nsHTMLAudioElement : public nsHTMLMediaElement,
public nsIDOMHTMLAudioElement,
public nsIJSNativeInitializer
{
public:
nsHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsHTMLAudioElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLMediaElement
using nsHTMLMediaElement::GetPaused;
NS_FORWARD_NSIDOMHTMLMEDIAELEMENT(nsHTMLMediaElement::)
// nsIDOMHTMLAudioElement
NS_DECL_NSIDOMHTMLAUDIOELEMENT
// nsIJSNativeInitializer
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aContext,
JSObject* aObj, uint32_t argc, jsval* argv);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsresult SetAcceptHeader(nsIHttpChannel* aChannel);
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
};
#endif

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

@ -1,60 +0,0 @@
/* -*- 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/. */
#if !defined(nsHTMLVideoElement_h__)
#define nsHTMLVideoElement_h__
#include "nsIDOMHTMLVideoElement.h"
#include "nsHTMLMediaElement.h"
class nsHTMLVideoElement : public nsHTMLMediaElement,
public nsIDOMHTMLVideoElement
{
public:
nsHTMLVideoElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsHTMLVideoElement();
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(nsHTMLVideoElement, video)
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLMediaElement
using nsHTMLMediaElement::GetPaused;
NS_FORWARD_NSIDOMHTMLMEDIAELEMENT(nsHTMLMediaElement::)
// nsIDOMHTMLVideoElement
NS_DECL_NSIDOMHTMLVIDEOELEMENT
virtual bool ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
// Set size with the current video frame's height and width.
// If there is no video frame, returns NS_ERROR_FAILURE.
nsresult GetVideoSize(nsIntSize* size);
virtual nsresult SetAcceptHeader(nsIHttpChannel* aChannel);
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
};
#endif

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

@ -3,9 +3,11 @@
/* 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/HTMLAudioElement.h"
#include "mozilla/dom/HTMLAudioElementBinding.h"
#include "nsError.h"
#include "nsIDOMHTMLAudioElement.h"
#include "nsHTMLAudioElement.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsIDocument.h"
@ -17,21 +19,20 @@
#include <algorithm>
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
DOMCI_NODE_DATA(HTMLAudioElement, mozilla::dom::HTMLAudioElement)
static bool
IsAudioAPIEnabled()
{
return Preferences::GetBool("media.audio_data.enabled", true);
return mozilla::Preferences::GetBool("media.audio_data.enabled", true);
}
nsGenericHTMLElement*
NS_NewHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo,
FromParser aFromParser)
mozilla::dom::FromParser aFromParser)
{
/*
* nsHTMLAudioElement's will be created without a nsINodeInfo passed in
* HTMLAudioElement's will be created without a nsINodeInfo passed in
* if someone says "var audio = new Audio();" in JavaScript, in a case like
* that we request the nsINodeInfo from the document's nodeinfo list.
*/
@ -47,36 +48,39 @@ NS_NewHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo,
NS_ENSURE_TRUE(nodeInfo, nullptr);
}
return new nsHTMLAudioElement(nodeInfo.forget());
return new mozilla::dom::HTMLAudioElement(nodeInfo.forget());
}
NS_IMPL_ADDREF_INHERITED(nsHTMLAudioElement, nsHTMLMediaElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLAudioElement, nsHTMLMediaElement)
namespace mozilla {
namespace dom {
DOMCI_NODE_DATA(HTMLAudioElement, nsHTMLAudioElement)
NS_IMPL_ADDREF_INHERITED(HTMLAudioElement, HTMLMediaElement)
NS_IMPL_RELEASE_INHERITED(HTMLAudioElement, HTMLMediaElement)
NS_INTERFACE_TABLE_HEAD(nsHTMLAudioElement)
NS_HTML_CONTENT_INTERFACE_TABLE3(nsHTMLAudioElement, nsIDOMHTMLMediaElement,
NS_INTERFACE_TABLE_HEAD(HTMLAudioElement)
NS_HTML_CONTENT_INTERFACE_TABLE3(HTMLAudioElement, nsIDOMHTMLMediaElement,
nsIDOMHTMLAudioElement, nsIJSNativeInitializer)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLAudioElement,
nsHTMLMediaElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLAudioElement,
HTMLMediaElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLAudioElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLAudioElement)
NS_IMPL_ELEMENT_CLONE(HTMLAudioElement)
nsHTMLAudioElement::nsHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsHTMLMediaElement(aNodeInfo)
HTMLAudioElement::HTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: HTMLMediaElement(aNodeInfo)
{
SetIsDOMBinding();
}
HTMLAudioElement::~HTMLAudioElement()
{
}
nsHTMLAudioElement::~nsHTMLAudioElement()
{
}
NS_IMETHODIMP
nsHTMLAudioElement::Initialize(nsISupports* aOwner, JSContext* aContext,
JSObject *aObj, uint32_t argc, jsval *argv)
HTMLAudioElement::Initialize(nsISupports* aOwner, JSContext* aContext,
JSObject *aObj, uint32_t argc, jsval *argv)
{
// Audio elements created using "new Audio(...)" should have
// 'preload' set to 'auto' (since the script must intend to
@ -105,21 +109,63 @@ nsHTMLAudioElement::Initialize(nsISupports* aOwner, JSContext* aContext,
return SetSrc(str);
}
NS_IMETHODIMP
nsHTMLAudioElement::MozSetup(uint32_t aChannels, uint32_t aRate)
already_AddRefed<HTMLAudioElement>
HTMLAudioElement::Audio(const GlobalObject& aGlobal, ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aGlobal.Get());
nsIDocument* doc;
if (!win || !(doc = win->GetExtantDoc())) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
nsCOMPtr<nsINodeInfo> nodeInfo =
doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::audio, nullptr,
kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);
if (!nodeInfo) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
nsRefPtr<HTMLAudioElement> audio = new HTMLAudioElement(nodeInfo.forget());
audio->SetHTMLAttr(nsGkAtoms::preload, NS_LITERAL_STRING("auto"), aRv);
if (aRv.Failed()) {
return nullptr;
}
return audio.forget();
}
already_AddRefed<HTMLAudioElement>
HTMLAudioElement::Audio(const GlobalObject& aGlobal, const nsAString& aSrc, ErrorResult& aRv)
{
nsRefPtr<HTMLAudioElement> audio = Audio(aGlobal, aRv);
if (audio) {
aRv = audio->SetSrc(aSrc);
}
return audio.forget();
}
void
HTMLAudioElement::MozSetup(uint32_t aChannels, uint32_t aRate, ErrorResult& aRv)
{
if (!IsAudioAPIEnabled()) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return;
}
// If there is already a src provided, don't setup another stream
if (mDecoder) {
return NS_ERROR_FAILURE;
aRv.Throw(NS_ERROR_FAILURE);
return;
}
// MozWriteAudio divides by mChannels, so validate now.
if (0 == aChannels) {
return NS_ERROR_FAILURE;
aRv.Throw(NS_ERROR_FAILURE);
return;
}
if (mAudioStream) {
@ -127,32 +173,41 @@ nsHTMLAudioElement::MozSetup(uint32_t aChannels, uint32_t aRate)
}
mAudioStream = AudioStream::AllocateStream();
nsresult rv = mAudioStream->Init(aChannels, aRate, mAudioChannelType);
if (NS_FAILED(rv)) {
aRv = mAudioStream->Init(aChannels, aRate, mAudioChannelType);
if (aRv.Failed()) {
mAudioStream->Shutdown();
mAudioStream = nullptr;
return rv;
return;
}
MetadataLoaded(aChannels, aRate, true, false, nullptr);
mAudioStream->SetVolume(mVolume);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAudioElement::MozWriteAudio(const JS::Value& aData, JSContext* aCx, uint32_t* aRetVal)
HTMLAudioElement::MozSetup(uint32_t aChannels, uint32_t aRate)
{
ErrorResult rv;
MozSetup(aChannels, aRate, rv);
return rv.ErrorCode();
}
uint32_t
HTMLAudioElement::MozWriteAudio(JSContext* aCx, JS::Value aData, ErrorResult& aRv)
{
if (!IsAudioAPIEnabled()) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return 0;
}
if (!mAudioStream) {
return NS_ERROR_DOM_INVALID_STATE_ERR;
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return 0;
}
if (!aData.isObject()) {
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
aRv.Throw(NS_ERROR_DOM_TYPE_MISMATCH_ERR);
return 0;
}
JSObject* darray = &aData.toObject();
@ -165,11 +220,13 @@ nsHTMLAudioElement::MozWriteAudio(const JS::Value& aData, JSContext* aCx, uint32
} else if (JS_IsArrayObject(aCx, darray)) {
JSObject* nobj = JS_NewFloat32ArrayFromArray(aCx, darray);
if (!nobj) {
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
aRv.Throw(NS_ERROR_DOM_TYPE_MISMATCH_ERR);
return 0;
}
tsrc = nobj;
} else {
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
aRv.Throw(NS_ERROR_DOM_TYPE_MISMATCH_ERR);
return 0;
}
tvr.setObject(tsrc);
@ -178,7 +235,8 @@ nsHTMLAudioElement::MozWriteAudio(const JS::Value& aData, JSContext* aCx, uint32
// Make sure that we are going to write the correct amount of data based
// on number of channels.
if (dataLength % mChannels != 0) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return 0;
}
// Don't write more than can be written without blocking.
@ -191,38 +249,54 @@ nsHTMLAudioElement::MozWriteAudio(const JS::Value& aData, JSContext* aCx, uint32
// AudioDataValue is 'float', but it's not worth it for this deprecated API.
nsAutoArrayPtr<AudioDataValue> audioData(new AudioDataValue[writeLen * mChannels]);
ConvertAudioSamples(frames, audioData.get(), writeLen * mChannels);
nsresult rv = mAudioStream->Write(audioData.get(), writeLen);
if (NS_FAILED(rv)) {
return rv;
aRv = mAudioStream->Write(audioData.get(), writeLen);
if (aRv.Failed()) {
return 0;
}
mAudioStream->Start();
// Return the actual amount written.
*aRetVal = writeLen * mChannels;
return rv;
return writeLen * mChannels;
}
NS_IMETHODIMP
nsHTMLAudioElement::MozCurrentSampleOffset(uint64_t *aRetVal)
HTMLAudioElement::MozWriteAudio(const JS::Value& aData, JSContext* aCx, uint32_t* aRetVal)
{
ErrorResult rv;
*aRetVal = MozWriteAudio(aCx, aData, rv);
return rv.ErrorCode();
}
uint64_t
HTMLAudioElement::MozCurrentSampleOffset(ErrorResult& aRv)
{
if (!IsAudioAPIEnabled()) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return 0;
}
if (!mAudioStream) {
return NS_ERROR_DOM_INVALID_STATE_ERR;
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return 0;
}
int64_t position = mAudioStream->GetPositionInFrames();
if (position < 0) {
*aRetVal = 0;
} else {
*aRetVal = position * mChannels;
return 0;
}
return NS_OK;
return position * mChannels;
}
nsresult nsHTMLAudioElement::SetAcceptHeader(nsIHttpChannel* aChannel)
NS_IMETHODIMP
HTMLAudioElement::MozCurrentSampleOffset(uint64_t *aRetVal)
{
ErrorResult rv;
*aRetVal = MozCurrentSampleOffset(rv);
return rv.ErrorCode();
}
nsresult HTMLAudioElement::SetAcceptHeader(nsIHttpChannel* aChannel)
{
nsAutoCString value(
#ifdef MOZ_WEBM
@ -244,3 +318,12 @@ nsresult nsHTMLAudioElement::SetAcceptHeader(nsIHttpChannel* aChannel)
value,
false);
}
JSObject*
HTMLAudioElement::WrapNode(JSContext* aCx, JSObject* aScope)
{
return HTMLAudioElementBinding::Wrap(aCx, aScope, this);
}
} // namespace dom
} // namespace mozilla

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -70,7 +70,7 @@ HTMLSourceElement::BindToTree(nsIDocument *aDocument,
if (!aParent || !aParent->IsNodeOfType(nsINode::eMEDIA))
return NS_OK;
nsHTMLMediaElement* media = static_cast<nsHTMLMediaElement*>(aParent);
HTMLMediaElement* media = static_cast<HTMLMediaElement*>(aParent);
media->NotifyAddedSource();
return NS_OK;

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

@ -9,7 +9,7 @@
#include "nsIDOMHTMLSourceElement.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLMediaElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
namespace mozilla {
namespace dom {

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

@ -0,0 +1,240 @@
/* -*- 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 "mozilla/Util.h"
#include "nsIDOMHTMLVideoElement.h"
#include "nsIDOMHTMLSourceElement.h"
#include "mozilla/dom/HTMLVideoElement.h"
#include "mozilla/dom/HTMLVideoElementBinding.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsSize.h"
#include "nsError.h"
#include "nsNodeInfoManager.h"
#include "plbase64.h"
#include "nsNetUtil.h"
#include "nsXPCOMStrings.h"
#include "prlock.h"
#include "nsThreadUtils.h"
#include "ImageContainer.h"
#include "nsIScriptSecurityManager.h"
#include "nsIXPConnect.h"
#include "jsapi.h"
#include "nsITimer.h"
#include "nsEventDispatcher.h"
#include "nsIDOMProgressEvent.h"
#include "MediaError.h"
#include "MediaDecoder.h"
NS_IMPL_NS_NEW_HTML_ELEMENT(Video)
DOMCI_NODE_DATA(HTMLVideoElement, mozilla::dom::HTMLVideoElement)
namespace mozilla {
namespace dom {
NS_IMPL_ADDREF_INHERITED(HTMLVideoElement, HTMLMediaElement)
NS_IMPL_RELEASE_INHERITED(HTMLVideoElement, HTMLMediaElement)
NS_INTERFACE_TABLE_HEAD(HTMLVideoElement)
NS_HTML_CONTENT_INTERFACE_TABLE2(HTMLVideoElement, nsIDOMHTMLMediaElement, nsIDOMHTMLVideoElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLVideoElement,
HTMLMediaElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLVideoElement)
NS_IMPL_ELEMENT_CLONE(HTMLVideoElement)
// nsIDOMHTMLVideoElement
NS_IMPL_INT_ATTR(HTMLVideoElement, Width, width)
NS_IMPL_INT_ATTR(HTMLVideoElement, Height, height)
// nsIDOMHTMLVideoElement
/* readonly attribute unsigned long videoWidth; */
NS_IMETHODIMP HTMLVideoElement::GetVideoWidth(uint32_t *aVideoWidth)
{
*aVideoWidth = VideoWidth();
return NS_OK;
}
/* readonly attribute unsigned long videoHeight; */
NS_IMETHODIMP HTMLVideoElement::GetVideoHeight(uint32_t *aVideoHeight)
{
*aVideoHeight = VideoHeight();
return NS_OK;
}
HTMLVideoElement::HTMLVideoElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: HTMLMediaElement(aNodeInfo)
{
SetIsDOMBinding();
}
HTMLVideoElement::~HTMLVideoElement()
{
}
nsresult HTMLVideoElement::GetVideoSize(nsIntSize* size)
{
if (mMediaSize.width == -1 && mMediaSize.height == -1) {
return NS_ERROR_FAILURE;
}
size->height = mMediaSize.height;
size->width = mMediaSize.width;
return NS_OK;
}
bool
HTMLVideoElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height) {
return aResult.ParseSpecialIntValue(aValue);
}
return HTMLMediaElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}
NS_IMETHODIMP_(bool)
HTMLVideoElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{
static const MappedAttributeEntry attributes[] = {
{ &nsGkAtoms::width },
{ &nsGkAtoms::height },
{ nullptr }
};
static const MappedAttributeEntry* const map[] = {
attributes,
sCommonAttributeMap
};
return FindAttributeDependence(aAttribute, map);
}
nsMapRuleToAttributesFunc
HTMLVideoElement::GetAttributeMappingFunction() const
{
return &MapAttributesIntoRule;
}
nsresult HTMLVideoElement::SetAcceptHeader(nsIHttpChannel* aChannel)
{
nsAutoCString value(
#ifdef MOZ_WEBM
"video/webm,"
#endif
#ifdef MOZ_OGG
"video/ogg,"
#endif
"video/*;q=0.9,"
#ifdef MOZ_OGG
"application/ogg;q=0.7,"
#endif
"audio/*;q=0.6,*/*;q=0.5");
return aChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
value,
false);
}
NS_IMPL_URI_ATTR(HTMLVideoElement, Poster, poster)
uint32_t HTMLVideoElement::MozParsedFrames() const
{
MOZ_ASSERT(NS_IsMainThread(), "Should be on main thread.");
return mDecoder ? mDecoder->GetFrameStatistics().GetParsedFrames() : 0;
}
NS_IMETHODIMP HTMLVideoElement::GetMozParsedFrames(uint32_t *aMozParsedFrames)
{
*aMozParsedFrames = MozParsedFrames();
return NS_OK;
}
uint32_t HTMLVideoElement::MozDecodedFrames() const
{
MOZ_ASSERT(NS_IsMainThread(), "Should be on main thread.");
return mDecoder ? mDecoder->GetFrameStatistics().GetDecodedFrames() : 0;
}
NS_IMETHODIMP HTMLVideoElement::GetMozDecodedFrames(uint32_t *aMozDecodedFrames)
{
*aMozDecodedFrames = MozDecodedFrames();
return NS_OK;
}
uint32_t HTMLVideoElement::MozPresentedFrames() const
{
MOZ_ASSERT(NS_IsMainThread(), "Should be on main thread.");
return mDecoder ? mDecoder->GetFrameStatistics().GetPresentedFrames() : 0;
}
NS_IMETHODIMP HTMLVideoElement::GetMozPresentedFrames(uint32_t *aMozPresentedFrames)
{
*aMozPresentedFrames = MozPresentedFrames();
return NS_OK;
}
uint32_t HTMLVideoElement::MozPaintedFrames()
{
MOZ_ASSERT(NS_IsMainThread(), "Should be on main thread.");
layers::ImageContainer* container = GetImageContainer();
return container ? container->GetPaintCount() : 0;
}
NS_IMETHODIMP HTMLVideoElement::GetMozPaintedFrames(uint32_t *aMozPaintedFrames)
{
*aMozPaintedFrames = MozPaintedFrames();
return NS_OK;
}
double HTMLVideoElement::MozFrameDelay()
{
MOZ_ASSERT(NS_IsMainThread(), "Should be on main thread.");
VideoFrameContainer* container = GetVideoFrameContainer();
return container ? container->GetFrameDelay() : 0;
}
NS_IMETHODIMP HTMLVideoElement::GetMozFrameDelay(double *aMozFrameDelay) {
*aMozFrameDelay = MozFrameDelay();
return NS_OK;
}
/* readonly attribute bool mozHasAudio */
bool HTMLVideoElement::MozHasAudio() const
{
MOZ_ASSERT(NS_IsMainThread(), "Should be on main thread.");
return mHasAudio;
}
NS_IMETHODIMP HTMLVideoElement::GetMozHasAudio(bool *aHasAudio) {
*aHasAudio = MozHasAudio();
return NS_OK;
}
JSObject*
HTMLVideoElement::WrapNode(JSContext* aCx, JSObject* aScope)
{
return HTMLVideoElementBinding::Wrap(aCx, aScope, this);
}
} // namespace dom
} // namespace mozilla

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

@ -160,12 +160,12 @@ EXPORTS_mozilla/dom += \
$(NULL)
CPPSRCS += \
nsHTMLAudioElement.cpp \
nsHTMLMediaElement.cpp \
HTMLAudioElement.cpp \
HTMLMediaElement.cpp \
MediaError.cpp \
HTMLSourceElement.cpp \
TimeRanges.cpp \
nsHTMLVideoElement.cpp \
HTMLVideoElement.cpp \
$(NULL)
endif

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

@ -21,7 +21,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MediaError)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMediaError)
NS_INTERFACE_MAP_END
MediaError::MediaError(nsHTMLMediaElement* aParent, uint16_t aCode)
MediaError::MediaError(HTMLMediaElement* aParent, uint16_t aCode)
: mParent(aParent)
, mCode(aCode)
{

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

@ -8,7 +8,7 @@
#define mozilla_dom_MediaError_h
#include "nsIDOMMediaError.h"
#include "nsHTMLMediaElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "nsWrapperCache.h"
#include "nsISupports.h"
#include "mozilla/Attributes.h"
@ -20,7 +20,7 @@ class MediaError MOZ_FINAL : public nsIDOMMediaError,
public nsWrapperCache
{
public:
MediaError(nsHTMLMediaElement* aParent, uint16_t aCode);
MediaError(HTMLMediaElement* aParent, uint16_t aCode);
// nsISupports
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -29,7 +29,7 @@ public:
// nsIDOMMediaError
NS_DECL_NSIDOMMEDIAERROR
nsHTMLMediaElement* GetParentObject() const
HTMLMediaElement* GetParentObject() const
{
return mParent;
}
@ -42,7 +42,7 @@ public:
}
private:
nsRefPtr<nsHTMLMediaElement> mParent;
nsRefPtr<HTMLMediaElement> mParent;
// Error code
const uint16_t mCode;

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

@ -6,7 +6,7 @@
#include "mozilla/dom/TimeRanges.h"
#include "mozilla/dom/TimeRangesBinding.h"
#include "nsHTMLMediaElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "nsContentUtils.h"
#include "nsDOMClassInfoID.h"
#include "nsError.h"

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

@ -1090,6 +1090,20 @@ AssertDocumentOrder(const nsTArray<nsGenericHTMLFormElement*>& aControls,
}
#endif
void
nsHTMLFormElement::PostPasswordEvent()
{
// Don't fire another add event if we have a pending add event.
if (mFormPasswordEvent.get()) {
return;
}
nsRefPtr<FormPasswordEvent> event =
new FormPasswordEvent(this, NS_LITERAL_STRING("DOMFormHasPassword"));
mFormPasswordEvent = event;
event->PostDOMEvent();
}
nsresult
nsHTMLFormElement::AddElement(nsGenericHTMLFormElement* aChild,
bool aUpdateValidity, bool aNotify)
@ -1157,12 +1171,14 @@ nsHTMLFormElement::AddElement(nsGenericHTMLFormElement* aChild,
// If it is a password control, and the password manager has not yet been
// initialized, initialize the password manager
//
if (!gPasswordManagerInitialized && type == NS_FORM_INPUT_PASSWORD) {
// Initialize the password manager category
gPasswordManagerInitialized = true;
NS_CreateServicesFromCategory(NS_PASSWORDMANAGER_CATEGORY,
nullptr,
NS_PASSWORDMANAGER_CATEGORY);
if (type == NS_FORM_INPUT_PASSWORD) {
if (!gPasswordManagerInitialized) {
gPasswordManagerInitialized = true;
NS_CreateServicesFromCategory(NS_PASSWORDMANAGER_CATEGORY,
nullptr,
NS_PASSWORDMANAGER_CATEGORY);
}
PostPasswordEvent();
}
// Default submit element handling

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

@ -14,15 +14,15 @@
#include "nsIDOMHTMLFormElement.h"
#include "nsIWebProgressListener.h"
#include "nsIRadioGroupContainer.h"
#include "nsIURI.h"
#include "nsIWeakReferenceUtils.h"
#include "nsPIDOMWindow.h"
#include "nsThreadUtils.h"
#include "nsInterfaceHashtable.h"
#include "nsDataHashtable.h"
#include "nsAsyncDOMEvent.h"
class nsFormControlList;
class nsIMutableArray;
class nsIURI;
class nsHTMLFormElement : public nsGenericHTMLElement,
public nsIDOMHTMLFormElement,
@ -241,6 +241,26 @@ public:
bool HasEverTriedInvalidSubmit() const { return mEverTriedInvalidSubmit; }
protected:
void PostPasswordEvent();
void EventHandled() { mFormPasswordEvent = nullptr; }
class FormPasswordEvent : public nsAsyncDOMEvent
{
public:
FormPasswordEvent(nsHTMLFormElement* aEventNode,
const nsAString& aEventType)
: nsAsyncDOMEvent(aEventNode, aEventType, true, true)
{}
NS_IMETHOD Run()
{
static_cast<nsHTMLFormElement*>(mEventNode.get())->EventHandled();
return nsAsyncDOMEvent::Run();
}
};
nsRefPtr<FormPasswordEvent> mFormPasswordEvent;
class RemoveElementRunnable;
friend class RemoveElementRunnable;

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

@ -1,201 +0,0 @@
/* -*- 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 "mozilla/Util.h"
#include "nsIDOMHTMLVideoElement.h"
#include "nsIDOMHTMLSourceElement.h"
#include "nsHTMLVideoElement.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsSize.h"
#include "nsError.h"
#include "nsNodeInfoManager.h"
#include "plbase64.h"
#include "nsNetUtil.h"
#include "nsXPCOMStrings.h"
#include "prlock.h"
#include "nsThreadUtils.h"
#include "ImageContainer.h"
#include "nsIScriptSecurityManager.h"
#include "nsIXPConnect.h"
#include "jsapi.h"
#include "nsITimer.h"
#include "nsEventDispatcher.h"
#include "nsIDOMProgressEvent.h"
#include "MediaError.h"
#include "MediaDecoder.h"
using namespace mozilla;
using namespace mozilla::dom;
NS_IMPL_NS_NEW_HTML_ELEMENT(Video)
NS_IMPL_ADDREF_INHERITED(nsHTMLVideoElement, nsHTMLMediaElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLVideoElement, nsHTMLMediaElement)
DOMCI_NODE_DATA(HTMLVideoElement, nsHTMLVideoElement)
NS_INTERFACE_TABLE_HEAD(nsHTMLVideoElement)
NS_HTML_CONTENT_INTERFACE_TABLE2(nsHTMLVideoElement, nsIDOMHTMLMediaElement, nsIDOMHTMLVideoElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLVideoElement,
nsHTMLMediaElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLVideoElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLVideoElement)
// nsIDOMHTMLVideoElement
NS_IMPL_INT_ATTR(nsHTMLVideoElement, Width, width)
NS_IMPL_INT_ATTR(nsHTMLVideoElement, Height, height)
// nsIDOMHTMLVideoElement
/* readonly attribute unsigned long videoWidth; */
NS_IMETHODIMP nsHTMLVideoElement::GetVideoWidth(uint32_t *aVideoWidth)
{
*aVideoWidth = mMediaSize.width == -1 ? 0 : mMediaSize.width;
return NS_OK;
}
/* readonly attribute unsigned long videoHeight; */
NS_IMETHODIMP nsHTMLVideoElement::GetVideoHeight(uint32_t *aVideoHeight)
{
*aVideoHeight = mMediaSize.height == -1 ? 0 : mMediaSize.height;
return NS_OK;
}
nsHTMLVideoElement::nsHTMLVideoElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsHTMLMediaElement(aNodeInfo)
{
}
nsHTMLVideoElement::~nsHTMLVideoElement()
{
}
nsresult nsHTMLVideoElement::GetVideoSize(nsIntSize* size)
{
if (mMediaSize.width == -1 && mMediaSize.height == -1) {
return NS_ERROR_FAILURE;
}
size->height = mMediaSize.height;
size->width = mMediaSize.width;
return NS_OK;
}
bool
nsHTMLVideoElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height) {
return aResult.ParseSpecialIntValue(aValue);
}
return nsHTMLMediaElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}
NS_IMETHODIMP_(bool)
nsHTMLVideoElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{
static const MappedAttributeEntry attributes[] = {
{ &nsGkAtoms::width },
{ &nsGkAtoms::height },
{ nullptr }
};
static const MappedAttributeEntry* const map[] = {
attributes,
sCommonAttributeMap
};
return FindAttributeDependence(aAttribute, map);
}
nsMapRuleToAttributesFunc
nsHTMLVideoElement::GetAttributeMappingFunction() const
{
return &MapAttributesIntoRule;
}
nsresult nsHTMLVideoElement::SetAcceptHeader(nsIHttpChannel* aChannel)
{
nsAutoCString value(
#ifdef MOZ_WEBM
"video/webm,"
#endif
#ifdef MOZ_OGG
"video/ogg,"
#endif
"video/*;q=0.9,"
#ifdef MOZ_OGG
"application/ogg;q=0.7,"
#endif
"audio/*;q=0.6,*/*;q=0.5");
return aChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
value,
false);
}
NS_IMPL_URI_ATTR(nsHTMLVideoElement, Poster, poster)
NS_IMETHODIMP nsHTMLVideoElement::GetMozParsedFrames(uint32_t *aMozParsedFrames)
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
*aMozParsedFrames = mDecoder ? mDecoder->GetFrameStatistics().GetParsedFrames() : 0;
return NS_OK;
}
NS_IMETHODIMP nsHTMLVideoElement::GetMozDecodedFrames(uint32_t *aMozDecodedFrames)
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
*aMozDecodedFrames = mDecoder ? mDecoder->GetFrameStatistics().GetDecodedFrames() : 0;
return NS_OK;
}
NS_IMETHODIMP nsHTMLVideoElement::GetMozPresentedFrames(uint32_t *aMozPresentedFrames)
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
*aMozPresentedFrames = mDecoder ? mDecoder->GetFrameStatistics().GetPresentedFrames() : 0;
return NS_OK;
}
NS_IMETHODIMP nsHTMLVideoElement::GetMozPaintedFrames(uint32_t *aMozPaintedFrames)
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
ImageContainer* container = GetImageContainer();
*aMozPaintedFrames = container ? container->GetPaintCount() : 0;
return NS_OK;
}
NS_IMETHODIMP nsHTMLVideoElement::GetMozFrameDelay(double *aMozFrameDelay) {
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
VideoFrameContainer* container = GetVideoFrameContainer();
*aMozFrameDelay = container ? container->GetFrameDelay() : 0;
return NS_OK;
}
/* readonly attribute bool mozHasAudio */
NS_IMETHODIMP nsHTMLVideoElement::GetMozHasAudio(bool *aHasAudio) {
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
*aHasAudio = mHasAudio;
return NS_OK;
}

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

@ -353,6 +353,11 @@ MOCHITEST_FILES = \
test_formData.html \
$(NULL)
ifdef MOZ_MEDIA
MOCHITEST_FILES += \
test_mozLoadFrom.html \
$(NULL)
endif
MOCHITEST_BROWSER_FILES = \
browser_bug649778.js \

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

@ -0,0 +1,19 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for mozLoadFrom</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script>
try {
document.createElement("video").mozLoadFrom({});
ok(false, "This should be throw an exception");
} catch(e) {
ok(true, "This should be throw an exception");
}
</script>
</body>
</html>

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

@ -10,6 +10,7 @@
#include "nsIImageLoadingContent.h"
#include "nsGenericHTMLElement.h"
#include "nsIDocumentInlines.h"
#include "nsDOMTokenList.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMEvent.h"
#include "nsIDOMKeyEvent.h"
@ -119,6 +120,13 @@ protected:
void ResetZoomLevel();
float GetZoomLevel();
enum eModeClasses {
eNone,
eShrinkToFit,
eOverflowing
};
void SetModeClass(eModeClasses mode);
nsresult OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage);
nsresult OnStopRequest(imgIRequest *aRequest, nsresult aStatus);
@ -421,8 +429,7 @@ ImageDocument::ShrinkToFit()
// origin now that we're showing a shrunk-to-window version.
(void) ScrollImageTo(0, 0, false);
imageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::style,
NS_LITERAL_STRING("cursor: -moz-zoom-in"), true);
SetModeClass(eShrinkToFit);
mImageIsResized = true;
@ -474,11 +481,10 @@ ImageDocument::RestoreImage()
imageContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::height, true);
if (mImageIsOverflowing) {
imageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::style,
NS_LITERAL_STRING("cursor: -moz-zoom-out"), true);
SetModeClass(eOverflowing);
}
else {
imageContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::style, true);
SetModeClass(eNone);
}
mImageIsResized = false;
@ -514,13 +520,15 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
return OnStartContainer(aRequest, image);
}
nsDOMTokenList* classList = mImageContent->AsElement()->GetClassList();
mozilla::ErrorResult rv;
if (aType == imgINotificationObserver::DECODE_COMPLETE) {
if (mImageContent) {
// Update the background-color of the image only after the
// image has been decoded to prevent flashes of just the
// background-color.
mImageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::_class,
NS_LITERAL_STRING("decoded"), true);
classList->Add(NS_LITERAL_STRING("decoded"), rv);
NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
}
}
@ -528,8 +536,8 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
// mImageContent can be null if the document is already destroyed
if (mImageContent) {
// Remove any decoded-related styling when the image is unloaded.
mImageContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::_class,
true);
classList->Remove(NS_LITERAL_STRING("decoded"), rv);
NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
}
}
@ -544,6 +552,25 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
return NS_OK;
}
void
ImageDocument::SetModeClass(eModeClasses mode)
{
nsDOMTokenList* classList = mImageContent->AsElement()->GetClassList();
mozilla::ErrorResult rv;
if (mode == eShrinkToFit) {
classList->Add(NS_LITERAL_STRING("shrinkToFit"), rv);
} else {
classList->Remove(NS_LITERAL_STRING("shrinkToFit"), rv);
}
if (mode == eOverflowing) {
classList->Add(NS_LITERAL_STRING("overflowing"), rv);
} else {
classList->Remove(NS_LITERAL_STRING("overflowing"), rv);
}
}
nsresult
ImageDocument::OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage)
{

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

@ -7,7 +7,7 @@
#include "nsGkAtoms.h"
#include "nsNodeInfoManager.h"
#include "nsContentCreatorFunctions.h"
#include "nsHTMLMediaElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "nsIDocumentInlines.h"
#include "nsContentUtils.h"
#include "mozilla/dom/Element.h"
@ -101,9 +101,9 @@ VideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
nsIDOMNode::ELEMENT_NODE);
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
nsRefPtr<nsHTMLMediaElement> element =
static_cast<nsHTMLMediaElement*>(NS_NewHTMLVideoElement(nodeInfo.forget(),
NOT_FROM_PARSER));
nsRefPtr<HTMLMediaElement> element =
static_cast<HTMLMediaElement*>(NS_NewHTMLVideoElement(nodeInfo.forget(),
NOT_FROM_PARSER));
if (!element)
return NS_ERROR_OUT_OF_MEMORY;
element->SetAutoplay(true);

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

@ -104,11 +104,7 @@ static int PrefChanged(const char* aPref, void* aClosure)
gVolumeScale = std::max<double>(0, PR_strtod(utf8.get(), nullptr));
}
} else if (strcmp(aPref, PREF_USE_CUBEB) == 0) {
#ifdef MOZ_WIDGET_GONK
bool value = Preferences::GetBool(aPref, false);
#else
bool value = Preferences::GetBool(aPref, true);
#endif
MutexAutoLock lock(*gAudioPrefsLock);
gUseCubeb = value;
} else if (strcmp(aPref, PREF_CUBEB_LATENCY) == 0) {

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

@ -10,7 +10,7 @@
#include <limits>
#include "nsNetUtil.h"
#include "AudioStream.h"
#include "nsHTMLVideoElement.h"
#include "mozilla/dom/HTMLVideoElement.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsTArray.h"

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

@ -7,12 +7,14 @@
#define MediaDecoderOwner_h_
#include "AbstractMediaDecoder.h"
class nsHTMLMediaElement;
namespace mozilla {
class VideoFrameContainer;
namespace dom {
class HTMLMediaElement;
}
class MediaDecoderOwner
{
public:
@ -34,9 +36,9 @@ public:
*/
virtual void FireTimeUpdate(bool aPeriodic) = 0;
// Get the nsHTMLMediaElement object if the decoder is being used from an
// Get the HTMLMediaElement object if the decoder is being used from an
// HTML media element, and null otherwise.
virtual nsHTMLMediaElement* GetMediaElement()
virtual dom::HTMLMediaElement* GetMediaElement()
{
return nullptr;
}

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

@ -14,7 +14,7 @@
#include "ImageLayers.h"
#include "AudioSampleFormat.h"
#include "MediaResource.h"
#include "nsHTMLMediaElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
namespace mozilla {

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

@ -23,7 +23,7 @@
#include "nsIStreamListener.h"
#include "nsIScriptSecurityManager.h"
#include "nsCrossSiteListenerProxy.h"
#include "nsHTMLMediaElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "nsError.h"
#include "nsICachingChannel.h"
#include "nsURILoader.h"
@ -152,7 +152,7 @@ ChannelMediaResource::OnStartRequest(nsIRequest* aRequest)
MediaDecoderOwner* owner = mDecoder->GetMediaOwner();
NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
nsHTMLMediaElement* element = owner->GetMediaElement();
HTMLMediaElement* element = owner->GetMediaElement();
NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
nsresult status;
nsresult rv = aRequest->GetStatus(&status);
@ -610,7 +610,7 @@ nsresult ChannelMediaResource::OpenChannel(nsIStreamListener** aStreamListener)
// an authorizing Access-Control header.
MediaDecoderOwner* owner = mDecoder->GetMediaOwner();
NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
nsHTMLMediaElement* element = owner->GetMediaElement();
HTMLMediaElement* element = owner->GetMediaElement();
NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
if (element->ShouldCheckAllowOrigin()) {
nsRefPtr<nsCORSListenerProxy> crossSiteListener =
@ -669,7 +669,7 @@ void ChannelMediaResource::SetupChannelHeaders()
if (!owner) {
return;
}
nsHTMLMediaElement* element = owner->GetMediaElement();
HTMLMediaElement* element = owner->GetMediaElement();
if (!element) {
return;
}
@ -818,7 +818,7 @@ void ChannelMediaResource::Suspend(bool aCloseImmediately)
// Shutting down; do nothing.
return;
}
nsHTMLMediaElement* element = owner->GetMediaElement();
HTMLMediaElement* element = owner->GetMediaElement();
if (!element) {
// Shutting down; do nothing.
return;
@ -853,7 +853,7 @@ void ChannelMediaResource::Resume()
// Shutting down; do nothing.
return;
}
nsHTMLMediaElement* element = owner->GetMediaElement();
HTMLMediaElement* element = owner->GetMediaElement();
if (!element) {
// Shutting down; do nothing.
return;
@ -902,7 +902,7 @@ ChannelMediaResource::RecreateChannel()
// The decoder is being shut down, so don't bother opening a new channel
return NS_OK;
}
nsHTMLMediaElement* element = owner->GetMediaElement();
HTMLMediaElement* element = owner->GetMediaElement();
if (!element) {
// The decoder is being shut down, so don't bother opening a new channel
return NS_OK;
@ -1430,7 +1430,7 @@ nsresult FileMediaResource::Open(nsIStreamListener** aStreamListener)
// web server.
MediaDecoderOwner* owner = mDecoder->GetMediaOwner();
NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
nsHTMLMediaElement* element = owner->GetMediaElement();
HTMLMediaElement* element = owner->GetMediaElement();
NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
rv = nsContentUtils::GetSecurityManager()->
@ -1495,7 +1495,7 @@ MediaResource* FileMediaResource::CloneData(MediaDecoder* aDecoder)
// The decoder is being shut down, so we can't clone
return nullptr;
}
nsHTMLMediaElement* element = owner->GetMediaElement();
HTMLMediaElement* element = owner->GetMediaElement();
if (!element) {
// The decoder is being shut down, so we can't clone
return nullptr;
@ -1610,7 +1610,7 @@ void BaseMediaResource::MoveLoadsToBackground() {
NS_WARNING("Null owner in MediaResource::MoveLoadsToBackground()");
return;
}
nsHTMLMediaElement* element = owner->GetMediaElement();
HTMLMediaElement* element = owner->GetMediaElement();
if (!element) {
NS_WARNING("Null element in MediaResource::MoveLoadsToBackground()");
return;

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

@ -4,6 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "StreamBuffer.h"
#include "prlog.h"
#include <algorithm>
namespace mozilla {

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

@ -6,7 +6,7 @@
#include "VideoFrameContainer.h"
#include "nsHTMLMediaElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "nsIFrame.h"
#include "nsDisplayList.h"
#include "nsSVGEffects.h"
@ -16,7 +16,7 @@ using namespace mozilla::layers;
namespace mozilla {
VideoFrameContainer::VideoFrameContainer(nsHTMLMediaElement* aElement,
VideoFrameContainer::VideoFrameContainer(dom::HTMLMediaElement* aElement,
already_AddRefed<ImageContainer> aContainer)
: mElement(aElement),
mImageContainer(aContainer), mMutex("nsVideoFrameContainer"),

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

@ -14,10 +14,12 @@
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
class nsHTMLMediaElement;
namespace mozilla {
namespace dom {
class HTMLMediaElement;
}
namespace layers {
class Image;
class ImageContainer;
@ -34,12 +36,12 @@ class ImageContainer;
*/
class VideoFrameContainer {
public:
typedef mozilla::layers::ImageContainer ImageContainer;
typedef mozilla::layers::Image Image;
typedef layers::ImageContainer ImageContainer;
typedef layers::Image Image;
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VideoFrameContainer)
VideoFrameContainer(nsHTMLMediaElement* aElement,
VideoFrameContainer(dom::HTMLMediaElement* aElement,
already_AddRefed<ImageContainer> aContainer);
~VideoFrameContainer();
@ -61,7 +63,7 @@ public:
protected:
// Non-addreffed pointer to the element. The element calls ForgetElement
// to clear this reference when the element is destroyed.
nsHTMLMediaElement* mElement;
dom::HTMLMediaElement* mElement;
nsRefPtr<ImageContainer> mImageContainer;
// mMutex protects all the fields below.

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

@ -10,11 +10,11 @@
* DASH is an adaptive bitrate streaming technology where a multimedia file is
* partitioned into one or more segments and delivered to a client using HTTP.
*
* Interaction with MediaDecoderStateMachine, nsHTMLMediaElement,
* Interaction with MediaDecoderStateMachine, HTMLMediaElement,
* ChannelMediaResource and sub-decoders (WebMDecoder).
*
*
* MediaDecoderStateMachine nsHTMLMediaElement
* MediaDecoderStateMachine HTMLMediaElement
* 1 / \ 1 / 1
* / \ /
* 1 / \ 1 / 1
@ -81,7 +81,7 @@
* -- At this point the Segment media stream downloads are managed by
* individual |ChannelMediaResource|s and |WebMReader|s.
* A single |DASHDecoder| and |MediaDecoderStateMachine| manage them
* and communicate to |nsHTMLMediaElement|.
* and communicate to |HTMLMediaElement|.
*
* Each |DASHRepDecoder| gets init range and index range from its MPD
* |Representation|. |DASHRepDecoder| uses ChannelMediaResource to start the
@ -565,7 +565,7 @@ DASHDecoder::CreateSubChannel(nsIURI* aUrl, nsIChannel** aChannel)
NS_ENSURE_ARG(aUrl);
NS_ENSURE_TRUE(mOwner, NS_ERROR_NULL_POINTER);
nsHTMLMediaElement* element = mOwner->GetMediaElement();
HTMLMediaElement* element = mOwner->GetMediaElement();
NS_ENSURE_TRUE(element, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsILoadGroup> loadGroup =

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

@ -196,7 +196,7 @@ DASHReader::ReadMetadata(VideoInfo* aInfo,
// Read metadata for all video streams.
for (uint i = 0; i < mVideoReaders.Length(); i++) {
// Use an nsAutoPtr here to ensure |tags| memory does not leak.
nsAutoPtr<nsHTMLMediaElement::MetadataTags> tags;
nsAutoPtr<HTMLMediaElement::MetadataTags> tags;
rv = mVideoReaders[i]->ReadMetadata(&videoInfo, getter_Transfers(tags));
NS_ENSURE_SUCCESS(rv, rv);
// Use metadata from current video sub reader to populate aInfo.

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

@ -17,7 +17,7 @@
#include <opus/opus.h>
#include "opus/opus_multistream.h"
// For MOZ_SAMPLE_TYPE_*
#include "nsHTMLMediaElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "MediaDecoderStateMachine.h"
#include "MediaDecoderReader.h"
#endif

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

@ -7,7 +7,7 @@
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/TimeRanges.h"
#include "MediaResource.h"
#include "nsHTMLMediaElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "MediaPluginHost.h"
#include "nsXPCOMStrings.h"
#include "nsISeekableStream.h"

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

@ -92,7 +92,7 @@ function createVideo() {
var v = document.createElement('video');
v.addEventListener('loadeddata', eventHandler, false);
v.addEventListener('error', eventHandler, false);
v.crossorigin = 'anonymous';
v.crossOrigin = 'anonymous';
return v;
}

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

@ -156,15 +156,15 @@ is(HTMLElement.prototype.MEDIA_ERR_ABORTED, undefined);
is(HTMLElement.prototype.MEDIA_ERR_NETWORK, undefined);
is(HTMLElement.prototype.MEDIA_ERR_DECODE, undefined);
is(HTMLElement.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED, undefined);
todo_is(HTMLMediaElement.prototype.NETWORK_EMPTY, 0, "HTMLMediaElement.prototype.NETWORK_EMPTY");
todo_is(HTMLMediaElement.prototype.NETWORK_IDLE, 1, "HTMLMediaElement.prototype.NETWORK_IDLE");
todo_is(HTMLMediaElement.prototype.NETWORK_LOADING, 2, "HTMLMediaElement.prototype.NETWORK_LOADING");
todo_is(HTMLMediaElement.prototype.NETWORK_NO_SOURCE, 3, "HTMLMediaElement.prototype.NETWORK_NO_SOURCE");
todo_is(HTMLMediaElement.prototype.HAVE_NOTHING, 0, "HTMLMediaElement.prototype.HAVE_NOTHING");
todo_is(HTMLMediaElement.prototype.HAVE_METADATA, 1, "HTMLMediaElement.prototype.HAVE_METADATA");
todo_is(HTMLMediaElement.prototype.HAVE_CURRENT_DATA, 2, "HTMLMediaElement.prototype.HAVE_CURRENT_DATA");
todo_is(HTMLMediaElement.prototype.HAVE_FUTURE_DATA, 3, "HTMLMediaElement.prototype.HAVE_FUTURE_DATA");
todo_is(HTMLMediaElement.prototype.HAVE_ENOUGH_DATA, 4, "HTMLMediaElement.prototype.HAVE_ENOUGH_DATA");
is(HTMLMediaElement.prototype.NETWORK_EMPTY, 0, "HTMLMediaElement.prototype.NETWORK_EMPTY");
is(HTMLMediaElement.prototype.NETWORK_IDLE, 1, "HTMLMediaElement.prototype.NETWORK_IDLE");
is(HTMLMediaElement.prototype.NETWORK_LOADING, 2, "HTMLMediaElement.prototype.NETWORK_LOADING");
is(HTMLMediaElement.prototype.NETWORK_NO_SOURCE, 3, "HTMLMediaElement.prototype.NETWORK_NO_SOURCE");
is(HTMLMediaElement.prototype.HAVE_NOTHING, 0, "HTMLMediaElement.prototype.HAVE_NOTHING");
is(HTMLMediaElement.prototype.HAVE_METADATA, 1, "HTMLMediaElement.prototype.HAVE_METADATA");
is(HTMLMediaElement.prototype.HAVE_CURRENT_DATA, 2, "HTMLMediaElement.prototype.HAVE_CURRENT_DATA");
is(HTMLMediaElement.prototype.HAVE_FUTURE_DATA, 3, "HTMLMediaElement.prototype.HAVE_FUTURE_DATA");
is(HTMLMediaElement.prototype.HAVE_ENOUGH_DATA, 4, "HTMLMediaElement.prototype.HAVE_ENOUGH_DATA");
is(HTMLMediaElement.prototype.MEDIA_ERR_ABORTED, undefined, "HTMLMediaElement.prototype.MEDIA_ERR_ABORTED");
is(HTMLMediaElement.prototype.MEDIA_ERR_NETWORK, undefined, "HTMLMediaElement.prototype.MEDIA_ERR_NETWORK");
is(HTMLMediaElement.prototype.MEDIA_ERR_DECODE, undefined, "HTMLMediaElement.prototype.MEDIA_ERR_DECODE");

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

@ -33,7 +33,7 @@ function checkPlaybackRate(wallclock, media, expected, threshold) {
return false;
}
// Those value are expected to match those at the top of nsHTMLMediaElement.cpp.
// Those value are expected to match those at the top of HTMLMediaElement.cpp.
let VERY_SLOW_RATE = 0.1,
SLOW_RATE = 0.25,
FAST_RATE = 5,

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

@ -28,7 +28,7 @@ function doTest() {
b.mozSrcObject = "invalid";
ok(false, "Setting mozSrcObject to an invalid value should throw.");
} catch (e) {
todo(e instanceof TypeError, "Exception should be a TypeError");
ok(e instanceof TypeError, "Exception should be a TypeError");
}
is(b.mozSrcObject, stream, "Stream not set to invalid value");
is(b.src, newSrc, "src attribute not affected by setting srcObject");

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

@ -13,11 +13,11 @@
<script class="testbody" type="text/javascript">
function test(element, value, shouldThrow) {
var threw = false;
var threw = null;
try {
element.volume = value;
} catch (err if err.name == "IndexSizeError") {
threw = true;
} catch (ex) {
threw = ex.name;
}
is(shouldThrow, threw, "Case: " +element.id+ " setVolume=" + value);
}
@ -27,12 +27,12 @@ var ids = new Array(document.getElementById('v1'), document.getElementById('a1')
for (i=0; i<ids.length; i++) {
var element = ids[i];
test(element, 0.0, false);
test(element, 1.0, false);
test(element, -0.1, true);
test(element, 1.1, true);
test(element, undefined, true);
test(element, NaN, true);
test(element, 0.0, null);
test(element, 1.0, null);
test(element, -0.1, "IndexSizeError");
test(element, 1.1, "IndexSizeError");
test(element, undefined, "TypeError");
test(element, NaN, "TypeError");
}
</script>

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

@ -140,7 +140,7 @@ nsresult WaveReader::ReadMetadata(VideoInfo* aInfo,
return NS_ERROR_FAILURE;
}
nsAutoPtr<nsHTMLMediaElement::MetadataTags> tags;
nsAutoPtr<HTMLMediaElement::MetadataTags> tags;
bool loadAllChunks = LoadAllChunks(tags);
if (!loadAllChunks) {
@ -531,7 +531,7 @@ WaveReader::GetNextChunk(uint32_t* aChunk, uint32_t* aChunkSize)
bool
WaveReader::LoadListChunk(uint32_t aChunkSize,
nsAutoPtr<nsHTMLMediaElement::MetadataTags> &aTags)
nsAutoPtr<HTMLMediaElement::MetadataTags> &aTags)
{
// List chunks are always word (two byte) aligned.
NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0,
@ -564,7 +564,7 @@ WaveReader::LoadListChunk(uint32_t aChunkSize,
const char* const end = chunk.get() + aChunkSize;
aTags = new nsHTMLMediaElement::MetadataTags;
aTags = new HTMLMediaElement::MetadataTags;
aTags->Init();
while (p + 8 < end) {
@ -605,7 +605,7 @@ WaveReader::LoadListChunk(uint32_t aChunkSize,
}
bool
WaveReader::LoadAllChunks(nsAutoPtr<nsHTMLMediaElement::MetadataTags> &aTags)
WaveReader::LoadAllChunks(nsAutoPtr<HTMLMediaElement::MetadataTags> &aTags)
{
// Chunks are always word (two byte) aligned.
NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0,

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

@ -53,8 +53,8 @@ private:
bool GetNextChunk(uint32_t* aChunk, uint32_t* aChunkSize);
bool LoadFormatChunk(uint32_t aChunkSize);
bool FindDataOffset(uint32_t aChunkSize);
bool LoadListChunk(uint32_t aChunkSize, nsAutoPtr<nsHTMLMediaElement::MetadataTags> &aTags);
bool LoadAllChunks(nsAutoPtr<nsHTMLMediaElement::MetadataTags> &aTags);
bool LoadListChunk(uint32_t aChunkSize, nsAutoPtr<dom::HTMLMediaElement::MetadataTags> &aTags);
bool LoadAllChunks(nsAutoPtr<dom::HTMLMediaElement::MetadataTags> &aTags);
// Returns the number of seconds that aBytes represents based on the
// current audio parameters. e.g. 176400 bytes is 1 second at 16-bit

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

@ -171,7 +171,7 @@ AudioNode::Connect(AudioNode& aDestination, uint32_t aOutput,
ProcessedMediaStream* ps =
static_cast<ProcessedMediaStream*>(aDestination.mStream.get());
input->mStreamPort =
ps->AllocateInputPort(mStream, MediaInputPort::FLAG_BLOCK_OUTPUT);
ps->AllocateInputPort(mStream, MediaInputPort::FLAG_BLOCK_INPUT);
}
}

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

@ -397,7 +397,7 @@ MediaDecodeTask::CreateReader()
mBufferDecoder = new BufferDecoder(resource);
// If you change this list to add support for new decoders, please consider
// updating nsHTMLMediaElement::CreateDecoder as well.
// updating HTMLMediaElement::CreateDecoder as well.
mDecoderReader = DecoderTraits::CreateReader(mContentType, mBufferDecoder);

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

@ -18,7 +18,6 @@ FAIL_ON_WARNINGS = 1
endif # !_MSC_VER
EXPORTS = \
nsISMILAnimationElement.h \
nsISMILAttr.h \
nsISMILType.h \
nsSMILAnimationController.h \

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

@ -1,127 +0,0 @@
/* -*- 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 NS_ISMILANIMATIONELEMENT_H_
#define NS_ISMILANIMATIONELEMENT_H_
#include "nsISupports.h"
//////////////////////////////////////////////////////////////////////////////
// nsISMILAnimationElement: Interface for elements that control the animation of
// some property of another element, e.g. <animate>, <set>.
#define NS_ISMILANIMATIONELEMENT_IID \
{ 0x29792cd9, 0x0f96, 0x4ba6, \
{ 0xad, 0xea, 0x03, 0x0e, 0x0b, 0xfe, 0x1e, 0xb7 } }
class nsISMILAttr;
class nsSMILAnimationFunction;
class nsSMILTimeContainer;
class nsSMILTimedElement;
class nsIAtom;
class nsAttrValue;
namespace mozilla {
namespace dom {
class Element;
} // namespace dom
} // namespace mozilla
enum nsSMILTargetAttrType {
eSMILTargetAttrType_auto,
eSMILTargetAttrType_CSS,
eSMILTargetAttrType_XML
};
class nsISMILAnimationElement : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISMILANIMATIONELEMENT_IID)
/*
* Returns this element as a mozilla::dom::Element.
*/
virtual const mozilla::dom::Element& AsElement() const = 0;
/*
* Non-const version of Element()
*/
virtual mozilla::dom::Element& AsElement() = 0;
/*
* Returns true if the element passes conditional processing
*/
virtual bool PassesConditionalProcessingTests() = 0;
/*
* Returns the source attribute as an nsAttrValue. The global namespace will
* be used.
*
* (The 'Anim' here and below is largely to avoid conflicts for subclasses
* that derive from Element)
*
* @param aName the name of the attr
* @returns true if the attribute was set (even when set to empty string)
* false when not set.
*/
virtual const nsAttrValue* GetAnimAttr(nsIAtom* aName) const = 0;
/*
* Get the current value of an attribute as a string. The global namespace
* will be used.
*
* @param aName the name of the attr
* @param aResult the value (may legitimately be the empty string) [OUT]
* @returns true if the attribute was set (even when set to empty string)
* false when not set.
*/
virtual bool GetAnimAttr(nsIAtom* aAttName, nsAString& aResult) const = 0;
/*
* Check for the presence of an attribute in the global namespace.
*/
virtual bool HasAnimAttr(nsIAtom* aAttName) const = 0;
/*
* Returns the target (animated) element.
*/
virtual mozilla::dom::Element* GetTargetElementContent() = 0;
/*
* Returns the name of the target (animated) attribute or property.
*/
virtual bool GetTargetAttributeName(int32_t* aNamespaceID,
nsIAtom** aLocalName) const = 0;
/*
* Returns the type of the target (animated) attribute or property.
*/
virtual nsSMILTargetAttrType GetTargetAttributeType() const = 0;
/*
* Returns the SMIL animation function associated with this animation element.
*
* The animation function is owned by the animation element.
*/
virtual nsSMILAnimationFunction& AnimationFunction() = 0;
/*
* Returns the SMIL timed element associated with this animation element.
*
* The timed element is owned by the animation element.
*/
virtual nsSMILTimedElement& TimedElement() = 0;
/*
* Returns the SMIL timed container root with which this animation element is
* associated (if any).
*/
virtual nsSMILTimeContainer* GetTimeContainer() = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsISMILAnimationElement,
NS_ISMILANIMATIONELEMENT_IID)
#endif // NS_ISMILANIMATIONELEMENT_H_

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

@ -10,10 +10,15 @@
class nsSMILValue;
class nsISMILType;
class nsISMILAnimationElement;
class nsIContent;
class nsAString;
namespace mozilla {
namespace dom {
class SVGAnimationElement;
}
}
////////////////////////////////////////////////////////////////////////
// nsISMILAttr: A variable targeted by SMIL for animation and can therefore have
// an underlying (base) value and an animated value For example, an attribute of
@ -46,7 +51,7 @@ public:
* @return NS_OK on success or an error code if creation failed.
*/
virtual nsresult ValueFromString(const nsAString& aStr,
const nsISMILAnimationElement* aSrcElement,
const mozilla::dom::SVGAnimationElement* aSrcElement,
nsSMILValue& aValue,
bool& aPreventCachingOfSandwich) const = 0;

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