зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1448362 - Remove some unused code from Places. r=standard8
MozReview-Commit-ID: DQCoYyZIvGD --HG-- extra : rebase_source : 4e54453619111fcae1d57627049b0bf73ab01c23
This commit is contained in:
Родитель
bad447111c
Коммит
59e8fa7fa3
|
@ -339,14 +339,6 @@ var StarUI = {
|
|||
}
|
||||
};
|
||||
|
||||
// Checks if an element is visible without flushing layout changes.
|
||||
function isVisible(element) {
|
||||
let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let bounds = windowUtils.getBoundsWithoutFlushing(element);
|
||||
return bounds.height > 0 && bounds.width > 0;
|
||||
}
|
||||
|
||||
var PlacesCommandHook = {
|
||||
/**
|
||||
* Adds a bookmark to the page loaded in the given browser.
|
||||
|
@ -1572,69 +1564,6 @@ var BookmarkingUI = {
|
|||
this._initMobileBookmarks(document.getElementById("menu_mobileBookmarks"));
|
||||
},
|
||||
|
||||
_showBookmarkedNotification: function BUI_showBookmarkedNotification() {
|
||||
function getCenteringTransformForRects(rectToPosition, referenceRect) {
|
||||
let topDiff = referenceRect.top - rectToPosition.top;
|
||||
let leftDiff = referenceRect.left - rectToPosition.left;
|
||||
let heightDiff = referenceRect.height - rectToPosition.height;
|
||||
let widthDiff = referenceRect.width - rectToPosition.width;
|
||||
return [(leftDiff + .5 * widthDiff) + "px", (topDiff + .5 * heightDiff) + "px"];
|
||||
}
|
||||
|
||||
if (this._notificationTimeout) {
|
||||
clearTimeout(this._notificationTimeout);
|
||||
}
|
||||
|
||||
if (this.notifier.style.transform == "") {
|
||||
// Get all the relevant nodes and computed style objects
|
||||
let dropmarker = document.getAnonymousElementByAttribute(this.button, "anonid", "dropmarker");
|
||||
let dropmarkerIcon = document.getAnonymousElementByAttribute(dropmarker, "class", "dropmarker-icon");
|
||||
let dropmarkerStyle = getComputedStyle(dropmarkerIcon);
|
||||
|
||||
// Check for RTL and get bounds
|
||||
let isRTL = getComputedStyle(this.button).direction == "rtl";
|
||||
let buttonRect = this.button.getBoundingClientRect();
|
||||
let notifierRect = this.notifier.getBoundingClientRect();
|
||||
let dropmarkerRect = dropmarkerIcon.getBoundingClientRect();
|
||||
let dropmarkerNotifierRect = this.dropmarkerNotifier.getBoundingClientRect();
|
||||
|
||||
// Compute, but do not set, transform for star icon
|
||||
let [translateX, translateY] = getCenteringTransformForRects(notifierRect, buttonRect);
|
||||
let starIconTransform = "translate(" + translateX + ", " + translateY + ")";
|
||||
if (isRTL) {
|
||||
starIconTransform += " scaleX(-1)";
|
||||
}
|
||||
|
||||
// Compute, but do not set, transform for dropmarker
|
||||
[translateX, translateY] = getCenteringTransformForRects(dropmarkerNotifierRect, dropmarkerRect);
|
||||
let dropmarkerTransform = "translate(" + translateX + ", " + translateY + ")";
|
||||
|
||||
// Do all layout invalidation in one go:
|
||||
this.notifier.style.transform = starIconTransform;
|
||||
this.dropmarkerNotifier.style.transform = dropmarkerTransform;
|
||||
|
||||
let dropmarkerAnimationNode = this.dropmarkerNotifier.firstChild;
|
||||
dropmarkerAnimationNode.style.listStyleImage = dropmarkerStyle.listStyleImage;
|
||||
dropmarkerAnimationNode.style.fill = dropmarkerStyle.fill;
|
||||
}
|
||||
|
||||
let isInOverflowPanel = this.button.getAttribute("overflowedItem") == "true";
|
||||
if (!isInOverflowPanel) {
|
||||
this.notifier.setAttribute("notification", "finish");
|
||||
this.button.setAttribute("notification", "finish");
|
||||
this.dropmarkerNotifier.setAttribute("notification", "finish");
|
||||
}
|
||||
|
||||
this._notificationTimeout = setTimeout( () => {
|
||||
this.notifier.removeAttribute("notification");
|
||||
this.dropmarkerNotifier.removeAttribute("notification");
|
||||
this.button.removeAttribute("notification");
|
||||
|
||||
this.dropmarkerNotifier.style.transform = "";
|
||||
this.notifier.style.transform = "";
|
||||
}, 1000);
|
||||
},
|
||||
|
||||
showSubView(anchor) {
|
||||
this._showSubView(null, anchor);
|
||||
},
|
||||
|
@ -1729,17 +1658,6 @@ var BookmarkingUI = {
|
|||
aEvent.target.removeEventListener("ViewHiding", this);
|
||||
},
|
||||
|
||||
onPanelMenuViewCommand: function BUI_onPanelMenuViewCommand(aEvent) {
|
||||
let target = aEvent.originalTarget;
|
||||
if (!target._placesNode)
|
||||
return;
|
||||
if (PlacesUtils.nodeIsContainer(target._placesNode))
|
||||
PlacesCommandHook.showPlacesOrganizer([ "BookmarksMenu", target._placesNode.itemId ]);
|
||||
else
|
||||
PlacesUIUtils.openNodeWithEvent(target._placesNode, aEvent);
|
||||
PanelUI.hide();
|
||||
},
|
||||
|
||||
showBookmarkingTools(triggerNode) {
|
||||
const panelID = "PanelUI-bookmarkingTools";
|
||||
let viewNode = document.getElementById(panelID);
|
||||
|
|
|
@ -629,16 +629,6 @@ var PlacesOrganizer = {
|
|||
additionalInfoBroadcaster.hidden = infoBox.getAttribute("minimal") == "true";
|
||||
},
|
||||
|
||||
// NOT YET USED
|
||||
updateThumbnailProportions: function PO_updateThumbnailProportions() {
|
||||
var previewBox = document.getElementById("previewBox");
|
||||
var canvas = document.getElementById("itemThumbnail");
|
||||
var height = previewBox.boxObject.height;
|
||||
var width = height * (screen.width / screen.height);
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
},
|
||||
|
||||
_fillDetailsPane: function PO__fillDetailsPane(aNodeList) {
|
||||
var infoBox = document.getElementById("infoBox");
|
||||
var detailsDeck = document.getElementById("detailsDeck");
|
||||
|
@ -726,28 +716,6 @@ var PlacesOrganizer = {
|
|||
}
|
||||
},
|
||||
|
||||
// NOT YET USED
|
||||
_updateThumbnail: function PO__updateThumbnail() {
|
||||
var bo = document.getElementById("previewBox").boxObject;
|
||||
var width = bo.width;
|
||||
var height = bo.height;
|
||||
|
||||
var canvas = document.getElementById("itemThumbnail");
|
||||
var ctx = canvas.getContext("2d");
|
||||
var notAvailableText = canvas.getAttribute("notavailabletext");
|
||||
ctx.save();
|
||||
ctx.fillStyle = "-moz-Dialog";
|
||||
ctx.fillRect(0, 0, width, height);
|
||||
ctx.translate(width / 2, height / 2);
|
||||
|
||||
ctx.fillStyle = "GrayText";
|
||||
ctx.mozTextStyle = "12pt sans serif";
|
||||
var len = ctx.mozMeasureText(notAvailableText);
|
||||
ctx.translate(-len / 2, 0);
|
||||
ctx.mozDrawText(notAvailableText);
|
||||
ctx.restore();
|
||||
},
|
||||
|
||||
toggleAdditionalInfoFields: function PO_toggleAdditionalInfoFields() {
|
||||
var infoBox = document.getElementById("infoBox");
|
||||
var infoBoxExpander = document.getElementById("infoBoxExpander");
|
||||
|
|
|
@ -83,9 +83,6 @@ const MICROSEC_PER_SEC = 1000000;
|
|||
|
||||
const EXPORT_INDENT = " "; // four spaces
|
||||
|
||||
// Counter used to build fake favicon urls.
|
||||
var serialNumber = 0;
|
||||
|
||||
function base64EncodeString(aString) {
|
||||
let stream = Cc["@mozilla.org/io/string-input-stream;1"]
|
||||
.createInstance(Ci.nsIStringInputStream);
|
||||
|
@ -757,62 +754,6 @@ BookmarkImporter.prototype = {
|
|||
this._curFrame.previousText += str;
|
||||
},
|
||||
|
||||
/**
|
||||
* data is a string that is a data URI for the favicon. Our job is to
|
||||
* decode it and store it in the favicon service.
|
||||
*
|
||||
* When aIconURI is non-null, we will use that as the URI of the favicon
|
||||
* when storing in the favicon service.
|
||||
*
|
||||
* When aIconURI is null, we have to make up a URI for this favicon so that
|
||||
* it can be stored in the service. The real one will be set the next time
|
||||
* the user visits the page. Our made up one should get expired when the
|
||||
* page no longer references it.
|
||||
*/
|
||||
_setFaviconForURI: function setFaviconForURI(aPageURI, aIconURI, aData) {
|
||||
// if the input favicon URI is a chrome: URI, then we just save it and don't
|
||||
// worry about data
|
||||
if (aIconURI) {
|
||||
if (aIconURI.schemeIs("chrome")) {
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(aPageURI, aIconURI, false,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, null,
|
||||
Services.scriptSecurityManager.getSystemPrincipal());
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// some bookmarks have placeholder URIs that contain just "data:"
|
||||
// ignore these
|
||||
if (aData.length <= 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
let faviconURI;
|
||||
if (aIconURI) {
|
||||
faviconURI = aIconURI;
|
||||
} else {
|
||||
// Make up a favicon URI for this page. Later, we'll make sure that this
|
||||
// favicon URI is always associated with local favicon data, so that we
|
||||
// don't load this URI from the network.
|
||||
let faviconSpec = "http://www.mozilla.org/2005/made-up-favicon/"
|
||||
+ serialNumber
|
||||
+ "-"
|
||||
+ new Date().getTime();
|
||||
faviconURI = NetUtil.newURI(faviconSpec);
|
||||
serialNumber++;
|
||||
}
|
||||
|
||||
// This could fail if the favicon is bigger than defined limit, in such a
|
||||
// case neither the favicon URI nor the favicon data will be saved. If the
|
||||
// bookmark is visited again later, the URI and data will be fetched.
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(faviconURI, aData, 0,
|
||||
Services.scriptSecurityManager.getSystemPrincipal());
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(aPageURI, faviconURI, false,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, null,
|
||||
Services.scriptSecurityManager.getSystemPrincipal());
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts a string date in seconds to a date object
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче