mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge mozilla-central to fx-team
This commit is contained in:
commit
b4df3ca4bb
@ -289,6 +289,15 @@ this.EventManager.prototype = {
|
||||
aEvent.accessible, { delay: 500 });
|
||||
break;
|
||||
}
|
||||
case Events.VALUE_CHANGE:
|
||||
{
|
||||
let position = this.contentScope.contentControl.vc.position;
|
||||
let target = aEvent.accessible;
|
||||
if (position === target ||
|
||||
Utils.getEmbeddedControl(position) === target) {
|
||||
this.present(Presentation.valueChanged(target));
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -73,6 +73,12 @@ Presenter.prototype = {
|
||||
*/
|
||||
selectionChanged: function selectionChanged(aObject) {},
|
||||
|
||||
/**
|
||||
* Value has changed.
|
||||
* @param {nsIAccessible} aAccessible the object whose value has changed.
|
||||
*/
|
||||
valueChanged: function valueChanged(aAccessible) {},
|
||||
|
||||
/**
|
||||
* The tab, or the tab's document state has changed.
|
||||
* @param {nsIAccessible} aDocObj the tab document accessible that has had its
|
||||
@ -472,6 +478,19 @@ SpeechPresenter.prototype = {
|
||||
};
|
||||
},
|
||||
|
||||
valueChanged: function SpeechPresenter_valueChanged(aAccessible) {
|
||||
return {
|
||||
type: this.type,
|
||||
details: {
|
||||
actions: [
|
||||
{ method: 'speak',
|
||||
data: aAccessible.value,
|
||||
options: { enqueue: false } }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
actionInvoked: function SpeechPresenter_actionInvoked(aObject, aActionName) {
|
||||
let actions = [];
|
||||
if (aActionName === 'click') {
|
||||
@ -607,6 +626,10 @@ this.Presentation = {
|
||||
for each (p in this.presenters)];
|
||||
},
|
||||
|
||||
valueChanged: function valueChanged(aAccessible) {
|
||||
return [ p.valueChanged(aAccessible) for (p of this.presenters) ];
|
||||
},
|
||||
|
||||
tabStateChanged: function Presentation_tabStateChanged(aDocObj, aPageState) {
|
||||
return [p.tabStateChanged(aDocObj, aPageState)
|
||||
for each (p in this.presenters)];
|
||||
|
@ -8,7 +8,9 @@
|
||||
'<head><title>such app</title></head>' +
|
||||
'<body>' +
|
||||
'<h1>wow</h1>' +
|
||||
'<label><input type="checkbox">many option</label>' +
|
||||
'<label><input type="checkbox">many option</label><br>' +
|
||||
'<label for="r">much range</label>' +
|
||||
'<input min="0" max="10" value="5" type="range" id="r">' +
|
||||
'</body>' +
|
||||
'</html>';
|
||||
|
||||
|
@ -372,6 +372,22 @@ var ContentMessages = {
|
||||
}
|
||||
},
|
||||
|
||||
adjustRangeUp: {
|
||||
name: 'AccessFu:AdjustRange',
|
||||
json: {
|
||||
origin: 'top',
|
||||
direction: 'backward'
|
||||
}
|
||||
},
|
||||
|
||||
adjustRangeDown: {
|
||||
name: 'AccessFu:AdjustRange',
|
||||
json: {
|
||||
origin: 'top',
|
||||
direction: 'forward'
|
||||
}
|
||||
},
|
||||
|
||||
focusSelector: function focusSelector(aSelector, aBlur) {
|
||||
return {
|
||||
name: 'AccessFuTest:Focus',
|
||||
|
@ -46,15 +46,31 @@
|
||||
speak: 'checked',
|
||||
speak_checkFunc: 'todo_isnot'
|
||||
}],
|
||||
// uncheck checkbox
|
||||
[ContentMessages.simpleMoveNext, {
|
||||
speak: 'much range label'
|
||||
}],
|
||||
[ContentMessages.simpleMoveNext, {
|
||||
speak: 'much range 5 slider'
|
||||
}],
|
||||
[ContentMessages.adjustRangeUp,
|
||||
{ speak: '6'}],
|
||||
[ContentMessages.simpleMoveNext, {
|
||||
speak: 'Home button'
|
||||
}],
|
||||
|
||||
// Simple traversal backward
|
||||
[ContentMessages.simpleMovePrevious, {
|
||||
speak: 'many option checked check button such app'
|
||||
speak: 'much range 6 slider such app'
|
||||
}],
|
||||
[ContentMessages.adjustRangeDown,
|
||||
{ speak: '5'}],
|
||||
[ContentMessages.simpleMovePrevious, {
|
||||
speak: 'much range label'
|
||||
}],
|
||||
[ContentMessages.simpleMovePrevious, {
|
||||
speak: 'many option checked check button'
|
||||
}],
|
||||
// uncheck checkbox
|
||||
[ContentMessages.activateCurrent(), {
|
||||
speak: 'unchecked'
|
||||
}],
|
||||
|
@ -650,6 +650,9 @@ pref("hal.processPriorityManager.gonk.MASTER.OomScoreAdjust", 0);
|
||||
pref("hal.processPriorityManager.gonk.MASTER.KillUnderKB", 4096);
|
||||
pref("hal.processPriorityManager.gonk.MASTER.Nice", 0);
|
||||
|
||||
pref("hal.processPriorityManager.gonk.PREALLOC.OomScoreAdjust", 67);
|
||||
pref("hal.processPriorityManager.gonk.PREALLOC.Nice", 18);
|
||||
|
||||
pref("hal.processPriorityManager.gonk.FOREGROUND_HIGH.OomScoreAdjust", 67);
|
||||
pref("hal.processPriorityManager.gonk.FOREGROUND_HIGH.KillUnderKB", 5120);
|
||||
pref("hal.processPriorityManager.gonk.FOREGROUND_HIGH.Nice", 0);
|
||||
@ -676,19 +679,6 @@ pref("hal.processPriorityManager.gonk.BACKGROUND.Nice", 18);
|
||||
// Processes get this niceness when they have low CPU priority.
|
||||
pref("hal.processPriorityManager.gonk.LowCPUNice", 18);
|
||||
|
||||
// By default the compositor thread on gonk runs without real-time priority. RT
|
||||
// priority can be enabled by setting this pref to a value between 1 and 99.
|
||||
// Note that audio processing currently runs at RT priority 2 or 3 at most.
|
||||
//
|
||||
// If RT priority is disabled, then the compositor nice value is used. The
|
||||
// code will default to ANDROID_PRIORITY_URGENT_DISPLAY which is -8. Per gfx
|
||||
// request we are keeping the compositor at nice level 0 until we can complete
|
||||
// the investigation in bug 982972.
|
||||
//
|
||||
// Do not change these values without gfx team review.
|
||||
pref("hal.gonk.compositor.rt_priority", 0);
|
||||
pref("hal.gonk.compositor.nice", 0);
|
||||
|
||||
// Fire a memory pressure event when the system has less than Xmb of memory
|
||||
// remaining. You should probably set this just above Y.KillUnderKB for
|
||||
// the highest priority class Y that you want to make an effort to keep alive.
|
||||
|
59
b2g/chrome/content/desktop.css
Normal file
59
b2g/chrome/content/desktop.css
Normal file
@ -0,0 +1,59 @@
|
||||
#controls {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom:0;
|
||||
right: 0;
|
||||
height: 30px;
|
||||
background-color: -moz-dialog;
|
||||
}
|
||||
|
||||
#home-button {
|
||||
margin: auto;
|
||||
margin-top: 3px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
background: #eee url("images/desktop/home-black.png") center no-repeat;
|
||||
border: 1px solid #888;
|
||||
border-radius: 12px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#home-button::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
#home-button:hover {
|
||||
background-image: url("images/desktop/home-white.png");
|
||||
background-color: #ccc;
|
||||
border-color: #555;
|
||||
}
|
||||
|
||||
#home-button.active {
|
||||
background-image: url("images/desktop/home-white.png");
|
||||
background-color: #888;
|
||||
border-color: black;
|
||||
}
|
||||
|
||||
#rotate-button {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
bottom: 3px;
|
||||
right: 3px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
background: #eee url("images/desktop/rotate.png") center no-repeat;
|
||||
border: 1px solid #888;
|
||||
border-radius: 12px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#rotate-button:hover {
|
||||
background-color: #ccc;
|
||||
border-color: #555;
|
||||
}
|
||||
|
||||
#rotate-button.active {
|
||||
background-color: #888;
|
||||
border-color: black;
|
||||
}
|
@ -2,16 +2,51 @@
|
||||
* 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/. */
|
||||
|
||||
window.addEventListener("ContentStart", function(evt) {
|
||||
// Enable touch event shim on desktop that translates mouse events
|
||||
// into touch ones
|
||||
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {})
|
||||
// Enable touch event shim on desktop that translates mouse events
|
||||
// into touch ones
|
||||
function enableTouch() {
|
||||
let require = Cu.import('resource://gre/modules/devtools/Loader.jsm', {})
|
||||
.devtools.require;
|
||||
let { TouchEventHandler } = require("devtools/touch-events");
|
||||
let { TouchEventHandler } = require('devtools/touch-events');
|
||||
let chromeEventHandler = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell)
|
||||
.chromeEventHandler || window;
|
||||
let touchEventHandler = new TouchEventHandler(chromeEventHandler);
|
||||
touchEventHandler.start();
|
||||
}
|
||||
|
||||
function setupButtons() {
|
||||
let homeButton = document.getElementById('home-button');
|
||||
if (!homeButton) {
|
||||
// The toolbar only exists in b2g desktop build with
|
||||
// FXOS_SIMULATOR turned on.
|
||||
return;
|
||||
}
|
||||
// The touch event helper is enabled on shell.html document,
|
||||
// so that click events are delayed and it is better to
|
||||
// listen for touch events.
|
||||
homeButton.addEventListener('touchstart', function() {
|
||||
shell.sendChromeEvent({type: 'home-button-press'});
|
||||
homeButton.classList.add('active');
|
||||
});
|
||||
homeButton.addEventListener('touchend', function() {
|
||||
shell.sendChromeEvent({type: 'home-button-release'});
|
||||
homeButton.classList.remove('active');
|
||||
});
|
||||
|
||||
Cu.import("resource://gre/modules/GlobalSimulatorScreen.jsm");
|
||||
let rotateButton = document.getElementById('rotate-button');
|
||||
rotateButton.addEventListener('touchstart', function () {
|
||||
rotateButton.classList.add('active');
|
||||
});
|
||||
rotateButton.addEventListener('touchend', function() {
|
||||
GlobalSimulatorScreen.flipScreen();
|
||||
rotateButton.classList.remove('active');
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener('ContentStart', function() {
|
||||
enableTouch();
|
||||
setupButtons();
|
||||
});
|
||||
|
BIN
b2g/chrome/content/images/desktop/home-black.png
Normal file
BIN
b2g/chrome/content/images/desktop/home-black.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 331 B |
BIN
b2g/chrome/content/images/desktop/home-white.png
Normal file
BIN
b2g/chrome/content/images/desktop/home-white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 276 B |
BIN
b2g/chrome/content/images/desktop/rotate.png
Normal file
BIN
b2g/chrome/content/images/desktop/rotate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 657 B |
@ -18,7 +18,7 @@ window.addEventListener('ContentStart', function() {
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
let hostDPI = windowUtils.displayDPI;
|
||||
|
||||
let DEFAULT_SCREEN = "320x480";
|
||||
let DEFAULT_SCREEN = '320x480';
|
||||
|
||||
// This is a somewhat random selection of named screens.
|
||||
// Add more to this list when we support more hardware.
|
||||
@ -120,36 +120,93 @@ window.addEventListener('ContentStart', function() {
|
||||
if (!width || !height || !dpi)
|
||||
usage();
|
||||
}
|
||||
|
||||
// In order to do rescaling, we set the <browser> tag to the specified
|
||||
// width and height, and then use a CSS transform to scale it so that
|
||||
// it appears at the correct size on the host display. We also set
|
||||
// the size of the <window> element to that scaled target size.
|
||||
let scale = rescale ? hostDPI / dpi : 1;
|
||||
|
||||
// Set the window width and height to desired size plus chrome
|
||||
let chromewidth = window.outerWidth - window.innerWidth;
|
||||
let chromeheight = window.outerHeight - window.innerHeight;
|
||||
window.resizeTo(Math.round(width * scale) + chromewidth,
|
||||
Math.round(height * scale) + chromeheight);
|
||||
Cu.import("resource://gre/modules/GlobalSimulatorScreen.jsm");
|
||||
function resize(width, height, dpi, shouldFlip) {
|
||||
GlobalSimulatorScreen.width = width;
|
||||
GlobalSimulatorScreen.height = height;
|
||||
|
||||
// Set the browser element to the full unscaled size of the screen
|
||||
browser.style.width = browser.style.minWidth = browser.style.maxWidth =
|
||||
width + 'px';
|
||||
browser.style.height = browser.style.minHeight = browser.style.maxHeight =
|
||||
height + 'px';
|
||||
browser.setAttribute('flex', '0'); // Don't let it stretch
|
||||
// In order to do rescaling, we set the <browser> tag to the specified
|
||||
// width and height, and then use a CSS transform to scale it so that
|
||||
// it appears at the correct size on the host display. We also set
|
||||
// the size of the <window> element to that scaled target size.
|
||||
let scale = rescale ? hostDPI / dpi : 1;
|
||||
|
||||
// Now scale the browser element as needed
|
||||
if (scale !== 1) {
|
||||
browser.style.transformOrigin = 'top left';
|
||||
browser.style.transform = 'scale(' + scale + ',' + scale + ')';
|
||||
// Set the window width and height to desired size plus chrome
|
||||
// Include the size of the toolbox displayed under the system app
|
||||
let controls = document.getElementById('controls');
|
||||
let controlsHeight = 0;
|
||||
if (controls) {
|
||||
controlsHeight = controls.getBoundingClientRect().height;
|
||||
}
|
||||
let chromewidth = window.outerWidth - window.innerWidth;
|
||||
let chromeheight = window.outerHeight - window.innerHeight + controlsHeight;
|
||||
window.resizeTo(Math.round(width * scale) + chromewidth,
|
||||
Math.round(height * scale) + chromeheight);
|
||||
|
||||
let frameWidth = width, frameHeight = height;
|
||||
if (shouldFlip) {
|
||||
frameWidth = height;
|
||||
frameHeight = width;
|
||||
}
|
||||
|
||||
// Set the browser element to the full unscaled size of the screen
|
||||
let style = browser.style;
|
||||
style.width = style.minWidth = style.maxWidth =
|
||||
frameWidth + 'px';
|
||||
style.height = style.minHeight = style.maxHeight =
|
||||
frameHeight + 'px';
|
||||
browser.setAttribute('flex', '0'); // Don't let it stretch
|
||||
|
||||
style.transformOrigin = '';
|
||||
style.transform = '';
|
||||
|
||||
// Now scale the browser element as needed
|
||||
if (scale !== 1) {
|
||||
style.transformOrigin = 'top left';
|
||||
style.transform += ' scale(' + scale + ',' + scale + ')';
|
||||
}
|
||||
|
||||
if (shouldFlip) {
|
||||
// Display the system app with a 90° clockwise rotation
|
||||
let shift = Math.floor(Math.abs(frameWidth-frameHeight) / 2);
|
||||
style.transform +=
|
||||
' rotate(0.25turn) translate(-' + shift + 'px, -' + shift + 'px)';
|
||||
}
|
||||
|
||||
// Set the pixel density that we want to simulate.
|
||||
// This doesn't change the on-screen size, but makes
|
||||
// CSS media queries and mozmm units work right.
|
||||
Services.prefs.setIntPref('layout.css.dpi', dpi);
|
||||
}
|
||||
|
||||
// Set the pixel density that we want to simulate.
|
||||
// This doesn't change the on-screen size, but makes
|
||||
// CSS media queries and mozmm units work right.
|
||||
Services.prefs.setIntPref('layout.css.dpi', dpi);
|
||||
// Resize on startup
|
||||
resize(width, height, dpi, false);
|
||||
|
||||
let defaultOrientation = width < height ? 'portrait' : 'landscape';
|
||||
|
||||
// Then resize on each rotation button click,
|
||||
// or when the system app lock/unlock the orientation
|
||||
Services.obs.addObserver(function orientationChangeListener(subject) {
|
||||
let screen = subject.wrappedJSObject;
|
||||
let { mozOrientation, screenOrientation } = screen;
|
||||
|
||||
let newWidth = width;
|
||||
let newHeight = height;
|
||||
// If we have an orientation different than the startup one,
|
||||
// we switch the sizes
|
||||
if (screenOrientation != defaultOrientation) {
|
||||
newWidth = height;
|
||||
newHeight = width;
|
||||
}
|
||||
|
||||
// If the current app doesn't supports the current screen orientation
|
||||
// still resize the window, but rotate its frame so that
|
||||
// it is displayed rotated on the side
|
||||
let shouldFlip = mozOrientation != screenOrientation;
|
||||
|
||||
resize(newWidth, newHeight, dpi, shouldFlip);
|
||||
}, 'simulator-adjust-window-size', false);
|
||||
|
||||
// A utility function like console.log() for printing to the terminal window
|
||||
// Uses dump(), but enables it first, if necessary
|
||||
@ -157,7 +214,7 @@ window.addEventListener('ContentStart', function() {
|
||||
let dump_enabled =
|
||||
Services.prefs.getBoolPref('browser.dom.window.dump.enabled');
|
||||
|
||||
if (!dump_enabled)
|
||||
if (!dump_enabled)
|
||||
Services.prefs.setBoolPref('browser.dom.window.dump.enabled', true);
|
||||
|
||||
dump(Array.prototype.join.call(arguments, ' ') + '\n');
|
||||
|
@ -12,7 +12,11 @@
|
||||
>
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="shell.css" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="shell.css" type="text/css">
|
||||
#ifdef FXOS_SIMULATOR
|
||||
<link rel="stylesheet" href="desktop.css" type="text/css">
|
||||
#endif
|
||||
|
||||
<script type="application/javascript;version=1.8"
|
||||
src="chrome://b2g/content/settings.js"> </script>
|
||||
<script type="application/javascript;version=1.8"
|
||||
@ -31,7 +35,15 @@
|
||||
#endif
|
||||
</head>
|
||||
<body id="container">
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
#ifdef FXOS_SIMULATOR
|
||||
<!--
|
||||
Some additional buttons are displayed on desktop to fake hardware buttons.
|
||||
-->
|
||||
<footer id="controls">
|
||||
<button id="home-button"></button>
|
||||
<button id="rotate-button"></button>
|
||||
</footer>
|
||||
#elifdef MOZ_WIDGET_COCOA
|
||||
<!--
|
||||
If the document is empty at startup, we don't display the window
|
||||
at all on Mac OS...
|
||||
|
@ -303,7 +303,11 @@ var shell = {
|
||||
systemAppFrame.setAttribute('src', "data:text/html;charset=utf-8,%3C!DOCTYPE html>%3Cbody style='background:black;");
|
||||
let container = document.getElementById('container');
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
container.removeChild(document.getElementById('placeholder'));
|
||||
// See shell.html
|
||||
let hotfix = document.getElementById('placeholder');
|
||||
if (hotfix) {
|
||||
container.removeChild(hotfix);
|
||||
}
|
||||
#endif
|
||||
container.appendChild(systemAppFrame);
|
||||
|
||||
|
@ -14,7 +14,13 @@ chrome.jar:
|
||||
* content/shell.js (content/shell.js)
|
||||
content/shell.css (content/shell.css)
|
||||
content/devtools.js (content/devtools.js)
|
||||
#ifndef ANDROID
|
||||
#ifdef FXOS_SIMULATOR
|
||||
content/desktop.css (content/desktop.css)
|
||||
content/images/desktop/home-black.png (content/images/desktop/home-black.png)
|
||||
content/images/desktop/home-white.png (content/images/desktop/home-white.png)
|
||||
content/images/desktop/rotate.png (content/images/desktop/rotate.png)
|
||||
#endif
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
content/desktop.js (content/desktop.js)
|
||||
content/screen.js (content/screen.js)
|
||||
content/runapp.js (content/runapp.js)
|
||||
|
@ -81,3 +81,9 @@ contract @mozilla.org/fxaccounts/fxaccounts-ui-glue;1 {51875c14-91d7-4b8c-b65d-3
|
||||
# HelperAppDialog.js
|
||||
component {710322af-e6ae-4b0c-b2c9-1474a87b077e} HelperAppDialog.js
|
||||
contract @mozilla.org/helperapplauncherdialog;1 {710322af-e6ae-4b0c-b2c9-1474a87b077e}
|
||||
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
component {c83c02c0-5d43-4e3e-987f-9173b313e880} SimulatorScreen.js
|
||||
contract @mozilla.org/simulator-screen;1 {c83c02c0-5d43-4e3e-987f-9173b313e880}
|
||||
category profile-after-change SimulatorScreen @mozilla.org/simulator-screen;1
|
||||
#endif
|
||||
|
90
b2g/components/GlobalSimulatorScreen.jsm
Normal file
90
b2g/components/GlobalSimulatorScreen.jsm
Normal file
@ -0,0 +1,90 @@
|
||||
/* 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/. */
|
||||
|
||||
this.EXPORTED_SYMBOLS = [ 'GlobalSimulatorScreen' ];
|
||||
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
|
||||
this.GlobalSimulatorScreen = {
|
||||
mozOrientationLocked: false,
|
||||
|
||||
// Actual orientation of apps
|
||||
mozOrientation: 'portrait',
|
||||
|
||||
// The restricted list of actual orientation that can be used
|
||||
// if mozOrientationLocked is true
|
||||
lockedOrientation: [],
|
||||
|
||||
// The faked screen orientation
|
||||
// if screenOrientation doesn't match mozOrientation due
|
||||
// to lockedOrientation restriction, the app will be displayed
|
||||
// on the side on desktop
|
||||
screenOrientation: 'portrait',
|
||||
|
||||
// Updated by screen.js
|
||||
width: 0, height: 0,
|
||||
|
||||
lock: function(orientation) {
|
||||
this.mozOrientationLocked = true;
|
||||
|
||||
// Normalize to portrait or landscape,
|
||||
// i.e. the possible values of screenOrientation
|
||||
function normalize(str) {
|
||||
if (str.match(/^portrait/)) {
|
||||
return 'portrait';
|
||||
} else if (str.match(/^landscape/)) {
|
||||
return 'landscape';
|
||||
} else {
|
||||
return 'portrait';
|
||||
}
|
||||
}
|
||||
this.lockedOrientation = orientation.map(normalize);
|
||||
|
||||
this.updateOrientation();
|
||||
},
|
||||
|
||||
unlock: function() {
|
||||
this.mozOrientationLocked = false;
|
||||
this.updateOrientation();
|
||||
},
|
||||
|
||||
updateOrientation: function () {
|
||||
let orientation = this.screenOrientation;
|
||||
|
||||
// If the orientation is locked, we have to ensure ending up with a value
|
||||
// of lockedOrientation. If none of lockedOrientation values matches
|
||||
// the screen orientation we just choose the first locked orientation.
|
||||
// This will be the precise scenario where the app is displayed on the
|
||||
// side on desktop!
|
||||
if (this.mozOrientationLocked &&
|
||||
this.lockedOrientation.indexOf(this.screenOrientation) == -1) {
|
||||
orientation = this.lockedOrientation[0];
|
||||
}
|
||||
|
||||
// If the actual orientation changed,
|
||||
// we have to fire mozorientation DOM events
|
||||
if (this.mozOrientation != orientation) {
|
||||
this.mozOrientation = orientation;
|
||||
|
||||
// Notify each app screen object to fire the event
|
||||
Services.obs.notifyObservers(null, 'simulator-orientation-change', null);
|
||||
}
|
||||
|
||||
// Finally, in any case, we update the window size and orientation
|
||||
// (Use wrappedJSObject trick to be able to pass a raw JS object)
|
||||
Services.obs.notifyObservers({wrappedJSObject:this}, 'simulator-adjust-window-size', null);
|
||||
},
|
||||
|
||||
flipScreen: function() {
|
||||
if (this.screenOrientation == 'portrait') {
|
||||
this.screenOrientation = 'landscape';
|
||||
} else if (this.screenOrientation == 'landscape') {
|
||||
this.screenOrientation = 'portrait';
|
||||
}
|
||||
this.updateOrientation();
|
||||
}
|
||||
}
|
112
b2g/components/SimulatorScreen.js
Normal file
112
b2g/components/SimulatorScreen.js
Normal file
@ -0,0 +1,112 @@
|
||||
/* 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/. */
|
||||
|
||||
let Ci = Components.interfaces;
|
||||
let Cu = Components.utils;
|
||||
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
Cu.import('resource://gre/modules/DOMRequestHelper.jsm');
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'GlobalSimulatorScreen',
|
||||
'resource://gre/modules/GlobalSimulatorScreen.jsm');
|
||||
|
||||
let DEBUG_PREFIX = 'SimulatorScreen.js - ';
|
||||
function debug() {
|
||||
//dump(DEBUG_PREFIX + Array.slice(arguments) + '\n');
|
||||
}
|
||||
|
||||
function fireOrientationEvent(window) {
|
||||
let e = new window.Event('mozorientationchange');
|
||||
window.screen.dispatchEvent(e);
|
||||
}
|
||||
|
||||
function hookScreen(window) {
|
||||
let nodePrincipal = window.document.nodePrincipal;
|
||||
let origin = nodePrincipal.origin;
|
||||
if (nodePrincipal.appStatus == nodePrincipal.APP_STATUS_NOT_INSTALLED) {
|
||||
Cu.reportError('deny mozLockOrientation:' + origin + 'is not installed');
|
||||
return;
|
||||
}
|
||||
|
||||
let screen = window.wrappedJSObject.screen;
|
||||
|
||||
screen.mozLockOrientation = function (orientation) {
|
||||
debug('mozLockOrientation:', orientation, 'from', origin);
|
||||
|
||||
// Normalize and do some checks against orientation input
|
||||
if (typeof(orientation) == 'string') {
|
||||
orientation = [orientation];
|
||||
}
|
||||
|
||||
function isInvalidOrientationString(str) {
|
||||
return typeof(str) != 'string' ||
|
||||
!str.match(/^default$|^(portrait|landscape)(-(primary|secondary))?$/);
|
||||
}
|
||||
if (!Array.isArray(orientation) ||
|
||||
orientation.some(isInvalidOrientationString)) {
|
||||
Cu.reportError('Invalid orientation "' + orientation + '"');
|
||||
return false;
|
||||
}
|
||||
|
||||
GlobalSimulatorScreen.lock(orientation);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
screen.mozUnlockOrientation = function() {
|
||||
debug('mozOrientationUnlock from', origin);
|
||||
GlobalSimulatorScreen.unlock();
|
||||
return true;
|
||||
};
|
||||
|
||||
Object.defineProperty(screen, 'width', {
|
||||
get: function () GlobalSimulatorScreen.width
|
||||
});
|
||||
Object.defineProperty(screen, 'height', {
|
||||
get: function () GlobalSimulatorScreen.height
|
||||
});
|
||||
Object.defineProperty(screen, 'mozOrientation', {
|
||||
get: function () GlobalSimulatorScreen.mozOrientation
|
||||
});
|
||||
}
|
||||
|
||||
function SimulatorScreen() {}
|
||||
SimulatorScreen.prototype = {
|
||||
classID: Components.ID('{c83c02c0-5d43-4e3e-987f-9173b313e880}'),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
|
||||
Ci.nsISupportsWeakReference]),
|
||||
_windows: new Set(),
|
||||
|
||||
observe: function (subject, topic, data) {
|
||||
switch (topic) {
|
||||
case 'profile-after-change':
|
||||
Services.obs.addObserver(this, 'document-element-inserted', false);
|
||||
Services.obs.addObserver(this, 'simulator-orientation-change', false);
|
||||
break;
|
||||
|
||||
case 'document-element-inserted':
|
||||
let window = subject.defaultView;
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
|
||||
hookScreen(window);
|
||||
|
||||
let windows = this._windows;
|
||||
window.addEventListener('unload', function unload() {
|
||||
window.removeEventListener('unload', unload);
|
||||
windows.delete(window);
|
||||
});
|
||||
windows.add(window);
|
||||
break;
|
||||
|
||||
case 'simulator-orientation-change':
|
||||
this._windows.forEach(fireOrientationEvent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SimulatorScreen]);
|
@ -46,6 +46,21 @@ XPCOMUtils.defineLazyServiceGetter(Services, "settings",
|
||||
"@mozilla.org/settingsService;1",
|
||||
"nsISettingsService");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'env',
|
||||
'@mozilla.org/process/environment;1',
|
||||
'nsIEnvironment');
|
||||
|
||||
function useSettings() {
|
||||
// When we're running in the real phone, then we can use settings.
|
||||
// But when we're running as part of xpcshell, there is no settings database
|
||||
// and trying to use settings in this scenario causes lots of weird
|
||||
// assertions at shutdown time.
|
||||
if (typeof useSettings.result === "undefined") {
|
||||
useSettings.result = !Services.env.get("XPCSHELL_TEST_PROFILE_DIR");
|
||||
}
|
||||
return useSettings.result;
|
||||
}
|
||||
|
||||
function UpdateCheckListener(updatePrompt) {
|
||||
this._updatePrompt = updatePrompt;
|
||||
}
|
||||
@ -183,8 +198,10 @@ UpdatePrompt.prototype = {
|
||||
|
||||
showUpdateHistory: function UP_showUpdateHistory(aParent) { },
|
||||
showUpdateInstalled: function UP_showUpdateInstalled() {
|
||||
let lock = Services.settings.createLock();
|
||||
lock.set("deviceinfo.last_updated", Date.now(), null, null);
|
||||
if (useSettings()) {
|
||||
let lock = Services.settings.createLock();
|
||||
lock.set("deviceinfo.last_updated", Date.now(), null, null);
|
||||
}
|
||||
},
|
||||
|
||||
// Custom functions
|
||||
@ -200,10 +217,12 @@ UpdatePrompt.prototype = {
|
||||
},
|
||||
|
||||
setUpdateStatus: function UP_setUpdateStatus(aStatus) {
|
||||
log("Setting gecko.updateStatus: " + aStatus);
|
||||
if (useSettings()) {
|
||||
log("Setting gecko.updateStatus: " + aStatus);
|
||||
|
||||
let lock = Services.settings.createLock();
|
||||
lock.set("gecko.updateStatus", aStatus, null);
|
||||
let lock = Services.settings.createLock();
|
||||
lock.set("gecko.updateStatus", aStatus, null);
|
||||
}
|
||||
},
|
||||
|
||||
showApplyPrompt: function UP_showApplyPrompt(aUpdate) {
|
||||
@ -379,20 +398,22 @@ UpdatePrompt.prototype = {
|
||||
#endif
|
||||
}
|
||||
|
||||
// Save current os version in deviceinfo.previous_os
|
||||
let lock = Services.settings.createLock({
|
||||
handle: callbackAfterSet,
|
||||
handleAbort: function(error) {
|
||||
log("Abort callback when trying to set previous_os: " + error);
|
||||
callbackAfterSet();
|
||||
}
|
||||
});
|
||||
lock.get("deviceinfo.os", {
|
||||
handle: function(name, value) {
|
||||
log("Set previous_os to: " + value);
|
||||
lock.set("deviceinfo.previous_os", value, null, null);
|
||||
}
|
||||
});
|
||||
if (useSettings()) {
|
||||
// Save current os version in deviceinfo.previous_os
|
||||
let lock = Services.settings.createLock({
|
||||
handle: callbackAfterSet,
|
||||
handleAbort: function(error) {
|
||||
log("Abort callback when trying to set previous_os: " + error);
|
||||
callbackAfterSet();
|
||||
}
|
||||
});
|
||||
lock.get("deviceinfo.os", {
|
||||
handle: function(name, value) {
|
||||
log("Set previous_os to: " + value);
|
||||
lock.set("deviceinfo.previous_os", value, null, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
forceUpdateCheck: function UP_forceUpdateCheck() {
|
||||
|
@ -23,6 +23,11 @@ EXTRA_COMPONENTS += [
|
||||
'YoutubeProtocolHandler.js',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
|
||||
EXTRA_COMPONENTS += [
|
||||
'SimulatorScreen.js'
|
||||
]
|
||||
|
||||
EXTRA_PP_COMPONENTS += [
|
||||
'B2GComponents.manifest',
|
||||
'DirectoryProvider.js',
|
||||
@ -41,6 +46,11 @@ EXTRA_JS_MODULES += [
|
||||
'WebappsUpdater.jsm',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
|
||||
EXTRA_JS_MODULES += [
|
||||
'GlobalSimulatorScreen.jsm'
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_SERVICES_FXACCOUNTS']:
|
||||
EXTRA_COMPONENTS += [
|
||||
'FxAccountsUIGlue.js'
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db2ef2b61c70889533a0837fa3e053d24e95fdea"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="06d3242182370ba93db9acbe54cbe6cc8f7b239f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="db2ef2b61c70889533a0837fa3e053d24e95fdea"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="06d3242182370ba93db9acbe54cbe6cc8f7b239f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="cb16958e41105d7c551d9941f522db97b8312538"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="a9e08b91e9cd1f0930f16cfc49ec72f63575d5fe">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="db2ef2b61c70889533a0837fa3e053d24e95fdea"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="06d3242182370ba93db9acbe54cbe6cc8f7b239f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="cb16958e41105d7c551d9941f522db97b8312538"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db2ef2b61c70889533a0837fa3e053d24e95fdea"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="06d3242182370ba93db9acbe54cbe6cc8f7b239f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
|
||||
|
@ -4,6 +4,6 @@
|
||||
"branch": "",
|
||||
"revision": ""
|
||||
},
|
||||
"revision": "91e5760ff948d3bef3959866c6a1744991560ef6",
|
||||
"revision": "6d2a2c5c58fce4b2263a7e5e654f6c4ccee5875a",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db2ef2b61c70889533a0837fa3e053d24e95fdea"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="06d3242182370ba93db9acbe54cbe6cc8f7b239f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db2ef2b61c70889533a0837fa3e053d24e95fdea"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="06d3242182370ba93db9acbe54cbe6cc8f7b239f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db2ef2b61c70889533a0837fa3e053d24e95fdea"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="06d3242182370ba93db9acbe54cbe6cc8f7b239f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db2ef2b61c70889533a0837fa3e053d24e95fdea"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="06d3242182370ba93db9acbe54cbe6cc8f7b239f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="db2ef2b61c70889533a0837fa3e053d24e95fdea"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="06d3242182370ba93db9acbe54cbe6cc8f7b239f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="cb16958e41105d7c551d9941f522db97b8312538"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db2ef2b61c70889533a0837fa3e053d24e95fdea"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="06d3242182370ba93db9acbe54cbe6cc8f7b239f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -543,7 +543,6 @@
|
||||
@BINPATH@/components/SystemMessageManager.manifest
|
||||
|
||||
@BINPATH@/components/Activities.manifest
|
||||
@BINPATH@/components/ActivityOptions.js
|
||||
@BINPATH@/components/ActivityProxy.js
|
||||
@BINPATH@/components/ActivityRequestHandler.js
|
||||
@BINPATH@/components/ActivityWrapper.js
|
||||
|
@ -42,4 +42,3 @@
|
||||
!define OPTIONS_BKGRD_COLOR 0x0F1B26
|
||||
!define INSTALL_BLURB_TEXT_COLOR 0xFFFFFF
|
||||
!define INSTALL_PROGRESS_TEXT_COLOR_NORMAL 0xFFFFFF
|
||||
!define INSTALL_PROGRESS_TEXT_COLOR_FADED 0xA1AAB3
|
||||
|
@ -42,4 +42,3 @@
|
||||
!define OPTIONS_BKGRD_COLOR 0x0F1B26
|
||||
!define INSTALL_BLURB_TEXT_COLOR 0xFFFFFF
|
||||
!define INSTALL_PROGRESS_TEXT_COLOR_NORMAL 0xFFFFFF
|
||||
!define INSTALL_PROGRESS_TEXT_COLOR_FADED 0xA1AAB3
|
||||
|
@ -46,4 +46,3 @@
|
||||
!define OPTIONS_BKGRD_COLOR 0xF0F0F0
|
||||
!define INSTALL_BLURB_TEXT_COLOR 0x666666
|
||||
!define INSTALL_PROGRESS_TEXT_COLOR_NORMAL 0x666666
|
||||
!define INSTALL_PROGRESS_TEXT_COLOR_FADED 0x999999
|
||||
|
@ -42,4 +42,3 @@
|
||||
!define OPTIONS_BKGRD_COLOR 0x0F1B26
|
||||
!define INSTALL_BLURB_TEXT_COLOR 0xFFFFFF
|
||||
!define INSTALL_PROGRESS_TEXT_COLOR_NORMAL 0xFFFFFF
|
||||
!define INSTALL_PROGRESS_TEXT_COLOR_FADED 0xA1AAB3
|
||||
|
@ -11,7 +11,6 @@ var SubscribeHandler = {
|
||||
|
||||
init: function SH_init() {
|
||||
this._feedWriter = new BrowserFeedWriter();
|
||||
this._feedWriter.init(window);
|
||||
},
|
||||
|
||||
writeContent: function SH_writeContent() {
|
||||
@ -20,9 +19,5 @@ var SubscribeHandler = {
|
||||
|
||||
uninit: function SH_uninit() {
|
||||
this._feedWriter.close();
|
||||
},
|
||||
|
||||
subscribe: function SH_subscribe() {
|
||||
this._feedWriter.subscribe();
|
||||
}
|
||||
};
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIFeedResultService.idl',
|
||||
'nsIFeedWriter.idl',
|
||||
'nsIWebContentConverterRegistrar.idl',
|
||||
]
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
|
||||
/**
|
||||
* Instances of this component write UI into the display page. This component
|
||||
* is trusted so can access preferences etc, but page content isn't and so
|
||||
* cannot.
|
||||
*/
|
||||
[scriptable, uuid(67003393-018c-4e96-af10-c6c51a049fad)]
|
||||
interface nsIFeedWriter : nsISupports
|
||||
{
|
||||
/**
|
||||
* Initializes the feed writer and loads the feed subscription UI.
|
||||
* @param aWindow
|
||||
* The DOMWindow of the preview page.
|
||||
* window.location.href == the URI of the feed.
|
||||
*/
|
||||
void init(in nsIDOMWindow aWindow);
|
||||
|
||||
/**
|
||||
* Writes the feed content, assumes that the feed writer is initialized.
|
||||
*/
|
||||
void writeContent();
|
||||
|
||||
/**
|
||||
* Uninitialize the feed writer.
|
||||
*/
|
||||
void close();
|
||||
};
|
@ -23,7 +23,6 @@ component {1c31ed79-accd-4b94-b517-06e0c81999d5} FeedConverter.js
|
||||
contract @mozilla.org/network/protocol;1?name=pcast {1c31ed79-accd-4b94-b517-06e0c81999d5}
|
||||
component {49bb6593-3aff-4eb3-a068-2712c28bd58e} FeedWriter.js
|
||||
contract @mozilla.org/browser/feeds/result-writer;1 {49bb6593-3aff-4eb3-a068-2712c28bd58e}
|
||||
category JavaScript-global-constructor BrowserFeedWriter @mozilla.org/browser/feeds/result-writer;1
|
||||
component {792a7e82-06a0-437c-af63-b2d12e808acc} WebContentConverter.js
|
||||
contract @mozilla.org/embeddor.implemented/web-content-handler-registrar;1 {792a7e82-06a0-437c-af63-b2d12e808acc}
|
||||
category app-startup WebContentConverter service,@mozilla.org/embeddor.implemented/web-content-handler-registrar;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
|
||||
|
@ -1123,7 +1123,7 @@ FeedWriter.prototype = {
|
||||
_feedPrincipal: null,
|
||||
_handlersMenuList: null,
|
||||
|
||||
// nsIFeedWriter
|
||||
// BrowserFeedWriter WebIDL methods
|
||||
init: function FW_init(aWindow) {
|
||||
var window = aWindow;
|
||||
this._feedURI = this._getOriginalURI(window);
|
||||
@ -1376,13 +1376,9 @@ FeedWriter.prototype = {
|
||||
},
|
||||
|
||||
classID: FEEDWRITER_CID,
|
||||
classInfo: XPCOMUtils.generateCI({classID: FEEDWRITER_CID,
|
||||
contractID: FEEDWRITER_CONTRACTID,
|
||||
interfaces: [Ci.nsIFeedWriter],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT}),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIFeedWriter,
|
||||
Ci.nsIDOMEventListener, Ci.nsIObserver,
|
||||
Ci.nsINavHistoryObserver])
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMEventListener, Ci.nsIObserver,
|
||||
Ci.nsINavHistoryObserver,
|
||||
Ci.nsIDOMGlobalPropertyInitializer])
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FeedWriter]);
|
||||
|
47
browser/components/feeds/src/FeedWriterEnabled.h
Normal file
47
browser/components/feeds/src/FeedWriterEnabled.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "js/TypeDecls.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsString.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
struct FeedWriterEnabled {
|
||||
static bool IsEnabled(JSContext* cx, JSObject* aGlobal)
|
||||
{
|
||||
// Make sure the global is a window
|
||||
nsGlobalWindow* win = xpc::WindowGlobalOrNull(aGlobal);
|
||||
if (!win) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure that the principal is about:feeds.
|
||||
nsCOMPtr<nsIPrincipal> principal = win->GetPrincipal();
|
||||
NS_ENSURE_TRUE(principal, false);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
principal->GetURI(getter_AddRefs(uri));
|
||||
if (!uri) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// First check the scheme to avoid getting long specs in the common case.
|
||||
bool isAbout = false;
|
||||
uri->SchemeIs("about", &isAbout);
|
||||
if (!isAbout) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now check the spec itself
|
||||
nsAutoCString spec;
|
||||
uri->GetSpec(spec);
|
||||
return spec.Equals("about:feeds");
|
||||
}
|
||||
};
|
||||
|
||||
}
|
@ -8,6 +8,10 @@ SOURCES += [
|
||||
'nsFeedSniffer.cpp',
|
||||
]
|
||||
|
||||
EXPORTS.mozilla += [
|
||||
'FeedWriterEnabled.h',
|
||||
]
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'BrowserFeeds.manifest',
|
||||
'FeedConverter.js',
|
||||
|
@ -544,7 +544,6 @@
|
||||
@BINPATH@/components/SystemMessageManager.manifest
|
||||
|
||||
@BINPATH@/components/Activities.manifest
|
||||
@BINPATH@/components/ActivityOptions.js
|
||||
@BINPATH@/components/ActivityProxy.js
|
||||
@BINPATH@/components/ActivityRequestHandler.js
|
||||
@BINPATH@/components/ActivityWrapper.js
|
||||
|
@ -21,12 +21,9 @@ RequestExecutionLevel user
|
||||
!addplugindir ./
|
||||
|
||||
Var Dialog
|
||||
Var ProgressbarDownload
|
||||
Var ProgressbarInstall
|
||||
Var LabelDownloadingDown
|
||||
Var LabelDownloadingInProgress
|
||||
Var LabelInstallingInProgress
|
||||
Var LabelInstallingToBeDone
|
||||
Var Progressbar
|
||||
Var LabelDownloading
|
||||
Var LabelInstalling
|
||||
Var LabelFreeSpace
|
||||
Var CheckboxSetAsDefault
|
||||
Var CheckboxShortcutOnBar ; Used for Quicklaunch or Taskbar as appropriate
|
||||
@ -63,6 +60,8 @@ Var InitialInstallDir
|
||||
Var HandleDownload
|
||||
Var CanSetAsDefault
|
||||
Var InstallCounterStep
|
||||
Var InstallStepSize
|
||||
Var InstallTotalSteps
|
||||
Var TmpVal
|
||||
|
||||
Var ExitCode
|
||||
@ -90,8 +89,6 @@ Var EndPreInstallPhaseTickCount
|
||||
Var EndInstallPhaseTickCount
|
||||
Var EndFinishPhaseTickCount
|
||||
|
||||
Var IntroPageShownCount
|
||||
Var OptionsPageShownCount
|
||||
Var InitialInstallRequirementsCode
|
||||
Var ExistingProfile
|
||||
Var ExistingVersion
|
||||
@ -108,7 +105,7 @@ Var ControlRightPX
|
||||
; the stub installer
|
||||
;!define STUB_DEBUG
|
||||
|
||||
!define StubURLVersion "v5"
|
||||
!define StubURLVersion "v6"
|
||||
|
||||
; Successful install exit code
|
||||
!define ERR_SUCCESS 0
|
||||
@ -144,7 +141,7 @@ Var ControlRightPX
|
||||
* The following errors prefixed with ERR_INSTALL apply to the install phase.
|
||||
*/
|
||||
; The installation timed out. The installation timeout is defined by the number
|
||||
; of progress steps defined in InstallProgresSteps and the install timer
|
||||
; of progress steps defined in InstallTotalSteps and the install timer
|
||||
; interval defined in InstallIntervalMS
|
||||
!define ERR_INSTALL_TIMEOUT 30
|
||||
|
||||
@ -168,18 +165,25 @@ Var ControlRightPX
|
||||
; Interval for the install timer
|
||||
!define InstallIntervalMS 100
|
||||
|
||||
; Number of steps for the install progress.
|
||||
; This is 120 seconds with a 100 millisecond timer and a first step of 20 as
|
||||
; defined by InstallProgressFirstStep. This might not be enough when installing
|
||||
; on a slow network drive so it will fallback to downloading the full installer
|
||||
; if it reaches this number. The size of the install progress step increases
|
||||
; when the full installer finishes instead of waiting the entire 120 seconds.
|
||||
!define InstallProgresSteps 1220
|
||||
|
||||
; The first step for the install progress bar. By starting with a large step
|
||||
; immediate feedback is given to the user.
|
||||
!define InstallProgressFirstStep 20
|
||||
|
||||
; Number of steps for the install progress.
|
||||
; This might not be enough when installing on a slow network drive so it will
|
||||
; fallback to downloading the full installer if it reaches this number. The size
|
||||
; of the install progress step is increased when the full installer finishes
|
||||
; instead of waiting.
|
||||
|
||||
; Approximately 150 seconds with a 100 millisecond timer and a first step of 20
|
||||
; as defined by InstallProgressFirstStep.
|
||||
!define /math InstallCleanTotalSteps ${InstallProgressFirstStep} + 1500
|
||||
|
||||
; Approximately 165 seconds (minus 0.2 seconds for each file that is removed)
|
||||
; with a 100 millisecond timer and a first step of 20 as defined by
|
||||
; InstallProgressFirstStep .
|
||||
!define /math InstallPaveOverTotalSteps ${InstallProgressFirstStep} + 1800
|
||||
|
||||
; The interval in MS used for the progress bars set as marquee.
|
||||
!define ProgressbarMarqueeIntervalMS 10
|
||||
|
||||
@ -189,12 +193,18 @@ Var ControlRightPX
|
||||
|
||||
!define CONFIG_INI "config.ini"
|
||||
|
||||
!define MAX_PATH 260
|
||||
|
||||
!define FILE_SHARE_READ 1
|
||||
!define GENERIC_READ 0x80000000
|
||||
!define OPEN_EXISTING 3
|
||||
!define INVALID_HANDLE_VALUE -1
|
||||
!ifndef FILE_SHARE_READ
|
||||
!define FILE_SHARE_READ 1
|
||||
!endif
|
||||
!ifndef GENERIC_READ
|
||||
!define GENERIC_READ 0x80000000
|
||||
!endif
|
||||
!ifndef OPEN_EXISTING
|
||||
!define OPEN_EXISTING 3
|
||||
!endif
|
||||
!ifndef INVALID_HANDLE_VALUE
|
||||
!define INVALID_HANDLE_VALUE -1
|
||||
!endif
|
||||
|
||||
!include "nsDialogs.nsh"
|
||||
!include "LogicLib.nsh"
|
||||
@ -230,6 +240,7 @@ Var ControlRightPX
|
||||
!insertmacro ElevateUAC
|
||||
!insertmacro GetLongPath
|
||||
!insertmacro GetPathFromString
|
||||
!insertmacro GetParent
|
||||
!insertmacro GetSingleInstallPath
|
||||
!insertmacro GetTextWidthHeight
|
||||
!insertmacro IsUserAdmin
|
||||
@ -340,39 +351,6 @@ Function .onInit
|
||||
System::Call 'user32::SetProcessDPIAware()'
|
||||
${EndIf}
|
||||
|
||||
; Create a mutex to prevent multiple launches of the same stub installer in
|
||||
; the same location on the file system. This intentionally won't handle the
|
||||
; case where someone runs multiple copies of the stub on the file system but
|
||||
; it does handle the important case which is a user launching the same stub
|
||||
; multiple times.
|
||||
StrCpy $1 "$EXEPATH"
|
||||
; Backslashes are illegal in a mutex name so replace all occurences of a
|
||||
; backslash with a forward slash.
|
||||
${WordReplace} "$1" "\" "/" "+" $1
|
||||
StrLen $2 "$1"
|
||||
|
||||
; The lpName parameter for CreateMutexW is limited to MAX_PATH characters so
|
||||
; use the characters at the end since they are more likely to be unique.
|
||||
${If} $2 > ${MAX_PATH}
|
||||
StrCpy $1 "$1" ${MAX_PATH} -${MAX_PATH}
|
||||
${EndIf}
|
||||
System::Call "kernel32::CreateMutexW(i 0, i 0, w '$1') i .r0 ?e"
|
||||
Pop $0
|
||||
|
||||
${Unless} $0 == 0
|
||||
; The mutex is specific to this executable's path so we should be able to
|
||||
; find the Window with the same caption as this executable's and bring that
|
||||
; window to the front. This could find another instance of the same
|
||||
; executable but that is an uninteresting edge case.
|
||||
FindWindow $1 "#32770" "$(WIN_CAPTION)" 0
|
||||
${If} $1 != 0
|
||||
; Restore the window if it is minimized and make it the foreground window
|
||||
System::Call "user32::ShowWindow(i r1, i ${SW_RESTORE}) i."
|
||||
System::Call "user32::SetForegroundWindow(i r1) i."
|
||||
${EndIf}
|
||||
Abort
|
||||
${EndUnless}
|
||||
|
||||
SetShellVarContext all ; Set SHCTX to HKLM
|
||||
${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
|
||||
|
||||
@ -392,6 +370,8 @@ Function .onInit
|
||||
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" \
|
||||
"Write Test"
|
||||
|
||||
; Only display set as default when there is write access to HKLM and on Win7
|
||||
; and below.
|
||||
${If} ${Errors}
|
||||
${OrIf} ${AtLeastWin8}
|
||||
StrCpy $CanSetAsDefault "false"
|
||||
@ -407,8 +387,6 @@ Function .onInit
|
||||
StrCpy $OptionsPhaseSeconds "0"
|
||||
StrCpy $EndPreInstallPhaseTickCount "0"
|
||||
StrCpy $EndInstallPhaseTickCount "0"
|
||||
StrCpy $IntroPageShownCount "0"
|
||||
StrCpy $OptionsPageShownCount "0"
|
||||
StrCpy $InitialInstallRequirementsCode ""
|
||||
StrCpy $IsDownloadFinished ""
|
||||
StrCpy $FirefoxLaunchCode "0"
|
||||
@ -560,9 +538,17 @@ Function SendPing
|
||||
StrCpy $R1 "0"
|
||||
${EndIf}
|
||||
|
||||
${WinVerGetMajor} $R2
|
||||
${WinVerGetMinor} $R3
|
||||
${WinVerGetBuild} $R4
|
||||
; Though these values are sometimes incorrect due to bug 444664 it happens
|
||||
; so rarely it isn't worth working around it by reading the registry values.
|
||||
${WinVerGetMajor} $5
|
||||
${WinVerGetMinor} $6
|
||||
${WinVerGetBuild} $7
|
||||
${WinVerGetServicePackLevel} $8
|
||||
${If} ${IsServerOS}
|
||||
StrCpy $9 "1"
|
||||
${Else}
|
||||
StrCpy $9 "0"
|
||||
${EndIf}
|
||||
|
||||
${If} "$ExitCode" == "${ERR_SUCCESS}"
|
||||
ReadINIStr $R5 "$INSTDIR\application.ini" "App" "Version"
|
||||
@ -595,6 +581,74 @@ Function SendPing
|
||||
StrCpy $DownloadServerIP "Unknown"
|
||||
${EndIf}
|
||||
|
||||
StrCpy $R2 ""
|
||||
SetShellVarContext current ; Set SHCTX to the current user
|
||||
ReadRegStr $R2 HKCU "Software\Classes\http\shell\open\command" ""
|
||||
${If} $R2 != ""
|
||||
${GetPathFromString} "$R2" $R2
|
||||
${GetParent} "$R2" $R3
|
||||
${GetLongPath} "$R3" $R3
|
||||
${If} $R3 == $INSTDIR
|
||||
StrCpy $R2 "1" ; This Firefox install is set as default.
|
||||
${Else}
|
||||
StrCpy $R2 "$R2" "" -11 # length of firefox.exe
|
||||
${If} "$R2" == "${FileMainEXE}"
|
||||
StrCpy $R2 "2" ; Another Firefox install is set as default.
|
||||
${Else}
|
||||
StrCpy $R2 "0"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${Else}
|
||||
StrCpy $R2 "0" ; Firefox is not set as default.
|
||||
${EndIf}
|
||||
|
||||
${If} "$R2" == "0"
|
||||
${AndIf} ${AtLeastWinVista}
|
||||
; Check to see if this install location is currently set as the default
|
||||
; browser by Default Programs which is only available on Vista and above.
|
||||
ClearErrors
|
||||
ReadRegStr $R3 HKLM "Software\RegisteredApplications" "${AppRegName}"
|
||||
${Unless} ${Errors}
|
||||
AppAssocReg::QueryAppIsDefaultAll "${AppRegName}" "effective"
|
||||
Pop $R3
|
||||
${If} $R3 == "1"
|
||||
StrCpy $R3 ""
|
||||
ReadRegStr $R2 HKLM "Software\Classes\http\shell\open\command" ""
|
||||
${If} $R2 != ""
|
||||
${GetPathFromString} "$R2" $R2
|
||||
${GetParent} "$R2" $R3
|
||||
${GetLongPath} "$R3" $R3
|
||||
${If} $R3 == $INSTDIR
|
||||
StrCpy $R2 "1" ; This Firefox install is set as default.
|
||||
${Else}
|
||||
StrCpy $R2 "$R2" "" -11 # length of firefox.exe
|
||||
${If} "$R2" == "${FileMainEXE}"
|
||||
StrCpy $R2 "2" ; Another Firefox install is set as default.
|
||||
${Else}
|
||||
StrCpy $R2 "0"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${Else}
|
||||
StrCpy $R2 "0" ; Firefox is not set as default.
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndUnless}
|
||||
${EndIf}
|
||||
|
||||
${If} $CanSetAsDefault == "true"
|
||||
${If} $CheckboxSetAsDefault == "1"
|
||||
StrCpy $R3 "2"
|
||||
${Else}
|
||||
StrCpy $R3 "3"
|
||||
${EndIf}
|
||||
${Else}
|
||||
${If} ${AtLeastWin8}
|
||||
StrCpy $R3 "1"
|
||||
${Else}
|
||||
StrCpy $R3 "0"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
!ifdef STUB_DEBUG
|
||||
MessageBox MB_OK "${BaseURLStubPing} \
|
||||
$\nStub URL Version = ${StubURLVersion}${StubURLVersionAppend} \
|
||||
@ -603,13 +657,16 @@ Function SendPing
|
||||
$\nLocale = ${AB_CD} \
|
||||
$\nFirefox x64 = $R0 \
|
||||
$\nRunning x64 Windows = $R1 \
|
||||
$\nMajor = $R2 \
|
||||
$\nMinor = $R3 \
|
||||
$\nBuild = $R4 \
|
||||
$\nMajor = $5 \
|
||||
$\nMinor = $6 \
|
||||
$\nBuild = $7 \
|
||||
$\nServicePack = $8 \
|
||||
$\nIsServer = $9 \
|
||||
$\nExit Code = $ExitCode \
|
||||
$\nFirefox Launch Code = $FirefoxLaunchCode \
|
||||
$\nDownload Retry Count = $DownloadRetryCount \
|
||||
$\nDownloaded Bytes = $DownloadedBytes \
|
||||
$\nDownload Size Bytes = $DownloadSizeBytes \
|
||||
$\nIntroduction Phase Seconds = $IntroPhaseSeconds \
|
||||
$\nOptions Phase Seconds = $OptionsPhaseSeconds \
|
||||
$\nDownload Phase Seconds = $0 \
|
||||
@ -618,8 +675,6 @@ Function SendPing
|
||||
$\nPreinstall Phase Seconds = $2 \
|
||||
$\nInstall Phase Seconds = $3 \
|
||||
$\nFinish Phase Seconds = $4 \
|
||||
$\nIntro Page Shown Count = $IntroPageShownCount \
|
||||
$\nOptions Page Shown Count = $OptionsPageShownCount \
|
||||
$\nInitial Install Requirements Code = $InitialInstallRequirementsCode \
|
||||
$\nOpened Download Page = $OpenedDownloadPage \
|
||||
$\nExisting Profile = $ExistingProfile \
|
||||
@ -629,6 +684,8 @@ Function SendPing
|
||||
$\nNew Build ID = $R6 \
|
||||
$\nDefault Install Dir = $R7 \
|
||||
$\nHas Admin = $R8 \
|
||||
$\nDefault Status = $R2 \
|
||||
$\nSet As Sefault Status = $R3 \
|
||||
$\nDownload Server IP = $DownloadServerIP"
|
||||
; The following will exit the installer
|
||||
SetAutoClose true
|
||||
@ -636,7 +693,7 @@ Function SendPing
|
||||
Call RelativeGotoPage
|
||||
!else
|
||||
${NSD_CreateTimer} OnPing ${DownloadIntervalMS}
|
||||
InetBgDL::Get "${BaseURLStubPing}/${StubURLVersion}${StubURLVersionAppend}/${Channel}/${UpdateChannel}/${AB_CD}/$R0/$R1/$R2/$R3/$R4/$ExitCode/$FirefoxLaunchCode/$DownloadRetryCount/$DownloadedBytes/$IntroPhaseSeconds/$OptionsPhaseSeconds/$0/$1/$DownloadFirstTransferSeconds/$2/$3/$4/$IntroPageShownCount/$OptionsPageShownCount/$InitialInstallRequirementsCode/$OpenedDownloadPage/$ExistingProfile/$ExistingVersion/$ExistingBuildID/$R5/$R6/$R7/$R8/$DownloadServerIP" \
|
||||
InetBgDL::Get "${BaseURLStubPing}/${StubURLVersion}/${Channel}/${UpdateChannel}/${AB_CD}/$R0/$R1/$5/$6/$7/$8/$9/$ExitCode/$FirefoxLaunchCode/$DownloadRetryCount/$DownloadedBytes/$DownloadSizeBytes/$IntroPhaseSeconds/$OptionsPhaseSeconds/$0/$1/$DownloadFirstTransferSeconds/$2/$3/$4/$InitialInstallRequirementsCode/$OpenedDownloadPage/$ExistingProfile/$ExistingVersion/$ExistingBuildID/$R5/$R6/$R7/$R8/$R2/$R3/$DownloadServerIP" \
|
||||
"$PLUGINSDIR\_temp" /END
|
||||
!endif
|
||||
${Else}
|
||||
@ -675,8 +732,6 @@ Function createIntro
|
||||
|
||||
SetCtlColors $HWNDPARENT ${FOOTER_CONTROL_TEXT_COLOR_NORMAL} ${FOOTER_BKGRD_COLOR}
|
||||
GetDlgItem $0 $HWNDPARENT 10 ; Default browser checkbox
|
||||
; Set as default is not supported in the installer for Win8 and above so
|
||||
; only display it on Windows 7 and below
|
||||
${If} "$CanSetAsDefault" == "true"
|
||||
; The uxtheme must be disabled on checkboxes in order to override the
|
||||
; system font color.
|
||||
@ -714,8 +769,6 @@ Function createIntro
|
||||
GetDlgItem $0 $HWNDPARENT 3 ; Back button used for Options
|
||||
SendMessage $0 ${WM_SETTEXT} 0 "STR:$(OPTIONS_BUTTON)"
|
||||
|
||||
IntOp $IntroPageShownCount $IntroPageShownCount + 1
|
||||
|
||||
System::Call "kernel32::GetTickCount()l .s"
|
||||
Pop $StartIntroPhaseTickCount
|
||||
|
||||
@ -731,10 +784,12 @@ Function leaveIntro
|
||||
|
||||
System::Call "kernel32::GetTickCount()l .s"
|
||||
Pop $0
|
||||
${GetSecondsElapsed} "$StartIntroPhaseTickCount" "$0" $1
|
||||
; This is added to the previous value of $IntroPhaseSeconds because the
|
||||
; introduction page can be displayed multiple times.
|
||||
IntOp $IntroPhaseSeconds $IntroPhaseSeconds + $1
|
||||
${GetSecondsElapsed} "$StartIntroPhaseTickCount" "$0" $IntroPhaseSeconds
|
||||
; It is possible for this value to be 0 if the user clicks fast enough so
|
||||
; increment the value by 1 if it is 0.
|
||||
${If} $IntroPhaseSeconds == 0
|
||||
IntOp $IntroPhaseSeconds $IntroPhaseSeconds + 1
|
||||
${EndIf}
|
||||
|
||||
SetShellVarContext all ; Set SHCTX to All Users
|
||||
; If the user doesn't have write access to the installation directory set
|
||||
@ -980,8 +1035,6 @@ Function createOptions
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
StrCpy $OptionsPageShownCount "1"
|
||||
|
||||
System::Call "kernel32::GetTickCount()l .s"
|
||||
Pop $StartOptionsPhaseTickCount
|
||||
|
||||
@ -1017,10 +1070,12 @@ Function leaveOptions
|
||||
|
||||
System::Call "kernel32::GetTickCount()l .s"
|
||||
Pop $0
|
||||
${GetSecondsElapsed} "$StartOptionsPhaseTickCount" "$0" $1
|
||||
; This is added to the previous value of $OptionsPhaseSeconds because the
|
||||
; options page can be displayed multiple times.
|
||||
IntOp $OptionsPhaseSeconds $OptionsPhaseSeconds + $1
|
||||
${GetSecondsElapsed} "$StartOptionsPhaseTickCount" "$0" $OptionsPhaseSeconds
|
||||
; It is possible for this value to be 0 if the user clicks fast enough so
|
||||
; increment the value by 1 if it is 0.
|
||||
${If} $OptionsPhaseSeconds == 0
|
||||
IntOp $OptionsPhaseSeconds $OptionsPhaseSeconds + 1
|
||||
${EndIf}
|
||||
|
||||
${NSD_GetState} $CheckboxShortcutOnBar $CheckboxShortcutOnBar
|
||||
${NSD_GetState} $CheckboxShortcutInStartMenu $CheckboxShortcutInStartMenu
|
||||
@ -1101,40 +1156,26 @@ Function createInstall
|
||||
ShowWindow $BitmapBlurb3 ${SW_HIDE}
|
||||
ShowWindow $LabelBlurb3 ${SW_HIDE}
|
||||
|
||||
nsDialogs::CreateControl /NOUNLOAD STATIC ${DEFAULT_STYLES}|${SS_SUNKEN} 0 260u 166u 1u 30u ""
|
||||
Pop $0
|
||||
|
||||
${NSD_CreateLabelCenter} 103u 180u 157u 20u "$(DOWNLOADING_IN_PROGRESS)"
|
||||
Pop $LabelDownloadingInProgress
|
||||
SendMessage $LabelDownloadingInProgress ${WM_SETFONT} $FontNormal 0
|
||||
SetCtlColors $LabelDownloadingInProgress ${INSTALL_PROGRESS_TEXT_COLOR_NORMAL} transparent
|
||||
|
||||
${NSD_CreateLabelCenter} 103u 180u 157u 20u "$(DOWNLOADING_DONE)"
|
||||
Pop $LabelDownloadingDown
|
||||
SendMessage $LabelDownloadingDown ${WM_SETFONT} $FontItalic 0
|
||||
SetCtlColors $LabelDownloadingDown ${INSTALL_PROGRESS_TEXT_COLOR_FADED} transparent
|
||||
ShowWindow $LabelDownloadingDown ${SW_HIDE}
|
||||
|
||||
${NSD_CreateLabelCenter} 260uu 180u 84u 20u "$(INSTALLING_TO_BE_DONE)"
|
||||
Pop $LabelInstallingToBeDone
|
||||
SendMessage $LabelInstallingToBeDone ${WM_SETFONT} $FontItalic 0
|
||||
SetCtlColors $LabelInstallingToBeDone ${INSTALL_PROGRESS_TEXT_COLOR_FADED} transparent
|
||||
|
||||
${NSD_CreateLabelCenter} 260uu 180u 84u 20u "$(INSTALLING_IN_PROGRESS)"
|
||||
Pop $LabelInstallingInProgress
|
||||
SendMessage $LabelInstallingInProgress ${WM_SETFONT} $FontNormal 0
|
||||
SetCtlColors $LabelInstallingInProgress ${INSTALL_PROGRESS_TEXT_COLOR_NORMAL} transparent
|
||||
ShowWindow $LabelInstallingInProgress ${SW_HIDE}
|
||||
|
||||
${NSD_CreateProgressBar} 103u 166u 157u 9u ""
|
||||
Pop $ProgressbarDownload
|
||||
${NSD_AddStyle} $ProgressbarDownload ${PBS_MARQUEE}
|
||||
SendMessage $ProgressbarDownload ${PBM_SETMARQUEE} 1 \
|
||||
${NSD_CreateProgressBar} 103u 166u 241u 9u ""
|
||||
Pop $Progressbar
|
||||
${NSD_AddStyle} $Progressbar ${PBS_MARQUEE}
|
||||
SendMessage $Progressbar ${PBM_SETMARQUEE} 1 \
|
||||
${ProgressbarMarqueeIntervalMS} ; start=1|stop=0 interval(ms)=+N
|
||||
|
||||
${NSD_CreateProgressBar} 260u 166u 84u 9u ""
|
||||
Pop $ProgressbarInstall
|
||||
SendMessage $ProgressbarInstall ${PBM_SETRANGE32} 0 ${InstallProgresSteps}
|
||||
${NSD_CreateLabelCenter} 103u 180u 241u 20u "$(DOWNLOADING_LABEL)"
|
||||
Pop $LabelDownloading
|
||||
SendMessage $LabelDownloading ${WM_SETFONT} $FontNormal 0
|
||||
SetCtlColors $LabelDownloading ${INSTALL_PROGRESS_TEXT_COLOR_NORMAL} transparent
|
||||
|
||||
${If} ${FileExists} "$INSTDIR\${FileMainEXE}"
|
||||
${NSD_CreateLabelCenter} 103u 180u 241u 20u "$(UPGRADING_LABEL)"
|
||||
${Else}
|
||||
${NSD_CreateLabelCenter} 103u 180u 241u 20u "$(INSTALLING_LABEL)"
|
||||
${EndIf}
|
||||
Pop $LabelInstalling
|
||||
SendMessage $LabelInstalling ${WM_SETFONT} $FontNormal 0
|
||||
SetCtlColors $LabelInstalling ${INSTALL_PROGRESS_TEXT_COLOR_NORMAL} transparent
|
||||
ShowWindow $LabelInstalling ${SW_HIDE}
|
||||
|
||||
${NSD_CreateBitmap} ${APPNAME_BMP_EDGE_DU} ${APPNAME_BMP_TOP_DU} \
|
||||
${APPNAME_BMP_WIDTH_DU} ${APPNAME_BMP_HEIGHT_DU} ""
|
||||
@ -1161,7 +1202,6 @@ Function createInstall
|
||||
; Kill the Cancel button's focus so pressing enter won't cancel the install.
|
||||
SendMessage $0 ${WM_KILLFOCUS} 0 0
|
||||
|
||||
; Set as default is not supported in the installer for Win8 and above
|
||||
${If} "$CanSetAsDefault" == "true"
|
||||
GetDlgItem $0 $HWNDPARENT 10 ; Default browser checkbox
|
||||
SendMessage $0 ${BM_GETCHECK} 0 0 $CheckboxSetAsDefault
|
||||
@ -1170,7 +1210,11 @@ Function createInstall
|
||||
${EndIf}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 11
|
||||
SendMessage $0 ${WM_SETTEXT} 0 "STR:$(ONE_MOMENT)"
|
||||
${If} ${FileExists} "$INSTDIR\${FileMainEXE}"
|
||||
SendMessage $0 ${WM_SETTEXT} 0 "STR:$(ONE_MOMENT_UPGRADE)"
|
||||
${Else}
|
||||
SendMessage $0 ${WM_SETTEXT} 0 "STR:$(ONE_MOMENT_INSTALL)"
|
||||
${EndIf}
|
||||
SendMessage $0 ${WM_SETFONT} $FontNormal 0
|
||||
SetCtlColors $0 ${FOOTER_CONTROL_TEXT_COLOR_FADED} ${FOOTER_BKGRD_COLOR}
|
||||
ShowWindow $0 ${SW_SHOW}
|
||||
@ -1209,6 +1253,12 @@ Function createInstall
|
||||
System::Call "kernel32::GetTickCount()l .s"
|
||||
Pop $StartDownloadPhaseTickCount
|
||||
|
||||
${If} ${FileExists} "$INSTDIR\uninstall\uninstall.log"
|
||||
StrCpy $InstallTotalSteps ${InstallPaveOverTotalSteps}
|
||||
${Else}
|
||||
StrCpy $InstallTotalSteps ${InstallCleanTotalSteps}
|
||||
${EndIf}
|
||||
|
||||
${NSD_CreateTimer} StartDownload ${DownloadIntervalMS}
|
||||
|
||||
LockWindow off
|
||||
@ -1247,8 +1297,8 @@ Function OnDownload
|
||||
IntOp $DownloadRetryCount $DownloadRetryCount + 1
|
||||
${If} "$DownloadReset" != "true"
|
||||
StrCpy $DownloadedBytes "0"
|
||||
${NSD_AddStyle} $ProgressbarDownload ${PBS_MARQUEE}
|
||||
SendMessage $ProgressbarDownload ${PBM_SETMARQUEE} 1 \
|
||||
${NSD_AddStyle} $Progressbar ${PBS_MARQUEE}
|
||||
SendMessage $Progressbar ${PBM_SETMARQUEE} 1 \
|
||||
${ProgressbarMarqueeIntervalMS} ; start=1|stop=0 interval(ms)=+N
|
||||
${EndIf}
|
||||
InetBgDL::Get /RESET /END
|
||||
@ -1302,9 +1352,13 @@ Function OnDownload
|
||||
StrCpy $DownloadSizeBytes "$4"
|
||||
System::Int64Op $4 / 2
|
||||
Pop $HalfOfDownload
|
||||
SendMessage $ProgressbarDownload ${PBM_SETMARQUEE} 0 0 ; start=1|stop=0 interval(ms)=+N
|
||||
${RemoveStyle} $ProgressbarDownload ${PBS_MARQUEE}
|
||||
SendMessage $ProgressbarDownload ${PBM_SETRANGE32} 0 $DownloadSizeBytes
|
||||
System::Int64Op $HalfOfDownload / $InstallTotalSteps
|
||||
Pop $InstallStepSize
|
||||
SendMessage $Progressbar ${PBM_SETMARQUEE} 0 0 ; start=1|stop=0 interval(ms)=+N
|
||||
${RemoveStyle} $Progressbar ${PBS_MARQUEE}
|
||||
System::Int64Op $HalfOfDownload + $DownloadSizeBytes
|
||||
Pop $R9
|
||||
SendMessage $Progressbar ${PBM_SETRANGE32} 0 $R9
|
||||
${EndIf}
|
||||
|
||||
; Don't update the status until after the download starts
|
||||
@ -1361,12 +1415,14 @@ Function OnDownload
|
||||
LockWindow on
|
||||
; Update the progress bars first in the UI change so they take affect
|
||||
; before other UI changes.
|
||||
SendMessage $ProgressbarDownload ${PBM_SETPOS} $DownloadSizeBytes 0
|
||||
SendMessage $ProgressbarInstall ${PBM_SETPOS} $InstallCounterStep 0
|
||||
ShowWindow $LabelDownloadingInProgress ${SW_HIDE}
|
||||
ShowWindow $LabelInstallingToBeDone ${SW_HIDE}
|
||||
ShowWindow $LabelInstallingInProgress ${SW_SHOW}
|
||||
ShowWindow $LabelDownloadingDown ${SW_SHOW}
|
||||
SendMessage $Progressbar ${PBM_SETPOS} $DownloadSizeBytes 0
|
||||
System::Int64Op $InstallStepSize * ${InstallProgressFirstStep}
|
||||
Pop $R9
|
||||
SendMessage $Progressbar ${PBM_SETSTEP} $R9 0
|
||||
SendMessage $Progressbar ${PBM_STEPIT} 0 0
|
||||
SendMessage $Progressbar ${PBM_SETSTEP} $InstallStepSize 0
|
||||
ShowWindow $LabelDownloading ${SW_HIDE}
|
||||
ShowWindow $LabelInstalling ${SW_SHOW}
|
||||
ShowWindow $LabelBlurb2 ${SW_HIDE}
|
||||
ShowWindow $BitmapBlurb2 ${SW_HIDE}
|
||||
ShowWindow $LabelBlurb3 ${SW_SHOW}
|
||||
@ -1451,7 +1507,7 @@ Function OnDownload
|
||||
WriteIniStr "$0" "TASKBAR" "Migrated" "true"
|
||||
${EndIf}
|
||||
|
||||
${OnStubInstallUninstall}
|
||||
${OnStubInstallUninstall} $Progressbar $InstallCounterStep
|
||||
|
||||
; Delete the install.log and let the full installer create it. When the
|
||||
; installer closes it we can detect that it has completed.
|
||||
@ -1476,7 +1532,7 @@ Function OnDownload
|
||||
LockWindow off
|
||||
${EndIf}
|
||||
StrCpy $DownloadedBytes "$3"
|
||||
SendMessage $ProgressbarDownload ${PBM_SETPOS} $3 0
|
||||
SendMessage $Progressbar ${PBM_SETPOS} $3 0
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
@ -1511,7 +1567,7 @@ Function StartInstall
|
||||
|
||||
IntOp $InstallCounterStep $InstallCounterStep + 1
|
||||
LockWindow on
|
||||
SendMessage $ProgressbarInstall ${PBM_SETPOS} $InstallCounterStep 0
|
||||
SendMessage $Progressbar ${PBM_STEPIT} 0 0
|
||||
LockWindow off
|
||||
|
||||
Exec "$\"$PLUGINSDIR\download.exe$\" /INI=$PLUGINSDIR\${CONFIG_INI}"
|
||||
@ -1520,7 +1576,7 @@ FunctionEnd
|
||||
|
||||
Function CheckInstall
|
||||
IntOp $InstallCounterStep $InstallCounterStep + 1
|
||||
${If} $InstallCounterStep >= ${InstallProgresSteps}
|
||||
${If} $InstallCounterStep >= $InstallTotalSteps
|
||||
${NSD_KillTimer} CheckInstall
|
||||
; Close the handle that prevents modification of the full installer
|
||||
System::Call 'kernel32::CloseHandle(i $HandleDownload)'
|
||||
@ -1530,7 +1586,7 @@ Function CheckInstall
|
||||
Return
|
||||
${EndIf}
|
||||
|
||||
SendMessage $ProgressbarInstall ${PBM_SETPOS} $InstallCounterStep 0
|
||||
SendMessage $Progressbar ${PBM_STEPIT} 0 0
|
||||
|
||||
${If} ${FileExists} "$INSTDIR\install.log"
|
||||
Delete "$INSTDIR\install.tmp"
|
||||
@ -1549,26 +1605,32 @@ Function CheckInstall
|
||||
Delete "$PLUGINSDIR\${CONFIG_INI}"
|
||||
System::Call "kernel32::GetTickCount()l .s"
|
||||
Pop $EndInstallPhaseTickCount
|
||||
System::Int64Op $InstallStepSize * 20
|
||||
Pop $InstallStepSize
|
||||
SendMessage $Progressbar ${PBM_SETSTEP} $InstallStepSize 0
|
||||
${NSD_CreateTimer} FinishInstall ${InstallIntervalMS}
|
||||
${EndUnless}
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function FinishInstall
|
||||
; The full installer has complete but we still need to finish the progress
|
||||
; bar so increase the size of the step
|
||||
IntOp $InstallCounterStep $InstallCounterStep + 20
|
||||
${If} ${InstallProgresSteps} < $InstallCounterStep
|
||||
StrCpy $InstallCounterStep "${InstallProgresSteps}"
|
||||
; The full installer has completed but the progress bar still needs to finish
|
||||
; so increase the size of the step.
|
||||
IntOp $InstallCounterStep $InstallCounterStep + 40
|
||||
${If} $InstallTotalSteps < $InstallCounterStep
|
||||
StrCpy $InstallCounterStep "$InstallTotalSteps"
|
||||
${EndIf}
|
||||
|
||||
SendMessage $ProgressbarInstall ${PBM_SETPOS} $InstallCounterStep 0
|
||||
${If} ${InstallProgresSteps} != $InstallCounterStep
|
||||
${If} $InstallTotalSteps != $InstallCounterStep
|
||||
SendMessage $Progressbar ${PBM_STEPIT} 0 0
|
||||
Return
|
||||
${EndIf}
|
||||
|
||||
${NSD_KillTimer} FinishInstall
|
||||
|
||||
SendMessage $Progressbar ${PBM_GETRANGE} 0 0 $R9
|
||||
SendMessage $Progressbar ${PBM_SETPOS} $R9 0
|
||||
|
||||
${If} "$CheckboxSetAsDefault" == "1"
|
||||
${GetParameters} $0
|
||||
ClearErrors
|
||||
@ -1603,6 +1665,19 @@ Function FinishInstall
|
||||
|
||||
StrCpy $ExitCode "${ERR_SUCCESS}"
|
||||
|
||||
StrCpy $InstallCounterStep 0
|
||||
${NSD_CreateTimer} FinishProgressBar ${InstallIntervalMS}
|
||||
FunctionEnd
|
||||
|
||||
Function FinishProgressBar
|
||||
IntOp $InstallCounterStep $InstallCounterStep + 1
|
||||
|
||||
${If} $InstallCounterStep < 10
|
||||
Return
|
||||
${EndIf}
|
||||
|
||||
${NSD_KillTimer} FinishProgressBar
|
||||
|
||||
Call LaunchApp
|
||||
|
||||
Call SendPing
|
||||
|
@ -46,16 +46,16 @@ ADD_CheckboxShortcutInStartMenu=In my &Start Menu Programs Folder
|
||||
ADD_CheckboxShortcutOnDesktop=On my &Desktop
|
||||
SPACE_REQUIRED=Space Required:
|
||||
SPACE_AVAILABLE=Space Available:
|
||||
ONE_MOMENT=One moment, $BrandShortName will launch as soon as the install is complete…
|
||||
ONE_MOMENT_INSTALL=One moment, $BrandShortName will launch as soon as the install is complete…
|
||||
ONE_MOMENT_UPGRADE=One moment, $BrandShortName will launch as soon as the upgrade is complete…
|
||||
INSTALL_MAINT_SERVICE=&Install the $BrandShortName background update service
|
||||
SEND_PING=S&end information about this installation to Mozilla
|
||||
BROWSE_BUTTON=B&rowse…
|
||||
DEST_FOLDER=Destination Folder
|
||||
|
||||
DOWNLOADING_IN_PROGRESS=Downloading…
|
||||
DOWNLOADING_DONE=Downloaded
|
||||
INSTALLING_TO_BE_DONE=Installing
|
||||
INSTALLING_IN_PROGRESS=Installing…
|
||||
DOWNLOADING_LABEL=Downloading $BrandShortName…
|
||||
INSTALLING_LABEL=Installing $BrandShortName…
|
||||
UPGRADING_LABEL=Upgrading $BrandShortName…
|
||||
|
||||
SELECT_FOLDER_TEXT=Select the folder to install $BrandShortName in.
|
||||
|
||||
|
@ -11,24 +11,39 @@ dnl can mess around with things like:
|
||||
dnl AC_SOMETHING(foo,AC_SUBST(),bar)
|
||||
define([AC_SUBST],
|
||||
[ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
|
||||
[ifdef([AC_SUBST_LIST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
|
||||
[ifdef([AC_SUBST_$1], ,
|
||||
[define([AC_SUBST_$1], )dnl
|
||||
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
|
||||
(''' $1 ''', r''' [$]$1 ''')
|
||||
AC_DIVERT_POP()dnl
|
||||
])])])
|
||||
])])])])
|
||||
|
||||
dnl Like AC_SUBST, but makes the value available as a set in python,
|
||||
dnl with values got from the value of the environment variable, split on
|
||||
dnl whitespaces.
|
||||
define([AC_SUBST_SET],
|
||||
[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
|
||||
[ifdef([AC_SUBST_LIST$1], [m4_fatal([Cannot use AC_SUBST_LIST and AC_SUBST_SET on the same variable ($1)])],
|
||||
[ifdef([AC_SUBST_SET_$1], ,
|
||||
[define([AC_SUBST_SET_$1], )dnl
|
||||
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
|
||||
(''' $1 ''', set(r''' [$]$1 '''.split()))
|
||||
AC_DIVERT_POP()dnl
|
||||
])])])
|
||||
])])])])
|
||||
|
||||
dnl Like AC_SUBST, but makes the value available as a list in python,
|
||||
dnl with values got from the value of the environment variable, split on
|
||||
dnl whitespaces.
|
||||
define([AC_SUBST_LIST],
|
||||
[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
|
||||
[ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST_SET and AC_SUBST_LIST on the same variable ($1)])],
|
||||
[ifdef([AC_SUBST_LIST_$1], ,
|
||||
[define([AC_SUBST_LIST_$1], )dnl
|
||||
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
|
||||
(''' $1 ''', list(r''' [$]$1 '''.split()))
|
||||
AC_DIVERT_POP()dnl
|
||||
])])])])
|
||||
|
||||
dnl Wrap AC_DEFINE to store values in a format suitable for python.
|
||||
dnl autoconf's AC_DEFINE still needs to be used to fill confdefs.h,
|
||||
|
37
configure.in
37
configure.in
@ -176,7 +176,11 @@ fi
|
||||
if test -n "$FXOS_SIMULATOR" -a -z "$GAIADIR" ; then
|
||||
AC_MSG_ERROR([FXOS_SIMULATOR=1 requires GAIADIR to be defined])
|
||||
fi
|
||||
AC_SUBST(FXOS_SIMULATOR)
|
||||
|
||||
if test -n "$FXOS_SIMULATOR" ; then
|
||||
AC_DEFINE(FXOS_SIMULATOR)
|
||||
AC_SUBST(FXOS_SIMULATOR)
|
||||
fi
|
||||
|
||||
MOZ_ARG_WITH_STRING(gonk,
|
||||
[ --with-gonk=DIR
|
||||
@ -1912,6 +1916,9 @@ case "$target" in
|
||||
fi
|
||||
TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
|
||||
|
||||
MMX_FLAGS="-mmmx"
|
||||
SSE_FLAGS="-msse"
|
||||
SSE2_FLAGS="-msse2"
|
||||
|
||||
if test "x$lto_is_enabled" = "xyes"; then
|
||||
echo "Skipping -dead_strip because lto is enabled."
|
||||
@ -2004,6 +2011,10 @@ ia64*-hpux*)
|
||||
fi
|
||||
TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
|
||||
|
||||
MMX_FLAGS="-mmmx"
|
||||
SSE_FLAGS="-msse"
|
||||
SSE2_FLAGS="-msse2"
|
||||
|
||||
MOZ_GFX_OPTIMIZE_MOBILE=1
|
||||
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
|
||||
;;
|
||||
@ -2025,6 +2036,10 @@ ia64*-hpux*)
|
||||
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
|
||||
fi
|
||||
|
||||
MMX_FLAGS="-mmmx"
|
||||
SSE_FLAGS="-msse"
|
||||
SSE2_FLAGS="-msse2"
|
||||
|
||||
TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
|
||||
|
||||
MOZ_MEMORY=1
|
||||
@ -2070,6 +2085,10 @@ ia64*-hpux*)
|
||||
DLL_PREFIX=
|
||||
IMPORT_LIB_SUFFIX=dll.a
|
||||
|
||||
MMX_FLAGS="-mmmx"
|
||||
SSE_FLAGS="-msse"
|
||||
SSE2_FLAGS="-msse2"
|
||||
|
||||
# We use mix of both POSIX and Win32 printf format across the tree, so format
|
||||
# warnings are useless on mingw.
|
||||
MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
|
||||
@ -2271,6 +2290,9 @@ ia64*-hpux*)
|
||||
fi
|
||||
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
|
||||
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@)) -o $@'
|
||||
MMX_FLAGS="-mmmx"
|
||||
SSE_FLAGS="-msse"
|
||||
SSE2_FLAGS="-msse2"
|
||||
;;
|
||||
|
||||
*-openbsd*)
|
||||
@ -2286,6 +2308,9 @@ ia64*-hpux*)
|
||||
if test "$LIBRUNPATH"; then
|
||||
DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
|
||||
fi
|
||||
MMX_FLAGS="-mmmx"
|
||||
SSE_FLAGS="-msse"
|
||||
SSE2_FLAGS="-msse2"
|
||||
;;
|
||||
|
||||
*-solaris*)
|
||||
@ -2301,6 +2326,9 @@ ia64*-hpux*)
|
||||
CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
|
||||
CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
|
||||
LDFLAGS="-xildoff $LDFLAGS"
|
||||
MMX_FLAGS="-xarch=mmx -xO4"
|
||||
SSE_FLAGS="-xarch=sse"
|
||||
SSE2_FLAGS="-xarch=ssei2 -xO4"
|
||||
if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
|
||||
_SAVE_LDFLAGS=$LDFLAGS
|
||||
LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
|
||||
@ -2364,6 +2392,9 @@ ia64*-hpux*)
|
||||
if test "$OS_RELEASE" = "5.3"; then
|
||||
AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
|
||||
fi
|
||||
MMX_FLAGS="-mmmx"
|
||||
SSE_FLAGS="-msse"
|
||||
SSE2_FLAGS="-msse2"
|
||||
fi
|
||||
if test "$OS_RELEASE" = "5.5.1"; then
|
||||
AC_DEFINE(NEED_USLEEP_PROTOTYPE)
|
||||
@ -2385,6 +2416,10 @@ ia64*-hpux*)
|
||||
|
||||
esac
|
||||
|
||||
AC_SUBST_LIST(MMX_FLAGS)
|
||||
AC_SUBST_LIST(SSE_FLAGS)
|
||||
AC_SUBST_LIST(SSE2_FLAGS)
|
||||
|
||||
case "$target" in
|
||||
*-*linux*)
|
||||
# Includes linux-android
|
||||
|
@ -2650,4 +2650,10 @@ nsINode::OwnerDocAsNode() const
|
||||
return OwnerDoc();
|
||||
}
|
||||
|
||||
inline mozilla::dom::ParentObject
|
||||
nsINode::GetParentObject() const
|
||||
{
|
||||
return GetParentObjectInternal(OwnerDoc());
|
||||
}
|
||||
|
||||
#endif /* nsIDocument_h___ */
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "mozilla/dom/EventTarget.h" // for base class
|
||||
#include "js/TypeDecls.h" // for Handle, Value, JSObject, JSContext
|
||||
#include "mozilla/dom/DOMString.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
|
||||
// Including 'windows.h' will #define GetClassInfo to something else.
|
||||
#ifdef XP_WIN
|
||||
@ -392,18 +393,18 @@ protected:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
public:
|
||||
nsIDocument* GetParentObject() const
|
||||
{
|
||||
// Make sure that we get the owner document of the content node, in case
|
||||
// we're in document teardown. If we are, it's important to *not* use
|
||||
// globalObj as the node's parent since that would give the node the
|
||||
// principal of globalObj (i.e. the principal of the document that's being
|
||||
// loaded) and not the principal of the document that's being unloaded.
|
||||
// See http://bugzilla.mozilla.org/show_bug.cgi?id=227417
|
||||
return OwnerDoc();
|
||||
// Subclasses that wish to override the parent behavior should return the
|
||||
// result of GetParentObjectIntenral, which handles the XBL scope stuff.
|
||||
//
|
||||
mozilla::dom::ParentObject GetParentObjectInternal(nsINode* aNativeParent) const {
|
||||
mozilla::dom::ParentObject p(aNativeParent);
|
||||
p.mUseXBLScope = ChromeOnlyAccess();
|
||||
return p;
|
||||
}
|
||||
|
||||
public:
|
||||
mozilla::dom::ParentObject GetParentObject() const; // Implemented in nsIDocument.h
|
||||
|
||||
/**
|
||||
* Return whether the node is an Element node
|
||||
*/
|
||||
|
@ -572,24 +572,20 @@ Link::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
}
|
||||
|
||||
URLSearchParams*
|
||||
Link::GetSearchParams()
|
||||
Link::SearchParams()
|
||||
{
|
||||
CreateSearchParamsIfNeeded();
|
||||
return mSearchParams;
|
||||
}
|
||||
|
||||
void
|
||||
Link::SetSearchParams(URLSearchParams* aSearchParams)
|
||||
Link::SetSearchParams(URLSearchParams& aSearchParams)
|
||||
{
|
||||
if (!aSearchParams) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mSearchParams) {
|
||||
mSearchParams->RemoveObserver(this);
|
||||
}
|
||||
|
||||
mSearchParams = aSearchParams;
|
||||
mSearchParams = &aSearchParams;
|
||||
mSearchParams->AddObserver(this);
|
||||
|
||||
nsAutoString search;
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
void SetHostname(const nsAString &aHostname);
|
||||
void SetPathname(const nsAString &aPathname);
|
||||
void SetSearch(const nsAString &aSearch);
|
||||
void SetSearchParams(mozilla::dom::URLSearchParams* aSearchParams);
|
||||
void SetSearchParams(mozilla::dom::URLSearchParams& aSearchParams);
|
||||
void SetPort(const nsAString &aPort);
|
||||
void SetHash(const nsAString &aHash);
|
||||
void GetOrigin(nsAString &aOrigin);
|
||||
@ -73,7 +73,7 @@ public:
|
||||
void GetHostname(nsAString &_hostname);
|
||||
void GetPathname(nsAString &_pathname);
|
||||
void GetSearch(nsAString &_search);
|
||||
URLSearchParams* GetSearchParams();
|
||||
URLSearchParams* SearchParams();
|
||||
void GetPort(nsAString &_port);
|
||||
void GetHash(nsAString &_hash);
|
||||
|
||||
|
@ -51,12 +51,7 @@ if CONFIG['MOZ_WEBRTC']:
|
||||
# nsTextFragment.cpp
|
||||
if CONFIG['INTEL_ARCHITECTURE']:
|
||||
SOURCES += ['nsTextFragmentSSE2.cpp']
|
||||
if CONFIG['GNU_CC']:
|
||||
# gcc requires -msse2 for this file since it uses SSE2 intrinsics. (See bug
|
||||
# 585538 comment 12.)
|
||||
SOURCES['nsTextFragmentSSE2.cpp'].flags += ['-msse2']
|
||||
if CONFIG['SOLARIS_SUNPRO_CXX']:
|
||||
SOURCES['nsTextFragmentSSE2.cpp'].flags += ['-xarch=sse2', '-xO4']
|
||||
SOURCES['nsTextFragmentSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'Attr.h',
|
||||
|
@ -2594,19 +2594,8 @@ nsINode::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aScope)
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> obj(aCx, WrapNode(aCx, aScope));
|
||||
if (obj && ChromeOnlyAccess() &&
|
||||
!nsContentUtils::IsSystemPrincipal(NodePrincipal()) &&
|
||||
xpc::AllowXBLScope(js::GetObjectCompartment(obj)))
|
||||
{
|
||||
// Create a new wrapper and cache it.
|
||||
JSAutoCompartment ac(aCx, obj);
|
||||
JSObject* wrapper = xpc::WrapperFactory::WrapSOWObject(aCx, obj);
|
||||
if (!wrapper) {
|
||||
ClearWrapper();
|
||||
return nullptr;
|
||||
}
|
||||
dom::SetSystemOnlyWrapper(obj, this, *wrapper);
|
||||
}
|
||||
MOZ_ASSERT_IF(ChromeOnlyAccess(),
|
||||
xpc::IsInXBLScope(obj) || !xpc::UseXBLScope(js::GetObjectCompartment(obj)));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -1537,11 +1537,11 @@ nsXMLHttpRequest::Open(const nsACString& method, const nsACString& url,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXMLHttpRequest::Open(const nsACString& method, const nsACString& url,
|
||||
nsXMLHttpRequest::Open(const nsACString& inMethod, const nsACString& url,
|
||||
bool async, const Optional<nsAString>& user,
|
||||
const Optional<nsAString>& password)
|
||||
{
|
||||
NS_ENSURE_ARG(!method.IsEmpty());
|
||||
NS_ENSURE_ARG(!inMethod.IsEmpty());
|
||||
|
||||
if (!async && !DontWarnAboutSyncXHR() && GetOwner() &&
|
||||
GetOwner()->GetExtantDoc()) {
|
||||
@ -1555,9 +1555,29 @@ nsXMLHttpRequest::Open(const nsACString& method, const nsACString& url,
|
||||
|
||||
// Disallow HTTP/1.1 TRACE method (see bug 302489)
|
||||
// and MS IIS equivalent TRACK (see bug 381264)
|
||||
if (method.LowerCaseEqualsLiteral("trace") ||
|
||||
method.LowerCaseEqualsLiteral("track")) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
// and CONNECT
|
||||
if (inMethod.LowerCaseEqualsLiteral("trace") ||
|
||||
inMethod.LowerCaseEqualsLiteral("connect") ||
|
||||
inMethod.LowerCaseEqualsLiteral("track")) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
nsAutoCString method;
|
||||
// GET, POST, DELETE, HEAD, OPTIONS, PUT methods normalized to upper case
|
||||
if (inMethod.LowerCaseEqualsLiteral("get")) {
|
||||
method.Assign(NS_LITERAL_CSTRING("GET"));
|
||||
} else if (inMethod.LowerCaseEqualsLiteral("post")) {
|
||||
method.Assign(NS_LITERAL_CSTRING("POST"));
|
||||
} else if (inMethod.LowerCaseEqualsLiteral("delete")) {
|
||||
method.Assign(NS_LITERAL_CSTRING("DELETE"));
|
||||
} else if (inMethod.LowerCaseEqualsLiteral("head")) {
|
||||
method.Assign(NS_LITERAL_CSTRING("HEAD"));
|
||||
} else if (inMethod.LowerCaseEqualsLiteral("options")) {
|
||||
method.Assign(NS_LITERAL_CSTRING("OPTIONS"));
|
||||
} else if (inMethod.LowerCaseEqualsLiteral("put")) {
|
||||
method.Assign(NS_LITERAL_CSTRING("PUT"));
|
||||
} else {
|
||||
method = inMethod; // other methods are not normalized
|
||||
}
|
||||
|
||||
// sync request is not allowed using withCredential or responseType
|
||||
|
@ -3130,6 +3130,18 @@ CanvasRenderingContext2D::IsPointInPath(double x, double y, const CanvasWindingR
|
||||
return mPath->ContainsPoint(Point(x, y), mTarget->GetTransform());
|
||||
}
|
||||
|
||||
bool CanvasRenderingContext2D::IsPointInPath(const CanvasPath& mPath, double x, double y, const CanvasWindingRule& mWinding)
|
||||
{
|
||||
if (!FloatValidate(x,y)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EnsureTarget();
|
||||
RefPtr<gfx::Path> tempPath = mPath.GetPath(mWinding, mTarget);
|
||||
|
||||
return tempPath->ContainsPoint(Point(x, y), mTarget->GetTransform());
|
||||
}
|
||||
|
||||
bool
|
||||
CanvasRenderingContext2D::IsPointInStroke(double x, double y)
|
||||
{
|
||||
@ -3158,6 +3170,28 @@ CanvasRenderingContext2D::IsPointInStroke(double x, double y)
|
||||
return mPath->StrokeContainsPoint(strokeOptions, Point(x, y), mTarget->GetTransform());
|
||||
}
|
||||
|
||||
bool CanvasRenderingContext2D::IsPointInStroke(const CanvasPath& mPath, double x, double y)
|
||||
{
|
||||
if (!FloatValidate(x,y)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EnsureTarget();
|
||||
RefPtr<gfx::Path> tempPath = mPath.GetPath(CanvasWindingRule::Nonzero, mTarget);
|
||||
|
||||
const ContextState &state = CurrentState();
|
||||
|
||||
StrokeOptions strokeOptions(state.lineWidth,
|
||||
state.lineJoin,
|
||||
state.lineCap,
|
||||
state.miterLimit,
|
||||
state.dash.Length(),
|
||||
state.dash.Elements(),
|
||||
state.dashOffset);
|
||||
|
||||
return tempPath->StrokeContainsPoint(strokeOptions, Point(x, y), mTarget->GetTransform());
|
||||
}
|
||||
|
||||
//
|
||||
// image
|
||||
//
|
||||
|
@ -231,7 +231,9 @@ public:
|
||||
void Clip(const CanvasWindingRule& winding);
|
||||
void Clip(const CanvasPath& path, const CanvasWindingRule& winding);
|
||||
bool IsPointInPath(double x, double y, const CanvasWindingRule& winding);
|
||||
bool IsPointInPath(const CanvasPath& path, double x, double y, const CanvasWindingRule& winding);
|
||||
bool IsPointInStroke(double x, double y);
|
||||
bool IsPointInStroke(const CanvasPath& path, double x, double y);
|
||||
void FillText(const nsAString& text, double x, double y,
|
||||
const Optional<double>& maxWidth,
|
||||
mozilla::ErrorResult& error);
|
||||
|
@ -162,6 +162,159 @@ function test_large_canvas() {
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>Canvas test: test_isPointInPath_canvas</p>
|
||||
<canvas id="c5" class="output" width="100" height="100">+
|
||||
</canvas>
|
||||
<script type="text/javascript">
|
||||
|
||||
function shouldThrow(ctx, s) {
|
||||
var _ok = false;
|
||||
try {
|
||||
eval(s);
|
||||
} catch(e) {
|
||||
_ok = true;
|
||||
}
|
||||
ok(_ok, s);
|
||||
}
|
||||
|
||||
function shouldBeTrue(ctx, path, s) {
|
||||
var _ok = eval(s);
|
||||
ok(_ok, s);
|
||||
}
|
||||
function shouldBeFalse(ctx, path, s) {
|
||||
var _ok = !eval(s);
|
||||
ok(_ok, s);
|
||||
}
|
||||
|
||||
function test_isPointInPath_canvas() {
|
||||
var c = document.getElementById("c5");
|
||||
var ctx = c.getContext("2d");
|
||||
|
||||
var path = new Path2D();
|
||||
path.rect(0, 0, 100, 100);
|
||||
path.rect(25, 25, 50, 50);
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInPath(path, 50, 50)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInPath(path, NaN, 50)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInPath(path, 50, NaN)");
|
||||
|
||||
path = new Path2D();
|
||||
path.rect(0, 0, 100, 100);
|
||||
path.rect(25, 25, 50, 50);
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInPath(path, 50, 50, 'nonzero')");
|
||||
|
||||
path = new Path2D();
|
||||
path.rect(0, 0, 100, 100);
|
||||
path.rect(25, 25, 50, 50);
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInPath(path, 50, 50, 'evenodd')");
|
||||
|
||||
shouldThrow(ctx, "ctx.isPointInPath(null, 50, 50)");
|
||||
shouldThrow(ctx, "ctx.isPointInPath(null, 50, 50, 'nonzero')");
|
||||
shouldThrow(ctx, "ctx.isPointInPath(null, 50, 50, 'evenodd')");
|
||||
shouldThrow(ctx, "ctx.isPointInPath(path, 50, 50)");
|
||||
shouldThrow(ctx, "ctx.isPointInPath(path, 50, 50, 'nonzero')");
|
||||
shouldThrow(ctx, "ctx.isPointInPath(path, 50, 50, 'evenodd')");
|
||||
|
||||
shouldThrow(ctx, "ctx.isPointInPath([], 50, 50)");
|
||||
shouldThrow(ctx, "ctx.isPointInPath([], 50, 50, 'nonzero')");
|
||||
shouldThrow(ctx, "ctx.isPointInPath([], 50, 50, 'evenodd')");
|
||||
shouldThrow(ctx, "ctx.isPointInPath({}, 50, 50)");
|
||||
shouldThrow(ctx, "ctx.isPointInPath({}, 50, 50, 'nonzero')");
|
||||
shouldThrow(ctx, "ctx.isPointInPath({}, 50, 50, 'evenodd')");
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>Canvas test: test_isPointInStroke_canvas</p>
|
||||
<canvas id="c6" class="output" width="100" height="100">+
|
||||
</canvas>
|
||||
<script type="text/javascript">
|
||||
|
||||
function test_isPointInStroke_canvas() {
|
||||
var c = document.getElementById("c6");
|
||||
var ctx = c.getContext("2d");
|
||||
|
||||
ctx.strokeStyle = '#0ff';
|
||||
|
||||
var path = new Path2D();
|
||||
path.rect(20,20,100,100);
|
||||
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,20,20)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,120,20)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,20,120)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,120,120)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,70,20)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,20,70)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,120,70)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,70,120)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,22,22)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,118,22)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,22,118)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,118,118)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,70,18)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,122,70)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,70,122)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,18,70)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,NaN,122)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,18,NaN)");
|
||||
|
||||
shouldThrow(ctx, "ctx.isPointInStroke(null,70,20)");
|
||||
shouldThrow(ctx, "ctx.isPointInStroke([],20,70)");
|
||||
shouldThrow(ctx, "ctx.isPointInStroke({},120,70)");
|
||||
|
||||
ctx.lineWidth = 10;
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,22,22)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,118,22)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,22,118)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,118,118)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,70,18)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,122,70)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,70,122)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,18,70)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,26,70)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,70,26)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,70,114)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,114,70)");
|
||||
|
||||
path = new Path2D();
|
||||
path.moveTo(10,10);
|
||||
path.lineTo(110,20);
|
||||
path.lineTo(10,30);
|
||||
ctx.lineJoin = "bevel";
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,113,20)");
|
||||
|
||||
ctx.miterLimit = 40.0;
|
||||
ctx.lineJoin = "miter";
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,113,20)");
|
||||
|
||||
ctx.miterLimit = 2.0;
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,113,20)");
|
||||
|
||||
path = new Path2D();
|
||||
path.moveTo(10,10);
|
||||
path.lineTo(110,10);
|
||||
ctx.lineCap = "butt";
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,112,10)");
|
||||
|
||||
ctx.lineCap = "round";
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,112,10)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,117,10)");
|
||||
|
||||
ctx.lineCap = "square";
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,112,10)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,117,10)");
|
||||
|
||||
ctx.lineCap = "butt";
|
||||
ctx.setLineDash([10,10]);
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,15,10)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,25,10)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,35,10)");
|
||||
|
||||
ctx.lineDashOffset = 10;
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,15,10)");
|
||||
shouldBeTrue(ctx, path, "ctx.isPointInStroke(path,25,10)");
|
||||
shouldBeFalse(ctx, path, "ctx.isPointInStroke(path,35,10)");
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function runTests() {
|
||||
@ -189,7 +342,18 @@ function runTests() {
|
||||
throw e;
|
||||
ok(false, "unexpected exception thrown in: test_large_canvas");
|
||||
}
|
||||
|
||||
try {
|
||||
test_isPointInPath_canvas();
|
||||
} catch(e) {
|
||||
throw e;
|
||||
ok(false, "unexpected exception thrown in: test_isPointInPath_canvas");
|
||||
}
|
||||
try {
|
||||
test_isPointInStroke_canvas();
|
||||
} catch(e) {
|
||||
throw e;
|
||||
ok(false, "unexpected exception thrown in: test_isPointInStroke_canvas");
|
||||
}
|
||||
SpecialPowers.setBoolPref("canvas.path.enabled", false);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ public:
|
||||
SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
|
||||
}
|
||||
|
||||
nsINode* GetParentObject() {
|
||||
ParentObject GetParentObject() {
|
||||
Element* form = GetFormElement();
|
||||
return form ? static_cast<nsINode*>(form)
|
||||
return form ? GetParentObjectInternal(form)
|
||||
: nsGenericHTMLElement::GetParentObject();
|
||||
}
|
||||
|
||||
|
@ -3951,6 +3951,7 @@ HTMLMediaElement::AddTextTrack(TextTrackKind aKind,
|
||||
if (mTextTrackManager) {
|
||||
return mTextTrackManager->AddTextTrack(aKind, aLabel, aLanguage,
|
||||
TextTrackMode::Hidden,
|
||||
TextTrackReadyState::Loaded,
|
||||
TextTrackSource::AddTextTrack);
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -154,7 +154,9 @@ HTMLTrackElement::CreateTextTrack()
|
||||
}
|
||||
|
||||
mTrack = new TextTrack(OwnerDoc()->GetParentObject(), kind, label, srcLang,
|
||||
TextTrackMode::Disabled, TextTrackSource::Track);
|
||||
TextTrackMode::Disabled,
|
||||
TextTrackReadyState::NotLoaded,
|
||||
TextTrackSource::Track);
|
||||
mTrack->SetTrackElement(this);
|
||||
|
||||
if (mMediaParent) {
|
||||
@ -317,7 +319,7 @@ uint16_t
|
||||
HTMLTrackElement::ReadyState() const
|
||||
{
|
||||
if (!mTrack) {
|
||||
return READY_STATE_NONE;
|
||||
return TextTrackReadyState::NotLoaded;
|
||||
}
|
||||
|
||||
return mTrack->ReadyState();
|
||||
|
@ -85,13 +85,6 @@ public:
|
||||
SetHTMLBoolAttr(nsGkAtoms::_default, aDefault, aError);
|
||||
}
|
||||
|
||||
// Constants for numeric readyState property values.
|
||||
enum {
|
||||
READY_STATE_NONE = 0U,
|
||||
READY_STATE_LOADING = 1U,
|
||||
READY_STATE_LOADED = 2U,
|
||||
READY_STATE_ERROR = 3U
|
||||
};
|
||||
uint16_t ReadyState() const;
|
||||
|
||||
TextTrack* Track();
|
||||
|
@ -113,15 +113,15 @@ already_AddRefed<TextTrack>
|
||||
TextTrackManager::AddTextTrack(TextTrackKind aKind, const nsAString& aLabel,
|
||||
const nsAString& aLanguage,
|
||||
TextTrackMode aMode,
|
||||
TextTrackReadyState aReadyState,
|
||||
TextTrackSource aTextTrackSource)
|
||||
{
|
||||
if (!mMediaElement) {
|
||||
return nullptr;
|
||||
}
|
||||
nsRefPtr<TextTrack> ttrack =
|
||||
mTextTracks->AddTextTrack(aKind, aLabel, aLanguage, aMode, aTextTrackSource,
|
||||
CompareTextTracks(mMediaElement));
|
||||
ttrack->SetReadyState(HTMLTrackElement::READY_STATE_LOADED);
|
||||
mTextTracks->AddTextTrack(aKind, aLabel, aLanguage, aMode, aReadyState,
|
||||
aTextTrackSource, CompareTextTracks(mMediaElement));
|
||||
AddCues(ttrack);
|
||||
return ttrack.forget();
|
||||
}
|
||||
@ -218,7 +218,7 @@ TextTrackManager::PopulatePendingList()
|
||||
for (uint32_t index = 0; index < len; ++index) {
|
||||
TextTrack* ttrack = mTextTracks->IndexedGetter(index, dummy);
|
||||
if (ttrack && ttrack->Mode() != TextTrackMode::Disabled &&
|
||||
ttrack->ReadyState() == HTMLTrackElement::READY_STATE_LOADING) {
|
||||
ttrack->ReadyState() == TextTrackReadyState::Loading) {
|
||||
mPendingTextTracks->AddTextTrack(ttrack,
|
||||
CompareTextTracks(mMediaElement));
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
const nsAString& aLabel,
|
||||
const nsAString& aLanguage,
|
||||
TextTrackMode aMode,
|
||||
TextTrackReadyState aReadyState,
|
||||
TextTrackSource aTextTrackSource);
|
||||
void AddTextTrack(TextTrack* aTextTrack);
|
||||
void RemoveTextTrack(TextTrack* aTextTrack, bool aPendingListOnly);
|
||||
|
@ -106,64 +106,6 @@
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
class nsINodeInfo;
|
||||
class nsIDOMNodeList;
|
||||
class nsRuleWalker;
|
||||
|
||||
// XXX todo: add in missing out-of-memory checks
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#ifdef GATHER_ELEMENT_USEAGE_STATISTICS
|
||||
|
||||
// static objects that have constructors are kinda bad, but we don't
|
||||
// care here, this is only debugging code!
|
||||
|
||||
static nsHashtable sGEUS_ElementCounts;
|
||||
|
||||
void GEUS_ElementCreated(nsINodeInfo *aNodeInfo)
|
||||
{
|
||||
nsAutoString name;
|
||||
aNodeInfo->GetName(name);
|
||||
|
||||
nsStringKey key(name);
|
||||
|
||||
int32_t count = (int32_t)sGEUS_ElementCounts.Get(&key);
|
||||
|
||||
count++;
|
||||
|
||||
sGEUS_ElementCounts.Put(&key, (void *)count);
|
||||
}
|
||||
|
||||
bool GEUS_enum_func(nsHashKey *aKey, void *aData, void *aClosure)
|
||||
{
|
||||
const char16_t *name_chars = ((nsStringKey *)aKey)->GetString();
|
||||
NS_ConvertUTF16toUTF8 name(name_chars);
|
||||
|
||||
printf ("%s %d\n", name.get(), aData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GEUS_DumpElementCounts()
|
||||
{
|
||||
printf ("Element count statistics:\n");
|
||||
|
||||
sGEUS_ElementCounts.Enumerate(GEUS_enum_func, nullptr);
|
||||
|
||||
printf ("End of element count statistics:\n");
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::Init(nsINodeInfo *aNodeInfo)
|
||||
{
|
||||
GEUS_ElementCreated(aNodeInfo);
|
||||
|
||||
return nsGenericHTMLElementBase::Init(aNodeInfo);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* nsAutoFocusEvent is used to dispatch a focus event when a
|
||||
* nsGenericHTMLFormElement is binded to the tree with the autofocus attribute
|
||||
@ -1985,12 +1927,14 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsGenericHTMLFormElement,
|
||||
nsGenericHTMLElement,
|
||||
nsIFormControl)
|
||||
|
||||
nsINode*
|
||||
mozilla::dom::ParentObject
|
||||
nsGenericHTMLFormElement::GetParentObject() const
|
||||
{
|
||||
// We use the parent chain to implement the scope for event handlers.
|
||||
return mForm ? static_cast<nsINode*>(mForm)
|
||||
: static_cast<nsINode*>(OwnerDoc());
|
||||
if (mForm) {
|
||||
return GetParentObjectInternal(mForm);
|
||||
}
|
||||
return nsGenericHTMLElement::GetParentObject();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -19,25 +19,15 @@
|
||||
#include "mozilla/dom/ValidityState.h"
|
||||
#include "mozilla/dom/ElementInlines.h"
|
||||
|
||||
class nsIDOMAttr;
|
||||
class nsIDOMEventListener;
|
||||
class nsIDOMNodeList;
|
||||
class nsIFrame;
|
||||
class nsIStyleRule;
|
||||
class nsChildContentList;
|
||||
class nsDOMCSSDeclaration;
|
||||
class nsIDOMCSSStyleDeclaration;
|
||||
class nsIURI;
|
||||
class nsIFormControlFrame;
|
||||
class nsIForm;
|
||||
class nsPresState;
|
||||
class nsILayoutHistoryState;
|
||||
class nsIEditor;
|
||||
struct nsRect;
|
||||
struct nsSize;
|
||||
class nsIDOMHTMLMenuElement;
|
||||
class nsIDOMHTMLCollection;
|
||||
class nsDOMSettableTokenList;
|
||||
class nsIDOMHTMLMenuElement;
|
||||
class nsIEditor;
|
||||
class nsIFormControlFrame;
|
||||
class nsIFrame;
|
||||
class nsILayoutHistoryState;
|
||||
class nsIURI;
|
||||
class nsPresState;
|
||||
struct nsSize;
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPostVisitor;
|
||||
@ -1290,7 +1280,7 @@ public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsINode* GetParentObject() const;
|
||||
mozilla::dom::ParentObject GetParentObject() const;
|
||||
|
||||
virtual bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE;
|
||||
virtual void SaveSubtreeState() MOZ_OVERRIDE;
|
||||
|
@ -16,7 +16,8 @@
|
||||
#include "EncodedBufferCache.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "mozilla/dom/BlobEvent.h"
|
||||
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsMimeTypes.h"
|
||||
|
||||
#include "mozilla/dom/AudioStreamTrack.h"
|
||||
#include "mozilla/dom/VideoStreamTrack.h"
|
||||
@ -320,7 +321,19 @@ private:
|
||||
|
||||
// Allocate encoder and bind with union stream.
|
||||
// At this stage, the API doesn't allow UA to choose the output mimeType format.
|
||||
mEncoder = MediaEncoder::CreateEncoder(NS_LITERAL_STRING(""), aTrackTypes);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = mRecorder->GetOwner()->GetExtantDoc();
|
||||
uint16_t appStatus = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
||||
if (doc) {
|
||||
doc->NodePrincipal()->GetAppStatus(&appStatus);
|
||||
}
|
||||
// Only allow certificated application can assign AUDIO_3GPP
|
||||
if (appStatus == nsIPrincipal::APP_STATUS_CERTIFIED &&
|
||||
mRecorder->mMimeType.EqualsLiteral(AUDIO_3GPP)) {
|
||||
mEncoder = MediaEncoder::CreateEncoder(NS_LITERAL_STRING(AUDIO_3GPP), aTrackTypes);
|
||||
} else {
|
||||
mEncoder = MediaEncoder::CreateEncoder(NS_LITERAL_STRING(""), aTrackTypes);
|
||||
}
|
||||
|
||||
if (!mEncoder) {
|
||||
DoSessionEndTask(NS_ERROR_ABORT);
|
||||
@ -579,7 +592,9 @@ MediaRecorder::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
|
||||
/* static */ already_AddRefed<MediaRecorder>
|
||||
MediaRecorder::Constructor(const GlobalObject& aGlobal,
|
||||
DOMMediaStream& aStream, ErrorResult& aRv)
|
||||
DOMMediaStream& aStream,
|
||||
const MediaRecorderOptions& aInitDict,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!sgo) {
|
||||
@ -594,6 +609,7 @@ MediaRecorder::Constructor(const GlobalObject& aGlobal,
|
||||
}
|
||||
|
||||
nsRefPtr<MediaRecorder> object = new MediaRecorder(aStream, ownerWindow);
|
||||
object->SetMimeType(aInitDict.mMimeType);
|
||||
return object.forget();
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ class EncodedBufferCache;
|
||||
class MediaEncoder;
|
||||
class ProcessedMediaStream;
|
||||
class MediaInputPort;
|
||||
struct MediaRecorderOptions;
|
||||
|
||||
namespace dom {
|
||||
|
||||
@ -75,7 +76,9 @@ public:
|
||||
|
||||
static already_AddRefed<MediaRecorder>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
DOMMediaStream& aStream, ErrorResult& aRv);
|
||||
DOMMediaStream& aStream,
|
||||
const MediaRecorderOptions& aInitDict,
|
||||
ErrorResult& aRv);
|
||||
|
||||
// EventHandler
|
||||
IMPL_EVENT_HANDLER(dataavailable)
|
||||
|
@ -29,28 +29,22 @@ NS_IMPL_RELEASE_INHERITED(TextTrack, nsDOMEventTargetHelper)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TextTrack)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
|
||||
|
||||
TextTrack::TextTrack(nsISupports* aParent, TextTrackSource aTextTrackSource)
|
||||
: mParent(aParent)
|
||||
, mTextTrackSource(aTextTrackSource)
|
||||
{
|
||||
SetDefaultSettings();
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
TextTrack::TextTrack(nsISupports* aParent,
|
||||
TextTrackKind aKind,
|
||||
const nsAString& aLabel,
|
||||
const nsAString& aLanguage,
|
||||
TextTrackMode aMode,
|
||||
TextTrackReadyState aReadyState,
|
||||
TextTrackSource aTextTrackSource)
|
||||
: mParent(aParent)
|
||||
, mKind(aKind)
|
||||
, mLabel(aLabel)
|
||||
, mLanguage(aLanguage)
|
||||
, mMode(aMode)
|
||||
, mReadyState(aReadyState)
|
||||
, mTextTrackSource(aTextTrackSource)
|
||||
{
|
||||
SetDefaultSettings();
|
||||
mKind = aKind;
|
||||
mLabel = aLabel;
|
||||
mLanguage = aLanguage;
|
||||
mMode = aMode;
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
@ -60,29 +54,28 @@ TextTrack::TextTrack(nsISupports* aParent,
|
||||
const nsAString& aLabel,
|
||||
const nsAString& aLanguage,
|
||||
TextTrackMode aMode,
|
||||
TextTrackReadyState aReadyState,
|
||||
TextTrackSource aTextTrackSource)
|
||||
: mParent(aParent)
|
||||
, mTextTrackList(aTextTrackList)
|
||||
, mKind(aKind)
|
||||
, mLabel(aLabel)
|
||||
, mLanguage(aLanguage)
|
||||
, mMode(aMode)
|
||||
, mReadyState(aReadyState)
|
||||
, mTextTrackSource(aTextTrackSource)
|
||||
{
|
||||
SetDefaultSettings();
|
||||
mKind = aKind;
|
||||
mLabel = aLabel;
|
||||
mLanguage = aLanguage;
|
||||
mMode = aMode;
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
void
|
||||
TextTrack::SetDefaultSettings()
|
||||
{
|
||||
mKind = TextTrackKind::Subtitles;
|
||||
mMode = TextTrackMode::Hidden;
|
||||
mCueList = new TextTrackCueList(mParent);
|
||||
mActiveCueList = new TextTrackCueList(mParent);
|
||||
mCuePos = 0;
|
||||
mDirty = false;
|
||||
mReadyState = HTMLTrackElement::READY_STATE_NONE;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
@ -187,14 +180,14 @@ TextTrack::GetActiveCueArray(nsTArray<nsRefPtr<TextTrackCue> >& aCues)
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t
|
||||
TextTrackReadyState
|
||||
TextTrack::ReadyState() const
|
||||
{
|
||||
return mReadyState;
|
||||
}
|
||||
|
||||
void
|
||||
TextTrack::SetReadyState(uint16_t aState)
|
||||
TextTrack::SetReadyState(TextTrackReadyState aState)
|
||||
{
|
||||
mReadyState = aState;
|
||||
|
||||
@ -203,8 +196,8 @@ TextTrack::SetReadyState(uint16_t aState)
|
||||
}
|
||||
|
||||
HTMLMediaElement* mediaElement = mTextTrackList->GetMediaElement();
|
||||
if (mediaElement && (mReadyState == HTMLTrackElement::READY_STATE_LOADED ||
|
||||
mReadyState == HTMLTrackElement::READY_STATE_ERROR)) {
|
||||
if (mediaElement && (mReadyState == TextTrackReadyState::Loaded||
|
||||
mReadyState == TextTrackReadyState::FailedToLoad)) {
|
||||
mediaElement->RemoveTextTrack(this, true);
|
||||
}
|
||||
}
|
||||
|
@ -28,19 +28,26 @@ enum TextTrackSource {
|
||||
MediaResourceSpecific
|
||||
};
|
||||
|
||||
// Constants for numeric readyState property values.
|
||||
enum TextTrackReadyState {
|
||||
NotLoaded = 0U,
|
||||
Loading = 1U,
|
||||
Loaded = 2U,
|
||||
FailedToLoad = 3U
|
||||
};
|
||||
|
||||
class TextTrack MOZ_FINAL : public nsDOMEventTargetHelper
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TextTrack, nsDOMEventTargetHelper)
|
||||
|
||||
TextTrack(nsISupports* aParent,
|
||||
TextTrackSource aTextTrackSource);
|
||||
TextTrack(nsISupports* aParent,
|
||||
TextTrackKind aKind,
|
||||
const nsAString& aLabel,
|
||||
const nsAString& aLanguage,
|
||||
TextTrackMode aMode,
|
||||
TextTrackReadyState aReadyState,
|
||||
TextTrackSource aTextTrackSource);
|
||||
TextTrack(nsISupports* aParent,
|
||||
TextTrackList* aTextTrackList,
|
||||
@ -48,6 +55,7 @@ public:
|
||||
const nsAString& aLabel,
|
||||
const nsAString& aLanguage,
|
||||
TextTrackMode aMode,
|
||||
TextTrackReadyState aReadyState,
|
||||
TextTrackSource aTextTrackSource);
|
||||
|
||||
void SetDefaultSettings();
|
||||
@ -98,8 +106,8 @@ public:
|
||||
TextTrackCueList* GetActiveCues();
|
||||
void GetActiveCueArray(nsTArray<nsRefPtr<TextTrackCue> >& aCues);
|
||||
|
||||
uint16_t ReadyState() const;
|
||||
void SetReadyState(uint16_t aState);
|
||||
TextTrackReadyState ReadyState() const;
|
||||
void SetReadyState(TextTrackReadyState aState);
|
||||
|
||||
void AddCue(TextTrackCue& aCue);
|
||||
void RemoveCue(TextTrackCue& aCue, ErrorResult& aRv);
|
||||
@ -136,7 +144,7 @@ private:
|
||||
nsRefPtr<HTMLTrackElement> mTrackElement;
|
||||
|
||||
uint32_t mCuePos;
|
||||
uint16_t mReadyState;
|
||||
TextTrackReadyState mReadyState;
|
||||
bool mDirty;
|
||||
|
||||
// An enum that represents where the track was sourced from.
|
||||
|
@ -66,11 +66,13 @@ TextTrackList::AddTextTrack(TextTrackKind aKind,
|
||||
const nsAString& aLabel,
|
||||
const nsAString& aLanguage,
|
||||
TextTrackMode aMode,
|
||||
TextTrackReadyState aReadyState,
|
||||
TextTrackSource aTextTrackSource,
|
||||
const CompareTextTracks& aCompareTT)
|
||||
{
|
||||
nsRefPtr<TextTrack> track = new TextTrack(mGlobal, this, aKind, aLabel, aLanguage,
|
||||
aMode, aTextTrackSource);
|
||||
nsRefPtr<TextTrack> track = new TextTrack(mGlobal, this, aKind, aLabel,
|
||||
aLanguage, aMode, aReadyState,
|
||||
aTextTrackSource);
|
||||
AddTextTrack(track, aCompareTT);
|
||||
return track.forget();
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
const nsAString& aLabel,
|
||||
const nsAString& aLanguage,
|
||||
TextTrackMode aMode,
|
||||
TextTrackReadyState aReadyState,
|
||||
TextTrackSource aTextTrackSource,
|
||||
const CompareTextTracks& aCompareTT);
|
||||
TextTrack* GetTrackById(const nsAString& aId);
|
||||
|
@ -78,7 +78,7 @@ WebVTTListener::LoadResource()
|
||||
rv = mParserWrapper->Watch(this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mElement->mTrack->SetReadyState(HTMLTrackElement::READY_STATE_LOADING);
|
||||
mElement->mTrack->SetReadyState(TextTrackReadyState::Loading);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -106,9 +106,9 @@ WebVTTListener::OnStopRequest(nsIRequest* aRequest,
|
||||
nsISupports* aContext,
|
||||
nsresult aStatus)
|
||||
{
|
||||
if (mElement->ReadyState() != HTMLTrackElement::READY_STATE_ERROR) {
|
||||
if (mElement->ReadyState() != TextTrackReadyState::FailedToLoad) {
|
||||
TextTrack* track = mElement->Track();
|
||||
track->SetReadyState(HTMLTrackElement::READY_STATE_LOADED);
|
||||
track->SetReadyState(TextTrackReadyState::Loaded);
|
||||
}
|
||||
// Attempt to parse any final data the parser might still have.
|
||||
mParserWrapper->Flush();
|
||||
|
@ -115,7 +115,7 @@ MediaEncoder::CreateEncoder(const nsAString& aMIMEType, uint8_t aTrackTypes)
|
||||
(aMIMEType.EqualsLiteral(VIDEO_MP4) ||
|
||||
(aTrackTypes & ContainerWriter::CREATE_VIDEO_TRACK))) {
|
||||
if (aTrackTypes & ContainerWriter::CREATE_AUDIO_TRACK) {
|
||||
audioEncoder = new OmxAudioTrackEncoder();
|
||||
audioEncoder = new OmxAACAudioTrackEncoder();
|
||||
NS_ENSURE_TRUE(audioEncoder, nullptr);
|
||||
}
|
||||
videoEncoder = new OmxVideoTrackEncoder();
|
||||
@ -123,6 +123,14 @@ MediaEncoder::CreateEncoder(const nsAString& aMIMEType, uint8_t aTrackTypes)
|
||||
NS_ENSURE_TRUE(writer, nullptr);
|
||||
NS_ENSURE_TRUE(videoEncoder, nullptr);
|
||||
mimeType = NS_LITERAL_STRING(VIDEO_MP4);
|
||||
} else if (MediaEncoder::IsOMXEncoderEnabled() &&
|
||||
(aMIMEType.EqualsLiteral(AUDIO_3GPP))) {
|
||||
audioEncoder = new OmxAMRAudioTrackEncoder();
|
||||
NS_ENSURE_TRUE(audioEncoder, nullptr);
|
||||
|
||||
writer = new ISOMediaWriter(aTrackTypes, ISOMediaWriter::TYPE_FRAG_3GP);
|
||||
NS_ENSURE_TRUE(writer, nullptr);
|
||||
mimeType = NS_LITERAL_STRING(AUDIO_3GPP);
|
||||
}
|
||||
#endif // MOZ_OMX_ENCODER
|
||||
else if (MediaDecoder::IsOggEnabled() && MediaDecoder::IsOpusEnabled() &&
|
||||
|
@ -67,6 +67,8 @@ OmxVideoTrackEncoder::GetMetadata()
|
||||
nsRefPtr<AVCTrackMetadata> meta = new AVCTrackMetadata();
|
||||
meta->mWidth = mFrameWidth;
|
||||
meta->mHeight = mFrameHeight;
|
||||
meta->mDisplayWidth = mDisplayWidth;
|
||||
meta->mDisplayHeight = mDisplayHeight;
|
||||
meta->mFrameRate = ENCODER_CONFIG_FRAME_RATE;
|
||||
return meta.forget();
|
||||
}
|
||||
@ -155,49 +157,6 @@ OmxVideoTrackEncoder::GetEncodedTrack(EncodedFrameContainer& aData)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
OmxAudioTrackEncoder::Init(int aChannels, int aSamplingRate)
|
||||
{
|
||||
mChannels = aChannels;
|
||||
mSamplingRate = aSamplingRate;
|
||||
|
||||
mEncoder = OMXCodecWrapper::CreateAACEncoder();
|
||||
NS_ENSURE_TRUE(mEncoder, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = mEncoder->Configure(mChannels, mSamplingRate);
|
||||
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mInitialized = (rv == NS_OK);
|
||||
|
||||
mReentrantMonitor.NotifyAll();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<TrackMetadataBase>
|
||||
OmxAudioTrackEncoder::GetMetadata()
|
||||
{
|
||||
{
|
||||
// Wait if mEncoder is not initialized nor is being canceled.
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
while (!mCanceled && !mInitialized) {
|
||||
mReentrantMonitor.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
if (mCanceled || mEncodingComplete) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<AACTrackMetadata> meta = new AACTrackMetadata();
|
||||
meta->mChannels = mChannels;
|
||||
meta->mSampleRate = mSamplingRate;
|
||||
meta->mFrameSize = OMXCodecWrapper::kAACFrameSize;
|
||||
meta->mFrameDuration = OMXCodecWrapper::kAACFrameDuration;
|
||||
|
||||
return meta.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
OmxAudioTrackEncoder::AppendEncodedFrames(EncodedFrameContainer& aContainer)
|
||||
{
|
||||
@ -218,8 +177,15 @@ OmxAudioTrackEncoder::AppendEncodedFrames(EncodedFrameContainer& aContainer)
|
||||
}
|
||||
|
||||
nsRefPtr<EncodedFrame> audiodata = new EncodedFrame();
|
||||
audiodata->SetFrameType(isCSD ?
|
||||
EncodedFrame::AAC_CSD : EncodedFrame::AAC_AUDIO_FRAME);
|
||||
if (mEncoder->GetCodecType() == OMXCodecWrapper::AAC_ENC) {
|
||||
audiodata->SetFrameType(isCSD ?
|
||||
EncodedFrame::AAC_CSD : EncodedFrame::AAC_AUDIO_FRAME);
|
||||
} else if (mEncoder->GetCodecType() == OMXCodecWrapper::AMR_NB_ENC){
|
||||
audiodata->SetFrameType(isCSD ?
|
||||
EncodedFrame::AMR_AUDIO_CSD : EncodedFrame::AMR_AUDIO_FRAME);
|
||||
} else {
|
||||
MOZ_ASSERT("audio codec not supported");
|
||||
}
|
||||
audiodata->SetTimeStamp(outTimeUs);
|
||||
rv = audiodata->SwapInFrameData(frameData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -277,4 +243,82 @@ OmxAudioTrackEncoder::GetEncodedTrack(EncodedFrameContainer& aData)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
OmxAACAudioTrackEncoder::Init(int aChannels, int aSamplingRate)
|
||||
{
|
||||
mChannels = aChannels;
|
||||
mSamplingRate = aSamplingRate;
|
||||
|
||||
mEncoder = OMXCodecWrapper::CreateAACEncoder();
|
||||
NS_ENSURE_TRUE(mEncoder, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = mEncoder->Configure(mChannels, mSamplingRate, mSamplingRate);
|
||||
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mInitialized = (rv == NS_OK);
|
||||
|
||||
mReentrantMonitor.NotifyAll();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<TrackMetadataBase>
|
||||
OmxAACAudioTrackEncoder::GetMetadata()
|
||||
{
|
||||
{
|
||||
// Wait if mEncoder is not initialized nor is being canceled.
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
while (!mCanceled && !mInitialized) {
|
||||
mReentrantMonitor.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
if (mCanceled || mEncodingComplete) {
|
||||
return nullptr;
|
||||
}
|
||||
nsRefPtr<AACTrackMetadata> meta = new AACTrackMetadata();
|
||||
meta->mChannels = mChannels;
|
||||
meta->mSampleRate = mSamplingRate;
|
||||
meta->mFrameSize = OMXCodecWrapper::kAACFrameSize;
|
||||
meta->mFrameDuration = OMXCodecWrapper::kAACFrameDuration;
|
||||
return meta.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
OmxAMRAudioTrackEncoder::Init(int aChannels, int aSamplingRate)
|
||||
{
|
||||
mChannels = aChannels;
|
||||
mSamplingRate = aSamplingRate;
|
||||
|
||||
mEncoder = OMXCodecWrapper::CreateAMRNBEncoder();
|
||||
NS_ENSURE_TRUE(mEncoder, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = mEncoder->Configure(mChannels, mSamplingRate, AMR_NB_SAMPLERATE);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mInitialized = (rv == NS_OK);
|
||||
|
||||
mReentrantMonitor.NotifyAll();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<TrackMetadataBase>
|
||||
OmxAMRAudioTrackEncoder::GetMetadata()
|
||||
{
|
||||
{
|
||||
// Wait if mEncoder is not initialized nor is being canceled.
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
while (!mCanceled && !mInitialized) {
|
||||
mReentrantMonitor.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
if (mCanceled || mEncodingComplete) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<AMRTrackMetadata> meta = new AMRTrackMetadata();
|
||||
return meta.forget();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,26 +43,54 @@ private:
|
||||
nsAutoPtr<android::OMXVideoEncoder> mEncoder;
|
||||
};
|
||||
|
||||
class OmxAudioTrackEncoder MOZ_FINAL : public AudioTrackEncoder
|
||||
class OmxAudioTrackEncoder : public AudioTrackEncoder
|
||||
{
|
||||
public:
|
||||
OmxAudioTrackEncoder()
|
||||
: AudioTrackEncoder()
|
||||
{}
|
||||
|
||||
already_AddRefed<TrackMetadataBase> GetMetadata() MOZ_OVERRIDE;
|
||||
already_AddRefed<TrackMetadataBase> GetMetadata() = 0;
|
||||
|
||||
nsresult GetEncodedTrack(EncodedFrameContainer& aData) MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
nsresult Init(int aChannels, int aSamplingRate) MOZ_OVERRIDE;
|
||||
nsresult Init(int aChannels, int aSamplingRate) = 0;
|
||||
|
||||
private:
|
||||
// Append encoded frames to aContainer.
|
||||
nsresult AppendEncodedFrames(EncodedFrameContainer& aContainer);
|
||||
|
||||
nsAutoPtr<android::OMXAudioEncoder> mEncoder;
|
||||
};
|
||||
|
||||
class OmxAACAudioTrackEncoder MOZ_FINAL : public OmxAudioTrackEncoder
|
||||
{
|
||||
public:
|
||||
OmxAACAudioTrackEncoder()
|
||||
: OmxAudioTrackEncoder()
|
||||
{}
|
||||
|
||||
already_AddRefed<TrackMetadataBase> GetMetadata() MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
nsresult Init(int aChannels, int aSamplingRate) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
class OmxAMRAudioTrackEncoder MOZ_FINAL : public OmxAudioTrackEncoder
|
||||
{
|
||||
public:
|
||||
OmxAMRAudioTrackEncoder()
|
||||
: OmxAudioTrackEncoder()
|
||||
{}
|
||||
|
||||
enum {
|
||||
AMR_NB_SAMPLERATE = 8000,
|
||||
};
|
||||
already_AddRefed<TrackMetadataBase> GetMetadata() MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
nsresult Init(int aChannels, int aSamplingRate) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -49,10 +49,14 @@ public:
|
||||
// The base class for video metadata.
|
||||
class VideoTrackMetadata : public TrackMetadataBase {
|
||||
public:
|
||||
// VideoHeight and VideoWidth are the frame size of the elementary stream.
|
||||
virtual uint32_t GetVideoHeight() = 0;
|
||||
|
||||
virtual uint32_t GetVideoWidth() = 0;
|
||||
|
||||
// VideoDisplayHeight and VideoDisplayWidth are the display frame size.
|
||||
virtual uint32_t GetVideoDisplayHeight() = 0;
|
||||
virtual uint32_t GetVideoDisplayWidth() = 0;
|
||||
|
||||
// VideoClockRate is the number of samples per second in video frame's
|
||||
// timestamp.
|
||||
// For example, if VideoClockRate is 90k Hz and VideoFrameRate is
|
||||
|
@ -167,6 +167,7 @@ nsresult
|
||||
ISOControl::SetMetadata(TrackMetadataBase* aTrackMeta)
|
||||
{
|
||||
if (aTrackMeta->GetKind() == TrackMetadataBase::METADATA_AAC ||
|
||||
aTrackMeta->GetKind() == TrackMetadataBase::METADATA_AMR ||
|
||||
aTrackMeta->GetKind() == TrackMetadataBase::METADATA_AVC) {
|
||||
mMetaArray.AppendElement(aTrackMeta);
|
||||
return NS_OK;
|
||||
@ -178,7 +179,8 @@ nsresult
|
||||
ISOControl::GetAudioMetadata(nsRefPtr<AudioTrackMetadata>& aAudMeta)
|
||||
{
|
||||
for (uint32_t i = 0; i < mMetaArray.Length() ; i++) {
|
||||
if (mMetaArray[i]->GetKind() == TrackMetadataBase::METADATA_AAC) {
|
||||
if (mMetaArray[i]->GetKind() == TrackMetadataBase::METADATA_AAC ||
|
||||
mMetaArray[i]->GetKind() == TrackMetadataBase::METADATA_AMR) {
|
||||
aAudMeta = static_cast<AudioTrackMetadata*>(mMetaArray[i].get());
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1179,8 +1179,13 @@ TrackHeaderBox::Generate(uint32_t* aBoxSize)
|
||||
volume = (mTrackType == Audio_Track ? 0x0100 : 0);
|
||||
|
||||
if (mTrackType == Video_Track) {
|
||||
width = mVideoMeta->GetVideoWidth() << 16;
|
||||
height = mVideoMeta->GetVideoHeight() << 16;
|
||||
width = mVideoMeta->GetVideoDisplayWidth() << 16;
|
||||
height = mVideoMeta->GetVideoDisplayHeight() << 16;
|
||||
// Check display size, using the pixel size if any of them is invalid.
|
||||
if (!width || !height) {
|
||||
width = mVideoMeta->GetVideoWidth() << 16;
|
||||
height = mVideoMeta->GetVideoHeight() << 16;
|
||||
}
|
||||
}
|
||||
|
||||
size += sizeof(creation_time) +
|
||||
|
@ -45,6 +45,8 @@ public:
|
||||
// VideoTrackMetadata members
|
||||
uint32_t GetVideoHeight() MOZ_OVERRIDE { return mHeight; }
|
||||
uint32_t GetVideoWidth() MOZ_OVERRIDE {return mWidth; }
|
||||
uint32_t GetVideoDisplayHeight() MOZ_OVERRIDE { return mDisplayHeight; }
|
||||
uint32_t GetVideoDisplayWidth() MOZ_OVERRIDE { return mDisplayWidth; }
|
||||
uint32_t GetVideoClockRate() MOZ_OVERRIDE { return AVC_CLOCK_RATE; }
|
||||
uint32_t GetVideoFrameRate() MOZ_OVERRIDE { return mFrameRate; }
|
||||
|
||||
@ -55,6 +57,8 @@ public:
|
||||
AVCTrackMetadata()
|
||||
: mHeight(0)
|
||||
, mWidth(0)
|
||||
, mDisplayHeight(0)
|
||||
, mDisplayWidth(0)
|
||||
, mFrameRate(0) {
|
||||
MOZ_COUNT_CTOR(AVCTrackMetadata);
|
||||
}
|
||||
@ -62,6 +66,8 @@ public:
|
||||
|
||||
uint32_t mHeight;
|
||||
uint32_t mWidth;
|
||||
uint32_t mDisplayHeight;
|
||||
uint32_t mDisplayWidth;
|
||||
uint32_t mFrameRate; // frames per second
|
||||
};
|
||||
|
||||
|
@ -27,6 +27,8 @@ using namespace mozilla::layers;
|
||||
#define ENCODER_CONFIG_I_FRAME_INTERVAL 1
|
||||
// Wait up to 5ms for input buffers.
|
||||
#define INPUT_BUFFER_TIMEOUT_US (5 * 1000ll)
|
||||
// AMR NB kbps
|
||||
#define AMRNB_BITRATE 12200
|
||||
|
||||
#define CODEC_ERROR(args...) \
|
||||
do { \
|
||||
@ -45,6 +47,16 @@ OMXCodecWrapper::CreateAACEncoder()
|
||||
return aac.forget();
|
||||
}
|
||||
|
||||
OMXAudioEncoder*
|
||||
OMXCodecWrapper::CreateAMRNBEncoder()
|
||||
{
|
||||
nsAutoPtr<OMXAudioEncoder> amr(new OMXAudioEncoder(CodecType::AMR_NB_ENC));
|
||||
// Return the object only when media codec is valid.
|
||||
NS_ENSURE_TRUE(amr->IsValid(), nullptr);
|
||||
|
||||
return amr.forget();
|
||||
}
|
||||
|
||||
OMXVideoEncoder*
|
||||
OMXCodecWrapper::CreateAVCEncoder()
|
||||
{
|
||||
@ -56,7 +68,9 @@ OMXCodecWrapper::CreateAVCEncoder()
|
||||
}
|
||||
|
||||
OMXCodecWrapper::OMXCodecWrapper(CodecType aCodecType)
|
||||
: mStarted(false)
|
||||
: mCodecType(aCodecType)
|
||||
, mStarted(false)
|
||||
, mAMRCSDProvided(false)
|
||||
{
|
||||
ProcessState::self()->startThreadPool();
|
||||
|
||||
@ -65,6 +79,8 @@ OMXCodecWrapper::OMXCodecWrapper(CodecType aCodecType)
|
||||
|
||||
if (aCodecType == CodecType::AVC_ENC) {
|
||||
mCodec = MediaCodec::CreateByType(mLooper, MEDIA_MIMETYPE_VIDEO_AVC, true);
|
||||
} else if (aCodecType == CodecType::AMR_NB_ENC) {
|
||||
mCodec = MediaCodec::CreateByType(mLooper, MEDIA_MIMETYPE_AUDIO_AMR_NB, true);
|
||||
} else if (aCodecType == CodecType::AAC_ENC) {
|
||||
mCodec = MediaCodec::CreateByType(mLooper, MEDIA_MIMETYPE_AUDIO_AAC, true);
|
||||
} else {
|
||||
@ -380,28 +396,53 @@ void OMXVideoEncoder::AppendFrame(nsTArray<uint8_t>* aOutputBuf,
|
||||
}
|
||||
|
||||
nsresult
|
||||
OMXAudioEncoder::Configure(int aChannels, int aSamplingRate)
|
||||
OMXAudioEncoder::Configure(int aChannels, int aInputSampleRate,
|
||||
int aEncodedSampleRate)
|
||||
{
|
||||
MOZ_ASSERT(!mStarted);
|
||||
|
||||
NS_ENSURE_TRUE(aChannels > 0 && aSamplingRate > 0, NS_ERROR_INVALID_ARG);
|
||||
NS_ENSURE_TRUE(aChannels > 0 && aInputSampleRate > 0 && aEncodedSampleRate >= 0,
|
||||
NS_ERROR_INVALID_ARG);
|
||||
|
||||
if (aInputSampleRate != aEncodedSampleRate) {
|
||||
int error;
|
||||
mResampler = speex_resampler_init(aChannels,
|
||||
aInputSampleRate,
|
||||
aEncodedSampleRate,
|
||||
SPEEX_RESAMPLER_QUALITY_DEFAULT,
|
||||
&error);
|
||||
|
||||
if (error != RESAMPLER_ERR_SUCCESS) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
speex_resampler_skip_zeros(mResampler);
|
||||
}
|
||||
// Set up configuration parameters for AAC encoder.
|
||||
sp<AMessage> format = new AMessage;
|
||||
// Fixed values.
|
||||
format->setString("mime", MEDIA_MIMETYPE_AUDIO_AAC);
|
||||
format->setInt32("bitrate", kAACBitrate);
|
||||
format->setInt32("aac-profile", OMX_AUDIO_AACObjectLC);
|
||||
if (mCodecType == AAC_ENC) {
|
||||
format->setString("mime", MEDIA_MIMETYPE_AUDIO_AAC);
|
||||
format->setInt32("aac-profile", OMX_AUDIO_AACObjectLC);
|
||||
format->setInt32("bitrate", kAACBitrate);
|
||||
format->setInt32("sample-rate", aInputSampleRate);
|
||||
} else if (mCodecType == AMR_NB_ENC) {
|
||||
format->setString("mime", MEDIA_MIMETYPE_AUDIO_AMR_NB);
|
||||
format->setInt32("bitrate", AMRNB_BITRATE);
|
||||
format->setInt32("sample-rate", aEncodedSampleRate);
|
||||
} else {
|
||||
MOZ_ASSERT(false, "Can't support this codec type!!");
|
||||
}
|
||||
// Input values.
|
||||
format->setInt32("channel-count", aChannels);
|
||||
format->setInt32("sample-rate", aSamplingRate);
|
||||
|
||||
status_t result = mCodec->configure(format, nullptr, nullptr,
|
||||
MediaCodec::CONFIGURE_FLAG_ENCODE);
|
||||
NS_ENSURE_TRUE(result == OK, NS_ERROR_FAILURE);
|
||||
|
||||
mChannels = aChannels;
|
||||
mSampleDuration = 1000000 / aSamplingRate;
|
||||
mSampleDuration = 1000000 / aInputSampleRate;
|
||||
mResamplingRatio = aEncodedSampleRate > 0 ? 1.0 *
|
||||
aEncodedSampleRate / aInputSampleRate : 1.0;
|
||||
result = Start();
|
||||
|
||||
return result == OK ? NS_OK : NS_ERROR_FAILURE;
|
||||
@ -474,6 +515,14 @@ private:
|
||||
size_t mOffset;
|
||||
};
|
||||
|
||||
OMXAudioEncoder::~OMXAudioEncoder()
|
||||
{
|
||||
if (mResampler) {
|
||||
speex_resampler_destroy(mResampler);
|
||||
mResampler = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
OMXAudioEncoder::Encode(AudioSegment& aSegment, int aInputFlags)
|
||||
{
|
||||
@ -495,16 +544,16 @@ OMXAudioEncoder::Encode(AudioSegment& aSegment, int aInputFlags)
|
||||
}
|
||||
NS_ENSURE_TRUE(result == OK, NS_ERROR_FAILURE);
|
||||
|
||||
size_t samplesCopied = 0; // Number of copied samples.
|
||||
size_t sourceSamplesCopied = 0; // Number of copied samples.
|
||||
|
||||
if (numSamples > 0) {
|
||||
// Copy input PCM data to input buffer until queue is empty.
|
||||
AudioSegment::ChunkIterator iter(const_cast<AudioSegment&>(aSegment));
|
||||
while (!iter.IsEnded()) {
|
||||
AudioChunk chunk = *iter;
|
||||
size_t samplesToCopy = chunk.GetDuration(); // Number of samples to copy.
|
||||
size_t bytesToCopy = samplesToCopy * mChannels * sizeof(AudioDataValue);
|
||||
|
||||
size_t sourceSamplesToCopy = chunk.GetDuration(); // Number of samples to copy.
|
||||
size_t bytesToCopy = sourceSamplesToCopy * mChannels *
|
||||
sizeof(AudioDataValue) * mResamplingRatio;
|
||||
if (bytesToCopy > buffer.AvailableSize()) {
|
||||
// Not enough space left in input buffer. Send it to encoder and get a
|
||||
// new one.
|
||||
@ -515,32 +564,47 @@ OMXAudioEncoder::Encode(AudioSegment& aSegment, int aInputFlags)
|
||||
if (result == -EAGAIN) {
|
||||
// All input buffers are full. Caller can try again later after
|
||||
// consuming some output buffers.
|
||||
aSegment.RemoveLeading(samplesCopied);
|
||||
aSegment.RemoveLeading(sourceSamplesCopied);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mTimestamp += samplesCopied * mSampleDuration;
|
||||
samplesCopied = 0;
|
||||
mTimestamp += sourceSamplesCopied * mSampleDuration;
|
||||
sourceSamplesCopied = 0;
|
||||
|
||||
NS_ENSURE_TRUE(result == OK, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
AudioDataValue* dst = reinterpret_cast<AudioDataValue*>(buffer.GetPointer());
|
||||
uint32_t dstSamplesCopied = sourceSamplesToCopy;
|
||||
if (!chunk.IsNull()) {
|
||||
// Append the interleaved data to input buffer.
|
||||
AudioTrackEncoder::InterleaveTrackData(chunk, samplesToCopy, mChannels,
|
||||
dst);
|
||||
if (mResampler) {
|
||||
nsAutoTArray<AudioDataValue, 9600> pcm;
|
||||
pcm.SetLength(bytesToCopy);
|
||||
// Append the interleaved data to input buffer.
|
||||
AudioTrackEncoder::InterleaveTrackData(chunk, sourceSamplesToCopy,
|
||||
mChannels,
|
||||
pcm.Elements());
|
||||
uint32_t inframes = sourceSamplesToCopy;
|
||||
short* in = reinterpret_cast<short*>(pcm.Elements());
|
||||
speex_resampler_process_interleaved_int(mResampler, in, &inframes,
|
||||
dst, &dstSamplesCopied);
|
||||
} else {
|
||||
AudioTrackEncoder::InterleaveTrackData(chunk, sourceSamplesToCopy,
|
||||
mChannels,
|
||||
dst);
|
||||
dstSamplesCopied = sourceSamplesToCopy * mChannels;
|
||||
}
|
||||
} else {
|
||||
// Silence.
|
||||
memset(dst, 0, bytesToCopy);
|
||||
memset(dst, 0, mResamplingRatio * sourceSamplesToCopy * sizeof(AudioDataValue));
|
||||
}
|
||||
|
||||
samplesCopied += samplesToCopy;
|
||||
buffer.IncreaseOffset(bytesToCopy);
|
||||
sourceSamplesCopied += sourceSamplesToCopy;
|
||||
buffer.IncreaseOffset(dstSamplesCopied * sizeof(AudioDataValue));
|
||||
iter.Next();
|
||||
}
|
||||
if (samplesCopied > 0) {
|
||||
aSegment.RemoveLeading(samplesCopied);
|
||||
if (sourceSamplesCopied > 0) {
|
||||
aSegment.RemoveLeading(sourceSamplesCopied);
|
||||
}
|
||||
} else if (aInputFlags & BUFFER_EOS) {
|
||||
// No audio data left in segment but we still have to feed something to
|
||||
@ -548,10 +612,10 @@ OMXAudioEncoder::Encode(AudioSegment& aSegment, int aInputFlags)
|
||||
size_t bytesToCopy = mChannels * sizeof(AudioDataValue);
|
||||
memset(buffer.GetPointer(), 0, bytesToCopy);
|
||||
buffer.IncreaseOffset(bytesToCopy);
|
||||
samplesCopied = 1;
|
||||
sourceSamplesCopied = 1;
|
||||
}
|
||||
|
||||
if (samplesCopied > 0) {
|
||||
if (sourceSamplesCopied > 0) {
|
||||
int flags = aInputFlags;
|
||||
if (aSegment.GetDuration() > 0) {
|
||||
// Don't signal EOS until source segment is empty.
|
||||
@ -560,7 +624,7 @@ OMXAudioEncoder::Encode(AudioSegment& aSegment, int aInputFlags)
|
||||
result = buffer.Enqueue(mTimestamp, flags);
|
||||
NS_ENSURE_TRUE(result == OK, NS_ERROR_FAILURE);
|
||||
|
||||
mTimestamp += samplesCopied * mSampleDuration;
|
||||
mTimestamp += sourceSamplesCopied * mSampleDuration;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -663,6 +727,20 @@ OMXCodecWrapper::GetNextEncodedFrame(nsTArray<uint8_t>* aOutputBuf,
|
||||
mCodec->releaseOutputBuffer(index);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
} else if ((mCodecType == AMR_NB_ENC) && !mAMRCSDProvided){
|
||||
// OMX AMR codec won't provide csd data, need to generate a fake one.
|
||||
nsRefPtr<EncodedFrame> audiodata = new EncodedFrame();
|
||||
// Decoder config descriptor
|
||||
const uint8_t decConfig[] = {
|
||||
0x0, 0x0, 0x0, 0x0, // vendor: 4 bytes
|
||||
0x0, // decoder version
|
||||
0x83, 0xFF, // mode set: all enabled
|
||||
0x00, // mode change period
|
||||
0x01, // frames per sample
|
||||
};
|
||||
aOutputBuf->AppendElements(decConfig, sizeof(decConfig));
|
||||
outFlags |= MediaCodec::BUFFER_FLAG_CODECCONFIG;
|
||||
mAMRCSDProvided = true;
|
||||
} else {
|
||||
AppendFrame(aOutputBuf, omxBuf->data(), omxBuf->size());
|
||||
}
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include "GonkNativeWindow.h"
|
||||
#include "GonkNativeWindowClient.h"
|
||||
|
||||
#include <speex/speex_resampler.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
class OMXAudioEncoder;
|
||||
@ -53,6 +55,7 @@ public:
|
||||
// Codec types.
|
||||
enum CodecType {
|
||||
AAC_ENC, // AAC encoder.
|
||||
AMR_NB_ENC, // AMR_NB encoder.
|
||||
AVC_ENC, // AVC/H.264 encoder.
|
||||
TYPE_COUNT
|
||||
};
|
||||
@ -83,6 +86,9 @@ public:
|
||||
/** Create a AAC audio encoder. Returns nullptr when failed. */
|
||||
static OMXAudioEncoder* CreateAACEncoder();
|
||||
|
||||
/** Create a AMR audio encoder. Returns nullptr when failed. */
|
||||
static OMXAudioEncoder* CreateAMRNBEncoder();
|
||||
|
||||
/** Create a AVC/H.264 video encoder. Returns nullptr when failed. */
|
||||
static OMXVideoEncoder* CreateAVCEncoder();
|
||||
|
||||
@ -97,7 +103,10 @@ public:
|
||||
nsresult GetNextEncodedFrame(nsTArray<uint8_t>* aOutputBuf,
|
||||
int64_t* aOutputTimestamp, int* aOutputFlags,
|
||||
int64_t aTimeOut);
|
||||
|
||||
/*
|
||||
* Get the codec type
|
||||
*/
|
||||
int GetCodecType() { return mCodecType; }
|
||||
protected:
|
||||
/**
|
||||
* See whether the object has been initialized successfully and is ready to
|
||||
@ -160,7 +169,9 @@ private:
|
||||
Vector<sp<ABuffer> > mInputBufs; // MediaCodec buffers to hold input data.
|
||||
Vector<sp<ABuffer> > mOutputBufs; // MediaCodec buffers to hold output data.
|
||||
|
||||
int mCodecType;
|
||||
bool mStarted; // Has MediaCodec been started?
|
||||
bool mAMRCSDProvided;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -172,8 +183,9 @@ public:
|
||||
/**
|
||||
* Configure audio codec parameters and start media codec. It must be called
|
||||
* before calling Encode() and GetNextEncodedFrame().
|
||||
* aReSamplingRate = 0 means no resampler required
|
||||
*/
|
||||
nsresult Configure(int aChannelCount, int aSampleRate);
|
||||
nsresult Configure(int aChannelCount, int aInputSampleRate, int aEncodedSampleRate);
|
||||
|
||||
/**
|
||||
* Encode 16-bit PCM audio samples stored in aSegment. To notify end of
|
||||
@ -183,10 +195,10 @@ public:
|
||||
*/
|
||||
nsresult Encode(mozilla::AudioSegment& aSegment, int aInputFlags = 0);
|
||||
|
||||
~OMXAudioEncoder();
|
||||
protected:
|
||||
virtual status_t AppendDecoderConfig(nsTArray<uint8_t>* aOutputBuf,
|
||||
ABuffer* aData) MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
// Hide these. User should always use creator functions to get a media codec.
|
||||
OMXAudioEncoder() MOZ_DELETE;
|
||||
@ -199,15 +211,24 @@ private:
|
||||
*/
|
||||
OMXAudioEncoder(CodecType aCodecType)
|
||||
: OMXCodecWrapper(aCodecType)
|
||||
, mResampler(nullptr)
|
||||
, mChannels(0)
|
||||
, mTimestamp(0)
|
||||
, mSampleDuration(0) {}
|
||||
, mSampleDuration(0)
|
||||
, mResamplingRatio(0) {}
|
||||
|
||||
// For creator function to access hidden constructor.
|
||||
friend class OMXCodecWrapper;
|
||||
|
||||
/**
|
||||
* If the input sample rate does not divide 48kHz evenly, the input data are
|
||||
* resampled.
|
||||
*/
|
||||
SpeexResamplerState* mResampler;
|
||||
// Number of audio channels.
|
||||
size_t mChannels;
|
||||
|
||||
float mResamplingRatio;
|
||||
// The total duration of audio samples that have been encoded in microseconds.
|
||||
int64_t mTimestamp;
|
||||
// Time per audio sample in microseconds.
|
||||
|
@ -30,12 +30,10 @@ function startTest(test, token) {
|
||||
}
|
||||
manager.started(token);
|
||||
var a = new Audio(test.name);
|
||||
a.addEventListener("canplaythrough",
|
||||
function(e){ e.target.play(); },
|
||||
false);
|
||||
a.autoplay = true;
|
||||
a.addEventListener("ended",
|
||||
function(e){
|
||||
ok(true, "We should get to the end. Oh look we did.");
|
||||
ok(true, "[" + a.src + "]We should get to the end. Oh look we did.");
|
||||
manager.finished(token);
|
||||
},
|
||||
false);
|
||||
|
@ -71,14 +71,13 @@ class GetCameraNameRunnable;
|
||||
*
|
||||
* MediaThread:
|
||||
* mState, mImage, mWidth, mHeight, mCapability, mPrefs, mDeviceName, mUniqueId, mInitDone,
|
||||
* mSources, mImageContainer, mSources, mState, mImage, mLastCapture
|
||||
* mImageContainer, mSources, mState, mImage
|
||||
*
|
||||
* MainThread:
|
||||
* mCaptureIndex, mWindowId,
|
||||
* mNativeCameraControl, mPreviewStream, mState, mLastCapture, mWidth, mHeight
|
||||
* mCaptureIndex, mLastCapture, mState, mWidth, mHeight,
|
||||
*
|
||||
* Where mWidth, mHeight, mImage are protected by mMonitor
|
||||
* mState, mLastCapture is protected by mCallbackMonitor
|
||||
* mState is protected by mCallbackMonitor
|
||||
* Other variable is accessed only from single thread
|
||||
*/
|
||||
class MediaEngineWebRTCVideoSource : public MediaEngineVideoSource
|
||||
|
@ -643,7 +643,6 @@ MediaEngineWebRTCVideoSource::OnError(CameraErrorContext aContext, CameraError a
|
||||
void
|
||||
MediaEngineWebRTCVideoSource::OnTakePictureComplete(uint8_t* aData, uint32_t aLength, const nsAString& aMimeType)
|
||||
{
|
||||
ReentrantMonitorAutoEnter sync(mCallbackMonitor);
|
||||
mLastCapture =
|
||||
static_cast<nsIDOMFile*>(new nsDOMMemoryFile(static_cast<void*>(aData),
|
||||
static_cast<uint64_t>(aLength),
|
||||
@ -715,10 +714,14 @@ MediaEngineWebRTCVideoSource::RotateImage(layers::Image* aImage, uint32_t aWidth
|
||||
|
||||
bool
|
||||
MediaEngineWebRTCVideoSource::OnNewPreviewFrame(layers::Image* aImage, uint32_t aWidth, uint32_t aHeight) {
|
||||
MonitorAutoLock enter(mMonitor);
|
||||
if (mState == kStopped) {
|
||||
return false;
|
||||
{
|
||||
ReentrantMonitorAutoEnter sync(mCallbackMonitor);
|
||||
if (mState == kStopped) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
MonitorAutoLock enter(mMonitor);
|
||||
// Bug XXX we'd prefer to avoid converting if mRotation == 0, but that causes problems in UpdateImage()
|
||||
RotateImage(aImage, aWidth, aHeight);
|
||||
if (mRotation != 0 && mRotation != 180) {
|
||||
|
@ -77,7 +77,7 @@ SVGFEBlendElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
||||
nsTArray<RefPtr<SourceSurface>>& aInputImages)
|
||||
{
|
||||
uint32_t mode = mEnumAttributes[MODE].GetAnimValue();
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eBlend);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::Blend);
|
||||
descr.Attributes().Set(eBlendBlendmode, mode);
|
||||
return descr;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ SVGFEColorMatrixElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
||||
uint32_t type = mEnumAttributes[TYPE].GetAnimValue();
|
||||
const SVGNumberList &values = mNumberListAttributes[VALUES].GetAnimValue();
|
||||
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eColorMatrix);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::ColorMatrix);
|
||||
if (!mNumberListAttributes[VALUES].IsExplicitlySet() &&
|
||||
(type == SVG_FECOLORMATRIX_TYPE_MATRIX ||
|
||||
type == SVG_FECOLORMATRIX_TYPE_SATURATE ||
|
||||
|
@ -78,7 +78,7 @@ SVGFEComponentTransferElement::GetPrimitiveDescription(nsSVGFilterInstance* aIns
|
||||
eComponentTransferFunctionA
|
||||
};
|
||||
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eComponentTransfer);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::ComponentTransfer);
|
||||
for (int32_t i = 0; i < 4; i++) {
|
||||
if (childForChannel[i]) {
|
||||
descr.Attributes().Set(attributeNames[i], childForChannel[i]->ComputeAttributes());
|
||||
|
@ -114,7 +114,7 @@ SVGFECompositeElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
||||
const nsTArray<bool>& aInputsAreTainted,
|
||||
nsTArray<RefPtr<SourceSurface>>& aInputImages)
|
||||
{
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eComposite);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::Composite);
|
||||
uint32_t op = mEnumAttributes[OPERATOR].GetAnimValue();
|
||||
descr.Attributes().Set(eCompositeOperator, op);
|
||||
|
||||
|
@ -169,7 +169,7 @@ SVGFEConvolveMatrixElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstan
|
||||
const nsTArray<bool>& aInputsAreTainted,
|
||||
nsTArray<RefPtr<SourceSurface>>& aInputImages)
|
||||
{
|
||||
const FilterPrimitiveDescription failureDescription(FilterPrimitiveDescription::eNone);
|
||||
const FilterPrimitiveDescription failureDescription(PrimitiveType::Empty);
|
||||
|
||||
const SVGNumberList &kernelMatrix =
|
||||
mNumberListAttributes[KERNELMATRIX].GetAnimValue();
|
||||
@ -230,7 +230,7 @@ SVGFEConvolveMatrixElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstan
|
||||
Size kernelUnitLength =
|
||||
GetKernelUnitLength(aInstance, &mNumberPairAttributes[KERNEL_UNIT_LENGTH]);
|
||||
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eConvolveMatrix);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::ConvolveMatrix);
|
||||
AttributeMap& atts = descr.Attributes();
|
||||
atts.Set(eConvolveMatrixKernelSize, IntSize(orderX, orderY));
|
||||
atts.Set(eConvolveMatrixKernelMatrix, &kernelMatrix[0], kmLength);
|
||||
|
@ -68,7 +68,7 @@ SVGFEDiffuseLightingElement::GetPrimitiveDescription(nsSVGFilterInstance* aInsta
|
||||
{
|
||||
float diffuseConstant = mNumberAttributes[DIFFUSE_CONSTANT].GetAnimValue();
|
||||
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eDiffuseLighting);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::DiffuseLighting);
|
||||
descr.Attributes().Set(eDiffuseLightingDiffuseConstant, diffuseConstant);
|
||||
return AddLightingAttributes(descr, aInstance);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ SVGFEDisplacementMapElement::GetPrimitiveDescription(nsSVGFilterInstance* aInsta
|
||||
if (aInputsAreTainted[1]) {
|
||||
// If the map is tainted, refuse to apply the effect and act as a
|
||||
// pass-through filter instead, as required by the spec.
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eOffset);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::Offset);
|
||||
descr.Attributes().Set(eOffsetOffset, IntPoint(0, 0));
|
||||
return descr;
|
||||
}
|
||||
@ -108,7 +108,7 @@ SVGFEDisplacementMapElement::GetPrimitiveDescription(nsSVGFilterInstance* aInsta
|
||||
&mNumberAttributes[SCALE]);
|
||||
uint32_t xChannel = mEnumAttributes[CHANNEL_X].GetAnimValue();
|
||||
uint32_t yChannel = mEnumAttributes[CHANNEL_Y].GetAnimValue();
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eDisplacementMap);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::DisplacementMap);
|
||||
descr.Attributes().Set(eDisplacementMapScale, scale);
|
||||
descr.Attributes().Set(eDisplacementMapXChannel, xChannel);
|
||||
descr.Attributes().Set(eDisplacementMapYChannel, yChannel);
|
||||
|
@ -93,7 +93,7 @@ SVGFEDropShadowElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
||||
&mNumberPairAttributes[STD_DEV],
|
||||
nsSVGNumberPair::eSecond);
|
||||
if (stdX < 0 || stdY < 0) {
|
||||
return FilterPrimitiveDescription(FilterPrimitiveDescription::eNone);
|
||||
return FilterPrimitiveDescription(PrimitiveType::Empty);
|
||||
}
|
||||
|
||||
IntPoint offset(int32_t(aInstance->GetPrimitiveNumber(
|
||||
@ -101,7 +101,7 @@ SVGFEDropShadowElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
||||
int32_t(aInstance->GetPrimitiveNumber(
|
||||
SVGContentUtils::Y, &mNumberAttributes[DY])));
|
||||
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eDropShadow);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::DropShadow);
|
||||
descr.Attributes().Set(eDropShadowStdDeviation, Size(stdX, stdY));
|
||||
descr.Attributes().Set(eDropShadowOffset, offset);
|
||||
|
||||
|
@ -39,7 +39,7 @@ SVGFEFloodElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
||||
const nsTArray<bool>& aInputsAreTainted,
|
||||
nsTArray<RefPtr<SourceSurface>>& aInputImages)
|
||||
{
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eFlood);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::Flood);
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsStyleContext* style = frame->StyleContext();
|
||||
|
@ -76,10 +76,10 @@ SVGFEGaussianBlurElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance
|
||||
&mNumberPairAttributes[STD_DEV],
|
||||
nsSVGNumberPair::eSecond);
|
||||
if (stdX < 0 || stdY < 0) {
|
||||
return FilterPrimitiveDescription(FilterPrimitiveDescription::eNone);
|
||||
return FilterPrimitiveDescription(PrimitiveType::Empty);
|
||||
}
|
||||
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eGaussianBlur);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::GaussianBlur);
|
||||
descr.Attributes().Set(eGaussianBlurStdDeviation, Size(stdX, stdY));
|
||||
return descr;
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ SVGFEImageElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
||||
{
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
return FilterPrimitiveDescription(FilterPrimitiveDescription::eNone);
|
||||
return FilterPrimitiveDescription(PrimitiveType::Empty);
|
||||
}
|
||||
|
||||
nsCOMPtr<imgIRequest> currentRequest;
|
||||
@ -218,7 +218,7 @@ SVGFEImageElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
||||
}
|
||||
|
||||
if (!currentFrame) {
|
||||
return FilterPrimitiveDescription(FilterPrimitiveDescription::eNone);
|
||||
return FilterPrimitiveDescription(PrimitiveType::Empty);
|
||||
}
|
||||
|
||||
gfxPlatform* platform = gfxPlatform::GetPlatform();
|
||||
@ -239,7 +239,7 @@ SVGFEImageElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
||||
|
||||
Filter filter = ToFilter(nsLayoutUtils::GetGraphicsFilterForFrame(frame));
|
||||
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eImage);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::Image);
|
||||
descr.Attributes().Set(eImageFilter, (uint32_t)filter);
|
||||
descr.Attributes().Set(eImageTransform, TM);
|
||||
|
||||
|
@ -33,7 +33,7 @@ SVGFEMergeElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
||||
const nsTArray<bool>& aInputsAreTainted,
|
||||
nsTArray<RefPtr<SourceSurface>>& aInputImages)
|
||||
{
|
||||
return FilterPrimitiveDescription(FilterPrimitiveDescription::eMerge);
|
||||
return FilterPrimitiveDescription(PrimitiveType::Merge);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -119,7 +119,7 @@ SVGFEMorphologyElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
||||
{
|
||||
int32_t rx, ry;
|
||||
GetRXY(&rx, &ry, *aInstance);
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eMorphology);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::Morphology);
|
||||
descr.Attributes().Set(eMorphologyRadii, Size(rx, ry));
|
||||
descr.Attributes().Set(eMorphologyOperator,
|
||||
(uint32_t)mEnumAttributes[OPERATOR].GetAnimValue());
|
||||
|
@ -65,7 +65,7 @@ SVGFEOffsetElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
||||
const nsTArray<bool>& aInputsAreTainted,
|
||||
nsTArray<RefPtr<SourceSurface>>& aInputImages)
|
||||
{
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eOffset);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::Offset);
|
||||
IntPoint offset(int32_t(aInstance->GetPrimitiveNumber(
|
||||
SVGContentUtils::X, &mNumberAttributes[DX])),
|
||||
int32_t(aInstance->GetPrimitiveNumber(
|
||||
|
@ -78,10 +78,10 @@ SVGFESpecularLightingElement::GetPrimitiveDescription(nsSVGFilterInstance* aInst
|
||||
|
||||
// specification defined range (15.22)
|
||||
if (specularExponent < 1 || specularExponent > 128) {
|
||||
return FilterPrimitiveDescription(FilterPrimitiveDescription::eNone);
|
||||
return FilterPrimitiveDescription(PrimitiveType::Empty);
|
||||
}
|
||||
|
||||
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eSpecularLighting);
|
||||
FilterPrimitiveDescription descr(PrimitiveType::SpecularLighting);
|
||||
descr.Attributes().Set(eSpecularLightingSpecularConstant, specularConstant);
|
||||
descr.Attributes().Set(eSpecularLightingSpecularExponent, specularExponent);
|
||||
return AddLightingAttributes(descr, aInstance);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user