Merge mozilla-central to autoland. a=merge CLOSED TREE

This commit is contained in:
Bogdan Tara 2018-12-28 23:53:12 +02:00
Родитель 0daee297ae fff0a1f4f9
Коммит d2a41cb853
173 изменённых файлов: 2275 добавлений и 1250 удалений

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

@ -146,6 +146,9 @@ tasks:
GECKO_COMMIT_MSG: {$if: 'tasks_for != "action"', then: '${push.comment}'}
HG_STORE_PATH: /builds/worker/checkouts/hg-store
TASKCLUSTER_CACHES: /builds/worker/checkouts
# someday, these will be provided by the worker - Bug 1492664
TASKCLUSTER_ROOT_URL: https://taskcluster.net
TASKCLUSTER_PROXY_URL: http://taskcluster
- $if: 'tasks_for == "action"'
then:
ACTION_TASK_GROUP_ID: '${action.taskGroupId}' # taskGroupId of the target task

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

@ -1651,8 +1651,10 @@ pref("browser.migrate.chrome.history.maxAgeInDays", 180);
// Enable browser frames for use on desktop. Only exposed to chrome callers.
pref("dom.mozBrowserFramesEnabled", true);
pref("extensions.pocket.api", "api.getpocket.com");
pref("extensions.pocket.enabled", true);
pref("extensions.pocket.oAuthConsumerKey", "40249-e88c401e1b1f2242d9e441c4");
pref("extensions.pocket.site", "getpocket.com");
pref("signon.schemeUpgrades", true);

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

@ -43,6 +43,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
PlacesUIUtils: "resource:///modules/PlacesUIUtils.jsm",
PlacesTransactions: "resource://gre/modules/PlacesTransactions.jsm",
PluralForm: "resource://gre/modules/PluralForm.jsm",
Pocket: "chrome://pocket/content/Pocket.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.jsm",
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
@ -139,6 +140,8 @@ if (AppConstants.NIGHTLY_BUILD) {
"chrome://browser/content/browser-webrender.js");
}
XPCOMUtils.defineLazyScriptGetter(this, "pktUI", "chrome://pocket/content/main.js");
// lazy service getters
XPCOMUtils.defineLazyServiceGetters(this, {

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

@ -1035,6 +1035,18 @@ xmlns="http://www.w3.org/1999/xhtml"
tooltiptext="&pageActionButton.tooltip;"
onmousedown="BrowserPageActions.mainButtonClicked(event);"
onkeypress="BrowserPageActions.mainButtonClicked(event);"/>
<hbox id="pocket-button-box"
hidden="true"
class="urlbar-icon-wrapper urlbar-page-action"
onclick="BrowserPageActions.doCommandForAction(PageActions.actionForID('pocket'), event, this);">
<image id="pocket-button"
class="urlbar-icon"
role="button"/>
<hbox id="pocket-button-animatable-box">
<image id="pocket-button-animatable-image"
role="presentation"/>
</hbox>
</hbox>
<hbox id="star-button-box"
hidden="true"
class="urlbar-icon-wrapper urlbar-page-action"

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

@ -59,9 +59,6 @@ const whitelist = {
"resource://gre/modules/Readerable.jsm",
"resource://gre/modules/WebProgressChild.jsm",
// Pocket
"chrome://pocket/content/AboutPocket.jsm",
// Telemetry
"resource://gre/modules/TelemetryController.jsm", // bug 1470339
"resource://gre/modules/TelemetryUtils.jsm", // bug 1470339

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

@ -83,6 +83,14 @@ static const RedirEntry kRedirMap[] = {
{"library", "chrome://browser/content/aboutLibrary.xhtml",
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT},
{"pocket-saved", "chrome://pocket/content/panels/saved.html",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::URI_CAN_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT},
{"pocket-signup", "chrome://pocket/content/panels/signup.html",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::URI_CAN_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT},
{"preferences",
"chrome://browser/content/preferences/in-content/preferences.xul",
nsIAboutModule::ALLOW_SCRIPT},

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

@ -113,6 +113,8 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "restartrequired", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "welcome", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "policies", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "pocket-saved", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "pocket-signup", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#if defined(XP_WIN)
{ NS_IEHISTORYENUMERATOR_CONTRACTID, &kNS_WINIEHISTORYENUMERATOR_CID },
#elif defined(XP_MACOSX)

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

@ -1,94 +0,0 @@
/* 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/. */
"use strict";
const Cm = Components.manager;
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
// See LOG_LEVELS in Console.jsm. Common examples: "All", "Info", "Warn", & "Error".
const PREF_LOG_LEVEL = "loop.debug.loglevel";
// eslint-disable-next-line no-unused-vars
XPCOMUtils.defineLazyGetter(this, "log", () => {
let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {}).ConsoleAPI;
let consoleOptions = {
maxLogLevelPref: PREF_LOG_LEVEL,
prefix: "Loop",
};
return new ConsoleAPI(consoleOptions);
});
function AboutPage(chromeURL, aboutHost, classID, description, uriFlags) {
this.chromeURL = chromeURL;
this.aboutHost = aboutHost;
this.classID = Components.ID(classID);
this.description = description;
this.uriFlags = uriFlags;
}
AboutPage.prototype = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIAboutModule]),
getURIFlags(aURI) { // eslint-disable-line no-unused-vars
return this.uriFlags;
},
newChannel(aURI, aLoadInfo) {
let newURI = Services.io.newURI(this.chromeURL);
let channel = Services.io.newChannelFromURIWithLoadInfo(newURI,
aLoadInfo);
channel.originalURI = aURI;
if (this.uriFlags & Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT) {
let principal = Services.scriptSecurityManager.createCodebasePrincipal(aURI, {});
channel.owner = principal;
}
return channel;
},
createInstance(outer, iid) {
if (outer !== null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
}
return this.QueryInterface(iid);
},
register() {
Cm.QueryInterface(Ci.nsIComponentRegistrar).registerFactory(
this.classID, this.description,
"@mozilla.org/network/protocol/about;1?what=" + this.aboutHost, this);
},
unregister() {
Cm.QueryInterface(Ci.nsIComponentRegistrar).unregisterFactory(
this.classID, this);
},
};
/* exported AboutPocket */
var AboutPocket = {};
XPCOMUtils.defineLazyGetter(AboutPocket, "aboutSaved", () =>
new AboutPage("chrome://pocket/content/panels/saved.html",
"pocket-saved",
"{3e759f54-37af-7843-9824-f71b5993ceed}",
"About Pocket Saved",
Ci.nsIAboutModule.ALLOW_SCRIPT |
Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT |
Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT)
);
XPCOMUtils.defineLazyGetter(AboutPocket, "aboutSignup", () =>
new AboutPage("chrome://pocket/content/panels/signup.html",
"pocket-signup",
"{8548329d-00c4-234e-8f17-75026db3b56e}",
"About Pocket Signup",
Ci.nsIAboutModule.ALLOW_SCRIPT |
Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT |
Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT)
);
var EXPORTED_SYMBOLS = ["AboutPocket"];

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

@ -6,11 +6,7 @@
"use strict";
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://services-common/utils.js");
ChromeUtils.defineModuleGetter(this, "AboutPocket",
"chrome://pocket/content/AboutPocket.jsm");
ChromeUtils.defineModuleGetter(this, "AddonManagerPrivate",
"resource://gre/modules/AddonManager.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");
ChromeUtils.defineModuleGetter(this, "PageActions",
@ -19,49 +15,12 @@ ChromeUtils.defineModuleGetter(this, "Pocket",
"chrome://pocket/content/Pocket.jsm");
ChromeUtils.defineModuleGetter(this, "ReaderMode",
"resource://gre/modules/ReaderMode.jsm");
ChromeUtils.defineModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyGetter(this, "gPocketBundle", function() {
return Services.strings.createBundle("chrome://pocket/locale/pocket.properties");
});
XPCOMUtils.defineLazyGetter(this, "gPocketStyleURI", function() {
return Services.io.newURI("chrome://pocket/skin/pocket.css");
});
var EXPORTED_SYMBOLS = ["SaveToPocket"];
// Due to bug 1051238 frame scripts are cached forever, so we can't update them
// as a restartless add-on. The Math.random() is the work around for this.
const PROCESS_SCRIPT = "chrome://pocket/content/pocket-content-process.js?" + Math.random();
const PREF_BRANCH = "extensions.pocket.";
const PREFS = {
enabled: true, // bug 1229937, figure out ui tour support
api: "api.getpocket.com",
site: "getpocket.com",
};
function setDefaultPrefs() {
let branch = Services.prefs.getDefaultBranch(PREF_BRANCH);
for (let [key, val] of Object.entries(PREFS)) {
// If someone beat us to setting a default, don't overwrite it. This can
// happen if distribution.ini sets the default first.
if (branch.getPrefType(key) != branch.PREF_INVALID)
continue;
switch (typeof val) {
case "boolean":
branch.setBoolPref(key, val);
break;
case "number":
branch.setIntPref(key, val);
break;
case "string":
branch.setCharPref(key, val);
break;
}
}
}
function createElementWithAttrs(document, type, attrs) {
let element = document.createXULElement(type);
Object.keys(attrs).forEach(function(attr) {
@ -98,46 +57,17 @@ var PocketPageAction = {
_urlbarNodeInMarkup: true,
onBeforePlacedInWindow(window) {
let doc = window.document;
if (doc.getElementById("pocket-button-box")) {
return;
}
let wrapper = doc.createXULElement("hbox");
wrapper.id = "pocket-button-box";
wrapper.classList.add("urlbar-icon-wrapper", "urlbar-page-action");
let animatableBox = doc.createXULElement("hbox");
animatableBox.id = "pocket-animatable-box";
let animatableImage = doc.createXULElement("image");
animatableImage.id = "pocket-animatable-image";
animatableImage.setAttribute("role", "presentation");
let tooltip =
gPocketBundle.GetStringFromName("pocket-button.tooltiptext");
animatableImage.setAttribute("tooltiptext", tooltip);
let pocketButton = doc.createXULElement("image");
pocketButton.id = "pocket-button";
pocketButton.classList.add("urlbar-icon");
pocketButton.setAttribute("role", "button");
pocketButton.setAttribute("tooltiptext", tooltip);
wrapper.appendChild(pocketButton);
wrapper.appendChild(animatableBox);
animatableBox.appendChild(animatableImage);
let iconBox = doc.getElementById("page-action-buttons");
iconBox.appendChild(wrapper);
wrapper.hidden = true;
wrapper.addEventListener("click", event => {
let {BrowserPageActions} = wrapper.ownerGlobal;
BrowserPageActions.doCommandForAction(this, event, wrapper);
});
doc.getElementById("pocket-button").setAttribute("tooltiptext", tooltip);
doc.getElementById("pocket-button-animatable-image").setAttribute("tooltiptext", tooltip);
},
onIframeShowing(iframe, panel) {
Pocket.onShownInPhotonPageActionPanel(panel, iframe);
let doc = panel.ownerDocument;
let urlbarNode = doc.getElementById("pocket-button-box");
if (!urlbarNode || urlbarNode.hidden) {
if (!urlbarNode) {
return;
}
@ -209,7 +139,7 @@ var PocketPageAction = {
let urlbarNode = browserWindow.document.getElementById(
BrowserPageActions.urlbarButtonNodeIDForActionID(this.pageAction.id)
);
if (!urlbarNode) {
if (!urlbarNode || urlbarNode.hidden) {
return;
}
let browser = browserWindow.gBrowser.selectedBrowser;
@ -231,9 +161,7 @@ var PocketPageAction = {
for (let win of browserWindows()) {
let doc = win.document;
let pocketButtonBox = doc.getElementById("pocket-button-box");
if (pocketButtonBox) {
pocketButtonBox.remove();
}
pocketButtonBox.setAttribute("hidden", "true");
}
this.pageAction.remove();
@ -379,45 +307,18 @@ var PocketReader = {
};
function pktUIGetter(prop, window) {
return {
get() {
// delete any getters for properties loaded from main.js so we only load main.js once
delete window.pktUI;
delete window.pktApi;
delete window.pktUIMessaging;
Services.scriptloader.loadSubScript("chrome://pocket/content/main.js", window);
return window[prop];
},
configurable: true,
enumerable: true,
};
}
var PocketOverlay = {
startup() {
let styleSheetService = Cc["@mozilla.org/content/style-sheet-service;1"]
.getService(Ci.nsIStyleSheetService);
this._sheetType = styleSheetService.AUTHOR_SHEET;
this._cachedSheet = styleSheetService.preloadSheet(gPocketStyleURI,
this._sheetType);
Services.ppmm.loadProcessScript(PROCESS_SCRIPT, true);
Services.obs.addObserver(this, "browser-delayed-startup-finished");
PocketReader.startup();
PocketPageAction.init();
PocketContextMenu.init();
for (let win of browserWindows()) {
this.onWindowOpened(win);
this.updateWindow(win);
}
},
shutdown() {
Services.ppmm.broadcastAsyncMessage("PocketShuttingDown");
Services.obs.removeObserver(this, "browser-delayed-startup-finished");
// Although the ppmm loads the scripts into the chrome process as well,
// we need to manually unregister here anyway to ensure these aren't part
// of the chrome process and avoid errors.
AboutPocket.aboutSaved.unregister();
AboutPocket.aboutSignup.unregister();
PocketPageAction.shutdown();
@ -428,12 +329,6 @@ var PocketOverlay = {
if (element)
element.remove();
}
this.removeStyles(window);
// remove script getters/objects
window.Pocket = undefined;
window.pktApi = undefined;
window.pktUI = undefined;
window.pktUIMessaging = undefined;
}
PocketContextMenu.shutdown();
@ -441,25 +336,9 @@ var PocketOverlay = {
},
observe(subject, topic, detail) {
if (topic == "browser-delayed-startup-finished") {
this.onWindowOpened(subject);
this.updateWindow(subject);
}
},
onWindowOpened(window) {
if (window.hasOwnProperty("pktUI"))
return;
this.setWindowScripts(window);
this.addStyles(window);
this.updateWindow(window);
},
setWindowScripts(window) {
ChromeUtils.defineModuleGetter(window, "Pocket",
"chrome://pocket/content/Pocket.jsm");
// Can't use XPCOMUtils for these because the scripts try to define the variables
// on window, and so the defineProperty inside defineLazyGetter fails.
Object.defineProperty(window, "pktApi", pktUIGetter("pktApi", window));
Object.defineProperty(window, "pktUI", pktUIGetter("pktUI", window));
Object.defineProperty(window, "pktUIMessaging", pktUIGetter("pktUIMessaging", window));
},
// called for each window as it is opened
updateWindow(window) {
// insert our three menu items
@ -482,17 +361,6 @@ var PocketOverlay = {
// enable or disable reader button
PocketReader.hidden = hidden;
},
addStyles(win) {
let utils = win.windowUtils;
utils.addSheet(this._cachedSheet, this._sheetType);
},
removeStyles(win) {
let utils = win.windowUtils;
utils.removeSheet(gPocketStyleURI, this._sheetType);
},
};
// use enabled pref as a way for tests (e.g. test_contextmenu.html) to disable
@ -511,10 +379,6 @@ function browserWindows() {
var SaveToPocket = {
init() {
if (AddonManagerPrivate.addonIsActive("isreaditlater@ideashower.com"))
return;
setDefaultPrefs();
// migrate enabled pref
if (Services.prefs.prefHasUserValue("browser.pocket.enabled")) {
Services.prefs.setBoolPref("extensions.pocket.enabled", Services.prefs.getBoolPref("browser.pocket.enabled"));

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

@ -1,51 +0,0 @@
/* 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/. */
"use strict";
// This file is loaded as a process script, it will be loaded in the parent
// process as well as all content processes.
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("chrome://pocket/content/AboutPocket.jsm");
function AboutPocketChildListener() {
}
AboutPocketChildListener.prototype = {
onStartup: function onStartup() {
// Only do this in content processes since, as the broadcaster of this
// message, the parent process doesn't also receive it. We handlers
// the shutting down separately.
if (Services.appinfo.processType ==
Services.appinfo.PROCESS_TYPE_CONTENT) {
Services.cpmm.addMessageListener("PocketShuttingDown", this, true);
}
AboutPocket.aboutSaved.register();
AboutPocket.aboutSignup.register();
},
onShutdown: function onShutdown() {
AboutPocket.aboutSignup.unregister();
AboutPocket.aboutSaved.unregister();
Services.cpmm.removeMessageListener("PocketShuttingDown", this);
Cu.unload("chrome://pocket/content/AboutPocket.jsm");
},
receiveMessage: function receiveMessage(message) {
switch (message.name) {
case "PocketShuttingDown":
this.onShutdown();
break;
default:
break;
}
},
};
const listener = new AboutPocketChildListener();
listener.onStartup();

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

@ -4,7 +4,5 @@
browser.jar:
% content pocket %content/pocket/ contentaccessible=yes
% skin pocket classic/1.0 %skin/classic/browser/pocket/
content/pocket/ (content/*)
skin/classic/browser/pocket/ (skin/*)

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

@ -1,183 +0,0 @@
#pageActionActivatedActionPanel[actionID="pocket"] > .panel-arrowcontainer > .panel-arrowcontent {
padding-top: 0;
padding-bottom: 0;
}
#pageActionActivatedActionPanel[actionID="pocket"] > .panel-arrowcontainer > .panel-arrowbox > .panel-arrow {
fill: #fbfbfb;
}
#pocket-button,
#pageAction-panel-pocket {
list-style-image: url("chrome://pocket/skin/pocket-outline.svg");
}
#appMenu-library-pocket-button,
#pocket-button-box[open="true"] > #pocket-button,
#pocket-button-box[pocketed="true"] > #pocket-button {
list-style-image: url("chrome://pocket/skin/pocket.svg");
}
#pocket-button-box[animate="true"] > #pocket-button,
#pocket-button[open="true"][animationsenabled] > .toolbarbutton-icon {
fill: transparent;
}
#pocket-button-box[open="true"] > #pocket-button,
#pocket-button-box[pocketed="true"] > #pocket-button {
fill: #ef4056;
fill-opacity: 1;
}
@keyframes pocket-animation {
from {
transform: translateX(0);
}
to {
transform: translateX(-240px);
}
}
@keyframes pocket-animation-rtl {
from {
transform: scaleX(-1) translateX(0);
}
to {
transform: scaleX(-1) translateX(-240px);
}
}
#pocket-button-box[animate="true"] > #pocket-animatable-box,
#pocket-button > .toolbarbutton-animatable-box {
top: calc(50% - 8px); /* 8px is half the height of the sprite */
/* Since .toolbarbutton-icon uses a different width than the animatable box,
we need to set a padding relative to the difference in widths. */
margin-inline-start: calc((16px + 2 * var(--toolbarbutton-inner-padding) - 20px) / 2);
width: 20px; /* Width of each frame within the SVG sprite */
height: 16px; /* Height of each frame within the SVG sprite */
}
#pocket-button-box[animate="true"] > #pocket-animatable-box {
position: absolute;
overflow: hidden;
/* .urlbar-icon has width 28px. Each frame is 20px wide. Set margin-inline-start
to be half the difference, 4px. */
margin-inline-start: 4px;
}
:root[uidensity=compact] #pocket-button-box[animate="true"] > #pocket-animatable-box {
/* .urlbar-icon has width 24px in this case */
margin-inline-start: 2px;
}
:root[uidensity=touch] #pocket-button-box[animate="true"] > #pocket-animatable-box {
/* .urlbar-icon has width 30px in this case */
margin-inline-start: 5px;
}
#pocket-button-box[animate="true"] > #pocket-animatable-box > #pocket-animatable-image,
#pocket-button > .toolbarbutton-animatable-box > .toolbarbutton-animatable-image {
height: var(--toolbarbutton-height); /* Height must be equal to height of toolbarbutton padding-box */
}
#pocket-button-box[animate="true"],
#pocket-button[open="true"][animationsenabled][cui-areatype="toolbar"]:not([overflowedItem="true"]) {
position: relative;
}
#pocket-button-box:not([animate="true"]):not(:hover) > #pocket-animatable-box {
display: none;
}
/* Preload pocket-animation.svg and library-pocket-animation.svg to prevent
a flicker at the start of either animation. The preloading of the library
animation is triggered off of hovering the pocket button since the pocket
button always animates before the library button. */
#pocket-button-box:not([animate="true"]):hover > #pocket-animatable-box > #pocket-animatable-image,
#pocket-button[animationsenabled][cui-areatype="toolbar"]:not([overflowedItem="true"]):not([open="true"]):hover > .toolbarbutton-animatable-box > .toolbarbutton-animatable-image {
background-image: url("chrome://pocket/skin/pocket-animation.svg"),
url("chrome://pocket/skin/library-pocket-animation.svg");
background-size: 0, 0;
}
#pocket-button-box[animate="true"] > #pocket-animatable-box > #pocket-animatable-image,
#pocket-button[open="true"][animationsenabled][cui-areatype="toolbar"]:not([overflowedItem="true"]) > .toolbarbutton-animatable-box > .toolbarbutton-animatable-image {
animation-name: pocket-animation;
animation-timing-function: steps(12);
animation-duration: 200ms;
background-image: url("chrome://pocket/skin/pocket-animation.svg");
fill: #ef4056;
-moz-context-properties: fill;
width: 260px;
}
#pocket-button-box[animate="true"]:-moz-locale-dir(rtl) > #pocket-animatable-box > #pocket-animatable-image,
#pocket-button[open="true"][animationsenabled][cui-areatype="toolbar"]:not([overflowedItem="true"]):-moz-locale-dir(rtl) > .toolbarbutton-animatable-box > .toolbarbutton-animatable-image {
animation-name: pocket-animation-rtl;
}
@keyframes library-pocket-animation {
from {
transform: translateX(0);
fill: inherit;
}
25% {
fill: inherit;
}
50% {
fill: #ef4056;
}
to {
transform: translateX(-1056px);
fill: #ef4056;
}
}
@keyframes library-pocket-animation-rtl {
from {
transform: translateX(1056px);
fill: inherit;
}
25% {
fill: inherit;
}
50% {
fill: #ef4056;
}
to {
transform: translateX(0);
fill: #ef4056;
}
}
/* We need to use an animation here instead of a transition
to guarantee that the animation succeeds. With transitions
if the starting value is already equal to the end value
then no transition will occur and thus no transitionend event. */
@keyframes library-pocket-fade {
from {
fill: #ef4056;
}
to {
fill: inherit;
}
}
#library-animatable-box[animate="pocket"] > .toolbarbutton-animatable-image {
background-image: url("chrome://pocket/skin/library-pocket-animation.svg");
width: 1078px;
animation-name: library-pocket-animation;
animation-duration: 800ms;
animation-timing-function: steps(48);
}
#library-animatable-box[animate="pocket"]:-moz-locale-dir(rtl) > .toolbarbutton-animatable-image {
animation-name: library-pocket-animation-rtl;
}
#library-animatable-box[animate="pocket"][fade] > .toolbarbutton-animatable-image {
animation-name: library-pocket-fade;
animation-duration: 2s;
animation-timing-function: ease-out;
}

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

@ -15,8 +15,9 @@ add_task(async function test_setup() {
add_task(async function() {
await promisePocketEnabled();
checkWindowProperties(true, ["Pocket", "pktUI", "pktUIMessaging"]);
checkElements(true, ["pocket-button", "appMenu-library-pocket-button"]);
let buttonBox = document.getElementById("pocket-button-box");
is(buttonBox.hidden, false, "Button should not have been hidden");
// check context menu exists
info("checking content context menu");
@ -39,9 +40,10 @@ add_task(async function() {
await promisePocketDisabled();
checkWindowProperties(false, ["Pocket", "pktUI", "pktUIMessaging"]);
checkElements(false, ["pocket-button", "appMenu-library-pocket-button",
checkElements(false, ["appMenu-library-pocket-button",
"context-pocket", "context-savelinktopocket"]);
buttonBox = document.getElementById("pocket-button-box");
is(buttonBox.hidden, true, "Button should have been hidden");
await promisePocketReset();
});

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

@ -31,11 +31,6 @@ function promisePocketDisabled() {
Services.prefs.setBoolPref("extensions.pocket.enabled", false);
return BrowserTestUtils.waitForCondition(() => {
return !PageActions.actionForID("pocket");
}).then(() => {
// wait for a full unload of pocket
return BrowserTestUtils.waitForCondition(() => {
return !window.hasOwnProperty("pktUI") || !window.pktUI;
});
});
}
@ -48,12 +43,6 @@ function promisePocketReset() {
return promisePocketDisabled();
}
function checkWindowProperties(expectPresent, l) {
for (let name of l) {
is(window.hasOwnProperty(name) && !!window[name], expectPresent, "property " + name + (expectPresent ? " is" : " is not") + " present");
}
}
function checkElements(expectPresent, l) {
for (let id of l) {
let el = document.getElementById(id) || gNavToolbox.palette.querySelector("#" + id);

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

До

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

После

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

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

До

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

После

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

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

До

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

После

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

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

До

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

После

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

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

@ -156,6 +156,7 @@
skin/classic/browser/home.svg (../shared/icons/home.svg)
skin/classic/browser/library.svg (../shared/icons/library.svg)
skin/classic/browser/library-bookmark-animation.svg (../shared/icons/library-bookmark-animation.svg)
skin/classic/browser/library-pocket-animation.svg (../shared/icons/library-pocket-animation.svg)
skin/classic/browser/link.svg (../shared/icons/link.svg)
skin/classic/browser/mail.svg (../shared/icons/mail.svg)
skin/classic/browser/menu.svg (../shared/icons/menu.svg)
@ -164,6 +165,9 @@
skin/classic/browser/new-window.svg (../shared/icons/new-window.svg)
skin/classic/browser/open.svg (../shared/icons/open.svg)
skin/classic/browser/page-action.svg (../shared/icons/page-action.svg)
skin/classic/browser/pocket.svg (../shared/icons/pocket.svg)
skin/classic/browser/pocket-animation.svg (../shared/icons/pocket-animation.svg)
skin/classic/browser/pocket-outline.svg (../shared/icons/pocket-outline.svg)
skin/classic/browser/print.svg (../shared/icons/print.svg)
skin/classic/browser/private-browsing.svg (../shared/icons/private-browsing.svg)
skin/classic/browser/privateBrowsing.svg (../shared/icons/privateBrowsing.svg)

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

@ -73,6 +73,10 @@
list-style-image: url(chrome://browser/skin/fullscreen-exit.svg);
}
#appMenu-library-pocket-button {
list-style-image: url("chrome://browser/skin/pocket.svg");
}
#appMenu-library-history-button {
list-style-image: url(chrome://browser/skin/history.svg);
}

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

@ -471,14 +471,19 @@ toolbar[brighttext] {
#library-animatable-box[animate] > .toolbarbutton-animatable-image {
min-height: 54px; /* Minimum height must be equal to the height of the SVG sprite */
width: 1078px;
animation-duration: 800ms;
animation-timing-function: steps(48);
}
#library-animatable-box[animate][fade] > .toolbarbutton-animatable-image {
animation-duration: 2s;
animation-timing-function: ease-out;
}
#library-animatable-box[animate="bookmark"] > .toolbarbutton-animatable-image {
background-image: url("chrome://browser/skin/library-bookmark-animation.svg");
width: 1078px;
animation-name: library-bookmark-animation;
animation-duration: 800ms;
animation-timing-function: steps(48);
-moz-context-properties: fill, fill-opacity, stroke;
stroke: var(--toolbarbutton-icon-fill-attention);
}
@ -489,8 +494,66 @@ toolbar[brighttext] {
#library-animatable-box[animate="bookmark"][fade] > .toolbarbutton-animatable-image {
animation-name: library-bookmark-fade;
animation-duration: 2s;
animation-timing-function: ease-out;
}
@keyframes library-pocket-animation {
from {
transform: translateX(0);
fill: inherit;
}
25% {
fill: inherit;
}
50% {
fill: #ef4056;
}
to {
transform: translateX(-1056px);
fill: #ef4056;
}
}
@keyframes library-pocket-animation-rtl {
from {
transform: translateX(1056px);
fill: inherit;
}
25% {
fill: inherit;
}
50% {
fill: #ef4056;
}
to {
transform: translateX(0);
fill: #ef4056;
}
}
/* We need to use an animation here instead of a transition
to guarantee that the animation succeeds. With transitions
if the starting value is already equal to the end value
then no transition will occur and thus no transitionend event. */
@keyframes library-pocket-fade {
from {
fill: #ef4056;
}
to {
fill: inherit;
}
}
#library-animatable-box[animate="pocket"] > .toolbarbutton-animatable-image {
background-image: url("chrome://browser/skin/library-pocket-animation.svg");
animation-name: library-pocket-animation;
}
#library-animatable-box[animate="pocket"]:-moz-locale-dir(rtl) > .toolbarbutton-animatable-image {
animation-name: library-pocket-animation-rtl;
}
#library-animatable-box[animate="pocket"][fade] > .toolbarbutton-animatable-image {
animation-name: library-pocket-fade;
}
/* ----- BOOKMARK BUTTONS ----- */

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

@ -133,6 +133,27 @@
fill: var(--toolbarbutton-icon-fill-attention);
}
#pocket-button,
#pageAction-panel-pocket {
list-style-image: url("chrome://browser/skin/pocket-outline.svg");
}
#pocket-button-box[open="true"] > #pocket-button,
#pocket-button-box[pocketed="true"] > #pocket-button {
list-style-image: url("chrome://browser/skin/pocket.svg");
}
#pocket-button-box[animate="true"] > #pocket-button,
#pocket-button[open="true"][animationsenabled] > .toolbarbutton-icon {
fill: transparent;
}
#pocket-button-box[open="true"] > #pocket-button,
#pocket-button-box[pocketed="true"] > #pocket-button {
fill: #ef4056;
fill-opacity: 1;
}
#pageAction-panel-copyURL,
#pageAction-urlbar-copyURL {
list-style-image: url("chrome://browser/skin/link.svg");
@ -188,6 +209,15 @@
min-height: 11px;
}
#pageActionActivatedActionPanel[actionID="pocket"] > .panel-arrowcontainer > .panel-arrowcontent {
padding-top: 0;
padding-bottom: 0;
}
#pageActionActivatedActionPanel[actionID="pocket"] > .panel-arrowcontainer > .panel-arrowbox > .panel-arrow {
fill: #fbfbfb;
}
/* URL bar and page action buttons */
#page-action-buttons {
@ -382,6 +412,94 @@
animation-name: bookmark-animation-rtl;
}
@keyframes pocket-animation {
from {
transform: translateX(0);
}
to {
transform: translateX(-240px);
}
}
@keyframes pocket-animation-rtl {
from {
transform: scaleX(-1) translateX(0);
}
to {
transform: scaleX(-1) translateX(-240px);
}
}
#pocket-button-box[animate="true"] > #pocket-animatable-box,
#pocket-button > .toolbarbutton-animatable-box {
top: calc(50% - 8px); /* 8px is half the height of the sprite */
/* Since .toolbarbutton-icon uses a different width than the animatable box,
we need to set a padding relative to the difference in widths. */
margin-inline-start: calc((16px + 2 * var(--toolbarbutton-inner-padding) - 20px) / 2);
width: 20px; /* Width of each frame within the SVG sprite */
height: 16px; /* Height of each frame within the SVG sprite */
}
#pocket-button-box[animate="true"] > #pocket-animatable-box {
position: absolute;
overflow: hidden;
/* .urlbar-icon has width 28px. Each frame is 20px wide. Set margin-inline-start
to be half the difference, 4px. */
margin-inline-start: 4px;
}
:root[uidensity=compact] #pocket-button-box[animate="true"] > #pocket-animatable-box {
/* .urlbar-icon has width 24px in this case */
margin-inline-start: 2px;
}
:root[uidensity=touch] #pocket-button-box[animate="true"] > #pocket-animatable-box {
/* .urlbar-icon has width 30px in this case */
margin-inline-start: 5px;
}
#pocket-button-box[animate="true"] > #pocket-animatable-box > #pocket-animatable-image,
#pocket-button > .toolbarbutton-animatable-box > .toolbarbutton-animatable-image {
height: var(--toolbarbutton-height); /* Height must be equal to height of toolbarbutton padding-box */
}
#pocket-button-box[animate="true"],
#pocket-button[open="true"][animationsenabled][cui-areatype="toolbar"]:not([overflowedItem="true"]) {
position: relative;
}
#pocket-button-box:not([animate="true"]):not(:hover) > #pocket-animatable-box {
display: none;
}
/* Preload pocket-animation.svg and library-pocket-animation.svg to prevent
a flicker at the start of either animation. The preloading of the library
animation is triggered off of hovering the pocket button since the pocket
button always animates before the library button. */
#pocket-button-box:not([animate="true"]):hover > #pocket-animatable-box > #pocket-animatable-image,
#pocket-button[animationsenabled][cui-areatype="toolbar"]:not([overflowedItem="true"]):not([open="true"]):hover > .toolbarbutton-animatable-box > .toolbarbutton-animatable-image {
background-image: url("chrome://browser/skin/pocket-animation.svg"),
url("chrome://browser/skin/library-pocket-animation.svg");
background-size: 0, 0;
}
#pocket-button-box[animate="true"] > #pocket-animatable-box > #pocket-animatable-image,
#pocket-button[open="true"][animationsenabled][cui-areatype="toolbar"]:not([overflowedItem="true"]) > .toolbarbutton-animatable-box > .toolbarbutton-animatable-image {
animation-name: pocket-animation;
animation-timing-function: steps(12);
animation-duration: 200ms;
background-image: url("chrome://browser/skin/pocket-animation.svg");
fill: #ef4056;
-moz-context-properties: fill;
width: 260px;
}
#pocket-button-box[animate="true"]:-moz-locale-dir(rtl) > #pocket-animatable-box > #pocket-animatable-image,
#pocket-button[open="true"][animationsenabled][cui-areatype="toolbar"]:not([overflowedItem="true"]):-moz-locale-dir(rtl) > .toolbarbutton-animatable-box > .toolbarbutton-animatable-image {
animation-name: pocket-animation-rtl;
}
/**
* Contextual Feature Recommendation
*

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

@ -45,6 +45,7 @@ mozilla.pth:third_party/python/pytest/src
mozilla.pth:third_party/python/pytoml
mozilla.pth:third_party/python/redo
mozilla.pth:third_party/python/six
mozilla.pth:third_party/python/taskcluster-urls
mozilla.pth:third_party/python/voluptuous
mozilla.pth:third_party/python/json-e
mozilla.pth:build

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

@ -3,15 +3,25 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// @flow
import type { Action, ThunkArgs } from "./types";
import type { Action, FocusItem, ThunkArgs } from "./types";
export function setExpandedState(expanded: Set<string>) {
export function setExpandedState(thread: string, expanded: Set<string>) {
return ({ dispatch, getState }: ThunkArgs) => {
dispatch(
({
type: "SET_EXPANDED_STATE",
thread,
expanded
}: Action)
);
};
}
export function focusItem(item: FocusItem) {
return ({ dispatch, getState }: ThunkArgs) => {
dispatch({
type: "SET_FOCUSED_SOURCE_ITEM",
item
});
};
}

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

@ -26,7 +26,7 @@ import type { Action, ThunkArgs } from "./types";
import type { Source } from "../types";
export function updateTab(source: Source, framework: string): Action {
const { url, id: sourceId } = source;
const { url, id: sourceId, thread } = source;
const isOriginal = isOriginalId(source.id);
return {
@ -34,19 +34,21 @@ export function updateTab(source: Source, framework: string): Action {
url,
framework,
isOriginal,
sourceId
sourceId,
thread
};
}
export function addTab(source: Source): Action {
const { url, id: sourceId } = source;
const { url, id: sourceId, thread } = source;
const isOriginal = isOriginalId(source.id);
return {
type: "ADD_TAB",
url,
isOriginal,
sourceId
sourceId,
thread
};
}

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

@ -33,7 +33,8 @@ import {
getSelectedSource,
getActiveSearch,
getSourcesForTabs,
getHasSiblingOfSameName
getHasSiblingOfSameName,
getWorkerDisplayName
} from "../../selectors";
import type { ActiveSearchType } from "../../selectors";
@ -51,7 +52,8 @@ type Props = {
closeTab: typeof actions.closeTab,
closeTabs: typeof actions.closeTabs,
togglePrettyPrint: typeof actions.togglePrettyPrint,
showSource: typeof actions.showSource
showSource: typeof actions.showSource,
threadName: string
};
class Tab extends PureComponent<Props> {
@ -161,7 +163,8 @@ class Tab extends PureComponent<Props> {
closeTab,
source,
tabSources,
hasSiblingOfSameName
hasSiblingOfSameName,
threadName
} = this.props;
const sourceId = source.id;
const active =
@ -188,6 +191,7 @@ class Tab extends PureComponent<Props> {
const path = getDisplayPath(source, tabSources);
const query = hasSiblingOfSameName ? getSourceQueryString(source) : "";
const threadNamePrefix = `${threadName}${threadName ? ": " : ""}`;
return (
<div
@ -204,7 +208,7 @@ class Tab extends PureComponent<Props> {
shouldHide={icon => ["file", "javascript"].includes(icon)}
/>
<div className="filename">
{getTruncatedFileName(source, query)}
{`${threadNamePrefix}${getTruncatedFileName(source, query)}`}
{path && <span>{`../${path}/..`}</span>}
</div>
<CloseButton
@ -223,7 +227,8 @@ const mapStateToProps = (state, { source }) => {
tabSources: getSourcesForTabs(state),
selectedSource: selectedSource,
activeSearch: getActiveSearch(state),
hasSiblingOfSameName: getHasSiblingOfSameName(state, source)
hasSiblingOfSameName: getHasSiblingOfSameName(state, source),
threadName: getWorkerDisplayName(state, source.thread)
};
};

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

@ -16,8 +16,10 @@ import {
getDebuggeeUrl,
getExpandedState,
getProjectDirectoryRoot,
getRelativeSources,
getSourceCount
getRelativeSourcesForThread,
getSourceCount,
getFocusedSourceItem,
getWorkerDisplayName
} from "../../selectors";
import { getGeneratedSourceByURL } from "../../reducers/sources";
@ -51,20 +53,23 @@ import type { SourcesMap, State as AppState } from "../../reducers/types";
import type { Item } from "../shared/ManagedTree";
type Props = {
thread: string,
sources: SourcesMap,
sourceCount: number,
shownSource?: Source,
selectedSource?: Source,
debuggeeUrl: string,
projectRoot: string,
expanded: Set<string> | null,
expanded: Set<string>,
selectSource: typeof actions.selectSource,
setExpandedState: typeof actions.setExpandedState,
clearProjectDirectoryRoot: typeof actions.clearProjectDirectoryRoot
clearProjectDirectoryRoot: typeof actions.clearProjectDirectoryRoot,
focusItem: typeof actions.focusItem,
focused: TreeNode,
workerDisplayName: string
};
type State = {
focusedItem: ?TreeNode,
parentMap: ParentMap,
sourceTree: TreeDirectory,
uncollapsedTree: TreeDirectory,
@ -90,6 +95,7 @@ class SourcesTree extends Component<Props, State> {
componentWillReceiveProps(nextProps: Props) {
const {
thread,
projectRoot,
debuggeeUrl,
sources,
@ -140,23 +146,22 @@ class SourcesTree extends Component<Props, State> {
debuggeeUrl,
projectRoot,
uncollapsedTree,
sourceTree,
focusedItem: this.state.focusedItem
sourceTree
})
);
}
}
focusItem = (item: TreeNode) => {
this.setState({ focusedItem: item });
};
selectItem = (item: TreeNode) => {
if (item.type == "source" && !Array.isArray(item.contents)) {
this.props.selectSource(item.contents.id);
}
};
onFocus = (item: TreeNode) => {
this.props.focusItem({ thread: this.props.thread, item });
};
// NOTE: we get the source from sources because item.contents is cached
getSource(item: TreeNode): ?Source {
const source = getSourceFromNode(item);
@ -180,18 +185,18 @@ class SourcesTree extends Component<Props, State> {
};
onExpand = (item: Item, expandedState: Set<string>) => {
this.props.setExpandedState(expandedState);
this.props.setExpandedState(this.props.thread, expandedState);
};
onCollapse = (item: Item, expandedState: Set<string>) => {
this.props.setExpandedState(expandedState);
this.props.setExpandedState(this.props.thread, expandedState);
};
onKeyDown = (e: KeyboardEvent) => {
const { focusedItem } = this.state;
const { focused } = this.props;
if (e.keyCode === 13 && focusedItem) {
this.selectItem(focusedItem);
if (e.keyCode === 13 && focused) {
this.selectItem(focused);
}
};
@ -267,7 +272,7 @@ class SourcesTree extends Component<Props, State> {
depth={depth}
focused={focused}
expanded={expanded}
focusItem={this.focusItem}
focusItem={this.onFocus}
selectItem={this.selectItem}
source={this.getSource(item)}
debuggeeUrl={debuggeeUrl}
@ -278,13 +283,14 @@ class SourcesTree extends Component<Props, State> {
};
renderTree() {
const { expanded } = this.props;
const { expanded, focused } = this.props;
const { highlightItems, listItems, parentMap } = this.state;
const treeProps = {
autoExpandAll: false,
autoExpandDepth: expanded ? 0 : 1,
expanded,
focused,
getChildren: (item: $Shape<TreeDirectory>) =>
nodeHasChildren(item) ? item.contents : [],
getParent: (item: $Shape<TreeNode>) => parentMap.get(item),
@ -296,7 +302,7 @@ class SourcesTree extends Component<Props, State> {
listItems,
onCollapse: this.onCollapse,
onExpand: this.onExpand,
onFocus: this.focusItem,
onFocus: this.onFocus,
renderItem: this.renderItem,
preventBlur: true
};
@ -319,7 +325,7 @@ class SourcesTree extends Component<Props, State> {
);
}
render() {
renderContents() {
const { projectRoot } = this.props;
if (this.isEmpty()) {
@ -342,28 +348,52 @@ class SourcesTree extends Component<Props, State> {
</div>
);
}
render() {
if (this.props.workerDisplayName) {
return (
<div>
{this.props.workerDisplayName}
{this.renderContents()}
</div>
);
}
return this.renderContents();
}
}
function getSourceForTree(state: AppState, source: ?Source): ?Source | null {
function getSourceForTree(
state: AppState,
source: ?Source,
thread: ?string
): ?Source {
if (!source || !source.isPrettyPrinted) {
return source;
}
return getGeneratedSourceByURL(state, getRawSourceURL(source.url));
const candidate = getGeneratedSourceByURL(state, getRawSourceURL(source.url));
if (!thread || !candidate || candidate.thread == thread) {
return candidate;
}
}
const mapStateToProps = state => {
const mapStateToProps = (state, props) => {
const selectedSource = getSelectedSource(state);
const shownSource = getShownSource(state);
const focused = getFocusedSourceItem(state);
const thread = props.thread;
return {
shownSource: getSourceForTree(state, shownSource),
selectedSource: getSourceForTree(state, selectedSource),
shownSource: getSourceForTree(state, shownSource, thread),
selectedSource: getSourceForTree(state, selectedSource, thread),
debuggeeUrl: getDebuggeeUrl(state),
expanded: getExpandedState(state),
expanded: getExpandedState(state, props.thread),
focused: focused && focused.thread == props.thread ? focused.item : null,
projectRoot: getProjectDirectoryRoot(state),
sources: getRelativeSources(state),
sourceCount: getSourceCount(state)
sources: getRelativeSourcesForThread(state, thread),
sourceCount: getSourceCount(state, props.thread),
workerDisplayName: getWorkerDisplayName(state, thread)
};
};
@ -372,6 +402,7 @@ export default connect(
{
selectSource: actions.selectSource,
setExpandedState: actions.setExpandedState,
clearProjectDirectoryRoot: actions.clearProjectDirectoryRoot
clearProjectDirectoryRoot: actions.clearProjectDirectoryRoot,
focusItem: actions.focusItem
}
)(SourcesTree);

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

@ -10,9 +10,10 @@ import { Tab, Tabs, TabList, TabPanels } from "react-aria-components/src/tabs";
import { formatKeyShortcut } from "../../utils/text";
import actions from "../../actions";
import {
getSources,
getRelativeSources,
getActiveSearch,
getSelectedPrimaryPaneTab
getSelectedPrimaryPaneTab,
getWorkerDisplayName
} from "../../selectors";
import { features, prefs } from "../../utils/prefs";
import "./Sources.css";
@ -21,7 +22,7 @@ import classnames from "classnames";
import Outline from "./Outline";
import SourcesTree from "./SourcesTree";
import type { SourcesMap } from "../../reducers/types";
import type { SourcesMapByThread } from "../../reducers/types";
import type { SelectedPrimaryPaneTabType } from "../../selectors";
type State = {
@ -30,12 +31,13 @@ type State = {
type Props = {
selectedTab: SelectedPrimaryPaneTabType,
sources: SourcesMap,
sources: SourcesMapByThread,
horizontal: boolean,
sourceSearchOn: boolean,
setPrimaryPaneTab: typeof actions.setPrimaryPaneTab,
setActiveSearch: typeof actions.setActiveSearch,
closeActiveSearch: typeof actions.closeActiveSearch
closeActiveSearch: typeof actions.closeActiveSearch,
getWorkerDisplayName: string => string
};
class PrimaryPanes extends Component<Props, State> {
@ -91,6 +93,17 @@ class PrimaryPanes extends Component<Props, State> {
];
}
renderThreadSources() {
const threads = Object.getOwnPropertyNames(this.props.sources);
threads.sort(
(a, b) =>
this.props.getWorkerDisplayName(a) > this.props.getWorkerDisplayName(b)
? 1
: -1
);
return threads.map(thread => <SourcesTree thread={thread} key={thread} />);
}
render() {
const { selectedTab } = this.props;
const activeIndex = selectedTab === "sources" ? 0 : 1;
@ -105,7 +118,7 @@ class PrimaryPanes extends Component<Props, State> {
{this.renderOutlineTabs()}
</TabList>
<TabPanels className="source-outline-panel" hasFocusableContent>
<SourcesTree />
<div>{this.renderThreadSources()}</div>
<Outline
alphabetizeOutline={this.state.alphabetizeOutline}
onAlphabetizeClick={this.onAlphabetizeClick}
@ -118,15 +131,18 @@ class PrimaryPanes extends Component<Props, State> {
const mapStateToProps = state => ({
selectedTab: getSelectedPrimaryPaneTab(state),
sources: getSources(state),
sourceSearchOn: getActiveSearch(state) === "source"
sources: getRelativeSources(state),
sourceSearchOn: getActiveSearch(state) === "source",
getWorkerDisplayName: thread => getWorkerDisplayName(state, thread)
});
export default connect(
const connector = connect(
mapStateToProps,
{
setPrimaryPaneTab: actions.setPrimaryPaneTab,
setActiveSearch: actions.setActiveSearch,
closeActiveSearch: actions.closeActiveSearch
}
)(PrimaryPanes);
);
export default connector(PrimaryPanes);

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

@ -10,7 +10,7 @@ import { basename } from "../utils/path";
import actions from "../actions";
import {
getRelativeSources,
getRelativeSourcesList,
getQuickOpenEnabled,
getQuickOpenQuery,
getQuickOpenType,
@ -420,7 +420,7 @@ function mapStateToProps(state) {
return {
enabled: getQuickOpenEnabled(state),
sources: formatSources(getRelativeSources(state), getTabs(state)),
sources: formatSources(getRelativeSourcesList(state), getTabs(state)),
selectedSource,
symbols: formatSymbols(getSymbols(state, selectedSource)),
symbolsLoading: isSymbolsLoading(state, selectedSource),

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

@ -14,7 +14,8 @@ import {
} from "../../../utils/source";
import {
getHasSiblingOfSameName,
getBreakpointsForSource
getBreakpointsForSource,
getWorkerDisplayName
} from "../../../selectors";
import SourceIcon from "../../shared/SourceIcon";
@ -30,7 +31,8 @@ type Props = {
disableBreakpointsInSource: typeof actions.disableBreakpointsInSource,
enableBreakpointsInSource: typeof actions.enableBreakpointsInSource,
removeBreakpointsInSource: typeof actions.removeBreakpointsInSource,
selectSource: typeof actions.selectSource
selectSource: typeof actions.selectSource,
threadName: string
};
class BreakpointHeading extends PureComponent<Props> {
@ -39,7 +41,13 @@ class BreakpointHeading extends PureComponent<Props> {
};
render() {
const { sources, source, hasSiblingOfSameName, selectSource } = this.props;
const {
sources,
source,
hasSiblingOfSameName,
selectSource,
threadName
} = this.props;
const path = getDisplayPath(source, sources);
const query = hasSiblingOfSameName ? getSourceQueryString(source) : "";
@ -56,7 +64,9 @@ class BreakpointHeading extends PureComponent<Props> {
shouldHide={icon => ["file", "javascript"].includes(icon)}
/>
<div className="filename">
{getTruncatedFileName(source, query)}
{threadName +
(threadName ? ": " : "") +
getTruncatedFileName(source, query)}
{path && <span>{`../${path}/..`}</span>}
</div>
</div>
@ -66,7 +76,8 @@ class BreakpointHeading extends PureComponent<Props> {
const mapStateToProps = (state, { source }) => ({
hasSiblingOfSameName: getHasSiblingOfSameName(state, source),
breakpointsForSource: getBreakpointsForSource(state, source.id)
breakpointsForSource: getBreakpointsForSource(state, source.id),
threadName: getWorkerDisplayName(state, source.thread)
});
export default connect(

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

@ -13,7 +13,8 @@ import {
getMainThread,
getCurrentThread,
threadIsPaused,
getWorkers
getWorkers,
getWorkerDisplayName
} from "../../selectors";
import { basename } from "../../utils/path";
import { features } from "../../utils/prefs";
@ -45,7 +46,11 @@ export class Workers extends Component<Props> {
onClick={() => this.props.selectThread(worker.actor)}
>
<img className="domain" />
{(worker.url ? basename(worker.url) : "Main Thread") +
{(worker.url
? `${this.props.getWorkerDisplayName(worker.actor)}: ${basename(
worker.url
)}`
: "Main Thread") +
(this.props.threadIsPaused(worker.actor) ? " PAUSED" : "")}
</div>
));
@ -81,6 +86,7 @@ export class Workers extends Component<Props> {
const mapStateToProps = state => ({
workers: getWorkers(state),
getWorkerDisplayName: thread => getWorkerDisplayName(state, thread),
mainThread: getMainThread(state),
currentThread: getCurrentThread(state),
threadIsPaused: thread => threadIsPaused(state, thread)

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

@ -24,18 +24,16 @@ type Props = {
highlightItems?: Array<Item>,
itemHeight: number,
listItems?: Array<Item>,
onFocus?: (item: any) => void,
onFocus: (item: any) => void,
onExpand?: (item: Item, expanded: Set<string>) => void,
onCollapse?: (item: Item, expanded: Set<string>) => void,
renderItem: any,
disabledFocus?: boolean,
focused?: any,
expanded?: any
};
type State = {
expanded: any,
focusedItem: ?Item
expanded: any
};
class ManagedTree extends Component<Props, State> {
@ -47,8 +45,12 @@ class ManagedTree extends Component<Props, State> {
};
}
static defaultProps = {
onFocus: () => {}
};
componentWillReceiveProps(nextProps: Props) {
const { listItems, highlightItems, focused } = this.props;
const { listItems, highlightItems } = this.props;
if (nextProps.listItems && nextProps.listItems != listItems) {
this.expandListItems(nextProps.listItems);
}
@ -60,10 +62,6 @@ class ManagedTree extends Component<Props, State> {
) {
this.highlightItem(nextProps.highlightItems);
}
if (nextProps.focused && nextProps.focused !== focused) {
this.focusItem(nextProps.focused);
}
}
setExpanded = (
@ -109,7 +107,7 @@ class ManagedTree extends Component<Props, State> {
expandListItems(listItems: Array<Item>) {
const { expanded } = this.state;
listItems.forEach(item => expanded.add(this.props.getPath(item)));
this.focusItem(listItems[0]);
this.props.onFocus(listItems[0]);
this.setState({ expanded });
}
@ -117,7 +115,7 @@ class ManagedTree extends Component<Props, State> {
const { expanded } = this.state;
// This file is visible, so we highlight it.
if (expanded.has(this.props.getPath(highlightItems[0]))) {
this.focusItem(highlightItems[0]);
this.props.onFocus(highlightItems[0]);
} else {
// Look at folders starting from the top-level until finds a
// closed folder and highlights this folder
@ -129,33 +127,23 @@ class ManagedTree extends Component<Props, State> {
);
if (highlightItems[index]) {
this.focusItem(highlightItems[index]);
this.props.onFocus(highlightItems[index]);
}
}
}
focusItem = (item: Item) => {
if (!this.props.disabledFocus && this.state.focusedItem !== item) {
this.setState({ focusedItem: item });
if (this.props.onFocus) {
this.props.onFocus(item);
}
}
};
render() {
const { expanded, focusedItem } = this.state;
const { expanded } = this.state;
return (
<div className="managed-tree">
<Tree
{...this.props}
isExpanded={item => expanded.has(this.props.getPath(item))}
focused={focusedItem}
focused={this.props.focused}
getKey={this.props.getPath}
onExpand={item => this.setExpanded(item, true, false)}
onCollapse={item => this.setExpanded(item, false, false)}
onFocus={this.focusItem}
onFocus={this.props.onFocus}
renderItem={(...args) =>
this.props.renderItem(...args, {
setExpanded: this.setExpanded

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

@ -39,8 +39,15 @@ export default function debuggee(
export const getWorkers = (state: OuterState) => state.debuggee.workers;
type OuterState = { debuggee: DebuggeeState };
export const getWorkerDisplayName = (state: OuterState, thread: string) => {
let index = 1;
for (const { actor } of state.debuggee.workers) {
if (actor == thread) {
return `Worker #${index}`;
}
index++;
}
return "";
};
export function getWorker(state: OuterState, url: string) {
return getWorkers(state).find(value => url);
}
type OuterState = { debuggee: DebuggeeState };

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

@ -12,12 +12,12 @@
import type { SourceTreeAction } from "../actions/types";
export type SourceTreeState = {
expanded: Set<string> | null
expanded: { [string]: Set<string> }
};
export function InitialState(): SourceTreeState {
return {
expanded: null
expanded: {}
};
}
@ -36,7 +36,7 @@ export default function update(
function updateExpanded(state, action) {
return {
...state,
expanded: new Set(action.expanded)
expanded: { ...state.expanded, [action.thread]: new Set(action.expanded) }
};
}
@ -44,6 +44,6 @@ type OuterState = {
sourceTree: SourceTreeState
};
export function getExpandedState(state: OuterState) {
return state.sourceTree.expanded;
export function getExpandedState(state: OuterState, thread: string) {
return state.sourceTree.expanded[thread];
}

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

@ -22,20 +22,22 @@ import { prefs } from "../utils/prefs";
import type { Source, SourceId, SourceLocation } from "../types";
import type { PendingSelectedLocation, Selector } from "./types";
import type { Action, DonePromiseAction } from "../actions/types";
import type { Action, DonePromiseAction, FocusItem } from "../actions/types";
import type { LoadSourceAction } from "../actions/types/SourceAction";
export type SourcesMap = { [string]: Source };
export type SourcesMapByThread = { [string]: SourcesMap };
type UrlsMap = { [string]: SourceId[] };
export type SourcesState = {
sources: SourcesMap,
urls: UrlsMap,
relativeSources: SourcesMap,
relativeSources: SourcesMapByThread,
pendingSelectedLocation?: PendingSelectedLocation,
selectedLocation: ?SourceLocation,
projectDirectoryRoot: string
projectDirectoryRoot: string,
focusedItem: ?FocusItem
};
export function initialSourcesState(): SourcesState {
@ -45,7 +47,8 @@ export function initialSourcesState(): SourcesState {
relativeSources: {},
selectedLocation: undefined,
pendingSelectedLocation: prefs.pendingSelectedLocation,
projectDirectoryRoot: prefs.projectDirectoryRoot
projectDirectoryRoot: prefs.projectDirectoryRoot,
focusedItem: null
};
}
@ -137,7 +140,7 @@ function update(
break;
case "SET_PROJECT_DIRECTORY_ROOT":
return recalculateRelativeSources(state, action.url);
return updateProjectDirectoryRoot(state, action.url);
case "NAVIGATE":
const source =
@ -151,6 +154,9 @@ function update(
}
return { ...initialSourcesState(), url };
case "SET_FOCUSED_SOURCE_ITEM":
return { ...state, focusedItem: action.item };
}
return state;
@ -190,10 +196,15 @@ function setSourceTextProps(state, action: LoadSourceAction): SourcesState {
}
function updateSources(state, sources) {
const relativeSources = { ...state.relativeSources };
for (const thread in relativeSources) {
relativeSources[thread] = { ...relativeSources[thread] };
}
state = {
...state,
sources: { ...state.sources },
relativeSources: { ...state.relativeSources },
relativeSources,
urls: { ...state.urls }
};
@ -230,10 +241,10 @@ function updateSource(state: SourcesState, source: Object) {
}
function updateRelativeSource(
relativeSources: SourcesMap,
relativeSources: SourcesMapByThread,
source: Source,
root: string
): SourcesMap {
): SourcesMapByThread {
if (!underRoot(source, root)) {
return relativeSources;
}
@ -243,15 +254,19 @@ function updateRelativeSource(
relativeUrl: getRelativeUrl(source, root)
}: any);
relativeSources[source.id] = relativeSource;
if (!relativeSources[source.thread]) {
relativeSources[source.thread] = {};
}
relativeSources[source.thread][source.id] = relativeSource;
return relativeSources;
}
function recalculateRelativeSources(state: SourcesState, root: string) {
function updateProjectDirectoryRoot(state: SourcesState, root: string) {
prefs.projectDirectoryRoot = root;
const relativeSources = (Object.values(state.sources): any).reduce(
const relativeSources = getSourceList({ sources: state }).reduce(
(sources, source: Source) => updateRelativeSource(sources, source, root),
{}
);
@ -308,7 +323,8 @@ export function getOriginalSourceByURL(
return getOriginalSourceByUrlInSources(
getSources(state),
getUrls(state),
url
url,
""
);
}
@ -319,7 +335,8 @@ export function getGeneratedSourceByURL(
return getGeneratedSourceByUrlInSources(
getSources(state),
getUrls(state),
url
url,
""
);
}
@ -381,40 +398,42 @@ export function hasPrettySource(state: OuterState, id: string) {
return !!getPrettySource(state, id);
}
export function getOriginalSourceByUrlInSources(
function getSourceHelper(
original: boolean,
sources: SourcesMap,
urls: UrlsMap,
url: string
url: string,
thread: string = ""
) {
const foundSources = getSourcesByUrlInSources(sources, urls, url);
if (!foundSources) {
return null;
}
return foundSources.find(source => isOriginalSource(source) == true);
return foundSources.find(
source =>
isOriginalSource(source) == original &&
(!thread || source.thread == thread)
);
}
export function getGeneratedSourceByUrlInSources(
sources: SourcesMap,
urls: UrlsMap,
url: string
) {
const foundSources = getSourcesByUrlInSources(sources, urls, url);
if (!foundSources) {
return null;
}
return foundSources.find(source => isOriginalSource(source) == false);
}
export const getOriginalSourceByUrlInSources = getSourceHelper.bind(null, true);
export const getGeneratedSourceByUrlInSources = getSourceHelper.bind(
null,
false
);
export function getSpecificSourceByUrlInSources(
sources: SourcesMap,
urls: UrlsMap,
url: string,
isOriginal: boolean
isOriginal: boolean,
thread: string
) {
return isOriginal
? getOriginalSourceByUrlInSources(sources, urls, url)
: getGeneratedSourceByUrlInSources(sources, urls, url);
? getOriginalSourceByUrlInSources(sources, urls, url, thread)
: getGeneratedSourceByUrlInSources(sources, urls, url, thread);
}
export function getSourceByUrlInSources(
@ -477,14 +496,22 @@ export function getUrls(state: OuterState) {
return state.sources.urls;
}
export function getSourceList(state: OuterState): Source[] {
return (Object.values(getSources(state)): any);
export function getSourceList(state: OuterState, thread?: string): Source[] {
const sourceList = (Object.values(getSources(state)): any);
return !thread
? sourceList
: sourceList.filter(source => source.thread == thread);
}
export const getSourceCount: Selector<number> = createSelector(
getSources,
sources => Object.keys(sources).length
);
export function getRelativeSourcesList(state: OuterState): Source[] {
return ((Object.values(getRelativeSources(state)): any).flatMap(
Object.values
): any);
}
export function getSourceCount(state: OuterState, thread?: string) {
return getSourceList(state, thread).length;
}
export const getSelectedLocation: Selector<?SourceLocation> = createSelector(
getSourcesState,
@ -507,8 +534,19 @@ export function getProjectDirectoryRoot(state: OuterState): string {
return state.sources.projectDirectoryRoot;
}
export function getRelativeSources(state: OuterState): SourcesMap {
export function getRelativeSources(state: OuterState): SourcesMapByThread {
return state.sources.relativeSources;
}
export function getRelativeSourcesForThread(
state: OuterState,
thread: string
): SourcesMap {
return getRelativeSources(state)[thread];
}
export function getFocusedSourceItem(state: OuterState): ?FocusItem {
return state.sources.focusedItem;
}
export default update;

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

@ -31,12 +31,22 @@ export type Tab = {
url: string,
framework?: string | null,
isOriginal: boolean,
sourceId?: string
sourceId?: string,
thread: string
};
export type TabList = Tab[];
function isSimilarTab(tab: Tab, url: string, isOriginal: boolean) {
return tab.url === url && tab.isOriginal === isOriginal;
function isSimilarTab(
tab: Tab,
url: string,
isOriginal: boolean,
thread: string
) {
return (
tab.url === url &&
tab.isOriginal === isOriginal &&
(!thread || !tab.thread || thread == tab.thread)
);
}
function update(state: TabList = [], action: Action): TabList {
@ -63,7 +73,10 @@ export function removeSourceFromTabList(
source: Source
): TabList {
return tabs.filter(
tab => tab.url !== source.url || tab.isOriginal != isOriginalId(source.id)
tab =>
tab.url !== source.url ||
tab.isOriginal != isOriginalId(source.id) ||
(tab.thread && tab.thread !== source.thread)
);
}
@ -81,16 +94,16 @@ export function removeSourcesFromTabList(tabs: TabList, sources: Source[]) {
*/
function updateTabList(
tabs: TabList,
{ url, framework = null, sourceId, isOriginal = false }
{ url, framework = null, sourceId, isOriginal = false, thread = "" }
) {
// Set currentIndex to -1 for URL-less tabs so that they aren't
// filtered by isSimilarTab
const currentIndex = url
? tabs.findIndex(tab => isSimilarTab(tab, url, isOriginal))
? tabs.findIndex(tab => isSimilarTab(tab, url, isOriginal, thread))
: -1;
if (currentIndex === -1) {
tabs = [{ url, framework, sourceId, isOriginal }, ...tabs];
tabs = [{ url, framework, sourceId, isOriginal, thread }, ...tabs];
} else if (framework) {
tabs[currentIndex].framework = framework;
}
@ -138,7 +151,12 @@ export function getNewSelectedSourceId(
}
const matchingTab = availableTabs.find(tab =>
isSimilarTab(tab, selectedTab.url, isOriginalId(selectedLocation.sourceId))
isSimilarTab(
tab,
selectedTab.url,
isOriginalId(selectedLocation.sourceId),
selectedTab.thread
)
);
if (matchingTab) {
@ -171,7 +189,8 @@ export function getNewSelectedSourceId(
getSources(state),
getUrls(state),
availableTab.url,
availableTab.isOriginal
availableTab.isOriginal,
availableTab.thread
);
if (tabSource) {
@ -217,7 +236,8 @@ function getTabWithOrWithoutUrl(tab, sources, urls) {
sources,
urls,
tab.url,
tab.isOriginal
tab.isOriginal,
tab.thread
);
}

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

@ -16,12 +16,15 @@ import type { Location as BabelLocation } from "@babel/types";
import type { Symbols } from "../reducers/ast";
import type { QuickOpenType } from "../reducers/quick-open";
import type { TabList } from "../reducers/tabs";
import type { SourcesMapByThread } from "../reducers/types";
import type { Source } from "../types";
import type {
SymbolDeclaration,
IdentifierDeclaration
} from "../workers/parser";
import { flatten } from "lodash";
export const MODIFIERS = {
"@": "functions",
"#": "variables",
@ -137,12 +140,10 @@ export function formatShortcutResults(): Array<QuickOpenResult> {
}
export function formatSources(
sources: { [string]: Source },
sources: Source[],
tabs: TabList
): Array<QuickOpenResult> {
const sourceList: Source[] = (Object.values(sources): any);
return sourceList
return sources
.filter(source => !isPretty(source))
.filter(({ relativeUrl }) => !!relativeUrl)
.map(source => formatSourcesForList(source, tabs));

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

@ -32,7 +32,6 @@ export function createTree({ sources, debuggeeUrl, projectRoot }: Params) {
return {
uncollapsedTree,
sourceTree,
parentMap: createParentMap(sourceTree),
focusedItem: null
parentMap: createParentMap(sourceTree)
};
}

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

@ -6,15 +6,11 @@
import { addToTree } from "./addToTree";
import { collapseTree } from "./collapseTree";
import { createParentMap, isSource, partIsFile } from "./utils";
import { createParentMap } from "./utils";
import { difference } from "lodash";
import {
getDomain,
findNodeInContents,
createTreeNodeMatcher
} from "./treeOrder";
import { getDomain } from "./treeOrder";
import type { SourcesMap } from "../../reducers/types";
import type { TreeDirectory, TreeNode } from "./types";
import type { TreeDirectory } from "./types";
function newSourcesSet(newSources, prevSources) {
const newSourceIds = difference(
@ -25,43 +21,13 @@ function newSourcesSet(newSources, prevSources) {
return uniqSources;
}
function findFocusedItemInTree(
newSourceTree: TreeDirectory,
focusedItem: TreeNode,
debuggeeHost: ?string
): ?TreeNode {
const parts = focusedItem.path.split("/").filter(p => p !== "");
let path = "";
return parts.reduce((subTree, part, index) => {
if (subTree === undefined || subTree === null) {
return null;
} else if (isSource(subTree)) {
return subTree;
}
path = path ? `${path}/${part}` : part;
const { index: childIndex } = findNodeInContents(
subTree,
createTreeNodeMatcher(
part,
!partIsFile(index, parts, focusedItem),
debuggeeHost
)
);
return subTree.contents[childIndex];
}, newSourceTree);
}
type Params = {
newSources: SourcesMap,
prevSources: SourcesMap,
uncollapsedTree: TreeDirectory,
sourceTree: TreeDirectory,
debuggeeUrl: string,
projectRoot: string,
focusedItem: ?TreeNode
projectRoot: string
};
export function updateTree({
@ -70,8 +36,7 @@ export function updateTree({
debuggeeUrl,
projectRoot,
uncollapsedTree,
sourceTree,
focusedItem
sourceTree
}: Params) {
const newSet = newSourcesSet(newSources, prevSources);
const debuggeeHost = getDomain(debuggeeUrl);
@ -82,18 +47,9 @@ export function updateTree({
const newSourceTree = collapseTree(uncollapsedTree);
if (focusedItem) {
focusedItem = findFocusedItemInTree(
newSourceTree,
focusedItem,
debuggeeHost
);
}
return {
uncollapsedTree,
sourceTree: newSourceTree,
parentMap: createParentMap(newSourceTree),
focusedItem
parentMap: createParentMap(newSourceTree)
};
}

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

@ -177,7 +177,7 @@
#include "mozilla/Encoding.h"
#include "nsDOMNavigationTiming.h"
#include "nsSMILAnimationController.h"
#include "mozilla/SMILAnimationController.h"
#include "imgIContainer.h"
#include "nsSVGUtils.h"
@ -6129,14 +6129,14 @@ void nsIDocument::EnumerateExternalResources(nsSubDocEnumFunc aCallback,
mExternalResourceMap.EnumerateResources(aCallback, aData);
}
nsSMILAnimationController* nsIDocument::GetAnimationController() {
SMILAnimationController* nsIDocument::GetAnimationController() {
// We create the animation controller lazily because most documents won't want
// one and only SVG documents and the like will call this
if (mAnimationController) return mAnimationController;
// Refuse to create an Animation Controller for data documents.
if (mLoadedAsData || mLoadedAsInteractiveData) return nullptr;
mAnimationController = new nsSMILAnimationController(this);
mAnimationController = new SMILAnimationController(this);
// If there's a presContext then check the animation mode and pause if
// necessary.

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

@ -112,7 +112,6 @@ class nsViewManager;
class nsPresContext;
class nsRange;
class nsSimpleContentList;
class nsSMILAnimationController;
class nsTextNode;
class nsUnblockOnloadEvent;
class nsWindowSizes;
@ -132,6 +131,7 @@ class FullscreenExit;
class FullscreenRequest;
class PendingAnimationTracker;
class ServoStyleSet;
class SMILAnimationController;
template <typename>
class OwningNonNull;
struct URLExtraData;
@ -2408,7 +2408,7 @@ class nsIDocument : public nsINode,
// mAnimationController isn't yet initialized.
//
// If HasAnimationController is true, this is guaranteed to return non-null.
nsSMILAnimationController* GetAnimationController();
mozilla::SMILAnimationController* GetAnimationController();
// Gets the tracker for animations that are waiting to start.
// Returns nullptr if there is no pending animation tracker for this document
@ -3646,7 +3646,7 @@ class nsIDocument : public nsINode,
LinksToUpdateList mLinksToUpdate;
// SMIL Animation Controller, lazily-initialized in GetAnimationController
RefPtr<nsSMILAnimationController> mAnimationController;
RefPtr<mozilla::SMILAnimationController> mAnimationController;
// Table of element properties for this document.
nsPropertyTable mPropertyTable;

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

@ -772,12 +772,12 @@ DOMInterfaces = {
},
'SVGAnimatedLengthList': {
'nativeType': 'mozilla::DOMSVGAnimatedLengthList',
'nativeType': 'mozilla::dom::DOMSVGAnimatedLengthList',
'headerFile': 'DOMSVGAnimatedLengthList.h',
},
'SVGAnimatedNumberList': {
'nativeType': 'mozilla::DOMSVGAnimatedNumberList',
'nativeType': 'mozilla::dom::DOMSVGAnimatedNumberList',
'headerFile': 'DOMSVGAnimatedNumberList.h'
},
@ -824,12 +824,12 @@ DOMInterfaces = {
},
'SVGLength': {
'nativeType': 'mozilla::DOMSVGLength',
'nativeType': 'mozilla::dom::DOMSVGLength',
'headerFile': 'DOMSVGLength.h'
},
'SVGLengthList': {
'nativeType': 'mozilla::DOMSVGLengthList',
'nativeType': 'mozilla::dom::DOMSVGLengthList',
'headerFile': 'DOMSVGLengthList.h'
},
@ -838,12 +838,12 @@ DOMInterfaces = {
},
'SVGNumber': {
'nativeType': 'mozilla::DOMSVGNumber',
'nativeType': 'mozilla::dom::DOMSVGNumber',
'headerFile': 'DOMSVGNumber.h',
},
'SVGNumberList': {
'nativeType': 'mozilla::DOMSVGNumberList',
'nativeType': 'mozilla::dom::DOMSVGNumberList',
'headerFile': 'DOMSVGNumberList.h'
},
@ -985,6 +985,8 @@ DOMInterfaces = {
},
'SVGTransform': {
'nativeType': 'mozilla::dom::DOMSVGTransform',
'headerFile': 'DOMSVGTransform.h',
'binaryNames': {
"matrix": "GetMatrix"
}

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

@ -4,7 +4,7 @@
* 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 "nsSMILAnimationController.h"
#include "mozilla/SMILAnimationController.h"
#include <algorithm>
@ -22,16 +22,17 @@
#include "nsSMILCSSProperty.h"
#include "nsSMILTimedElement.h"
using namespace mozilla;
using namespace mozilla::dom;
namespace mozilla {
//----------------------------------------------------------------------
// nsSMILAnimationController implementation
// SMILAnimationController implementation
//----------------------------------------------------------------------
// ctors, dtors, factory methods
nsSMILAnimationController::nsSMILAnimationController(nsIDocument* aDoc)
SMILAnimationController::SMILAnimationController(nsIDocument* aDoc)
: mAvgTimeBetweenSamples(0),
mResampleNeeded(false),
mDeferredStartSampling(false),
@ -52,7 +53,7 @@ nsSMILAnimationController::nsSMILAnimationController(nsIDocument* aDoc)
Begin();
}
nsSMILAnimationController::~nsSMILAnimationController() {
SMILAnimationController::~SMILAnimationController() {
NS_ASSERTION(mAnimationElementTable.Count() == 0,
"Animation controller shouldn't be tracking any animation"
" elements when it dies");
@ -60,7 +61,7 @@ nsSMILAnimationController::~nsSMILAnimationController() {
"Leaving stale entry in refresh driver's observer list");
}
void nsSMILAnimationController::Disconnect() {
void SMILAnimationController::Disconnect() {
MOZ_ASSERT(mDocument, "disconnecting when we weren't connected...?");
MOZ_ASSERT(mRefCnt.get() == 1,
"Expecting to disconnect when doc is sole remaining owner");
@ -75,7 +76,7 @@ void nsSMILAnimationController::Disconnect() {
//----------------------------------------------------------------------
// nsSMILTimeContainer methods:
void nsSMILAnimationController::Pause(uint32_t aType) {
void SMILAnimationController::Pause(uint32_t aType) {
nsSMILTimeContainer::Pause(aType);
if (mPauseState) {
@ -84,7 +85,7 @@ void nsSMILAnimationController::Pause(uint32_t aType) {
}
}
void nsSMILAnimationController::Resume(uint32_t aType) {
void SMILAnimationController::Resume(uint32_t aType) {
bool wasPaused = (mPauseState != 0);
// Update mCurrentSampleTime so that calls to GetParentTime--used for
// calculating parent offsets--are accurate
@ -98,17 +99,17 @@ void nsSMILAnimationController::Resume(uint32_t aType) {
}
}
nsSMILTime nsSMILAnimationController::GetParentTime() const {
nsSMILTime SMILAnimationController::GetParentTime() const {
return (nsSMILTime)(mCurrentSampleTime - mStartTime).ToMilliseconds();
}
//----------------------------------------------------------------------
// nsARefreshObserver methods:
NS_IMPL_ADDREF(nsSMILAnimationController)
NS_IMPL_RELEASE(nsSMILAnimationController)
NS_IMPL_ADDREF(SMILAnimationController)
NS_IMPL_RELEASE(SMILAnimationController)
// nsRefreshDriver Callback function
void nsSMILAnimationController::WillRefresh(mozilla::TimeStamp aTime) {
void SMILAnimationController::WillRefresh(mozilla::TimeStamp aTime) {
// Although we never expect aTime to go backwards, when we initialise the
// animation controller, if we can't get hold of a refresh driver we
// initialise mCurrentSampleTime to Now(). It may be possible that after
@ -158,7 +159,7 @@ void nsSMILAnimationController::WillRefresh(mozilla::TimeStamp aTime) {
//----------------------------------------------------------------------
// Animation element registration methods:
void nsSMILAnimationController::RegisterAnimationElement(
void SMILAnimationController::RegisterAnimationElement(
SVGAnimationElement* aAnimationElement) {
mAnimationElementTable.PutEntry(aAnimationElement);
if (mDeferredStartSampling) {
@ -174,7 +175,7 @@ void nsSMILAnimationController::RegisterAnimationElement(
}
}
void nsSMILAnimationController::UnregisterAnimationElement(
void SMILAnimationController::UnregisterAnimationElement(
SVGAnimationElement* aAnimationElement) {
mAnimationElementTable.RemoveEntry(aAnimationElement);
}
@ -182,18 +183,18 @@ void nsSMILAnimationController::UnregisterAnimationElement(
//----------------------------------------------------------------------
// Page show/hide
void nsSMILAnimationController::OnPageShow() {
void SMILAnimationController::OnPageShow() {
Resume(nsSMILTimeContainer::PAUSE_PAGEHIDE);
}
void nsSMILAnimationController::OnPageHide() {
void SMILAnimationController::OnPageHide() {
Pause(nsSMILTimeContainer::PAUSE_PAGEHIDE);
}
//----------------------------------------------------------------------
// Cycle-collection support
void nsSMILAnimationController::Traverse(
void SMILAnimationController::Traverse(
nsCycleCollectionTraversalCallback* aCallback) {
// Traverse last compositor table
if (mLastCompositorTable) {
@ -204,19 +205,19 @@ void nsSMILAnimationController::Traverse(
}
}
void nsSMILAnimationController::Unlink() { mLastCompositorTable = nullptr; }
void SMILAnimationController::Unlink() { mLastCompositorTable = nullptr; }
//----------------------------------------------------------------------
// Refresh driver lifecycle related methods
void nsSMILAnimationController::NotifyRefreshDriverCreated(
void SMILAnimationController::NotifyRefreshDriverCreated(
nsRefreshDriver* aRefreshDriver) {
if (!mPauseState) {
MaybeStartSampling(aRefreshDriver);
}
}
void nsSMILAnimationController::NotifyRefreshDriverDestroying(
void SMILAnimationController::NotifyRefreshDriverDestroying(
nsRefreshDriver* aRefreshDriver) {
if (!mPauseState && !mDeferredStartSampling) {
StopSampling(aRefreshDriver);
@ -226,7 +227,7 @@ void nsSMILAnimationController::NotifyRefreshDriverDestroying(
//----------------------------------------------------------------------
// Timer-related implementation helpers
void nsSMILAnimationController::StartSampling(nsRefreshDriver* aRefreshDriver) {
void SMILAnimationController::StartSampling(nsRefreshDriver* aRefreshDriver) {
NS_ASSERTION(mPauseState == 0, "Starting sampling but controller is paused");
NS_ASSERTION(!mDeferredStartSampling,
"Started sampling but the deferred start flag is still set");
@ -243,7 +244,7 @@ void nsSMILAnimationController::StartSampling(nsRefreshDriver* aRefreshDriver) {
}
}
void nsSMILAnimationController::StopSampling(nsRefreshDriver* aRefreshDriver) {
void SMILAnimationController::StopSampling(nsRefreshDriver* aRefreshDriver) {
if (aRefreshDriver && mRegisteredWithRefreshDriver) {
// NOTE: The document might already have been detached from its PresContext
// (and RefreshDriver), which would make GetRefreshDriver() return null.
@ -254,7 +255,7 @@ void nsSMILAnimationController::StopSampling(nsRefreshDriver* aRefreshDriver) {
}
}
void nsSMILAnimationController::MaybeStartSampling(
void SMILAnimationController::MaybeStartSampling(
nsRefreshDriver* aRefreshDriver) {
if (mDeferredStartSampling) {
// We've received earlier 'MaybeStartSampling' calls, and we're
@ -272,11 +273,11 @@ void nsSMILAnimationController::MaybeStartSampling(
//----------------------------------------------------------------------
// Sample-related methods and callbacks
void nsSMILAnimationController::DoSample() {
void SMILAnimationController::DoSample() {
DoSample(true); // Skip unchanged time containers
}
void nsSMILAnimationController::DoSample(bool aSkipUnchangedContainers) {
void SMILAnimationController::DoSample(bool aSkipUnchangedContainers) {
if (!mDocument) {
NS_ERROR("Shouldn't be sampling after document has disconnected");
return;
@ -420,7 +421,7 @@ void nsSMILAnimationController::DoSample(bool aSkipUnchangedContainers) {
NS_ASSERTION(!mResampleNeeded, "Resample dirty flag set during sample!");
}
void nsSMILAnimationController::RewindElements() {
void SMILAnimationController::RewindElements() {
bool rewindNeeded = false;
for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
nsSMILTimeContainer* container = iter.Get()->GetKey();
@ -445,7 +446,7 @@ void nsSMILAnimationController::RewindElements() {
}
}
void nsSMILAnimationController::DoMilestoneSamples() {
void SMILAnimationController::DoMilestoneSamples() {
// We need to sample the timing model but because SMIL operates independently
// of the frame-rate, we can get one sample at t=0s and the next at t=10min.
//
@ -537,7 +538,7 @@ void nsSMILAnimationController::DoMilestoneSamples() {
}
}
/*static*/ void nsSMILAnimationController::SampleTimedElement(
/*static*/ void SMILAnimationController::SampleTimedElement(
SVGAnimationElement* aElement, TimeContainerHashtable* aActiveContainers) {
nsSMILTimeContainer* timeContainer = aElement->GetTimeContainer();
if (!timeContainer) return;
@ -560,7 +561,7 @@ void nsSMILAnimationController::DoMilestoneSamples() {
aElement->TimedElement().SampleAt(containerTime);
}
/*static*/ void nsSMILAnimationController::AddAnimationToCompositorTable(
/*static*/ void SMILAnimationController::AddAnimationToCompositorTable(
SVGAnimationElement* aElement, nsSMILCompositorTable* aCompositorTable,
bool& aStyleFlushNeeded) {
// Add a compositor to the hash table if there's not already one there
@ -608,7 +609,7 @@ static inline bool IsTransformAttribute(int32_t aNamespaceID,
// Helper function that, given a SVGAnimationElement, looks up its target
// element & target attribute and populates a nsSMILTargetIdentifier
// for this target.
/*static*/ bool nsSMILAnimationController::GetTargetIdentifierForAnimation(
/*static*/ bool SMILAnimationController::GetTargetIdentifierForAnimation(
SVGAnimationElement* aAnimElem, nsSMILTargetIdentifier& aResult) {
// Look up target (animated) element
Element* targetElem = aAnimElem->GetTargetElementContent();
@ -640,11 +641,11 @@ static inline bool IsTransformAttribute(int32_t aNamespaceID,
return true;
}
bool nsSMILAnimationController::PreTraverse() {
bool SMILAnimationController::PreTraverse() {
return PreTraverseInSubtree(nullptr);
}
bool nsSMILAnimationController::PreTraverseInSubtree(Element* aRoot) {
bool SMILAnimationController::PreTraverseInSubtree(Element* aRoot) {
MOZ_ASSERT(NS_IsMainThread());
if (!mMightHavePendingStyleUpdates) {
@ -692,7 +693,7 @@ bool nsSMILAnimationController::PreTraverseInSubtree(Element* aRoot) {
//----------------------------------------------------------------------
// Add/remove child time containers
nsresult nsSMILAnimationController::AddChild(nsSMILTimeContainer& aChild) {
nsresult SMILAnimationController::AddChild(nsSMILTimeContainer& aChild) {
TimeContainerPtrKey* key = mChildContainerTable.PutEntry(&aChild);
NS_ENSURE_TRUE(key, NS_ERROR_OUT_OF_MEMORY);
@ -704,7 +705,7 @@ nsresult nsSMILAnimationController::AddChild(nsSMILTimeContainer& aChild) {
return NS_OK;
}
void nsSMILAnimationController::RemoveChild(nsSMILTimeContainer& aChild) {
void SMILAnimationController::RemoveChild(nsSMILTimeContainer& aChild) {
mChildContainerTable.RemoveEntry(&aChild);
if (!mPauseState && mChildContainerTable.Count() == 0) {
@ -713,7 +714,7 @@ void nsSMILAnimationController::RemoveChild(nsSMILTimeContainer& aChild) {
}
// Helper method
nsRefreshDriver* nsSMILAnimationController::GetRefreshDriver() {
nsRefreshDriver* SMILAnimationController::GetRefreshDriver() {
if (!mDocument) {
NS_ERROR("Requesting refresh driver after document has disconnected!");
return nullptr;
@ -723,8 +724,11 @@ nsRefreshDriver* nsSMILAnimationController::GetRefreshDriver() {
return context ? context->RefreshDriver() : nullptr;
}
void nsSMILAnimationController::FlagDocumentNeedsFlush() {
void SMILAnimationController::FlagDocumentNeedsFlush() {
if (nsIPresShell* shell = mDocument->GetShell()) {
shell->SetNeedStyleFlush();
}
}
} // namespace mozilla

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

@ -27,10 +27,9 @@ namespace dom {
class Element;
class SVGAnimationElement;
} // namespace dom
} // namespace mozilla
//----------------------------------------------------------------------
// nsSMILAnimationController
// SMILAnimationController
//
// The animation controller maintains the animation timer and determines the
// sample times and sample rate for all SMIL animations in a document. There is
@ -42,10 +41,10 @@ class SVGAnimationElement;
// a compound document. These time containers can be paused individually or
// here, at the document level.
//
class nsSMILAnimationController final : public nsSMILTimeContainer,
class SMILAnimationController final : public nsSMILTimeContainer,
public nsARefreshObserver {
public:
explicit nsSMILAnimationController(nsIDocument* aDoc);
explicit SMILAnimationController(nsIDocument* aDoc);
// Clears mDocument pointer. (Called by our nsIDocument when it's going away)
void Disconnect();
@ -112,7 +111,7 @@ class nsSMILAnimationController final : public nsSMILTimeContainer,
bool PreTraverseInSubtree(mozilla::dom::Element* aRoot);
protected:
~nsSMILAnimationController();
~SMILAnimationController();
// Typedefs
typedef nsPtrHashKey<nsSMILTimeContainer> TimeContainerPtrKey;
@ -207,4 +206,6 @@ class nsSMILAnimationController final : public nsSMILTimeContainer,
nsAutoPtr<nsSMILCompositorTable> mLastCompositorTable;
};
} // namespace mozilla
#endif // NS_SMILANIMATIONCONTROLLER_H_

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

@ -8,11 +8,11 @@
#define MOZILLA_SMILBOOLTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
namespace mozilla {
class SMILBoolType : public nsISMILType {
class SMILBoolType : public SMILType {
public:
// Singleton for nsSMILValue objects to hold onto.
static SMILBoolType* Singleton() {
@ -21,7 +21,7 @@ class SMILBoolType : public nsISMILType {
}
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
virtual void Init(nsSMILValue& aValue) const override;
virtual void Destroy(nsSMILValue& aValue) const override;

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

@ -9,7 +9,7 @@
#ifndef NS_SMILCSSVALUETYPE_H_
#define NS_SMILCSSVALUETYPE_H_
#include "nsISMILType.h"
#include "SMILType.h"
#include "nsCSSPropertyID.h"
#include "nsStringFwd.h"
#include "mozilla/Attributes.h"
@ -24,7 +24,7 @@ class Element;
/*
* SMILCSSValueType: Represents a SMIL-animated CSS value.
*/
class SMILCSSValueType : public nsISMILType {
class SMILCSSValueType : public SMILType {
public:
typedef mozilla::dom::Element Element;
typedef mozilla::AnimationValue AnimationValue;
@ -33,7 +33,7 @@ class SMILCSSValueType : public nsISMILType {
static SMILCSSValueType sSingleton;
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
void Init(nsSMILValue& aValue) const override;
void Destroy(nsSMILValue&) const override;

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

@ -8,11 +8,11 @@
#define MOZILLA_SMILENUMTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
namespace mozilla {
class SMILEnumType : public nsISMILType {
class SMILEnumType : public SMILType {
public:
// Singleton for nsSMILValue objects to hold onto.
static SMILEnumType* Singleton() {
@ -21,7 +21,7 @@ class SMILEnumType : public nsISMILType {
}
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
virtual void Init(nsSMILValue& aValue) const override;
virtual void Destroy(nsSMILValue& aValue) const override;

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

@ -8,11 +8,11 @@
#define NS_SMILFLOATTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
namespace mozilla {
class SMILFloatType : public nsISMILType {
class SMILFloatType : public SMILType {
public:
// Singleton for nsSMILValue objects to hold onto.
static SMILFloatType* Singleton() {
@ -21,7 +21,7 @@ class SMILFloatType : public nsISMILType {
}
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
virtual void Init(nsSMILValue& aValue) const override;
virtual void Destroy(nsSMILValue& aValue) const override;

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

@ -8,11 +8,11 @@
#define MOZILLA_SMILINTEGERTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
namespace mozilla {
class SMILIntegerType : public nsISMILType {
class SMILIntegerType : public SMILType {
public:
virtual void Init(nsSMILValue& aValue) const override;
virtual void Destroy(nsSMILValue& aValue) const override;

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

@ -8,17 +8,17 @@
#define NS_SMILNULLTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
namespace mozilla {
class SMILNullType : public nsISMILType {
class SMILNullType : public SMILType {
public:
// Singleton for nsSMILValue objects to hold onto.
static SMILNullType* Singleton();
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
virtual void Init(nsSMILValue& aValue) const override {}
virtual void Destroy(nsSMILValue& aValue) const override {}

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

@ -8,11 +8,11 @@
#define MOZILLA_SMILSTRINGTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
namespace mozilla {
class SMILStringType : public nsISMILType {
class SMILStringType : public SMILType {
public:
// Singleton for nsSMILValue objects to hold onto.
static SMILStringType* Singleton() {
@ -21,7 +21,7 @@ class SMILStringType : public nsISMILType {
}
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
virtual void Init(nsSMILValue& aValue) const override;
virtual void Destroy(nsSMILValue& aValue) const override;

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

@ -12,8 +12,10 @@
class nsSMILValue;
namespace mozilla {
//////////////////////////////////////////////////////////////////////////////
// nsISMILType: Interface for defining the basic operations needed for animating
// SMILType: Interface for defining the basic operations needed for animating
// a particular kind of data (e.g. lengths, colors, transformation matrices).
//
// This interface is never used directly but always through an nsSMILValue that
@ -45,11 +47,11 @@ class nsSMILValue;
// +---------------------+---------------+-------------+------------------+
//
class nsISMILType {
class SMILType {
/**
* Only give the nsSMILValue class access to this interface.
*/
friend class nsSMILValue;
friend class ::nsSMILValue;
protected:
/**
@ -84,7 +86,7 @@ class nsISMILType {
const nsSMILValue& aSrc) const = 0;
/**
* Test two nsSMILValue objects (of this nsISMILType) for equality.
* Test two nsSMILValue objects (of this SMILType) for equality.
*
* A return value of true represents a guarantee that aLeft and aRight are
* equal. (That is, they would behave identically if passed to the methods
@ -207,4 +209,6 @@ class nsISMILType {
nsSMILValue& aResult) const = 0;
};
} // namespace mozilla
#endif // NS_ISMILTYPE_H_

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

@ -11,8 +11,6 @@ MOCHITEST_MANIFESTS += ['test/mochitest.ini']
EXPORTS += [
'nsISMILAttr.h',
'nsISMILType.h',
'nsSMILAnimationController.h',
'nsSMILAnimationFunction.h',
'nsSMILCompositorTable.h',
'nsSMILCSSProperty.h',
@ -32,6 +30,11 @@ EXPORTS += [
'nsSMILValue.h',
'SMILCSSValueType.h',
'SMILNullType.h',
'SMILType.h',
]
EXPORTS.mozilla += [
'SMILAnimationController.h',
]
EXPORTS.mozilla.dom += [
@ -39,7 +42,6 @@ EXPORTS.mozilla.dom += [
]
UNIFIED_SOURCES += [
'nsSMILAnimationController.cpp',
'nsSMILAnimationFunction.cpp',
'nsSMILCompositor.cpp',
'nsSMILCSSProperty.cpp',
@ -54,6 +56,7 @@ UNIFIED_SOURCES += [
'nsSMILTimeValue.cpp',
'nsSMILTimeValueSpec.cpp',
'nsSMILValue.cpp',
'SMILAnimationController.cpp',
'SMILBoolType.cpp',
'SMILCSSValueType.cpp',
'SMILEnumType.cpp',

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

@ -113,7 +113,7 @@ class nsSMILCompositor : public PLDHashEntryHdr {
bool mForceCompositing;
// Cached base value, so we can detect & force-recompose when it changes
// from one sample to the next. (nsSMILAnimationController moves this
// from one sample to the next. (SMILAnimationController moves this
// forward from the previous sample's compositor by calling
// StealCachedBaseValue.)
nsSMILValue mCachedBaseValue;

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

@ -13,7 +13,7 @@
// nsSMILCompositorTable : A hashmap of nsSMILCompositors
//
// This is just a forward-declaration because it is included in
// nsSMILAnimationController which is used in nsDocument. We don't want to
// SMILAnimationController which is used in nsDocument. We don't want to
// expose all of nsSMILCompositor or otherwise any changes to it will mean the
// whole world will need to be rebuilt.

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

@ -14,11 +14,11 @@
*
* Tuple of: { Animated Element, Attribute Name }
*
* Used in nsSMILAnimationController as hash key for mapping an animation
* Used in SMILAnimationController as hash key for mapping an animation
* target to the nsSMILCompositor for that target.
*
* NOTE: Need a nsRefPtr for the element & attribute name, because
* nsSMILAnimationController retain its hash table for one sample into the
* SMILAnimationController retain its hash table for one sample into the
* future, and we need to make sure their target isn't deleted in that time.
*/

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

@ -11,7 +11,7 @@
//----------------------------------------------------------------------
// Public methods
nsSMILValue::nsSMILValue(const nsISMILType* aType)
nsSMILValue::nsSMILValue(const SMILType* aType)
: mType(SMILNullType::Singleton()) {
mU.mBool = false;
if (!aType) {
@ -120,8 +120,8 @@ nsresult nsSMILValue::Interpolate(const nsSMILValue& aEndVal,
//----------------------------------------------------------------------
// Helper methods
// Wrappers for nsISMILType::Init & ::Destroy that verify their postconditions
void nsSMILValue::InitAndCheckPostcondition(const nsISMILType* aNewType) {
// Wrappers for SMILType::Init & ::Destroy that verify their postconditions
void nsSMILValue::InitAndCheckPostcondition(const SMILType* aNewType) {
aNewType->Init(*this);
MOZ_ASSERT(mType == aNewType,
"Post-condition of Init failed. nsSMILValue is invalid");
@ -134,7 +134,7 @@ void nsSMILValue::DestroyAndCheckPostcondition() {
"nsSMILValue not null after destroying");
}
void nsSMILValue::DestroyAndReinit(const nsISMILType* aNewType) {
void nsSMILValue::DestroyAndReinit(const SMILType* aNewType) {
DestroyAndCheckPostcondition();
InitAndCheckPostcondition(aNewType);
}

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

@ -7,7 +7,7 @@
#ifndef NS_SMILVALUE_H_
#define NS_SMILVALUE_H_
#include "nsISMILType.h"
#include "SMILType.h"
#include "SMILNullType.h"
/**
@ -22,9 +22,10 @@
class nsSMILValue {
public:
typedef mozilla::SMILNullType SMILNullType;
typedef mozilla::SMILType SMILType;
nsSMILValue() : mU(), mType(SMILNullType::Singleton()) {}
explicit nsSMILValue(const nsISMILType* aType);
explicit nsSMILValue(const SMILType* aType);
nsSMILValue(const nsSMILValue& aVal);
~nsSMILValue() { mType->Destroy(*this); }
@ -36,7 +37,7 @@ class nsSMILValue {
nsSMILValue& operator=(nsSMILValue&& aVal);
// Equality operators. These are allowed to be conservative (return false
// more than you'd expect) - see comment above nsISMILType::IsEqual.
// more than you'd expect) - see comment above SMILType::IsEqual.
bool operator==(const nsSMILValue& aVal) const;
bool operator!=(const nsSMILValue& aVal) const { return !(*this == aVal); }
@ -62,12 +63,12 @@ class nsSMILValue {
float mNumberPair[2];
void* mPtr;
} mU;
const nsISMILType* mType;
const SMILType* mType;
protected:
void InitAndCheckPostcondition(const nsISMILType* aNewType);
void InitAndCheckPostcondition(const SMILType* aNewType);
void DestroyAndCheckPostcondition();
void DestroyAndReinit(const nsISMILType* aNewType);
void DestroyAndReinit(const SMILType* aNewType);
};
#endif // NS_SMILVALUE_H_

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

@ -15,6 +15,7 @@
// See the architecture comment in this file's header.
namespace mozilla {
namespace dom {
static inline nsSVGAttrTearoffTable<SVGAnimatedLengthList,
DOMSVGAnimatedLengthList>&
@ -123,4 +124,5 @@ const SVGAnimatedLengthList& DOMSVGAnimatedLengthList::InternalAList() const {
return *mElement->GetAnimatedLengthList(mAttrEnum);
}
} // namespace dom
} // namespace mozilla

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

@ -16,6 +16,9 @@ namespace mozilla {
class SVGAnimatedLengthList;
class SVGLengthList;
namespace dom {
class DOMSVGLengthList;
/**
@ -195,6 +198,7 @@ class DOMSVGAnimatedLengthList final : public nsWrapperCache {
uint8_t mAxis;
};
} // namespace dom
} // namespace mozilla
#endif // MOZILLA_DOMSVGANIMATEDLENGTHLIST_H__

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

@ -15,6 +15,7 @@
// See the architecture comment in this file's header.
namespace mozilla {
namespace dom {
static inline nsSVGAttrTearoffTable<SVGAnimatedNumberList,
DOMSVGAnimatedNumberList>&
@ -129,4 +130,5 @@ const SVGAnimatedNumberList& DOMSVGAnimatedNumberList::InternalAList() const {
return *mElement->GetAnimatedNumberList(mAttrEnum);
}
} // namespace dom
} // namespace mozilla

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

@ -15,10 +15,13 @@
namespace mozilla {
class DOMSVGNumberList;
class SVGAnimatedNumberList;
class SVGNumberList;
namespace dom {
class DOMSVGNumberList;
/**
* Class DOMSVGAnimatedNumberList
*
@ -124,6 +127,7 @@ class DOMSVGAnimatedNumberList final : public nsISupports,
uint8_t mAttrEnum;
};
} // namespace dom
} // namespace mozilla
#endif // MOZILLA_DOMSVGANIMATEDNUMBERLIST_H__

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

@ -21,7 +21,7 @@
namespace mozilla {
using namespace dom;
namespace dom {
static nsSVGAttrTearoffTable<nsSVGLength2, DOMSVGLength>
sBaseSVGLengthTearOffTable, sAnimSVGLengthTearOffTable;
@ -54,7 +54,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGLength)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGLength)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(mozilla::DOMSVGLength) // pseudo-interface
NS_INTERFACE_MAP_ENTRY(DOMSVGLength) // pseudo-interface
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
@ -462,4 +462,5 @@ bool DOMSVGLength::IndexIsValid() {
}
#endif
} // namespace dom
} // namespace mozilla

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

@ -35,7 +35,6 @@ class ErrorResult;
namespace dom {
class SVGElement;
}
/**
* Class DOMSVGLength
@ -235,6 +234,7 @@ class DOMSVGLength final : public nsISupports, public nsWrapperCache {
NS_DEFINE_STATIC_IID_ACCESSOR(DOMSVGLength, MOZILLA_DOMSVGLENGTH_IID)
} // namespace dom
} // namespace mozilla
#undef MOZ_SVG_LIST_INDEX_BIT_COUNT

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

@ -19,7 +19,7 @@
// local helper functions
namespace {
using mozilla::DOMSVGLength;
using mozilla::dom::DOMSVGLength;
void UpdateListIndicesFromIndex(FallibleTArray<DOMSVGLength*>& aItemsArray,
uint32_t aStartingIndex) {
@ -35,6 +35,7 @@ void UpdateListIndicesFromIndex(FallibleTArray<DOMSVGLength*>& aItemsArray,
} // namespace
namespace mozilla {
namespace dom {
// We could use NS_IMPL_CYCLE_COLLECTION(, except that in Unlink() we need to
// clear our DOMSVGAnimatedLengthList's weak ref to us to be safe. (The other
@ -390,4 +391,5 @@ void DOMSVGLengthList::MaybeRemoveItemFromAnimValListAt(uint32_t aIndex) {
UpdateListIndicesFromIndex(animVal->mItems, aIndex);
}
} // namespace dom
} // namespace mozilla

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

@ -17,11 +17,9 @@
namespace mozilla {
class DOMSVGLength;
namespace dom {
class DOMSVGLength;
class SVGElement;
}
/**
* Class DOMSVGLengthList
@ -161,6 +159,7 @@ class DOMSVGLengthList final : public nsISupports, public nsWrapperCache {
RefPtr<DOMSVGAnimatedLengthList> mAList;
};
} // namespace dom
} // namespace mozilla
#endif // MOZILLA_DOMSVGLENGTHLIST_H__

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

@ -16,6 +16,7 @@
// See the architecture comment in DOMSVGAnimatedNumberList.h.
namespace mozilla {
namespace dom {
// We could use NS_IMPL_CYCLE_COLLECTION(, except that in Unlink() we need to
// clear our list's weak ref to us to be safe. (The other option would be to
@ -167,7 +168,8 @@ bool DOMSVGNumber::IndexIsValid() {
JSObject* DOMSVGNumber::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return dom::SVGNumber_Binding::Wrap(aCx, this, aGivenProto);
return SVGNumber_Binding::Wrap(aCx, this, aGivenProto);
}
} // namespace dom
} // namespace mozilla

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

@ -20,7 +20,6 @@ namespace mozilla {
namespace dom {
class SVGElement;
}
/**
* Class DOMSVGNumber
@ -152,6 +151,7 @@ class DOMSVGNumber final : public nsISupports, public nsWrapperCache {
float mValue;
};
} // namespace dom
} // namespace mozilla
#undef MOZ_SVG_LIST_INDEX_BIT_COUNT

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

@ -19,7 +19,7 @@
// local helper functions
namespace {
using mozilla::DOMSVGNumber;
using mozilla::dom::DOMSVGNumber;
void UpdateListIndicesFromIndex(FallibleTArray<DOMSVGNumber*>& aItemsArray,
uint32_t aStartingIndex) {
@ -35,6 +35,7 @@ void UpdateListIndicesFromIndex(FallibleTArray<DOMSVGNumber*>& aItemsArray,
} // namespace
namespace mozilla {
namespace dom {
// We could use NS_IMPL_CYCLE_COLLECTION(, except that in Unlink() we need to
// clear our DOMSVGAnimatedNumberList's weak ref to us to be safe. (The other
@ -368,4 +369,5 @@ void DOMSVGNumberList::MaybeRemoveItemFromAnimValListAt(uint32_t aIndex) {
UpdateListIndicesFromIndex(animVal->mItems, aIndex);
}
} // namespace dom
} // namespace mozilla

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

@ -17,11 +17,9 @@
namespace mozilla {
class DOMSVGNumber;
namespace dom {
class DOMSVGNumber;
class SVGElement;
}
/**
* Class DOMSVGNumberList
@ -159,6 +157,7 @@ class DOMSVGNumberList final : public nsISupports, public nsWrapperCache {
RefPtr<DOMSVGAnimatedNumberList> mAList;
};
} // namespace dom
} // namespace mozilla
#endif // MOZILLA_DOMSVGNUMBERLIST_H__

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

@ -4,9 +4,8 @@
* 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 "SVGTransform.h"
#include "DOMSVGTransform.h"
#include "mozilla/dom/SVGTransform.h"
#include "mozilla/dom/SVGMatrix.h"
#include "mozilla/dom/SVGTransformBinding.h"
#include "mozilla/DebugOnly.h"
@ -24,8 +23,10 @@ namespace dom {
using namespace SVGTransform_Binding;
static nsSVGAttrTearoffTable<SVGTransform, SVGMatrix>& SVGMatrixTearoffTable() {
static nsSVGAttrTearoffTable<SVGTransform, SVGMatrix> sSVGMatrixTearoffTable;
static nsSVGAttrTearoffTable<DOMSVGTransform, SVGMatrix>&
SVGMatrixTearoffTable() {
static nsSVGAttrTearoffTable<DOMSVGTransform, SVGMatrix>
sSVGMatrixTearoffTable;
return sSVGMatrixTearoffTable;
}
@ -35,9 +36,9 @@ static nsSVGAttrTearoffTable<SVGTransform, SVGMatrix>& SVGMatrixTearoffTable() {
// clear our list's weak ref to us to be safe. (The other option would be to
// not unlink and rely on the breaking of the other edges in the cycle, as
// NS_SVG_VAL_IMPL_CYCLE_COLLECTION does.)
NS_IMPL_CYCLE_COLLECTION_CLASS(SVGTransform)
NS_IMPL_CYCLE_COLLECTION_CLASS(DOMSVGTransform)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(SVGTransform)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMSVGTransform)
// We may not belong to a list, so we must null check tmp->mList.
if (tmp->mList) {
tmp->mList->mItems[tmp->mListIndex] = nullptr;
@ -46,21 +47,21 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(SVGTransform)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(SVGTransform)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMSVGTransform)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mList)
SVGMatrix* matrix = SVGMatrixTearoffTable().GetTearoff(tmp);
CycleCollectionNoteChild(cb, matrix, "matrix");
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(SVGTransform)
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(DOMSVGTransform)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(SVGTransform, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(SVGTransform, Release)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGTransform, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGTransform, Release)
JSObject* SVGTransform::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
JSObject* DOMSVGTransform::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return SVGTransform_Binding::Wrap(aCx, this, aGivenProto);
}
@ -71,7 +72,7 @@ JSObject* SVGTransform::WrapObject(JSContext* aCx,
class MOZ_RAII AutoChangeTransformNotifier {
public:
explicit AutoChangeTransformNotifier(
SVGTransform* aTransform MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
DOMSVGTransform* aTransform MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mTransform(aTransform) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mTransform, "Expecting non-null transform");
@ -92,7 +93,7 @@ class MOZ_RAII AutoChangeTransformNotifier {
}
private:
SVGTransform* const mTransform;
DOMSVGTransform* const mTransform;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
@ -100,8 +101,8 @@ class MOZ_RAII AutoChangeTransformNotifier {
//----------------------------------------------------------------------
// Ctors:
SVGTransform::SVGTransform(DOMSVGTransformList* aList, uint32_t aListIndex,
bool aIsAnimValItem)
DOMSVGTransform::DOMSVGTransform(DOMSVGTransformList* aList,
uint32_t aListIndex, bool aIsAnimValItem)
: mList(aList),
mListIndex(aListIndex),
mIsAnimValItem(aIsAnimValItem),
@ -112,7 +113,7 @@ SVGTransform::SVGTransform(DOMSVGTransformList* aList, uint32_t aListIndex,
MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGNumber!");
}
SVGTransform::SVGTransform()
DOMSVGTransform::DOMSVGTransform()
: mList(nullptr),
mListIndex(0),
mIsAnimValItem(false),
@ -121,19 +122,19 @@ SVGTransform::SVGTransform()
// identity matrix
{}
SVGTransform::SVGTransform(const gfxMatrix& aMatrix)
DOMSVGTransform::DOMSVGTransform(const gfxMatrix& aMatrix)
: mList(nullptr),
mListIndex(0),
mIsAnimValItem(false),
mTransform(new nsSVGTransform(aMatrix)) {}
SVGTransform::SVGTransform(const nsSVGTransform& aTransform)
DOMSVGTransform::DOMSVGTransform(const nsSVGTransform& aTransform)
: mList(nullptr),
mListIndex(0),
mIsAnimValItem(false),
mTransform(new nsSVGTransform(aTransform)) {}
SVGTransform::~SVGTransform() {
DOMSVGTransform::~DOMSVGTransform() {
SVGMatrix* matrix = SVGMatrixTearoffTable().GetTearoff(this);
if (matrix) {
SVGMatrixTearoffTable().RemoveTearoff(this);
@ -147,9 +148,9 @@ SVGTransform::~SVGTransform() {
}
}
uint16_t SVGTransform::Type() const { return Transform().Type(); }
uint16_t DOMSVGTransform::Type() const { return Transform().Type(); }
SVGMatrix* SVGTransform::GetMatrix() {
SVGMatrix* DOMSVGTransform::GetMatrix() {
SVGMatrix* wrapper = SVGMatrixTearoffTable().GetTearoff(this);
if (!wrapper) {
NS_ADDREF(wrapper = new SVGMatrix(*this));
@ -158,9 +159,9 @@ SVGMatrix* SVGTransform::GetMatrix() {
return wrapper;
}
float SVGTransform::Angle() const { return Transform().Angle(); }
float DOMSVGTransform::Angle() const { return Transform().Angle(); }
void SVGTransform::SetMatrix(SVGMatrix& aMatrix, ErrorResult& rv) {
void DOMSVGTransform::SetMatrix(SVGMatrix& aMatrix, ErrorResult& rv) {
if (mIsAnimValItem) {
rv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
@ -168,7 +169,7 @@ void SVGTransform::SetMatrix(SVGMatrix& aMatrix, ErrorResult& rv) {
SetMatrix(aMatrix.GetMatrix());
}
void SVGTransform::SetTranslate(float tx, float ty, ErrorResult& rv) {
void DOMSVGTransform::SetTranslate(float tx, float ty, ErrorResult& rv) {
if (mIsAnimValItem) {
rv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
@ -183,7 +184,7 @@ void SVGTransform::SetTranslate(float tx, float ty, ErrorResult& rv) {
Transform().SetTranslate(tx, ty);
}
void SVGTransform::SetScale(float sx, float sy, ErrorResult& rv) {
void DOMSVGTransform::SetScale(float sx, float sy, ErrorResult& rv) {
if (mIsAnimValItem) {
rv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
@ -197,7 +198,8 @@ void SVGTransform::SetScale(float sx, float sy, ErrorResult& rv) {
Transform().SetScale(sx, sy);
}
void SVGTransform::SetRotate(float angle, float cx, float cy, ErrorResult& rv) {
void DOMSVGTransform::SetRotate(float angle, float cx, float cy,
ErrorResult& rv) {
if (mIsAnimValItem) {
rv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
@ -215,7 +217,7 @@ void SVGTransform::SetRotate(float angle, float cx, float cy, ErrorResult& rv) {
Transform().SetRotate(angle, cx, cy);
}
void SVGTransform::SetSkewX(float angle, ErrorResult& rv) {
void DOMSVGTransform::SetSkewX(float angle, ErrorResult& rv) {
if (mIsAnimValItem) {
rv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
@ -236,7 +238,7 @@ void SVGTransform::SetSkewX(float angle, ErrorResult& rv) {
MOZ_ASSERT(NS_SUCCEEDED(result), "SetSkewX unexpectedly failed");
}
void SVGTransform::SetSkewY(float angle, ErrorResult& rv) {
void DOMSVGTransform::SetSkewY(float angle, ErrorResult& rv) {
if (mIsAnimValItem) {
rv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
@ -260,8 +262,9 @@ void SVGTransform::SetSkewY(float angle, ErrorResult& rv) {
//----------------------------------------------------------------------
// List management methods:
void SVGTransform::InsertingIntoList(DOMSVGTransformList* aList,
uint32_t aListIndex, bool aIsAnimValItem) {
void DOMSVGTransform::InsertingIntoList(DOMSVGTransformList* aList,
uint32_t aListIndex,
bool aIsAnimValItem) {
MOZ_ASSERT(!HasOwner(), "Inserting item that is already in a list");
mList = aList;
@ -272,7 +275,7 @@ void SVGTransform::InsertingIntoList(DOMSVGTransformList* aList,
MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGLength!");
}
void SVGTransform::RemovingFromList() {
void DOMSVGTransform::RemovingFromList() {
MOZ_ASSERT(!mTransform,
"Item in list also has another non-list value associated with it");
@ -281,18 +284,18 @@ void SVGTransform::RemovingFromList() {
mIsAnimValItem = false;
}
nsSVGTransform& SVGTransform::InternalItem() {
nsSVGTransform& DOMSVGTransform::InternalItem() {
SVGAnimatedTransformList* alist = Element()->GetAnimatedTransformList();
return mIsAnimValItem && alist->mAnimVal ? (*alist->mAnimVal)[mListIndex]
: alist->mBaseVal[mListIndex];
}
const nsSVGTransform& SVGTransform::InternalItem() const {
return const_cast<SVGTransform*>(this)->InternalItem();
const nsSVGTransform& DOMSVGTransform::InternalItem() const {
return const_cast<DOMSVGTransform*>(this)->InternalItem();
}
#ifdef DEBUG
bool SVGTransform::IndexIsValid() {
bool DOMSVGTransform::IndexIsValid() {
SVGAnimatedTransformList* alist = Element()->GetAnimatedTransformList();
return (mIsAnimValItem && mListIndex < alist->GetAnimValue().Length()) ||
(!mIsAnimValItem && mListIndex < alist->GetBaseValue().Length());
@ -302,7 +305,7 @@ bool SVGTransform::IndexIsValid() {
//----------------------------------------------------------------------
// Interface for SVGMatrix's use
void SVGTransform::SetMatrix(const gfxMatrix& aMatrix) {
void DOMSVGTransform::SetMatrix(const gfxMatrix& aMatrix) {
MOZ_ASSERT(!mIsAnimValItem, "Attempting to modify read-only transform");
if (Transform().Type() == SVG_TRANSFORM_MATRIX &&

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

@ -28,18 +28,18 @@ class SVGMatrix;
/**
* DOM wrapper for an SVG transform. See DOMSVGLength.h.
*/
class SVGTransform final : public nsWrapperCache {
class DOMSVGTransform final : public nsWrapperCache {
friend class AutoChangeTransformNotifier;
public:
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(SVGTransform)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(SVGTransform)
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGTransform)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGTransform)
/**
* Generic ctor for SVGTransform objects that are created for an attribute.
* Generic ctor for DOMSVGTransform objects that are created for an attribute.
*/
SVGTransform(DOMSVGTransformList* aList, uint32_t aListIndex,
bool aIsAnimValItem);
DOMSVGTransform(DOMSVGTransformList* aList, uint32_t aListIndex,
bool aIsAnimValItem);
/**
* Ctors for creating the objects returned by:
@ -48,21 +48,21 @@ class SVGTransform final : public nsWrapperCache {
* SVGTransformList.createSVGTransformFromMatrix(in SVGMatrix matrix)
* which do not initially belong to an attribute.
*/
explicit SVGTransform();
explicit SVGTransform(const gfxMatrix& aMatrix);
explicit DOMSVGTransform();
explicit DOMSVGTransform(const gfxMatrix& aMatrix);
/**
* Ctor for creating an unowned copy. Used with Clone().
*/
explicit SVGTransform(const nsSVGTransform& aMatrix);
explicit DOMSVGTransform(const nsSVGTransform& aMatrix);
/**
* Create an unowned copy of an owned transform. The caller is responsible for
* the first AddRef().
*/
SVGTransform* Clone() {
DOMSVGTransform* Clone() {
NS_ASSERTION(mList, "unexpected caller");
return new SVGTransform(InternalItem());
return new DOMSVGTransform(InternalItem());
}
bool IsInList() const { return !!mList; }
@ -118,7 +118,7 @@ class SVGTransform final : public nsWrapperCache {
void SetSkewY(float angle, ErrorResult& rv);
protected:
~SVGTransform();
~DOMSVGTransform();
// Interface for SVGMatrix's use
friend class dom::SVGMatrix;

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

@ -6,8 +6,8 @@
#include "DOMSVGTransformList.h"
#include "mozilla/dom/DOMSVGTransform.h"
#include "mozilla/dom/SVGElement.h"
#include "mozilla/dom/SVGTransform.h"
#include "mozilla/dom/SVGMatrix.h"
#include "mozilla/dom/SVGTransformListBinding.h"
#include "SVGAnimatedTransformList.h"
@ -18,7 +18,7 @@
namespace {
void UpdateListIndicesFromIndex(
FallibleTArray<mozilla::dom::SVGTransform*>& aItemsArray,
FallibleTArray<mozilla::dom::DOMSVGTransform*>& aItemsArray,
uint32_t aStartingIndex) {
uint32_t length = aItemsArray.Length();
@ -105,10 +105,10 @@ class MOZ_RAII AutoChangeTransformListNotifier {
void DOMSVGTransformList::InternalListLengthWillChange(uint32_t aNewLength) {
uint32_t oldLength = mItems.Length();
if (aNewLength > SVGTransform::MaxListIndex()) {
if (aNewLength > DOMSVGTransform::MaxListIndex()) {
// It's safe to get out of sync with our internal list as long as we have
// FEWER items than it does.
aNewLength = SVGTransform::MaxListIndex();
aNewLength = DOMSVGTransform::MaxListIndex();
}
RefPtr<DOMSVGTransformList> kungFuDeathGrip;
@ -154,8 +154,8 @@ void DOMSVGTransformList::Clear(ErrorResult& error) {
if (LengthNoFlush() > 0) {
AutoChangeTransformListNotifier notifier(this);
// Notify any existing DOM items of removal *before* truncating the lists
// so that they can find their SVGTransform internal counterparts and copy
// their values. This also notifies the animVal list:
// so that they can find their DOMSVGTransform internal counterparts and
// copy their values. This also notifies the animVal list:
mAList->InternalBaseValListWillChangeLengthTo(0);
mItems.Clear();
@ -163,8 +163,8 @@ void DOMSVGTransformList::Clear(ErrorResult& error) {
}
}
already_AddRefed<SVGTransform> DOMSVGTransformList::Initialize(
SVGTransform& newItem, ErrorResult& error) {
already_AddRefed<DOMSVGTransform> DOMSVGTransformList::Initialize(
DOMSVGTransform& newItem, ErrorResult& error) {
if (IsAnimValList()) {
error.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return nullptr;
@ -178,7 +178,7 @@ already_AddRefed<SVGTransform> DOMSVGTransformList::Initialize(
// clone of newItem, it would actually insert newItem. To prevent that from
// happening we have to do the clone here, if necessary.
RefPtr<SVGTransform> domItem = &newItem;
RefPtr<DOMSVGTransform> domItem = &newItem;
if (domItem->HasOwner()) {
domItem = newItem.Clone();
}
@ -188,17 +188,17 @@ already_AddRefed<SVGTransform> DOMSVGTransformList::Initialize(
return InsertItemBefore(*domItem, 0, error);
}
already_AddRefed<SVGTransform> DOMSVGTransformList::GetItem(
already_AddRefed<DOMSVGTransform> DOMSVGTransformList::GetItem(
uint32_t index, ErrorResult& error) {
bool found;
RefPtr<SVGTransform> item = IndexedGetter(index, found, error);
RefPtr<DOMSVGTransform> item = IndexedGetter(index, found, error);
if (!found) {
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
}
return item.forget();
}
already_AddRefed<SVGTransform> DOMSVGTransformList::IndexedGetter(
already_AddRefed<DOMSVGTransform> DOMSVGTransformList::IndexedGetter(
uint32_t index, bool& found, ErrorResult& error) {
if (IsAnimValList()) {
Element()->FlushAnimations();
@ -210,20 +210,20 @@ already_AddRefed<SVGTransform> DOMSVGTransformList::IndexedGetter(
return nullptr;
}
already_AddRefed<SVGTransform> DOMSVGTransformList::InsertItemBefore(
SVGTransform& newItem, uint32_t index, ErrorResult& error) {
already_AddRefed<DOMSVGTransform> DOMSVGTransformList::InsertItemBefore(
DOMSVGTransform& newItem, uint32_t index, ErrorResult& error) {
if (IsAnimValList()) {
error.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return nullptr;
}
index = std::min(index, LengthNoFlush());
if (index >= SVGTransform::MaxListIndex()) {
if (index >= DOMSVGTransform::MaxListIndex()) {
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;
}
RefPtr<SVGTransform> domItem = &newItem;
RefPtr<DOMSVGTransform> domItem = &newItem;
if (newItem.HasOwner()) {
domItem = newItem.Clone(); // must do this before changing anything!
}
@ -259,8 +259,8 @@ already_AddRefed<SVGTransform> DOMSVGTransformList::InsertItemBefore(
return domItem.forget();
}
already_AddRefed<SVGTransform> DOMSVGTransformList::ReplaceItem(
SVGTransform& newItem, uint32_t index, ErrorResult& error) {
already_AddRefed<DOMSVGTransform> DOMSVGTransformList::ReplaceItem(
DOMSVGTransform& newItem, uint32_t index, ErrorResult& error) {
if (IsAnimValList()) {
error.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return nullptr;
@ -271,7 +271,7 @@ already_AddRefed<SVGTransform> DOMSVGTransformList::ReplaceItem(
return nullptr;
}
RefPtr<SVGTransform> domItem = &newItem;
RefPtr<DOMSVGTransform> domItem = &newItem;
if (newItem.HasOwner()) {
domItem = newItem.Clone(); // must do this before changing anything!
}
@ -293,7 +293,7 @@ already_AddRefed<SVGTransform> DOMSVGTransformList::ReplaceItem(
return domItem.forget();
}
already_AddRefed<SVGTransform> DOMSVGTransformList::RemoveItem(
already_AddRefed<DOMSVGTransform> DOMSVGTransformList::RemoveItem(
uint32_t index, ErrorResult& error) {
if (IsAnimValList()) {
error.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
@ -312,7 +312,7 @@ already_AddRefed<SVGTransform> DOMSVGTransformList::RemoveItem(
MaybeRemoveItemFromAnimValListAt(index);
// We have to return the removed item, so get it, creating it if necessary:
RefPtr<SVGTransform> result = GetItemAt(index);
RefPtr<DOMSVGTransform> result = GetItemAt(index);
// Notify the DOM item of removal *before* modifying the lists so that the
// DOM item can copy its *old* value:
@ -326,13 +326,13 @@ already_AddRefed<SVGTransform> DOMSVGTransformList::RemoveItem(
return result.forget();
}
already_AddRefed<SVGTransform>
already_AddRefed<DOMSVGTransform>
DOMSVGTransformList::CreateSVGTransformFromMatrix(dom::SVGMatrix& matrix) {
RefPtr<SVGTransform> result = new SVGTransform(matrix.GetMatrix());
RefPtr<DOMSVGTransform> result = new DOMSVGTransform(matrix.GetMatrix());
return result.forget();
}
already_AddRefed<SVGTransform> DOMSVGTransformList::Consolidate(
already_AddRefed<DOMSVGTransform> DOMSVGTransformList::Consolidate(
ErrorResult& error) {
if (IsAnimValList()) {
error.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
@ -356,20 +356,21 @@ already_AddRefed<SVGTransform> DOMSVGTransformList::Consolidate(
MOZ_ASSERT(!error.Failed(), "How could this fail?");
// And append the new transform
RefPtr<SVGTransform> transform = new SVGTransform(mx);
RefPtr<DOMSVGTransform> transform = new DOMSVGTransform(mx);
return InsertItemBefore(*transform, LengthNoFlush(), error);
}
//----------------------------------------------------------------------
// Implementation helpers:
already_AddRefed<SVGTransform> DOMSVGTransformList::GetItemAt(uint32_t aIndex) {
already_AddRefed<DOMSVGTransform> DOMSVGTransformList::GetItemAt(
uint32_t aIndex) {
MOZ_ASSERT(aIndex < mItems.Length());
if (!mItems[aIndex]) {
mItems[aIndex] = new SVGTransform(this, aIndex, IsAnimValList());
mItems[aIndex] = new DOMSVGTransform(this, aIndex, IsAnimValList());
}
RefPtr<SVGTransform> result = mItems[aIndex];
RefPtr<DOMSVGTransform> result = mItems[aIndex];
return result.forget();
}

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

@ -20,7 +20,7 @@ namespace mozilla {
namespace dom {
class SVGElement;
class SVGMatrix;
class SVGTransform;
class DOMSVGTransform;
} // namespace dom
/**
@ -33,7 +33,7 @@ class SVGTransform;
*/
class DOMSVGTransformList final : public nsISupports, public nsWrapperCache {
friend class AutoChangeTransformListNotifier;
friend class dom::SVGTransform;
friend class dom::DOMSVGTransform;
~DOMSVGTransformList() {
// Our mAList's weak ref to us must be nulled out when we die. If GC has
@ -96,26 +96,26 @@ class DOMSVGTransformList final : public nsISupports, public nsWrapperCache {
return LengthNoFlush();
}
void Clear(ErrorResult& error);
already_AddRefed<dom::SVGTransform> Initialize(dom::SVGTransform& newItem,
already_AddRefed<dom::DOMSVGTransform> Initialize(
dom::DOMSVGTransform& newItem, ErrorResult& error);
already_AddRefed<dom::DOMSVGTransform> GetItem(uint32_t index,
ErrorResult& error);
already_AddRefed<dom::SVGTransform> GetItem(uint32_t index,
ErrorResult& error);
already_AddRefed<dom::SVGTransform> IndexedGetter(uint32_t index, bool& found,
already_AddRefed<dom::DOMSVGTransform> IndexedGetter(uint32_t index,
bool& found,
ErrorResult& error);
already_AddRefed<dom::DOMSVGTransform> InsertItemBefore(
dom::DOMSVGTransform& newItem, uint32_t index, ErrorResult& error);
already_AddRefed<dom::DOMSVGTransform> ReplaceItem(
dom::DOMSVGTransform& newItem, uint32_t index, ErrorResult& error);
already_AddRefed<dom::DOMSVGTransform> RemoveItem(uint32_t index,
ErrorResult& error);
already_AddRefed<dom::SVGTransform> InsertItemBefore(
dom::SVGTransform& newItem, uint32_t index, ErrorResult& error);
already_AddRefed<dom::SVGTransform> ReplaceItem(dom::SVGTransform& newItem,
uint32_t index,
ErrorResult& error);
already_AddRefed<dom::SVGTransform> RemoveItem(uint32_t index,
ErrorResult& error);
already_AddRefed<dom::SVGTransform> AppendItem(dom::SVGTransform& newItem,
ErrorResult& error) {
already_AddRefed<dom::DOMSVGTransform> AppendItem(
dom::DOMSVGTransform& newItem, ErrorResult& error) {
return InsertItemBefore(newItem, LengthNoFlush(), error);
}
already_AddRefed<dom::SVGTransform> CreateSVGTransformFromMatrix(
already_AddRefed<dom::DOMSVGTransform> CreateSVGTransformFromMatrix(
dom::SVGMatrix& matrix);
already_AddRefed<dom::SVGTransform> Consolidate(ErrorResult& error);
already_AddRefed<dom::DOMSVGTransform> Consolidate(ErrorResult& error);
uint32_t Length() const { return NumberOfItems(); }
private:
@ -138,15 +138,15 @@ class DOMSVGTransformList final : public nsISupports, public nsWrapperCache {
*/
SVGTransformList& InternalList() const;
/// Returns the SVGTransform at aIndex, creating it if necessary.
already_AddRefed<dom::SVGTransform> GetItemAt(uint32_t aIndex);
/// Returns the DOMSVGTransform at aIndex, creating it if necessary.
already_AddRefed<dom::DOMSVGTransform> GetItemAt(uint32_t aIndex);
void MaybeInsertNullInAnimValListAt(uint32_t aIndex);
void MaybeRemoveItemFromAnimValListAt(uint32_t aIndex);
// Weak refs to our SVGTransform items. The items are friends and take care
// Weak refs to our DOMSVGTransform items. The items are friends and take care
// of clearing our pointer to them when they die.
FallibleTArray<dom::SVGTransform*> mItems;
FallibleTArray<dom::DOMSVGTransform*> mItems;
RefPtr<dom::DOMSVGAnimatedTransformList> mAList;
};

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

@ -14,10 +14,10 @@ class nsSVGLength2;
namespace mozilla {
class DOMSVGLength;
namespace dom {
class DOMSVGLength;
class SVGAnimatedLength final : public nsWrapperCache {
public:
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(SVGAnimatedLength)

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

@ -38,8 +38,8 @@ class SVGElement;
*/
class SVGAnimatedLengthList {
// friends so that they can get write access to mBaseVal
friend class DOMSVGLength;
friend class DOMSVGLengthList;
friend class dom::DOMSVGLength;
friend class dom::DOMSVGLengthList;
public:
SVGAnimatedLengthList() {}

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

@ -38,8 +38,8 @@ class SVGElement;
*/
class SVGAnimatedNumberList {
// friends so that they can get write access to mBaseVal
friend class DOMSVGNumber;
friend class DOMSVGNumberList;
friend class dom::DOMSVGNumber;
friend class dom::DOMSVGNumberList;
public:
SVGAnimatedNumberList() : mIsBaseSet(false) {}

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

@ -21,7 +21,7 @@ namespace mozilla {
namespace dom {
class SVGAnimationElement;
class SVGElement;
class SVGTransform;
class DOMSVGTransform;
} // namespace dom
/**
@ -40,7 +40,7 @@ class SVGTransform;
*/
class SVGAnimatedTransformList {
// friends so that they can get write access to mBaseVal
friend class dom::SVGTransform;
friend class dom::DOMSVGTransform;
friend class DOMSVGTransformList;
public:

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

@ -8,7 +8,7 @@
#include "mozilla/dom/SVGSVGElement.h"
#include "mozilla/dom/ElementInlines.h"
#include "nsSMILTimeContainer.h"
#include "nsSMILAnimationController.h"
#include "SMILAnimationController.h"
#include "nsSMILAnimationFunction.h"
#include "nsContentUtils.h"
#include "nsIContentInlines.h"
@ -146,7 +146,7 @@ nsresult SVGAnimationElement::BindToTree(nsIDocument* aDocument,
// Add myself to the animation controller's master set of animation elements.
if (nsIDocument* doc = GetComposedDoc()) {
nsSMILAnimationController* controller = doc->GetAnimationController();
SMILAnimationController* controller = doc->GetAnimationController();
if (controller) {
controller->RegisterAnimationElement(this);
}
@ -170,7 +170,7 @@ nsresult SVGAnimationElement::BindToTree(nsIDocument* aDocument,
}
void SVGAnimationElement::UnbindFromTree(bool aDeep, bool aNullParent) {
nsSMILAnimationController* controller = OwnerDoc()->GetAnimationController();
SMILAnimationController* controller = OwnerDoc()->GetAnimationController();
if (controller) {
controller->UnregisterAnimationElement(this);
}

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

@ -21,6 +21,7 @@
#include "mozilla/EventListenerManager.h"
#include "mozilla/InternalMutationEvent.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/SMILAnimationController.h"
#include "mozilla/Unused.h"
#include "mozAutoDocUpdate.h"
#include "nsAttrValueOrString.h"
@ -34,7 +35,6 @@
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsLayoutUtils.h"
#include "nsSMILAnimationController.h"
#include "nsSVGAngle.h"
#include "nsSVGBoolean.h"
#include "nsSVGEnum.h"

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

@ -15,10 +15,10 @@ nsresult NS_NewSVGFEColorMatrixElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
namespace mozilla {
class DOMSVGAnimatedNumberList;
namespace dom {
class DOMSVGAnimatedNumberList;
typedef SVGFE SVGFEColorMatrixElementBase;
class SVGFEColorMatrixElement : public SVGFEColorMatrixElementBase {

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

@ -20,9 +20,9 @@ nsresult NS_NewSVGFEConvolveMatrixElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
namespace mozilla {
class DOMSVGAnimatedNumberList;
namespace dom {
class DOMSVGAnimatedNumberList;
class SVGAnimatedBoolean;
typedef SVGFE SVGFEConvolveMatrixElementBase;

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

@ -8,13 +8,13 @@
#define MOZILLA_SVGINTEGERPAIRSMILTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
class nsSMILValue;
namespace mozilla {
class SVGIntegerPairSMILType : public nsISMILType {
class SVGIntegerPairSMILType : public SMILType {
public:
// Singleton for nsSMILValue objects to hold onto.
static SVGIntegerPairSMILType* Singleton() {
@ -23,7 +23,7 @@ class SVGIntegerPairSMILType : public nsISMILType {
}
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
virtual void Init(nsSMILValue& aValue) const override;
virtual void Destroy(nsSMILValue&) const override;

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

@ -19,6 +19,11 @@
namespace mozilla {
namespace dom {
class DOMSVGLength;
class DOMSVGLengthList;
} // namespace dom
/**
* ATTENTION! WARNING! WATCH OUT!!
*
@ -29,9 +34,9 @@ namespace mozilla {
* The DOM wrapper class for this class is DOMSVGLengthList.
*/
class SVGLengthList {
friend class dom::DOMSVGLength;
friend class dom::DOMSVGLengthList;
friend class SVGAnimatedLengthList;
friend class DOMSVGLengthList;
friend class DOMSVGLength;
public:
SVGLengthList() {}

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

@ -8,7 +8,7 @@
#define MOZILLA_SVGLENGTHLISTSMILTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
class nsSMILValue;
@ -19,13 +19,13 @@ namespace mozilla {
//
// Operations for animating an SVGLengthList.
//
class SVGLengthListSMILType : public nsISMILType {
class SVGLengthListSMILType : public SMILType {
public:
// Singleton for nsSMILValue objects to hold onto.
static SVGLengthListSMILType sSingleton;
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
/**

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

@ -20,7 +20,7 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(SVGMatrix, mTransform)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(SVGMatrix, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(SVGMatrix, Release)
SVGTransform* SVGMatrix::GetParentObject() const { return mTransform; }
DOMSVGTransform* SVGMatrix::GetParentObject() const { return mTransform; }
JSObject* SVGMatrix::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {

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

@ -37,7 +37,7 @@
#ifndef mozilla_dom_SVGMatrix_h
#define mozilla_dom_SVGMatrix_h
#include "mozilla/dom/SVGTransform.h"
#include "mozilla/dom/DOMSVGTransform.h"
#include "gfxMatrix.h"
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
@ -55,12 +55,12 @@ class SVGMatrix final : public nsWrapperCache {
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(SVGMatrix)
/**
* Ctor for SVGMatrix objects that belong to a SVGTransform.
* Ctor for SVGMatrix objects that belong to a DOMSVGTransform.
*/
explicit SVGMatrix(SVGTransform& aTransform) : mTransform(&aTransform) {}
explicit SVGMatrix(DOMSVGTransform& aTransform) : mTransform(&aTransform) {}
/**
* Ctors for SVGMatrix objects created independently of a SVGTransform.
* Ctors for SVGMatrix objects created independently of a DOMSVGTransform.
*/
// Default ctor for gfxMatrix will produce identity mx
SVGMatrix() {}
@ -72,7 +72,7 @@ class SVGMatrix final : public nsWrapperCache {
}
// WebIDL
SVGTransform* GetParentObject() const;
DOMSVGTransform* GetParentObject() const;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
@ -117,10 +117,11 @@ class SVGMatrix final : public nsWrapperCache {
return mTransform ? mTransform->IsAnimVal() : false;
}
RefPtr<SVGTransform> mTransform;
RefPtr<DOMSVGTransform> mTransform;
// Typically we operate on the matrix data accessed via mTransform but for
// matrices that exist independently of an SVGTransform we use mMatrix below.
// matrices that exist independently of an DOMSVGTransform we use mMatrix
// below.
gfxMatrix mMatrix;
};

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

@ -4,14 +4,14 @@
* 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/. */
/* implementation of nsISMILType for use by <animateMotion> element */
/* implementation of SMILType for use by <animateMotion> element */
#ifndef MOZILLA_SVGMOTIONSMILTYPE_H_
#define MOZILLA_SVGMOTIONSMILTYPE_H_
#include "mozilla/gfx/2D.h"
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
class nsSMILValue;
@ -27,13 +27,13 @@ enum RotateType {
};
/**
* SVGMotionSMILType: Implements the nsISMILType interface for SMIL animations
* SVGMotionSMILType: Implements the SMILType interface for SMIL animations
* from <animateMotion>.
*
* NOTE: Even though there's technically no "motion" attribute, we behave in
* many ways as if there were, for simplicity.
*/
class SVGMotionSMILType : public nsISMILType {
class SVGMotionSMILType : public SMILType {
typedef mozilla::gfx::Path Path;
public:
@ -41,7 +41,7 @@ class SVGMotionSMILType : public nsISMILType {
static SVGMotionSMILType sSingleton;
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
virtual void Init(nsSMILValue& aValue) const override;
virtual void Destroy(nsSMILValue& aValue) const override;

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

@ -17,6 +17,11 @@
namespace mozilla {
namespace dom {
class DOMSVGNumber;
class DOMSVGNumberList;
} // namespace dom
/**
* ATTENTION! WARNING! WATCH OUT!!
*
@ -27,9 +32,9 @@ namespace mozilla {
* The DOM wrapper class for this class is DOMSVGNumberList.
*/
class SVGNumberList {
friend class dom::DOMSVGNumber;
friend class dom::DOMSVGNumberList;
friend class SVGAnimatedNumberList;
friend class DOMSVGNumberList;
friend class DOMSVGNumber;
public:
SVGNumberList() {}

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

@ -8,7 +8,7 @@
#define MOZILLA_SVGNUMBERLISTSMILTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
class nsSMILValue;
@ -19,13 +19,13 @@ namespace mozilla {
//
// Operations for animating an SVGNumberList.
//
class SVGNumberListSMILType : public nsISMILType {
class SVGNumberListSMILType : public SMILType {
public:
// Singleton for nsSMILValue objects to hold onto.
static SVGNumberListSMILType sSingleton;
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
virtual void Init(nsSMILValue& aValue) const override;

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

@ -8,19 +8,19 @@
#define MOZILLA_SVGNUMBERPAIRSMILTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
class nsSMILValue;
namespace mozilla {
class SVGNumberPairSMILType : public nsISMILType {
class SVGNumberPairSMILType : public SMILType {
public:
// Singleton for nsSMILValue objects to hold onto.
static SVGNumberPairSMILType sSingleton;
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
virtual void Init(nsSMILValue& aValue) const override;
virtual void Destroy(nsSMILValue&) const override;

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

@ -8,12 +8,12 @@
#define MOZILLA_SVGORIENTSMILTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
class nsSMILValue;
/**
* This nsISMILType class is a special case for the 'orient' attribute on SVG's
* This SMILType class is a special case for the 'orient' attribute on SVG's
* 'marker' element.
*
* orient = "auto | auto-start-reverse | <angle>"
@ -34,13 +34,13 @@ class nsSMILValue;
namespace mozilla {
class SVGOrientSMILType : public nsISMILType {
class SVGOrientSMILType : public SMILType {
public:
// Singleton for nsSMILValue objects to hold onto.
static SVGOrientSMILType sSingleton;
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
virtual void Init(nsSMILValue& aValue) const override;
virtual void Destroy(nsSMILValue&) const override;

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

@ -8,7 +8,7 @@
#define MOZILLA_SVGPATHSEGLISTSMILTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
class nsSMILValue;
@ -19,7 +19,7 @@ namespace mozilla {
//
// Operations for animating an SVGPathData.
//
class SVGPathSegListSMILType : public nsISMILType {
class SVGPathSegListSMILType : public SMILType {
public:
// Singleton for nsSMILValue objects to hold onto.
static SVGPathSegListSMILType* Singleton() {
@ -28,7 +28,7 @@ class SVGPathSegListSMILType : public nsISMILType {
}
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
virtual void Init(nsSMILValue& aValue) const override;

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

@ -8,7 +8,7 @@
#define MOZILLA_SVGPOINTLISTSMILTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
class nsSMILValue;
@ -19,13 +19,13 @@ namespace mozilla {
//
// Operations for animating an SVGPointList.
//
class SVGPointListSMILType : public nsISMILType {
class SVGPointListSMILType : public SMILType {
public:
// Singleton for nsSMILValue objects to hold onto.
static SVGPointListSMILType sSingleton;
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
virtual void Init(nsSMILValue& aValue) const override;

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

@ -12,6 +12,7 @@
#include "mozilla/dom/SVGRect.h"
#include "mozilla/dom/SVGViewElement.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/SMILAnimationController.h"
#include "DOMSVGLength.h"
#include "DOMSVGNumber.h"
@ -20,7 +21,6 @@
#include "nsLayoutStylesheetCache.h"
#include "nsIFrame.h"
#include "nsISVGSVGFrame.h"
#include "nsSMILAnimationController.h"
#include "nsSMILTimeContainer.h"
#include "nsSVGAngle.h"
#include "SVGAngle.h"
@ -283,14 +283,14 @@ already_AddRefed<SVGIRect> SVGSVGElement::CreateSVGRect() {
return NS_NewSVGRect(this);
}
already_AddRefed<SVGTransform> SVGSVGElement::CreateSVGTransform() {
RefPtr<SVGTransform> transform = new SVGTransform();
already_AddRefed<DOMSVGTransform> SVGSVGElement::CreateSVGTransform() {
RefPtr<DOMSVGTransform> transform = new DOMSVGTransform();
return transform.forget();
}
already_AddRefed<SVGTransform> SVGSVGElement::CreateSVGTransformFromMatrix(
already_AddRefed<DOMSVGTransform> SVGSVGElement::CreateSVGTransformFromMatrix(
SVGMatrix& matrix) {
RefPtr<SVGTransform> transform = new SVGTransform(matrix.GetMatrix());
RefPtr<DOMSVGTransform> transform = new DOMSVGTransform(matrix.GetMatrix());
return transform.forget();
}
@ -380,7 +380,7 @@ nsSMILTimeContainer* SVGSVGElement::GetTimedDocumentRoot() {
// SVGElement
nsresult SVGSVGElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent) {
nsSMILAnimationController* smilController = nullptr;
SMILAnimationController* smilController = nullptr;
if (aDocument) {
smilController = aDocument->GetAnimationController();

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

@ -19,10 +19,10 @@ namespace mozilla {
class AutoSVGViewHandler;
class SVGFragmentIdentifier;
class EventChainPreVisitor;
class DOMSVGLength;
class DOMSVGNumber;
namespace dom {
class DOMSVGLength;
class DOMSVGNumber;
class SVGAngle;
class SVGMatrix;
class SVGIRect;
@ -137,8 +137,8 @@ class SVGSVGElement final : public SVGSVGElementBase {
already_AddRefed<nsISVGPoint> CreateSVGPoint();
already_AddRefed<SVGMatrix> CreateSVGMatrix();
already_AddRefed<SVGIRect> CreateSVGRect();
already_AddRefed<SVGTransform> CreateSVGTransform();
already_AddRefed<SVGTransform> CreateSVGTransformFromMatrix(
already_AddRefed<DOMSVGTransform> CreateSVGTransform();
already_AddRefed<DOMSVGTransform> CreateSVGTransformFromMatrix(
SVGMatrix& matrix);
using nsINode::GetElementById; // This does what we want
uint16_t ZoomAndPan();

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

@ -13,10 +13,10 @@
namespace mozilla {
class SVGAnimatedLengthList;
class DOMSVGAnimatedLengthList;
class DOMSVGAnimatedNumberList;
namespace dom {
class DOMSVGAnimatedLengthList;
class DOMSVGAnimatedNumberList;
typedef SVGTextContentElement SVGTextPositioningElementBase;
class SVGTextPositioningElement : public SVGTextPositioningElementBase {

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

@ -14,7 +14,7 @@
namespace mozilla {
namespace dom {
class SVGTransform;
class DOMSVGTransform;
} // namespace dom
/**
@ -29,7 +29,7 @@ class SVGTransform;
class SVGTransformList {
friend class SVGAnimatedTransformList;
friend class DOMSVGTransformList;
friend class dom::SVGTransform;
friend class dom::DOMSVGTransform;
public:
SVGTransformList() {}

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

@ -8,7 +8,7 @@
#define SVGTRANSFORMLISTSMILTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
#include "nsTArray.h"
class nsSMILValue;
@ -78,7 +78,7 @@ class SVGTransformSMILData;
// we have seen above can contain 0..n elements) whilst the end-value comes from
// the <animateTransform> and so can only hold 1 transform.
//
class SVGTransformListSMILType : public nsISMILType {
class SVGTransformListSMILType : public SMILType {
public:
// Singleton for nsSMILValue objects to hold onto.
static SVGTransformListSMILType* Singleton() {
@ -87,7 +87,7 @@ class SVGTransformListSMILType : public nsISMILType {
}
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
virtual void Init(nsSMILValue& aValue) const override;
virtual void Destroy(nsSMILValue& aValue) const override;

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

@ -8,19 +8,19 @@
#define MOZILLA_SVGVIEWBOXSMILTYPE_H_
#include "mozilla/Attributes.h"
#include "nsISMILType.h"
#include "SMILType.h"
class nsSMILValue;
namespace mozilla {
class SVGViewBoxSMILType : public nsISMILType {
class SVGViewBoxSMILType : public SMILType {
public:
// Singleton for nsSMILValue objects to hold onto.
static SVGViewBoxSMILType sSingleton;
protected:
// nsISMILType Methods
// SMILType Methods
// -------------------
virtual void Init(nsSMILValue& aValue) const override;
virtual void Destroy(nsSMILValue&) const override;

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