зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central and Places
This commit is contained in:
Коммит
1116a273ea
|
@ -1737,7 +1737,8 @@ nsAccessibleWrap::GetXPAccessibleFor(const VARIANT& aVarChild)
|
|||
if (nsAccUtils::MustPrune(this))
|
||||
return nsnull;
|
||||
|
||||
return GetChildAt(aVarChild.lVal);
|
||||
// Gecko child indices are 0-based in contrast to indices used in MSAA.
|
||||
return GetChildAt(aVarChild.lVal - 1);
|
||||
}
|
||||
|
||||
void nsAccessibleWrap::UpdateSystemCaret()
|
||||
|
|
|
@ -14,60 +14,8 @@
|
|||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../states.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../events.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function designModeOn()
|
||||
{
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_REORDER, document)
|
||||
];
|
||||
|
||||
this.invoke = function designModeOn_invoke()
|
||||
{
|
||||
document.designMode = "on";
|
||||
}
|
||||
|
||||
this.finalCheck = function designModeOn_finalCheck()
|
||||
{
|
||||
testStates(document, 0, EXT_STATE_EDITABLE);
|
||||
testStates("p", 0, EXT_STATE_EDITABLE);
|
||||
testStates("document", 0, EXT_STATE_EDITABLE);
|
||||
testStates("editable_document", 0, EXT_STATE_EDITABLE);
|
||||
}
|
||||
|
||||
this.getID = function designModeOn_getID()
|
||||
{
|
||||
return "design mode on";
|
||||
}
|
||||
}
|
||||
|
||||
function designModeOff()
|
||||
{
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_REORDER, document)
|
||||
];
|
||||
|
||||
this.invoke = function designModeOn_invoke()
|
||||
{
|
||||
document.designMode = "off";
|
||||
}
|
||||
|
||||
this.finalCheck = function designModeOn_finalCheck()
|
||||
{
|
||||
testStates(document, STATE_READONLY);
|
||||
testStates("document", STATE_READONLY);
|
||||
testStates("editable_document", 0, EXT_STATE_EDITABLE);
|
||||
}
|
||||
|
||||
this.getID = function designModeOn_getID()
|
||||
{
|
||||
return "design mode off";
|
||||
}
|
||||
}
|
||||
|
||||
var gQueue = null;
|
||||
function doTest()
|
||||
{
|
||||
// Bug 566542: root accesible should expose active state when focused.
|
||||
|
@ -88,11 +36,20 @@
|
|||
testStates("document", STATE_READONLY);
|
||||
testStates("editable_document", 0, EXT_STATE_EDITABLE);
|
||||
|
||||
// Design mode on/off trigger document accessible subtree recreation.
|
||||
gQueue = new eventQueue();
|
||||
gQueue.push(new designModeOn());
|
||||
gQueue.push(new designModeOff());
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
document.designMode = "on";
|
||||
|
||||
testStates(document, 0, EXT_STATE_EDITABLE);
|
||||
testStates("p", 0, EXT_STATE_EDITABLE);
|
||||
testStates("document", 0, EXT_STATE_EDITABLE);
|
||||
testStates("editable_document", 0, EXT_STATE_EDITABLE);
|
||||
|
||||
document.designMode = "off";
|
||||
|
||||
testStates(document, STATE_READONLY);
|
||||
testStates("document", STATE_READONLY);
|
||||
testStates("editable_document", 0, EXT_STATE_EDITABLE);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
@ -14,77 +14,35 @@
|
|||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../states.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../events.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function designModeOn()
|
||||
function doTest()
|
||||
{
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_REORDER, document)
|
||||
];
|
||||
var docAcc = getAccessible(document, [nsIAccessibleDocument]);
|
||||
if (docAcc) {
|
||||
testStates(docAcc, STATE_READONLY);
|
||||
testStates("aria_article", STATE_READONLY);
|
||||
testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
|
||||
testStates("article", STATE_READONLY);
|
||||
testStates("editable_article", 0, EXT_STATE_EDITABLE);
|
||||
|
||||
this.invoke = function designModeOn_invoke()
|
||||
{
|
||||
document.designMode = "on";
|
||||
}
|
||||
|
||||
this.finalCheck = function designModeOn_finalCheck()
|
||||
{
|
||||
testStates(document, 0, EXT_STATE_EDITABLE);
|
||||
testStates(docAcc, 0, EXT_STATE_EDITABLE);
|
||||
testStates("aria_article", 0, EXT_STATE_EDITABLE);
|
||||
testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
|
||||
testStates("article", 0, EXT_STATE_EDITABLE);
|
||||
testStates("editable_article", 0, EXT_STATE_EDITABLE);
|
||||
}
|
||||
|
||||
this.getID = function designModeOn_getID()
|
||||
{
|
||||
return "design mode on";
|
||||
}
|
||||
}
|
||||
|
||||
function designModeOff()
|
||||
{
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_REORDER, document)
|
||||
];
|
||||
|
||||
this.invoke = function designModeOn_invoke()
|
||||
{
|
||||
|
||||
document.designMode = "off";
|
||||
}
|
||||
|
||||
this.finalCheck = function designModeOn_finalCheck()
|
||||
{
|
||||
testStates(document, STATE_READONLY);
|
||||
testStates(docAcc, STATE_READONLY);
|
||||
testStates("aria_article", STATE_READONLY);
|
||||
testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
|
||||
testStates("article", STATE_READONLY);
|
||||
testStates("editable_article", 0, EXT_STATE_EDITABLE);
|
||||
}
|
||||
|
||||
this.getID = function designModeOn_getID()
|
||||
{
|
||||
return "design mode off";
|
||||
}
|
||||
}
|
||||
|
||||
var gQueue = null;
|
||||
|
||||
function doTest()
|
||||
{
|
||||
testStates(document, STATE_READONLY);
|
||||
testStates("aria_article", STATE_READONLY);
|
||||
testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
|
||||
testStates("article", STATE_READONLY);
|
||||
testStates("editable_article", 0, EXT_STATE_EDITABLE);
|
||||
|
||||
// Design mode on/off trigger document accessible subtree recreation.
|
||||
gQueue = new eventQueue();
|
||||
gQueue.push(new designModeOn());
|
||||
gQueue.push(new designModeOff());
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
@ -172,8 +172,8 @@ let TabView = {
|
|||
// will not have happened by the time the browser tries to
|
||||
// update the title.
|
||||
let activeTab = window.gBrowser.selectedTab;
|
||||
if (activeTab.tabItem && activeTab.tabItem.parent){
|
||||
let groupName = activeTab.tabItem.parent.getTitle();
|
||||
if (activeTab._tabViewTabItem && activeTab._tabViewTabItem.parent){
|
||||
let groupName = activeTab._tabViewTabItem.parent.getTitle();
|
||||
if (groupName)
|
||||
return groupName;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ let TabView = {
|
|||
|
||||
let self = this;
|
||||
this._initFrame(function() {
|
||||
let activeGroup = tab.tabItem.parent;
|
||||
let activeGroup = tab._tabViewTabItem.parent;
|
||||
let groupItems = self._window.GroupItems.groupItems;
|
||||
|
||||
groupItems.forEach(function(groupItem) {
|
||||
|
|
|
@ -1851,7 +1851,7 @@ function gotoHistoryIndex(aEvent) {
|
|||
}
|
||||
// Modified click. Go there in a new tab/window.
|
||||
|
||||
duplicateTabIn(gBrowser.selectedTab, where, index);
|
||||
duplicateTabIn(gBrowser.selectedTab, where, index - gBrowser.sessionHistory.index);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1866,8 +1866,7 @@ function BrowserForward(aEvent) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
let currentIndex = getWebNavigation().sessionHistory.index;
|
||||
duplicateTabIn(gBrowser.selectedTab, where, currentIndex + 1);
|
||||
duplicateTabIn(gBrowser.selectedTab, where, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1882,8 +1881,7 @@ function BrowserBack(aEvent) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
let currentIndex = getWebNavigation().sessionHistory.index;
|
||||
duplicateTabIn(gBrowser.selectedTab, where, currentIndex - 1);
|
||||
duplicateTabIn(gBrowser.selectedTab, where, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3921,6 +3919,25 @@ var FullScreen = {
|
|||
document.documentElement.setAttribute("inFullscreen", true);
|
||||
}
|
||||
|
||||
// In tabs-on-top mode, move window controls to the tab bar,
|
||||
// and in tabs-on-bottom mode, move them back to the navigation toolbar.
|
||||
// When there is a chance the tab bar may be collapsed, put window
|
||||
// controls on nav bar.
|
||||
var fullscreenflex = document.getElementById("fullscreenflex");
|
||||
var fullscreenctls = document.getElementById("window-controls");
|
||||
var ctlsOnTabbar = TabsOnTop.enabled &&
|
||||
!gPrefService.getBoolPref("browser.tabs.autoHide");
|
||||
if (fullscreenctls.parentNode.id == "nav-bar" && ctlsOnTabbar) {
|
||||
document.getElementById("TabsToolbar").appendChild(fullscreenctls);
|
||||
// we don't need this space in tabs-on-top mode, so prevent it from
|
||||
// being shown
|
||||
fullscreenflex.removeAttribute("fullscreencontrol");
|
||||
}
|
||||
else if (fullscreenctls.parentNode.id == "TabsToolbar" && !ctlsOnTabbar) {
|
||||
document.getElementById("nav-bar").appendChild(fullscreenctls);
|
||||
fullscreenflex.setAttribute("fullscreencontrol", "true");
|
||||
}
|
||||
|
||||
var controls = document.getElementsByAttribute("fullscreencontrol", "true");
|
||||
for (var i = 0; i < controls.length; ++i)
|
||||
controls[i].hidden = aShow;
|
||||
|
@ -7489,10 +7506,6 @@ var gIdentityHandler = {
|
|||
// Update the popup strings
|
||||
this.setPopupMessages(this._identityBox.className);
|
||||
|
||||
// Make sure the identity popup hangs toward the middle of the location bar
|
||||
// in RTL builds
|
||||
var position = (getComputedStyle(gNavToolbox, "").direction == "rtl") ? 'bottomcenter topright' : 'bottomcenter topleft';
|
||||
|
||||
// Add the "open" attribute to the identity box for styling
|
||||
this._identityBox.setAttribute("open", "true");
|
||||
var self = this;
|
||||
|
@ -7502,7 +7515,7 @@ var gIdentityHandler = {
|
|||
}, false);
|
||||
|
||||
// Now open the popup, anchored off the primary chrome element
|
||||
this._identityPopup.openPopup(this._identityBox, position);
|
||||
this._identityPopup.openPopup(this._identityBox, "bottomcenter topleft");
|
||||
},
|
||||
|
||||
onDragStart: function (event) {
|
||||
|
@ -8254,25 +8267,12 @@ function safeModeRestart()
|
|||
* tabs, and vice versa
|
||||
* "window" new window
|
||||
*
|
||||
* historyIndex is an index the page can navigate to after the new tab is
|
||||
* created and loaded, it can for example be used to go back one page after the
|
||||
* tab is duplicated.
|
||||
* delta is the offset to the history entry that you want to load.
|
||||
*/
|
||||
function duplicateTabIn(aTab, where, historyIndex) {
|
||||
let newTab = gBrowser.duplicateTab(aTab);
|
||||
|
||||
// Go to index if it's provided, fallback to loadURI if there's no history.
|
||||
if (historyIndex != null) {
|
||||
try {
|
||||
gBrowser.getBrowserForTab(newTab).gotoIndex(historyIndex);
|
||||
}
|
||||
catch (ex) {
|
||||
let sessionHistory = aTab.linkedBrowser.sessionHistory;
|
||||
let entry = sessionHistory.getEntryAtIndex(historyIndex, false);
|
||||
let fallbackUrl = entry.URI.spec;
|
||||
gBrowser.getBrowserForTab(newTab).loadURI(fallbackUrl);
|
||||
}
|
||||
}
|
||||
function duplicateTabIn(aTab, where, delta) {
|
||||
let newTab = Cc['@mozilla.org/browser/sessionstore;1']
|
||||
.getService(Ci.nsISessionStore)
|
||||
.duplicateTab(window, aTab, delta);
|
||||
|
||||
var loadInBackground =
|
||||
getBoolPref("browser.tabs.loadBookmarksInBackground", false);
|
||||
|
|
|
@ -153,15 +153,19 @@ let gUsageTreeView = {
|
|||
* Process the quota information as returned by info/collection_usage.
|
||||
*/
|
||||
displayUsageData: function displayUsageData(data) {
|
||||
data = data || {};
|
||||
for each (let coll in this._collections) {
|
||||
coll.size = 0;
|
||||
// If we couldn't retrieve any data, just blank out the label.
|
||||
if (!data) {
|
||||
coll.sizeLabel = "";
|
||||
continue;
|
||||
}
|
||||
|
||||
for each (let engineName in coll.engines)
|
||||
coll.size += data[engineName] || 0;
|
||||
let sizeLabel = "";
|
||||
if (coll.size)
|
||||
sizeLabel = gSyncQuota.bundle.getFormattedString(
|
||||
"quota.sizeValueUnit.label", gSyncQuota.convertKB(coll.size));
|
||||
sizeLabel = gSyncQuota.bundle.getFormattedString(
|
||||
"quota.sizeValueUnit.label", gSyncQuota.convertKB(coll.size));
|
||||
coll.sizeLabel = sizeLabel;
|
||||
}
|
||||
let sizeColumn = this.treeBox.columns.getNamedColumn("size");
|
||||
|
|
|
@ -296,7 +296,10 @@ Drag.prototype = {
|
|||
if (this.parent && this.parent.expanded)
|
||||
this.parent.arrange();
|
||||
|
||||
if (this.item && !this.item.parent) {
|
||||
if (this.item.parent)
|
||||
this.item.parent.arrange();
|
||||
|
||||
if (!this.item.parent) {
|
||||
this.item.setZ(drag.zIndex);
|
||||
drag.zIndex++;
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ function GroupItem(listOfEls, options) {
|
|||
// ___ Titlebar
|
||||
var html =
|
||||
"<div class='title-container'>" +
|
||||
"<input class='name' />" +
|
||||
"<input class='name' placeholder='" + this.defaultName + "'/>" +
|
||||
"<div class='title-shield' />" +
|
||||
"</div>";
|
||||
|
||||
|
@ -160,31 +160,7 @@ function GroupItem(listOfEls, options) {
|
|||
this.$titleContainer = iQ('.title-container', this.$titlebar);
|
||||
this.$title = iQ('.name', this.$titlebar);
|
||||
this.$titleShield = iQ('.title-shield', this.$titlebar);
|
||||
this.setTitle(options.title || this.defaultName);
|
||||
|
||||
var titleUnfocus = function(immediately) {
|
||||
self.$titleShield.show();
|
||||
if (!self.getTitle()) {
|
||||
self.$title
|
||||
.addClass("defaultName")
|
||||
.val(self.defaultName)
|
||||
.css({"background-image":null, "-moz-padding-start":null});
|
||||
} else {
|
||||
self.$title.css({"background-image":"none"});
|
||||
if (immediately) {
|
||||
self.$title.css({
|
||||
"-moz-padding-start": "1px"
|
||||
});
|
||||
} else {
|
||||
self.$title.animate({
|
||||
"-moz-padding-start": "1px"
|
||||
}, {
|
||||
duration: 200,
|
||||
easing: "tabviewBounce"
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
this.setTitle(options.title);
|
||||
|
||||
var handleKeyDown = function(e) {
|
||||
if (e.which == 13 || e.which == 27) { // return & escape
|
||||
|
@ -208,25 +184,19 @@ function GroupItem(listOfEls, options) {
|
|||
};
|
||||
|
||||
this.$title
|
||||
.css({backgroundRepeat: 'no-repeat'})
|
||||
.blur(titleUnfocus)
|
||||
.blur(function() {
|
||||
self.$titleShield.show();
|
||||
})
|
||||
.focus(function() {
|
||||
if (self.locked.title) {
|
||||
(self.$title)[0].blur();
|
||||
return;
|
||||
}
|
||||
(self.$title)[0].select();
|
||||
if (!self.getTitle()) {
|
||||
self.$title
|
||||
.removeClass("defaultName")
|
||||
.val('');
|
||||
}
|
||||
})
|
||||
.keydown(handleKeyDown)
|
||||
.keyup(handleKeyUp);
|
||||
|
||||
titleUnfocus(immediately);
|
||||
|
||||
if (this.locked.title)
|
||||
this.$title.addClass('name-locked');
|
||||
else {
|
||||
|
@ -282,7 +252,7 @@ function GroupItem(listOfEls, options) {
|
|||
|
||||
// ___ Children
|
||||
Array.prototype.forEach.call(listOfEls, function(el) {
|
||||
self.add(el, null, options);
|
||||
self.add(el, options);
|
||||
});
|
||||
|
||||
// ___ Finish Up
|
||||
|
@ -383,8 +353,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
// Function: getTitle
|
||||
// Returns the title of this groupItem as a string.
|
||||
getTitle: function GroupItem_getTitle() {
|
||||
var value = (this.$title ? this.$title.val() : '');
|
||||
return (value == this.defaultName ? '' : value);
|
||||
return this.$title ? this.$title.val() : '';
|
||||
},
|
||||
|
||||
// ----------
|
||||
|
@ -811,14 +780,14 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
//
|
||||
// a - The item to add. Can be an <Item>, a DOM element or an iQ object.
|
||||
// The latter two must refer to the container of an <Item>.
|
||||
// dropPos - An object with left and top properties referring to the
|
||||
// location dropped at. Optional.
|
||||
// options - An optional object with settings for this call. See below.
|
||||
// options - An object with optional settings for this call.
|
||||
//
|
||||
// Possible options:
|
||||
// dontArrange - Don't rearrange the children for the new item
|
||||
// immediately - Don't animate
|
||||
add: function GroupItem_add(a, dropPos, options) {
|
||||
// Options:
|
||||
//
|
||||
// index - (int) if set, add this tab at this index
|
||||
// immediately - (bool) if true, no animation will be used
|
||||
// dontArrange - (bool) if true, will not trigger an arrange on the group
|
||||
add: function GroupItem_add(a, options) {
|
||||
try {
|
||||
var item;
|
||||
var $el;
|
||||
|
@ -846,48 +815,8 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
wasAlreadyInThisGroupItem = true;
|
||||
}
|
||||
|
||||
// TODO: You should be allowed to drop in the white space at the bottom
|
||||
// and have it go to the end (right now it can match the thumbnail above
|
||||
// it and go there)
|
||||
// Bug 586548
|
||||
function findInsertionPoint(dropPos) {
|
||||
if (self.shouldStack(self._children.length + 1))
|
||||
return 0;
|
||||
|
||||
var best = {dist: Infinity, item: null};
|
||||
var index = 0;
|
||||
var box;
|
||||
self._children.forEach(function(child) {
|
||||
box = child.getBounds();
|
||||
if (box.bottom < dropPos.top || box.top > dropPos.top)
|
||||
return;
|
||||
|
||||
var dist = Math.sqrt(Math.pow((box.top+box.height/2)-dropPos.top,2)
|
||||
+ Math.pow((box.left+box.width/2)-dropPos.left,2));
|
||||
|
||||
if (dist <= best.dist) {
|
||||
best.item = child;
|
||||
best.dist = dist;
|
||||
best.index = index;
|
||||
}
|
||||
});
|
||||
|
||||
if (self._children.length) {
|
||||
if (best.item) {
|
||||
box = best.item.getBounds();
|
||||
var insertLeft = dropPos.left <= box.left + box.width/2;
|
||||
if (!insertLeft)
|
||||
return best.index+1;
|
||||
return best.index;
|
||||
}
|
||||
return self._children.length;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Insert the tab into the right position.
|
||||
var index = dropPos ? findInsertionPoint(dropPos) : this._children.length;
|
||||
var index = ("index" in options) ? options.index : this._children.length;
|
||||
this._children.splice(index, 0, item);
|
||||
|
||||
item.setZ(this.getZ() + 1);
|
||||
|
@ -1120,54 +1049,84 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
// Lays out all of the children.
|
||||
//
|
||||
// Parameters:
|
||||
// options - passed to <Items.arrange> or <_stackArrange>
|
||||
// options - passed to <Items.arrange> or <_stackArrange>, except those below
|
||||
//
|
||||
// Options:
|
||||
// addTab - (boolean) if true, we add one to the child count
|
||||
// oldDropIndex - if set, we will only set any bounds if the dropIndex has
|
||||
// changed
|
||||
// dropPos - (<Point>) a position where a tab is currently positioned, above
|
||||
// this group.
|
||||
// animate - (boolean) if true, movement of children will be animated.
|
||||
//
|
||||
// Returns:
|
||||
// dropIndex - an index value for where an item would be dropped, if
|
||||
// options.dropPos is given.
|
||||
arrange: function GroupItem_arrange(options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
|
||||
let childrenToArrange = [];
|
||||
this._children.forEach(function(child) {
|
||||
if (child.isDragging)
|
||||
options.addTab = true;
|
||||
else
|
||||
childrenToArrange.push(child);
|
||||
});
|
||||
|
||||
if (GroupItems._arrangePaused) {
|
||||
GroupItems.pushArrange(this, options);
|
||||
return;
|
||||
}
|
||||
var dropIndex = false;
|
||||
if (this.expanded) {
|
||||
this.topChild = null;
|
||||
var box = new Rect(this.expanded.bounds);
|
||||
box.inset(8, 8);
|
||||
Items.arrange(this._children, box, Utils.extend({}, options, {z: 99999}));
|
||||
let result = Items.arrange(childrenToArrange, box, Utils.extend({}, options, {z: 99999}));
|
||||
dropIndex = result.dropIndex;
|
||||
} else {
|
||||
var count = childrenToArrange.length;
|
||||
var bb = this.getContentBounds();
|
||||
if (!this.shouldStack()) {
|
||||
if (!options)
|
||||
options = {};
|
||||
|
||||
this._children.forEach(function(child) {
|
||||
if (!this.shouldStack(count + (options.addTab ? 1 : 0))) {
|
||||
childrenToArrange.forEach(function(child) {
|
||||
child.removeClass("stacked")
|
||||
});
|
||||
|
||||
this.topChild = null;
|
||||
|
||||
if (!this._children.length)
|
||||
if (!childrenToArrange.length)
|
||||
return;
|
||||
|
||||
var arrangeOptions = Utils.copy(options);
|
||||
Utils.extend(arrangeOptions, {
|
||||
var arrangeOptions = Utils.extend({}, options, {
|
||||
columns: this._columns
|
||||
});
|
||||
|
||||
// Items.arrange will rearrange the children, but also return an array
|
||||
// of the Rect's used.
|
||||
|
||||
var rects = Items.arrange(this._children, bb, arrangeOptions);
|
||||
let result = Items.arrange(childrenToArrange, bb, arrangeOptions);
|
||||
dropIndex = result.dropIndex;
|
||||
if ("oldDropIndex" in options && options.oldDropIndex === dropIndex)
|
||||
return dropIndex;
|
||||
var rects = result.rects;
|
||||
|
||||
// first, find the right of the rightmost tab! luckily, they're in order.
|
||||
var rightMostRight = 0;
|
||||
if (UI.rtl) {
|
||||
rightMostRight = rects[0].right;
|
||||
} else {
|
||||
for each (var rect in rects) {
|
||||
if (rect.right > rightMostRight)
|
||||
rightMostRight = rect.right;
|
||||
else
|
||||
break;
|
||||
let index = 0;
|
||||
let self = this;
|
||||
childrenToArrange.forEach(function GroupItem_arrange_children_each(child, i) {
|
||||
// If dropIndex spacing is active and this is a child after index,
|
||||
// bump it up one so we actually use the correct rect
|
||||
// (and skip one for the dropPos)
|
||||
if (self._dropSpaceActive && index === dropIndex)
|
||||
index++;
|
||||
if (!child.locked.bounds) {
|
||||
child.setBounds(rects[index], !options.animate);
|
||||
child.setRotation(0);
|
||||
if (options.z)
|
||||
child.setZ(options.z);
|
||||
}
|
||||
}
|
||||
index++;
|
||||
});
|
||||
|
||||
this._isStacked = false;
|
||||
} else
|
||||
|
@ -1176,6 +1135,8 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
|
||||
if (this._isStacked && !this.expanded) this.showExpandControl();
|
||||
else this.hideExpandControl();
|
||||
|
||||
return dropIndex;
|
||||
},
|
||||
|
||||
// ----------
|
||||
|
@ -1416,15 +1377,87 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
// Helper routine for the constructor; adds various event handlers to the container.
|
||||
_addHandlers: function GroupItem__addHandlers(container) {
|
||||
var self = this;
|
||||
var dropIndex = false;
|
||||
var dropSpaceTimer = null;
|
||||
|
||||
this.dropOptions.over = function() {
|
||||
// When the _dropSpaceActive flag is turned on on a group, and a tab is
|
||||
// dragged on top, a space will open up.
|
||||
this._dropSpaceActive = false;
|
||||
|
||||
this.dropOptions.over = function GroupItem_dropOptions_over(event) {
|
||||
iQ(this.container).addClass("acceptsDrop");
|
||||
};
|
||||
this.dropOptions.drop = function(event) {
|
||||
iQ(this.container).removeClass("acceptsDrop");
|
||||
this.add(drag.info.$el, {left:event.pageX, top:event.pageY});
|
||||
GroupItems.setActiveGroupItem(this);
|
||||
this.dropOptions.move = function GroupItem_dropOptions_move(event) {
|
||||
let oldDropIndex = dropIndex;
|
||||
let dropPos = drag.info.item.getBounds().center();
|
||||
let options = {dropPos: dropPos,
|
||||
addTab: self._dropSpaceActive && drag.info.item.parent != self,
|
||||
oldDropIndex: oldDropIndex};
|
||||
newDropIndex = self.arrange(options);
|
||||
// If this is a new drop index, start a timer!
|
||||
if (newDropIndex !== oldDropIndex) {
|
||||
dropIndex = newDropIndex;
|
||||
if (this._dropSpaceActive)
|
||||
return;
|
||||
|
||||
if (dropSpaceTimer) {
|
||||
clearTimeout(dropSpaceTimer);
|
||||
dropSpaceTimer = null;
|
||||
}
|
||||
|
||||
dropSpaceTimer = setTimeout(function GroupItem_arrange_evaluateDropSpace() {
|
||||
// Note that dropIndex's scope is GroupItem__addHandlers, but
|
||||
// newDropIndex's scope is GroupItem_dropOptions_move. Thus,
|
||||
// dropIndex may change with other movement events before we come
|
||||
// back and check this. If it's still the same dropIndex, activate
|
||||
// drop space display!
|
||||
if (dropIndex === newDropIndex) {
|
||||
self._dropSpaceActive = true;
|
||||
dropIndex = self.arrange({dropPos: dropPos,
|
||||
addTab: drag.info.item.parent != self,
|
||||
animate: true});
|
||||
}
|
||||
dropSpaceTimer = null;
|
||||
}, 250);
|
||||
}
|
||||
};
|
||||
this.dropOptions.drop = function GroupItem_dropOptions_drop(event) {
|
||||
iQ(this.container).removeClass("acceptsDrop");
|
||||
let options = {};
|
||||
if (this._dropSpaceActive)
|
||||
this._dropSpaceActive = false;
|
||||
|
||||
if (dropSpaceTimer) {
|
||||
clearTimeout(dropSpaceTimer);
|
||||
dropSpaceTimer = null;
|
||||
// If we drop this item before the timed rearrange was executed,
|
||||
// we won't have an accurate dropIndex value. Get that now.
|
||||
let dropPos = drag.info.item.getBounds().center();
|
||||
dropIndex = self.arrange({dropPos: dropPos,
|
||||
addTab: drag.info.item.parent != self,
|
||||
animate: true});
|
||||
}
|
||||
if (dropIndex !== false)
|
||||
options = {index: dropIndex}
|
||||
this.add(drag.info.$el, options);
|
||||
GroupItems.setActiveGroupItem(this);
|
||||
dropIndex = false;
|
||||
};
|
||||
this.dropOptions.out = function GroupItem_dropOptions_out(event) {
|
||||
dropIndex = false;
|
||||
if (this._dropSpaceActive)
|
||||
this._dropSpaceActive = false;
|
||||
|
||||
if (dropSpaceTimer) {
|
||||
clearTimeout(dropSpaceTimer);
|
||||
dropSpaceTimer = null;
|
||||
}
|
||||
self.arrange();
|
||||
var groupItem = drag.info.item.parent;
|
||||
if (groupItem)
|
||||
groupItem.remove(drag.info.$el, {dontClose: true});
|
||||
iQ(this.container).removeClass("acceptsDrop");
|
||||
}
|
||||
|
||||
if (!this.locked.bounds)
|
||||
this.draggable();
|
||||
|
@ -1462,7 +1495,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
// TabItems will have handled the new tab and added the tabItem property.
|
||||
// We don't have to check if it's an app tab (and therefore wouldn't have a
|
||||
// TabItem), since we've just created it.
|
||||
newTab.tabItem.zoomIn(!url);
|
||||
newTab._tabViewTabItem.zoomIn(!url);
|
||||
},
|
||||
|
||||
// ----------
|
||||
|
@ -1559,7 +1592,6 @@ let GroupItems = {
|
|||
_arrangePaused: false,
|
||||
_arrangesPending: [],
|
||||
_removingHiddenGroups: false,
|
||||
_updatingTabBarPaused: false,
|
||||
|
||||
// ----------
|
||||
// Function: init
|
||||
|
@ -1883,7 +1915,7 @@ let GroupItems = {
|
|||
// tab in question): make a new group
|
||||
|
||||
if (activeGroupItem) {
|
||||
activeGroupItem.add(tabItem, null, options);
|
||||
activeGroupItem.add(tabItem, options);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1893,15 +1925,15 @@ let GroupItems = {
|
|||
// find first visible non-app tab in the tabbar.
|
||||
gBrowser.visibleTabs.some(function(tab) {
|
||||
if (!tab.pinned && tab != tabItem.tab) {
|
||||
if (tab.tabItem) {
|
||||
if (!tab.tabItem.parent) {
|
||||
if (tab._tabViewTabItem) {
|
||||
if (!tab._tabViewTabItem.parent) {
|
||||
// the first visible tab is an orphan tab, set the orphan tab, and
|
||||
// create a new group for orphan tab and new tabItem
|
||||
orphanTabItem = tab.tabItem;
|
||||
} else if (!tab.tabItem.parent.hidden) {
|
||||
orphanTabItem = tab._tabViewTabItem;
|
||||
} else if (!tab._tabViewTabItem.parent.hidden) {
|
||||
// the first visible tab belongs to a group, add the new tabItem to
|
||||
// that group
|
||||
targetGroupItem = tab.tabItem.parent;
|
||||
targetGroupItem = tab._tabViewTabItem.parent;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -2004,25 +2036,6 @@ let GroupItems = {
|
|||
this._activeOrphanTab = tabItem;
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: pauseUpdatingTabBar
|
||||
// Don't update the tab bar until resume is called.
|
||||
pauseUpdatingTabBar: function GroupItems_pauseUdatingTabBar() {
|
||||
Utils.assertThrow(!this._updatingTabBarPaused, "shouldn't already be paused");
|
||||
|
||||
this._updatingTabBarPaused = true;
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: resumeUpdatingTabBar
|
||||
// Allows updating the tab bar, and does an update.
|
||||
resumeUpdatingTabBar: function GroupItems_resumeUpdatingTabBar() {
|
||||
Utils.assertThrow(this._updatingTabBarPaused, "should already be paused");
|
||||
|
||||
this._updatingTabBarPaused = false;
|
||||
this._updateTabBar();
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: _updateTabBar
|
||||
// Hides and shows tabs in the tab bar based on the active groupItem or
|
||||
|
@ -2031,9 +2044,6 @@ let GroupItems = {
|
|||
if (!window.UI)
|
||||
return; // called too soon
|
||||
|
||||
if (this._updatingTabBarPaused)
|
||||
return;
|
||||
|
||||
if (!this._activeGroupItem && !this._activeOrphanTab) {
|
||||
Utils.assert(false, "There must be something to show in the tab bar!");
|
||||
return;
|
||||
|
@ -2173,7 +2183,11 @@ let GroupItems = {
|
|||
if (tab.pinned)
|
||||
return;
|
||||
|
||||
Utils.assertThrow(tab.tabItem, "tab must be linked to a TabItem");
|
||||
Utils.assertThrow(tab._tabViewTabItem, "tab must be linked to a TabItem");
|
||||
|
||||
// given tab is already contained in target group
|
||||
if (tab._tabViewTabItem.parent && tab._tabViewTabItem.parent.id == groupItemId)
|
||||
return;
|
||||
|
||||
let shouldUpdateTabBar = false;
|
||||
let shouldShowTabView = false;
|
||||
|
@ -2198,13 +2212,13 @@ let GroupItems = {
|
|||
shouldUpdateTabBar = true
|
||||
|
||||
// remove tab item from a groupItem
|
||||
if (tab.tabItem.parent)
|
||||
tab.tabItem.parent.remove(tab.tabItem);
|
||||
if (tab._tabViewTabItem.parent)
|
||||
tab._tabViewTabItem.parent.remove(tab._tabViewTabItem);
|
||||
|
||||
// add tab item to a groupItem
|
||||
if (groupItemId) {
|
||||
groupItem = GroupItems.groupItem(groupItemId);
|
||||
groupItem.add(tab.tabItem);
|
||||
groupItem.add(tab._tabViewTabItem);
|
||||
UI.setReorderTabItemsOnShow(groupItem);
|
||||
} else {
|
||||
let pageBounds = Items.getPageBounds();
|
||||
|
@ -2214,13 +2228,13 @@ let GroupItems = {
|
|||
box.width = 250;
|
||||
box.height = 200;
|
||||
|
||||
new GroupItem([ tab.tabItem ], { bounds: box });
|
||||
new GroupItem([ tab._tabViewTabItem ], { bounds: box });
|
||||
}
|
||||
|
||||
if (shouldUpdateTabBar)
|
||||
this._updateTabBar();
|
||||
else if (shouldShowTabView) {
|
||||
tab.tabItem.setZoomPrep(false);
|
||||
tab._tabViewTabItem.setZoomPrep(false);
|
||||
UI.showTabView();
|
||||
}
|
||||
},
|
||||
|
|
|
@ -478,6 +478,13 @@ iQClass.prototype = {
|
|||
}
|
||||
properties = {};
|
||||
properties[key] = b;
|
||||
} else if (a instanceof Rect) {
|
||||
properties = {
|
||||
left: a.left,
|
||||
top: a.top,
|
||||
width: a.width,
|
||||
height: a.height
|
||||
};
|
||||
} else {
|
||||
properties = a;
|
||||
}
|
||||
|
@ -539,6 +546,16 @@ iQClass.prototype = {
|
|||
let duration = (options.duration || 400);
|
||||
let easing = (easings[options.easing] || 'ease');
|
||||
|
||||
if (css instanceof Rect) {
|
||||
css = {
|
||||
left: css.left,
|
||||
top: css.top,
|
||||
width: css.width,
|
||||
height: css.height
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// The latest versions of Firefox do not animate from a non-explicitly
|
||||
// set css properties. So for each element to be animated, go through
|
||||
// and explicitly define 'em.
|
||||
|
|
|
@ -179,6 +179,9 @@ Item.prototype = {
|
|||
start: function(e, ui) {
|
||||
if (this.isAGroupItem)
|
||||
GroupItems.setActiveGroupItem(this);
|
||||
// if we start dragging a tab within a group, start with dropSpace on.
|
||||
else if (this.parent != null)
|
||||
this.parent._dropSpaceActive = true;
|
||||
drag.info = new Drag(this, e);
|
||||
},
|
||||
drag: function(e) {
|
||||
|
@ -200,7 +203,6 @@ Item.prototype = {
|
|||
var groupItem = drag.info.item.parent;
|
||||
if (groupItem)
|
||||
groupItem.remove(drag.info.$el, {dontClose: true});
|
||||
|
||||
iQ(this.container).removeClass("acceptsDrop");
|
||||
},
|
||||
drop: function(event) {
|
||||
|
@ -511,7 +513,7 @@ Item.prototype = {
|
|||
// This functionality is enabled only by the debug property.
|
||||
_updateDebugBounds: function Item__updateDebugBounds() {
|
||||
if (this.$debug) {
|
||||
this.$debug.css(this.bounds.css());
|
||||
this.$debug.css(this.bounds);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -617,7 +619,6 @@ Item.prototype = {
|
|||
var box = self.getBounds();
|
||||
box.left = startPos.x + (mouse.x - startMouse.x);
|
||||
box.top = startPos.y + (mouse.y - startMouse.y);
|
||||
|
||||
self.setBounds(box, true);
|
||||
|
||||
if (typeof self.dragOptions.drag == "function")
|
||||
|
@ -663,6 +664,11 @@ Item.prototype = {
|
|||
dropOptions.over.apply(dropTarget, [e]);
|
||||
}
|
||||
}
|
||||
if (dropTarget) {
|
||||
dropOptions = dropTarget.dropOptions;
|
||||
if (dropOptions && typeof dropOptions.move == "function")
|
||||
dropOptions.move.apply(dropTarget, [e]);
|
||||
}
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
@ -919,10 +925,16 @@ let Items = {
|
|||
// default: the actual item count
|
||||
// padding - pixels between each item
|
||||
// columns - (int) a preset number of columns to use
|
||||
// dropPos - a <Point> which should have a one-tab space left open, used
|
||||
// when a tab is dragged over.
|
||||
//
|
||||
// Returns:
|
||||
// an object with the width value of the child items and the number of columns,
|
||||
// if the return option is set to 'widthAndColumns'; otherwise the list of <Rect>s
|
||||
// By default, an object with two properties: `rects`, the list of <Rect>s,
|
||||
// and `dropIndex`, the index which a dragged tab should have if dropped
|
||||
// (null if no `dropPos` was specified);
|
||||
// If the `return` option is set to 'widthAndColumns', an object with the
|
||||
// width value of the child items (`childWidth`) and the number of columns
|
||||
// (`columns`) is returned.
|
||||
arrange: function Items_arrange(items, bounds, options) {
|
||||
if (typeof options == 'undefined')
|
||||
options = {};
|
||||
|
@ -936,8 +948,12 @@ let Items = {
|
|||
|
||||
var tabAspect = TabItems.tabHeight / TabItems.tabWidth;
|
||||
var count = options.count || (items ? items.length : 0);
|
||||
if (!count)
|
||||
return rects;
|
||||
if (options.addTab)
|
||||
count++;
|
||||
if (!count) {
|
||||
let dropIndex = (Utils.isPoint(options.dropPos)) ? 0 : null;
|
||||
return {rects: rects, dropIndex: dropIndex};
|
||||
}
|
||||
|
||||
var columns = options.columns || 1;
|
||||
// We'll assume for the time being that all the items have the same styling
|
||||
|
@ -981,17 +997,23 @@ let Items = {
|
|||
|
||||
var column = 0;
|
||||
|
||||
var dropIndex = false;
|
||||
var dropRect = false;
|
||||
if (Utils.isPoint(options.dropPos))
|
||||
dropRect = new Rect(options.dropPos.x, options.dropPos.y, 1, 1);
|
||||
for (let a = 0; a < count; a++) {
|
||||
rects.push(new Rect(box));
|
||||
if (items && a < items.length) {
|
||||
let item = items[a];
|
||||
if (!item.locked.bounds) {
|
||||
item.setBounds(box, immediately);
|
||||
item.setRotation(0);
|
||||
if (options.z)
|
||||
item.setZ(options.z);
|
||||
}
|
||||
// If we had a dropPos, see if this is where we should place it
|
||||
if (dropRect) {
|
||||
let activeBox = new Rect(box);
|
||||
activeBox.inset(-itemMargin - 1, -itemMargin - 1);
|
||||
// if the designated position (dropRect) is within the active box,
|
||||
// this is where, if we drop the tab being dragged, it should land!
|
||||
if (activeBox.contains(dropRect))
|
||||
dropIndex = a;
|
||||
}
|
||||
|
||||
// record the box.
|
||||
rects.push(new Rect(box));
|
||||
|
||||
box.left += (UI.rtl ? -1 : 1) * (box.width + padding);
|
||||
column++;
|
||||
|
@ -1002,7 +1024,7 @@ let Items = {
|
|||
}
|
||||
}
|
||||
|
||||
return rects;
|
||||
return {rects: rects, dropIndex: dropIndex};
|
||||
},
|
||||
|
||||
// ----------
|
||||
|
|
|
@ -262,22 +262,6 @@ Rect.prototype = {
|
|||
this.top = a.top;
|
||||
this.width = a.width;
|
||||
this.height = a.height;
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: css
|
||||
// Returns an object with the dimensions of this rectangle, suitable for
|
||||
// passing into iQ's css method. You could of course just pass the rectangle
|
||||
// straight in, but this is cleaner, as it removes all the extraneous
|
||||
// properties. If you give a <Rect> to <iQClass.css> without this, it will
|
||||
// ignore the extraneous properties, but result in CSS warnings.
|
||||
css: function Rect_css() {
|
||||
return {
|
||||
left: this.left,
|
||||
top: this.top,
|
||||
width: this.width,
|
||||
height: this.height
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -335,10 +335,12 @@ SearchEventHandlerClass.prototype = {
|
|||
});
|
||||
|
||||
iQ("#searchbutton").mousedown(function() {
|
||||
self.initiatedBy = "buttonclick";
|
||||
ensureSearchShown(null);
|
||||
self.switchToInMode();
|
||||
});
|
||||
|
||||
this.initiatedBy = "";
|
||||
this.currentHandler = null;
|
||||
this.switchToBeforeMode();
|
||||
},
|
||||
|
@ -358,6 +360,7 @@ SearchEventHandlerClass.prototype = {
|
|||
return;
|
||||
|
||||
this.switchToInMode();
|
||||
this.initiatedBy = "keypress";
|
||||
ensureSearchShown(event);
|
||||
},
|
||||
|
||||
|
@ -367,7 +370,7 @@ SearchEventHandlerClass.prototype = {
|
|||
inSearchKeyHandler: function (event) {
|
||||
let term = iQ("#searchbox").val();
|
||||
if ((event.keyCode == event.DOM_VK_ESCAPE) ||
|
||||
(event.keyCode == event.DOM_VK_BACK_SPACE && term.length <= 1)) {
|
||||
(event.keyCode == event.DOM_VK_BACK_SPACE && term.length <= 1 && this.initiatedBy == "keypress")) {
|
||||
hideSearch(event);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ function TabItem(tab, options) {
|
|||
|
||||
this.tab = tab;
|
||||
// register this as the tab's tabItem
|
||||
this.tab.tabItem = this;
|
||||
this.tab._tabViewTabItem = this;
|
||||
|
||||
if (!options)
|
||||
options = {};
|
||||
|
@ -142,7 +142,7 @@ function TabItem(tab, options) {
|
|||
position: "absolute",
|
||||
zIndex: -99
|
||||
})
|
||||
.css(groupItemBounds.css())
|
||||
.css(groupItemBounds)
|
||||
.hide()
|
||||
.appendTo("body");
|
||||
|
||||
|
@ -155,7 +155,7 @@ function TabItem(tab, options) {
|
|||
|
||||
// Utils.log('updatedBounds:',updatedBounds);
|
||||
if (updatedBounds)
|
||||
phantom.css(updatedBounds.css());
|
||||
phantom.css(updatedBounds);
|
||||
|
||||
phantom.fadeIn();
|
||||
|
||||
|
@ -351,7 +351,7 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
if (tabData.groupID) {
|
||||
var groupItem = GroupItems.groupItem(tabData.groupID);
|
||||
if (groupItem) {
|
||||
groupItem.add(this, null, {immediately: true});
|
||||
groupItem.add(this, {immediately: true});
|
||||
|
||||
// if it matches the selected tab or no active tab and the browser
|
||||
// tab is hidden, the active group item would be set.
|
||||
|
@ -648,7 +648,7 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
TabItems.resumePainting();
|
||||
|
||||
$tabEl
|
||||
.css(orig.css())
|
||||
.css(orig)
|
||||
.removeClass("front");
|
||||
|
||||
onZoomDone();
|
||||
|
@ -883,7 +883,7 @@ let TabItems = {
|
|||
try {
|
||||
Utils.assertThrow(tab, "tab");
|
||||
Utils.assertThrow(!tab.pinned, "shouldn't be an app tab");
|
||||
Utils.assertThrow(tab.tabItem, "should already be linked");
|
||||
Utils.assertThrow(tab._tabViewTabItem, "should already be linked");
|
||||
|
||||
let shouldDefer = (
|
||||
this.isPaintingPaused() ||
|
||||
|
@ -923,8 +923,8 @@ let TabItems = {
|
|||
this._tabsWaitingForUpdate.splice(index, 1);
|
||||
|
||||
// ___ get the TabItem
|
||||
Utils.assertThrow(tab.tabItem, "must already be linked");
|
||||
let tabItem = tab.tabItem;
|
||||
Utils.assertThrow(tab._tabViewTabItem, "must already be linked");
|
||||
let tabItem = tab._tabViewTabItem;
|
||||
|
||||
// ___ icon
|
||||
let iconUrl = tab.image;
|
||||
|
@ -979,8 +979,8 @@ let TabItems = {
|
|||
try {
|
||||
Utils.assertThrow(tab, "tab");
|
||||
Utils.assertThrow(!tab.pinned, "shouldn't be an app tab");
|
||||
Utils.assertThrow(!tab.tabItem, "shouldn't already be linked");
|
||||
new TabItem(tab, options); // sets tab.tabItem to itself
|
||||
Utils.assertThrow(!tab._tabViewTabItem, "shouldn't already be linked");
|
||||
new TabItem(tab, options); // sets tab._tabViewTabItem to itself
|
||||
} catch(e) {
|
||||
Utils.log(e);
|
||||
}
|
||||
|
@ -992,16 +992,16 @@ let TabItems = {
|
|||
unlink: function TabItems_unlink(tab) {
|
||||
try {
|
||||
Utils.assertThrow(tab, "tab");
|
||||
Utils.assertThrow(tab.tabItem, "should already be linked");
|
||||
Utils.assertThrow(tab._tabViewTabItem, "should already be linked");
|
||||
// note that it's ok to unlink an app tab; see .handleTabUnpin
|
||||
|
||||
this.unregister(tab.tabItem);
|
||||
tab.tabItem._sendToSubscribers("close");
|
||||
iQ(tab.tabItem.container).remove();
|
||||
tab.tabItem.removeTrenches();
|
||||
Items.unsquish(null, tab.tabItem);
|
||||
this.unregister(tab._tabViewTabItem);
|
||||
tab._tabViewTabItem._sendToSubscribers("close");
|
||||
iQ(tab._tabViewTabItem.container).remove();
|
||||
tab._tabViewTabItem.removeTrenches();
|
||||
Items.unsquish(null, tab._tabViewTabItem);
|
||||
|
||||
tab.tabItem = null;
|
||||
tab._tabViewTabItem = null;
|
||||
Storage.saveTab(tab, null);
|
||||
|
||||
let index = this._tabsWaitingForUpdate.indexOf(tab);
|
||||
|
|
|
@ -223,6 +223,7 @@ html[dir=rtl] #search {
|
|||
position: absolute;
|
||||
right: 20px;
|
||||
top: 20px;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
html[dir=rtl] #searchbox {
|
||||
|
@ -265,6 +266,7 @@ html[dir=rtl] #actions #searchbutton {
|
|||
|
||||
.inlineMatch{
|
||||
display: inline-block;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.inlineMatch>span{
|
||||
|
|
|
@ -3,16 +3,12 @@ const Ci = Components.interfaces;
|
|||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource:///modules/tabview/AllTabs.jsm");
|
||||
Cu.import("resource:///modules/tabview/groups.jsm");
|
||||
Cu.import("resource:///modules/tabview/utils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gWindow", function() {
|
||||
return window.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIWebNavigation).
|
||||
QueryInterface(Ci.nsIDocShell).
|
||||
chromeEventHandler.ownerDocument.defaultView;
|
||||
return window.parent;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gBrowser", function() gWindow.gBrowser);
|
||||
|
@ -33,9 +29,7 @@ XPCOMUtils.defineLazyGetter(this, "tabviewBundle", function() {
|
|||
function tabviewString(name) tabviewBundle.GetStringFromName('tabview.' + name);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gPrefBranch", function() {
|
||||
return Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefService).
|
||||
getBranch("browser.panorama.");
|
||||
return Services.prefs.getBranch("browser.panorama.");
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gPrivateBrowsing", function() {
|
||||
|
|
|
@ -233,7 +233,7 @@ Trench.prototype = {
|
|||
if (!this.dom.guideTrench)
|
||||
this.dom.guideTrench = iQ("<div/>").addClass('guideTrench').css({id: 'guideTrench'+this.id});
|
||||
var guideTrench = this.dom.guideTrench;
|
||||
guideTrench.css(this.guideRect.css());
|
||||
guideTrench.css(this.guideRect);
|
||||
iQ("body").append(guideTrench);
|
||||
} else {
|
||||
if (this.dom.guideTrench) {
|
||||
|
@ -266,8 +266,8 @@ Trench.prototype = {
|
|||
else
|
||||
activeVisibleTrench.removeClass('activeTrench');
|
||||
|
||||
visibleTrench.css(this.rect.css());
|
||||
activeVisibleTrench.css((this.activeRect || this.rect).css());
|
||||
visibleTrench.css(this.rect);
|
||||
activeVisibleTrench.css(this.activeRect || this.rect);
|
||||
iQ("body").append(visibleTrench);
|
||||
iQ("body").append(activeVisibleTrench);
|
||||
},
|
||||
|
|
|
@ -295,7 +295,7 @@ let UI = {
|
|||
items.forEach(function(item) {
|
||||
if (item.parent)
|
||||
item.parent.remove(item);
|
||||
groupItem.add(item, null, {immediately: true});
|
||||
groupItem.add(item, {immediately: true});
|
||||
});
|
||||
|
||||
if (firstTime) {
|
||||
|
@ -303,7 +303,7 @@ let UI = {
|
|||
|
||||
let url = gPrefBranch.getCharPref("welcome_url");
|
||||
let newTab = gBrowser.loadOneTab(url, {inBackground: true});
|
||||
let newTabItem = newTab.tabItem;
|
||||
let newTabItem = newTab._tabViewTabItem;
|
||||
let parent = newTabItem.parent;
|
||||
Utils.assert(parent, "should have a parent");
|
||||
|
||||
|
@ -428,15 +428,15 @@ let UI = {
|
|||
let event = document.createEvent("Events");
|
||||
event.initEvent("tabviewshown", true, false);
|
||||
|
||||
if (zoomOut && currentTab && currentTab.tabItem) {
|
||||
item = currentTab.tabItem;
|
||||
if (zoomOut && currentTab && currentTab._tabViewTabItem) {
|
||||
item = currentTab._tabViewTabItem;
|
||||
// If there was a previous currentTab we want to animate
|
||||
// its thumbnail (canvas) for the zoom out.
|
||||
// Note that we start the animation on the chrome thread.
|
||||
|
||||
// Zoom out!
|
||||
item.zoomOut(function() {
|
||||
if (!currentTab.tabItem) // if the tab's been destroyed
|
||||
if (!currentTab._tabViewTabItem) // if the tab's been destroyed
|
||||
item = null;
|
||||
|
||||
self.setActiveTab(item);
|
||||
|
@ -451,8 +451,8 @@ let UI = {
|
|||
dispatchEvent(event);
|
||||
});
|
||||
} else {
|
||||
if (currentTab && currentTab.tabItem)
|
||||
currentTab.tabItem.setZoomPrep(false);
|
||||
if (currentTab && currentTab._tabViewTabItem)
|
||||
currentTab._tabViewTabItem.setZoomPrep(false);
|
||||
|
||||
self.setActiveTab(null);
|
||||
dispatchEvent(event);
|
||||
|
@ -538,6 +538,7 @@ let UI = {
|
|||
this.reset(false);
|
||||
|
||||
TabItems.resumeReconnecting();
|
||||
GroupItems._updateTabBar();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -583,7 +584,6 @@ let UI = {
|
|||
} else if (aTopic == "private-browsing-change-granted") {
|
||||
if (aData == "enter" || aData == "exit") {
|
||||
self._privateBrowsing.transitionMode = aData;
|
||||
GroupItems.pauseUpdatingTabBar();
|
||||
self.storageBusy();
|
||||
}
|
||||
} else if (aTopic == "private-browsing-transition-complete") {
|
||||
|
@ -594,7 +594,6 @@ let UI = {
|
|||
|
||||
self._privateBrowsing.transitionMode = "";
|
||||
self.storageReady();
|
||||
GroupItems.resumeUpdatingTabBar();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -664,8 +663,8 @@ let UI = {
|
|||
// for the tab focus event to pick up.
|
||||
self._closedLastVisibleTab = true;
|
||||
// remove the zoom prep.
|
||||
if (tab && tab.tabItem)
|
||||
tab.tabItem.setZoomPrep(false);
|
||||
if (tab && tab._tabViewTabItem)
|
||||
tab._tabViewTabItem.setZoomPrep(false);
|
||||
self.showTabView();
|
||||
}
|
||||
}
|
||||
|
@ -774,13 +773,15 @@ let UI = {
|
|||
let oldItem = null;
|
||||
let newItem = null;
|
||||
|
||||
if (currentTab && currentTab.tabItem)
|
||||
oldItem = currentTab.tabItem;
|
||||
if (currentTab && currentTab._tabViewTabItem)
|
||||
oldItem = currentTab._tabViewTabItem;
|
||||
|
||||
// update the tab bar for the new tab's group
|
||||
if (tab && tab.tabItem) {
|
||||
newItem = tab.tabItem;
|
||||
GroupItems.updateActiveGroupItemAndTabBar(newItem);
|
||||
if (tab && tab._tabViewTabItem) {
|
||||
if (!TabItems.reconnectingPaused()) {
|
||||
newItem = tab._tabViewTabItem;
|
||||
GroupItems.updateActiveGroupItemAndTabBar(newItem);
|
||||
}
|
||||
} else {
|
||||
// No tabItem; must be an app tab. Base the tab bar on the current group.
|
||||
// If no current group or orphan tab, figure it out based on what's
|
||||
|
@ -789,7 +790,7 @@ let UI = {
|
|||
for (let a = 0; a < gBrowser.tabs.length; a++) {
|
||||
let theTab = gBrowser.tabs[a];
|
||||
if (!theTab.pinned) {
|
||||
let tabItem = theTab.tabItem;
|
||||
let tabItem = theTab._tabViewTabItem;
|
||||
if (tabItem.parent)
|
||||
GroupItems.setActiveGroupItem(tabItem.parent);
|
||||
else
|
||||
|
@ -858,16 +859,15 @@ let UI = {
|
|||
getClosestTab: function UI_getClosestTab(tabCenter) {
|
||||
let cl = null;
|
||||
let clDist;
|
||||
for each(item in TabItems.getItems()) {
|
||||
if (item.parent && item.parent.hidden) {
|
||||
continue;
|
||||
}
|
||||
TabItems.getItems().forEach(function (item) {
|
||||
if (item.parent && item.parent.hidden)
|
||||
return;
|
||||
let testDist = tabCenter.distance(item.bounds.center());
|
||||
if (cl==null || testDist < clDist) {
|
||||
cl = item;
|
||||
clDist = testDist;
|
||||
}
|
||||
}
|
||||
});
|
||||
return cl;
|
||||
},
|
||||
|
||||
|
@ -1098,9 +1098,9 @@ let UI = {
|
|||
iQ(window).unbind("mousemove", updateSize);
|
||||
item.container.removeClass("dragRegion");
|
||||
dragOutInfo.stop();
|
||||
if (phantom.css("opacity") != 1)
|
||||
collapse();
|
||||
else {
|
||||
box = item.getBounds();
|
||||
if (box.width > minMinSize && box.height > minMinSize &&
|
||||
(box.width > minSize || box.height > minSize)) {
|
||||
var bounds = item.getBounds();
|
||||
|
||||
// Add all of the orphaned tabs that are contained inside the new groupItem
|
||||
|
@ -1116,6 +1116,8 @@ let UI = {
|
|||
GroupItems.setActiveGroupItem(groupItem);
|
||||
phantom.remove();
|
||||
dragOutInfo = null;
|
||||
} else {
|
||||
collapse();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1252,7 +1254,7 @@ let UI = {
|
|||
// selected tab is an app tab), just go there.
|
||||
let activeTabItem = this.getActiveTab();
|
||||
if (!activeTabItem) {
|
||||
let tabItem = gBrowser.selectedTab.tabItem;
|
||||
let tabItem = gBrowser.selectedTab._tabViewTabItem;
|
||||
if (tabItem) {
|
||||
if (!tabItem.parent || !tabItem.parent.hidden) {
|
||||
activeTabItem = tabItem;
|
||||
|
|
|
@ -146,6 +146,7 @@ _BROWSER_FILES = \
|
|||
browser_bug562649.js \
|
||||
browser_bug563588.js \
|
||||
browser_bug565575.js \
|
||||
browser_zbug569342.js \
|
||||
browser_bug575561.js \
|
||||
browser_bug577121.js \
|
||||
browser_bug579872.js \
|
||||
|
@ -165,6 +166,7 @@ _BROWSER_FILES = \
|
|||
browser_bug599325.js \
|
||||
browser_bug609700.js \
|
||||
browser_bug616836.js \
|
||||
browser_bug623893.js \
|
||||
browser_contextSearchTabPosition.js \
|
||||
browser_ctrlTab.js \
|
||||
browser_disablechrome.js \
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
loadAndWait("data:text/plain,1", function () {
|
||||
loadAndWait("data:text/plain,2", function () {
|
||||
loadAndWait("data:text/plain,3", runTests);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
duplicate(0, "maintained the original index", function () {
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
duplicate(-1, "went back", function () {
|
||||
duplicate(1, "went forward", function () {
|
||||
gBrowser.removeCurrentTab();
|
||||
gBrowser.removeCurrentTab();
|
||||
gBrowser.addTab();
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function duplicate(delta, msg, cb) {
|
||||
var start = gBrowser.sessionHistory.index;
|
||||
|
||||
duplicateTabIn(gBrowser.selectedTab, "tab", delta);
|
||||
|
||||
gBrowser.selectedBrowser.addEventListener("pageshow", function () {
|
||||
gBrowser.selectedBrowser.removeEventListener("pageshow", arguments.callee, false);
|
||||
is(gBrowser.sessionHistory.index, start + delta, msg);
|
||||
executeSoon(cb);
|
||||
}, false);
|
||||
}
|
||||
|
||||
function loadAndWait(url, cb) {
|
||||
gBrowser.selectedBrowser.addEventListener("load", function () {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
executeSoon(cb);
|
||||
}, true);
|
||||
|
||||
gBrowser.loadURI(url);
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
var gTab = null;
|
||||
|
||||
function cleanUp() {
|
||||
gBrowser.removeTab(gTab);
|
||||
finish();
|
||||
}
|
||||
|
||||
// function borrowed from browser_bug386835.js
|
||||
function load(tab, url, cb) {
|
||||
tab.linkedBrowser.addEventListener("load", function (event) {
|
||||
event.currentTarget.removeEventListener("load", arguments.callee, true);
|
||||
cb();
|
||||
}, true);
|
||||
tab.linkedBrowser.loadURI(url);
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gTab = gBrowser.selectedTab = gBrowser.addTab();
|
||||
ok(gFindBar.hidden, "Find bar should not be visible");
|
||||
|
||||
run_test_1();
|
||||
}
|
||||
|
||||
function run_test_1() {
|
||||
load(gTab, "about:config", function() {
|
||||
ok(gFindBar.hidden, "Find bar should not be visible");
|
||||
EventUtils.synthesizeKey("/", {}, gTab.linkedBrowser.contentWindow);
|
||||
ok(gFindBar.hidden, "Find bar should not be visible");
|
||||
|
||||
run_test_2();
|
||||
});
|
||||
}
|
||||
|
||||
function run_test_2() {
|
||||
load(gTab, "about:addons", function() {
|
||||
ok(gFindBar.hidden, "Find bar should not be visible");
|
||||
EventUtils.synthesizeKey("/", {}, gTab.linkedBrowser.contentWindow);
|
||||
ok(gFindBar.hidden, "Find bar should not be visible");
|
||||
|
||||
cleanUp();
|
||||
});
|
||||
}
|
|
@ -51,12 +51,14 @@ _BROWSER_FILES = \
|
|||
browser_tabview_bug587043.js \
|
||||
browser_tabview_bug587231.js \
|
||||
browser_tabview_bug587351.js \
|
||||
browser_tabview_bug587503.js \
|
||||
browser_tabview_bug587990.js \
|
||||
browser_tabview_bug589324.js \
|
||||
browser_tabview_bug590606.js \
|
||||
browser_tabview_bug591706.js \
|
||||
browser_tabview_bug594176.js \
|
||||
browser_tabview_bug595191.js \
|
||||
browser_tabview_bug595436.js \
|
||||
browser_tabview_bug595518.js \
|
||||
browser_tabview_bug595521.js \
|
||||
browser_tabview_bug595560.js \
|
||||
|
@ -69,9 +71,13 @@ _BROWSER_FILES = \
|
|||
browser_tabview_bug598600.js \
|
||||
browser_tabview_bug599626.js \
|
||||
browser_tabview_bug600645.js \
|
||||
browser_tabview_bug606657.js \
|
||||
browser_tabview_bug606905.js \
|
||||
browser_tabview_bug608037.js \
|
||||
browser_tabview_bug608158.js \
|
||||
browser_tabview_bug618828.js \
|
||||
browser_tabview_bug619937.js \
|
||||
browser_tabview_bug624265.js \
|
||||
browser_tabview_dragdrop.js \
|
||||
browser_tabview_exit_button.js \
|
||||
browser_tabview_group.js \
|
||||
|
|
|
@ -61,7 +61,7 @@ function onTabViewWindowLoaded() {
|
|||
ok(testGroup.isEmpty(), "This group is empty");
|
||||
|
||||
// place tab in group
|
||||
let testTabItem = testTab.tabItem;
|
||||
let testTabItem = testTab._tabViewTabItem;
|
||||
|
||||
if (testTabItem.parent)
|
||||
testTabItem.parent.remove(testTabItem);
|
||||
|
@ -103,8 +103,8 @@ function onTabViewWindowLoaded() {
|
|||
ok((lastTime - initialUpdateTime) > hbTiming, "Tab has been updated:"+lastTime+"-"+initialUpdateTime+">"+hbTiming);
|
||||
|
||||
// clean up
|
||||
testGroup.remove(testTab.tabItem);
|
||||
testTab.tabItem.close();
|
||||
testGroup.remove(testTab._tabViewTabItem);
|
||||
testTab._tabViewTabItem.close();
|
||||
testGroup.close();
|
||||
|
||||
let currentTabs = contentWindow.TabItems.getItems();
|
||||
|
|
|
@ -0,0 +1,245 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is bug 587503 test.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Michael Yoshitaka Erlewine <mitcho@mitcho.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
|
||||
if (TabView.isVisible())
|
||||
onTabViewWindowLoaded();
|
||||
else
|
||||
TabView.show();
|
||||
}
|
||||
|
||||
function onTabViewWindowLoaded() {
|
||||
window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
|
||||
|
||||
ok(TabView.isVisible(), "Tab View is visible");
|
||||
|
||||
let contentWindow = document.getElementById("tab-view").contentWindow;
|
||||
let [originalTab] = gBrowser.visibleTabs;
|
||||
|
||||
let currentGroup = contentWindow.GroupItems.getActiveGroupItem();
|
||||
|
||||
// Create a group and make it active
|
||||
let box = new contentWindow.Rect(100, 100, 370, 370);
|
||||
let group = new contentWindow.GroupItem([], { bounds: box });
|
||||
ok(group.isEmpty(), "This group is empty");
|
||||
contentWindow.GroupItems.setActiveGroupItem(group);
|
||||
|
||||
// Create a bunch of tabs in the group
|
||||
let tabs = [];
|
||||
tabs.push(gBrowser.loadOneTab("about:blank#0", {inBackground: true}));
|
||||
tabs.push(gBrowser.loadOneTab("about:blank#1", {inBackground: true}));
|
||||
tabs.push(gBrowser.loadOneTab("about:blank#2", {inBackground: true}));
|
||||
tabs.push(gBrowser.loadOneTab("about:blank#3", {inBackground: true}));
|
||||
tabs.push(gBrowser.loadOneTab("about:blank#4", {inBackground: true}));
|
||||
tabs.push(gBrowser.loadOneTab("about:blank#5", {inBackground: true}));
|
||||
tabs.push(gBrowser.loadOneTab("about:blank#6", {inBackground: true}));
|
||||
|
||||
ok(!group.shouldStack(group._children.length), "Group should not stack.");
|
||||
|
||||
// PREPARE FINISH:
|
||||
group.addSubscriber(group, "close", function() {
|
||||
group.removeSubscriber(group, "close");
|
||||
|
||||
ok(group.isEmpty(), "The group is empty again");
|
||||
|
||||
contentWindow.GroupItems.setActiveGroupItem(currentGroup);
|
||||
isnot(contentWindow.GroupItems.getActiveGroupItem(), null, "There is an active group");
|
||||
is(gBrowser.tabs.length, 1, "There is only one tab left");
|
||||
is(gBrowser.visibleTabs.length, 1, "There is also only one visible tab");
|
||||
|
||||
let onTabViewHidden = function() {
|
||||
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
|
||||
finish();
|
||||
};
|
||||
window.addEventListener("tabviewhidden", onTabViewHidden, false);
|
||||
gBrowser.selectedTab = originalTab;
|
||||
|
||||
TabView.hide();
|
||||
});
|
||||
|
||||
// STAGE 1: move the last tab to the third position
|
||||
let currentTarget = tabs[6]._tabViewTabItem;
|
||||
let currentPos = currentTarget.getBounds().center();
|
||||
let targetPos = tabs[2]._tabViewTabItem.getBounds().center();
|
||||
let vector = new contentWindow.Point(targetPos.x - currentPos.x,
|
||||
targetPos.y - currentPos.y);
|
||||
checkDropIndexAndDropSpace(currentTarget, group, vector.x, vector.y, contentWindow,
|
||||
function(index, dropSpaceActiveValues) {
|
||||
// Now: 0, 1, 6, 2, 3, 4, 5
|
||||
is(index, 2, "Tab 6 is now in the third position");
|
||||
is(dropSpaceActiveValues[0], true, "dropSpace was always showing");
|
||||
|
||||
// STAGE 2: move the second tab to the end of the list
|
||||
let currentTarget = tabs[1]._tabViewTabItem;
|
||||
let currentPos = currentTarget.getBounds().center();
|
||||
// pick a point in that empty bottom part of the group
|
||||
let groupBounds = group.getBounds();
|
||||
let bottomPos = new contentWindow.Point(
|
||||
(groupBounds.left + groupBounds.right) / 2,
|
||||
groupBounds.bottom - 15);
|
||||
let vector = new contentWindow.Point(bottomPos.x - currentPos.x,
|
||||
bottomPos.y - currentPos.y);
|
||||
checkDropIndexAndDropSpace(currentTarget, group, vector.x, vector.y, contentWindow,
|
||||
function(index, dropSpaceActiveValues) {
|
||||
// Now: 0, 6, 2, 3, 4, 5, 1
|
||||
is(index, 6, "Tab 1 is now at the end of the group");
|
||||
is(dropSpaceActiveValues[0], true, "dropSpace was always showing");
|
||||
|
||||
// STAGE 3: move the fifth tab outside the group
|
||||
// Note: there should be room below the active group...
|
||||
let currentTarget = tabs[4]._tabViewTabItem;
|
||||
let currentPos = currentTarget.getBounds().center();
|
||||
// Pick a point below the group.
|
||||
let belowPos = new contentWindow.Point(
|
||||
(groupBounds.left + groupBounds.right) / 2,
|
||||
groupBounds.bottom + 300);
|
||||
let vector = new contentWindow.Point(belowPos.x - currentPos.x,
|
||||
belowPos.y - currentPos.y);
|
||||
checkDropIndexAndDropSpace(currentTarget, group, vector.x, vector.y, contentWindow,
|
||||
function(index, dropSpaceActiveValues) {
|
||||
// Now: 0, 6, 2, 3, 5, 1
|
||||
is(index, -1, "Tab 5 is no longer in the group");
|
||||
contentWindow.Utils.log('dropSpaceActiveValues',dropSpaceActiveValues);
|
||||
is(dropSpaceActiveValues[0], true, "The group began by showing a dropSpace");
|
||||
is(dropSpaceActiveValues[dropSpaceActiveValues.length - 1], false, "In the end, the group was not showing a dropSpace");
|
||||
|
||||
// We wrap this in a setTimeout with 1000ms delay in order to wait for the
|
||||
// tab to resize, as it does after we drop it in stage 3 outside of the group.
|
||||
setTimeout(function() {
|
||||
// STAGE 4: move the fifth tab back into the group, on the second row.
|
||||
let currentTarget = tabs[4]._tabViewTabItem;
|
||||
let currentPos = currentTarget.getBounds().center();
|
||||
let targetPos = tabs[5]._tabViewTabItem.getBounds().center();
|
||||
// contentWindow.Utils.log(targetPos, currentPos);
|
||||
vector = new contentWindow.Point(targetPos.x - currentPos.x,
|
||||
targetPos.y - currentPos.y);
|
||||
// Call with time = 4000
|
||||
checkDropIndexAndDropSpace(currentTarget, group, vector.x, vector.y, contentWindow,
|
||||
function(index, dropSpaceActiveValues) {
|
||||
// Now: 0, 6, 2, 3, 4, 5, 1
|
||||
is(index, 4, "Tab 5 is back and again the fifth tab.");
|
||||
contentWindow.Utils.log('dropSpaceActiveValues',dropSpaceActiveValues);
|
||||
is(dropSpaceActiveValues[0], false, "The group began by not showing a dropSpace");
|
||||
is(dropSpaceActiveValues[dropSpaceActiveValues.length - 1], true, "In the end, the group was showing a dropSpace");
|
||||
|
||||
// Get rid of the group and its children
|
||||
// The group close will trigger a finish().
|
||||
group.closeAll();
|
||||
group.closeHidden();
|
||||
}, 6000, false);
|
||||
},1000);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function simulateSlowDragDrop(srcElement, offsetX, offsetY, contentWindow, time) {
|
||||
// enter drag mode
|
||||
let dataTransfer;
|
||||
|
||||
// contentWindow.Utils.log('offset', offsetX, offsetY);
|
||||
let bounds = srcElement.getBoundingClientRect();
|
||||
// contentWindow.Utils.log('original center', bounds.left + bounds.width / 2, bounds.top + bounds.height / 2);
|
||||
|
||||
EventUtils.synthesizeMouse(
|
||||
srcElement, 2, 2, { type: "mousedown" }, contentWindow);
|
||||
let event = contentWindow.document.createEvent("DragEvents");
|
||||
event.initDragEvent(
|
||||
"dragenter", true, true, contentWindow, 0, 0, 0, 0, 0,
|
||||
false, false, false, false, 1, null, dataTransfer);
|
||||
srcElement.dispatchEvent(event);
|
||||
|
||||
let steps = 20;
|
||||
|
||||
// drag over
|
||||
let moveIncremental = function moveIncremental(i, steps) {
|
||||
// calculate how much to move
|
||||
let offsetXDiff = Math.round(i * offsetX / steps) - Math.round((i - 1) * offsetX / steps);
|
||||
let offsetYDiff = Math.round(i * offsetY / steps) - Math.round((i - 1) * offsetY / steps);
|
||||
// contentWindow.Utils.log('step', offsetXDiff, offsetYDiff);
|
||||
// simulate mousemove
|
||||
EventUtils.synthesizeMouse(
|
||||
srcElement, offsetXDiff + 2, offsetYDiff + 2,
|
||||
{ type: "mousemove" }, contentWindow);
|
||||
// simulate dragover
|
||||
let event = contentWindow.document.createEvent("DragEvents");
|
||||
event.initDragEvent(
|
||||
"dragover", true, true, contentWindow, 0, 0, 0, 0, 0,
|
||||
false, false, false, false, 0, null, dataTransfer);
|
||||
srcElement.dispatchEvent(event);
|
||||
let bounds = srcElement.getBoundingClientRect();
|
||||
// contentWindow.Utils.log(i, 'center', bounds.left + bounds.width / 2, bounds.top + bounds.height / 2);
|
||||
};
|
||||
for (let i = 1; i <= steps; i++)
|
||||
setTimeout(moveIncremental, i / (steps + 1) * time, i, steps);
|
||||
|
||||
// drop
|
||||
let finalDrop = function finalDrop() {
|
||||
EventUtils.synthesizeMouseAtCenter(srcElement, { type: "mouseup" }, contentWindow);
|
||||
event = contentWindow.document.createEvent("DragEvents");
|
||||
event.initDragEvent(
|
||||
"drop", true, true, contentWindow, 0, 0, 0, 0, 0,
|
||||
false, false, false, false, 0, null, dataTransfer);
|
||||
srcElement.dispatchEvent(event);
|
||||
contentWindow.iQ(srcElement).css({border: 'green 1px solid'});
|
||||
}
|
||||
setTimeout(finalDrop, time);
|
||||
}
|
||||
|
||||
function checkDropIndexAndDropSpace(item, group, offsetX, offsetY, contentWindow, callback, time) {
|
||||
contentWindow.UI.setActiveTab(item);
|
||||
let dropSpaceActiveValues = [];
|
||||
let recordDropSpaceValue = function() {
|
||||
dropSpaceActiveValues.push(group._dropSpaceActive);
|
||||
};
|
||||
// contentWindow.iQ(item.container).css({border: 'red 1px solid'});
|
||||
let onDrop = function() {
|
||||
item.container.removeEventListener('dragover', recordDropSpaceValue, false);
|
||||
item.container.removeEventListener('drop', onDrop, false);
|
||||
let index = group._children.indexOf(item);
|
||||
callback(index, dropSpaceActiveValues);
|
||||
};
|
||||
item.container.addEventListener('dragover', recordDropSpaceValue, false);
|
||||
item.container.addEventListener('drop', onDrop, false);
|
||||
simulateSlowDragDrop(item.container, offsetX, offsetY, contentWindow, time || 1000);
|
||||
}
|
|
@ -55,7 +55,7 @@ function onTabViewWindowLoaded() {
|
|||
|
||||
// Create a first tab and orphan it
|
||||
let firstTab = gBrowser.loadOneTab("about:blank#1", {inBackground: true});
|
||||
let firstTabItem = firstTab.tabItem;
|
||||
let firstTabItem = firstTab._tabViewTabItem;
|
||||
let currentGroup = contentWindow.GroupItems.getActiveGroupItem();
|
||||
ok(currentGroup.getChildren().some(function(child) child == firstTabItem),"The first tab was made in the current group");
|
||||
contentWindow.GroupItems.getActiveGroupItem().remove(firstTabItem);
|
||||
|
@ -69,7 +69,7 @@ function onTabViewWindowLoaded() {
|
|||
|
||||
// Create a second tab in this new group
|
||||
let secondTab = gBrowser.loadOneTab("about:blank#2", {inBackground: true});
|
||||
let secondTabItem = secondTab.tabItem;
|
||||
let secondTabItem = secondTab._tabViewTabItem;
|
||||
ok(group.getChildren().some(function(child) child == secondTabItem),"The second tab was made in our new group");
|
||||
is(group.getChildren().length, 1, "Only one tab in the first group");
|
||||
isnot(firstTab.linkedBrowser.contentWindow.location, secondTab.linkedBrowser.contentWindow.location, "The two tabs must have different locations");
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is a test for bug 595436.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Tim Taubert <tim.taubert@gmx.de>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
window.addEventListener('tabviewshown', onTabViewWindowLoaded, false);
|
||||
TabView.toggle();
|
||||
}
|
||||
|
||||
function onTabViewWindowLoaded() {
|
||||
window.removeEventListener('tabviewshown', onTabViewWindowLoaded, false);
|
||||
|
||||
let contentWindow = document.getElementById('tab-view').contentWindow;
|
||||
let search = contentWindow.document.getElementById('search');
|
||||
let searchButton = contentWindow.document.getElementById('searchbutton');
|
||||
|
||||
let isSearchEnabled = function () {
|
||||
return 'none' != search.style.display;
|
||||
}
|
||||
|
||||
let assertSearchIsEnabled = function () {
|
||||
ok(isSearchEnabled(), 'search is enabled');
|
||||
}
|
||||
|
||||
let assertSearchIsDisabled = function () {
|
||||
ok(!isSearchEnabled(), 'search is disabled');
|
||||
}
|
||||
|
||||
let testSearchInitiatedByKeyPress = function () {
|
||||
EventUtils.synthesizeKey('a', {});
|
||||
assertSearchIsEnabled();
|
||||
|
||||
EventUtils.synthesizeKey('VK_BACK_SPACE', {});
|
||||
assertSearchIsDisabled();
|
||||
}
|
||||
|
||||
let testSearchInitiatedByMouseClick = function () {
|
||||
EventUtils.sendMouseEvent({type: 'mousedown'}, searchButton, contentWindow);
|
||||
assertSearchIsEnabled();
|
||||
|
||||
EventUtils.synthesizeKey('a', {});
|
||||
EventUtils.synthesizeKey('VK_BACK_SPACE', {});
|
||||
EventUtils.synthesizeKey('VK_BACK_SPACE', {});
|
||||
assertSearchIsEnabled();
|
||||
|
||||
EventUtils.synthesizeKey('VK_ESCAPE', {});
|
||||
assertSearchIsDisabled();
|
||||
}
|
||||
|
||||
let finishTest = function () {
|
||||
let onTabViewHidden = function () {
|
||||
window.removeEventListener('tabviewhidden', onTabViewHidden, false);
|
||||
finish();
|
||||
}
|
||||
|
||||
window.addEventListener('tabviewhidden', onTabViewHidden, false);
|
||||
TabView.hide();
|
||||
}
|
||||
|
||||
assertSearchIsDisabled();
|
||||
|
||||
testSearchInitiatedByKeyPress();
|
||||
testSearchInitiatedByMouseClick();
|
||||
|
||||
finishTest();
|
||||
}
|
|
@ -97,7 +97,7 @@ function testThree(contentWindow) {
|
|||
"tabviewsearchenabled", onSearchEnabled, false);
|
||||
|
||||
let searchBox = contentWindow.iQ("#searchbox");
|
||||
searchBox.val(newTabOne.tabItem.nameEl.innerHTML);
|
||||
searchBox.val(newTabOne._tabViewTabItem.nameEl.innerHTML);
|
||||
|
||||
contentWindow.performSearch();
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ function onTabViewWindowLoaded() {
|
|||
ok(group1.isEmpty(), "This group is empty");
|
||||
contentWindow.GroupItems.setActiveGroupItem(group1);
|
||||
let tab1 = gBrowser.loadOneTab("about:blank#1", {inBackground: true});
|
||||
let tab1Item = tab1.tabItem;
|
||||
let tab1Item = tab1._tabViewTabItem;
|
||||
ok(group1.getChildren().some(function(child) child == tab1Item), "The tab was made in our new group");
|
||||
is(group1.getChildren().length, 1, "Only one tab in the first group");
|
||||
|
||||
|
|
|
@ -102,6 +102,6 @@ function onTabViewWindowLoaded() {
|
|||
}
|
||||
|
||||
window.addEventListener("tabviewhidden", onTabViewHidden, false);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, normalXulTab.tabItem.container, contentWindow);
|
||||
EventUtils.sendMouseEvent({ type: "mouseup" }, normalXulTab.tabItem.container, contentWindow);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, normalXulTab._tabViewTabItem.container, contentWindow);
|
||||
EventUtils.sendMouseEvent({ type: "mouseup" }, normalXulTab._tabViewTabItem.container, contentWindow);
|
||||
}
|
|
@ -100,22 +100,30 @@ function setupTwo() {
|
|||
restoredWin.removeEventListener(
|
||||
"tabviewframeinitialized", onTabViewFrameInitialized, false);
|
||||
|
||||
/*
|
||||
// bug 615954 happens too often so we disable this until we have a fix
|
||||
let restoredContentWindow =
|
||||
restoredWin.document.getElementById("tab-view").contentWindow;
|
||||
// prevent TabItems._update being called before checking cached images
|
||||
restoredContentWindow.TabItems._pauseUpdateForTest = true;
|
||||
*/
|
||||
restoredWin.close();
|
||||
finish();
|
||||
}
|
||||
restoredWin.addEventListener(
|
||||
"tabviewframeinitialized", onTabViewFrameInitialized, false);
|
||||
|
||||
restoredWin.addEventListener("tabviewshown", onTabViewShown, false);
|
||||
|
||||
is(restoredWin.gBrowser.tabs.length, 2, "The total number of tabs is 2");
|
||||
|
||||
/*
|
||||
// bug 615954 happens too often so we disable this until we have a fix
|
||||
restoredWin.addEventListener("tabviewshown", onTabViewShown, false);
|
||||
|
||||
// setup tab variables and listen to the load progress.
|
||||
newTabOne = restoredWin.gBrowser.tabs[0];
|
||||
newTabTwo = restoredWin.gBrowser.tabs[1];
|
||||
restoredWin.gBrowser.addTabsProgressListener(gTabsProgressListener);
|
||||
*/
|
||||
}, false);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TabView Groups.
|
||||
* The Original Code is a test for bug 606657.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
|
@ -19,8 +19,7 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Edward Lee <edilee@mozilla.com>
|
||||
* Ian Gilman <ian@iangilman.com>
|
||||
* Tim Taubert <tim.taubert@gmx.de>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -36,35 +35,31 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
const Cr = Components.results;
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
window.addEventListener('tabviewshown', onTabViewWindowLoaded, false);
|
||||
TabView.toggle();
|
||||
}
|
||||
|
||||
let EXPORTED_SYMBOLS = ["Groups"];
|
||||
function onTabViewWindowLoaded() {
|
||||
window.removeEventListener('tabviewshown', onTabViewWindowLoaded, false);
|
||||
|
||||
let Groups = let (T = {
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//// Public
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
let [tab] = gBrowser.tabs;
|
||||
let groupId = tab._tabViewTabItem.parent.id;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//// Private
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
let finishTest = function () {
|
||||
let onTabViewHidden = function () {
|
||||
window.removeEventListener('tabviewhidden', onTabViewHidden, false);
|
||||
finish();
|
||||
}
|
||||
|
||||
init: function init() {
|
||||
// Only allow calling init once
|
||||
T.init = function() T;
|
||||
|
||||
// load all groups data
|
||||
// presumably we can load from app global, not a window
|
||||
// how do we know which window has which group?
|
||||
// load tab data to figure out which go into which group
|
||||
// set up interface for subscribing to our data
|
||||
|
||||
return T;
|
||||
window.addEventListener('tabviewhidden', onTabViewHidden, false);
|
||||
TabView.hide();
|
||||
}
|
||||
}) T.init();
|
||||
|
||||
TabView.moveTabTo(tab, groupId);
|
||||
is(tab._tabViewTabItem.parent.id, groupId, 'tab did not change its group');
|
||||
|
||||
finishTest();
|
||||
}
|
|
@ -83,8 +83,8 @@ function onTabViewWindowLoaded() {
|
|||
is(groupItems[0].getChildren().length, 2, "The group has two tab items");
|
||||
|
||||
tabTwo = undoCloseTab(0);
|
||||
tabTwo.tabItem.addSubscriber(tabTwo, "reconnected", function() {
|
||||
tabTwo.tabItem.removeSubscriber(tabTwo, "reconnected");
|
||||
tabTwo._tabViewTabItem.addSubscriber(tabTwo, "reconnected", function() {
|
||||
tabTwo._tabViewTabItem.removeSubscriber(tabTwo, "reconnected");
|
||||
|
||||
ok(TabView.isVisible(), "Tab View is still visible after restoring a tab");
|
||||
is(groupItems[0].getChildren().length, 3, "The group still has three tab items");
|
||||
|
|
|
@ -0,0 +1,128 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is a test for bug 618828.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Tim Taubert <tim.taubert@gmx.de>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
ok(!TabView.isVisible(), 'TabView is hidden');
|
||||
let tab = gBrowser.loadOneTab('about:blank#other', {inBackground: true});
|
||||
|
||||
TabView._initFrame(function () {
|
||||
newWindowWithTabView(function (win) {
|
||||
onTabViewWindowLoaded(win, tab);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function onTabViewWindowLoaded(win, tab) {
|
||||
let contentWindow = win.TabView.getContentWindow();
|
||||
let search = contentWindow.document.getElementById('search');
|
||||
let searchbox = contentWindow.document.getElementById('searchbox');
|
||||
let searchButton = contentWindow.document.getElementById('searchbutton');
|
||||
let results = contentWindow.document.getElementById('results');
|
||||
|
||||
let isSearchEnabled = function () {
|
||||
return 'none' != search.style.display;
|
||||
}
|
||||
|
||||
let assertSearchIsEnabled = function () {
|
||||
ok(isSearchEnabled(), 'search is enabled');
|
||||
}
|
||||
|
||||
let assertSearchIsDisabled = function () {
|
||||
ok(!isSearchEnabled(), 'search is disabled');
|
||||
}
|
||||
|
||||
let enableSearch = function () {
|
||||
assertSearchIsDisabled();
|
||||
EventUtils.sendMouseEvent({type: 'mousedown'}, searchButton, contentWindow);
|
||||
}
|
||||
|
||||
let finishTest = function () {
|
||||
win.close();
|
||||
gBrowser.removeTab(tab);
|
||||
finish();
|
||||
}
|
||||
|
||||
let testClickOnSearchBox = function () {
|
||||
EventUtils.synthesizeMouseAtCenter(searchbox, {}, contentWindow);
|
||||
assertSearchIsEnabled();
|
||||
}
|
||||
|
||||
let testClickOnOtherSearchResult = function () {
|
||||
// search for the tab from our main window
|
||||
searchbox.setAttribute('value', 'other');
|
||||
contentWindow.performSearch();
|
||||
|
||||
// prepare to finish when the main window gets focus back
|
||||
window.addEventListener('focus', function () {
|
||||
window.removeEventListener('focus', arguments.callee, true);
|
||||
assertSearchIsDisabled();
|
||||
|
||||
// check that the right tab is active
|
||||
is(gBrowser.selectedTab, tab, 'search result is the active tab');
|
||||
|
||||
finishTest();
|
||||
}, true);
|
||||
|
||||
// click the first result
|
||||
ok(results.firstChild, 'search returns one result');
|
||||
EventUtils.synthesizeMouseAtCenter(results.firstChild, {}, contentWindow);
|
||||
}
|
||||
|
||||
enableSearch();
|
||||
assertSearchIsEnabled();
|
||||
|
||||
testClickOnSearchBox();
|
||||
testClickOnOtherSearchResult();
|
||||
}
|
||||
|
||||
// ---------
|
||||
function newWindowWithTabView(callback) {
|
||||
let win = window.openDialog(getBrowserURL(), "_blank",
|
||||
"chrome,all,dialog=no,height=800,width=800");
|
||||
let onLoad = function() {
|
||||
win.removeEventListener("load", onLoad, false);
|
||||
let onShown = function() {
|
||||
win.removeEventListener("tabviewshown", onShown, false);
|
||||
callback(win);
|
||||
};
|
||||
win.addEventListener("tabviewshown", onShown, false);
|
||||
win.TabView.toggle();
|
||||
}
|
||||
win.addEventListener("load", onLoad, false);
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Panorama bug 619937 (clicking the background) test.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Michael Yoshitaka Erlewine <mitcho@mitcho.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
|
||||
TabView.toggle();
|
||||
}
|
||||
|
||||
function endGame() {
|
||||
window.removeEventListener("tabviewhidden", endGame, false);
|
||||
ok(!TabView.isVisible(), "Tab View is hidden");
|
||||
|
||||
finish();
|
||||
};
|
||||
|
||||
function onTabViewWindowLoaded() {
|
||||
window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
|
||||
ok(TabView.isVisible(), "Tab View is visible");
|
||||
|
||||
let contentWindow = document.getElementById("tab-view").contentWindow;
|
||||
|
||||
// establish initial state
|
||||
is(contentWindow.GroupItems.groupItems.length, 1,
|
||||
"we start with one group (the default)");
|
||||
is(gBrowser.tabs.length, 1, "we start with one tab");
|
||||
let originalTab = gBrowser.tabs[0];
|
||||
|
||||
let bg = contentWindow.document.getElementById("bg");
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" }, bg, contentWindow);
|
||||
|
||||
is(contentWindow.GroupItems.groupItems.length, 1,
|
||||
"we should still only have one group");
|
||||
|
||||
window.addEventListener("tabviewhidden", endGame, false);
|
||||
TabView.toggle();
|
||||
}
|
|
@ -0,0 +1,232 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is tabview bug 624265 test.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Tim Taubert <tim.taubert@gmx.de>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
let pb = Cc['@mozilla.org/privatebrowsing;1'].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
|
||||
function test() {
|
||||
let tests = [];
|
||||
|
||||
let getContentWindow = function () {
|
||||
return TabView.getContentWindow();
|
||||
}
|
||||
|
||||
let assertOneSingleGroupItem = function () {
|
||||
is(getContentWindow().GroupItems.groupItems.length, 1, 'There is one single groupItem');
|
||||
}
|
||||
|
||||
let assertNumberOfVisibleTabs = function (numTabs) {
|
||||
is(gBrowser.visibleTabs.length, numTabs, 'There should be ' + numTabs + ' visible tabs');
|
||||
}
|
||||
|
||||
let restoreTab = function (callback) {
|
||||
let tab = undoCloseTab(0);
|
||||
|
||||
tab._tabViewTabItem.addSubscriber(tab, 'reconnected', function () {
|
||||
tab._tabViewTabItem.removeSubscriber(tab, 'reconnected');
|
||||
afterAllTabsLoaded(callback);
|
||||
});
|
||||
}
|
||||
|
||||
let next = function () {
|
||||
while (gBrowser.tabs.length-1)
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
|
||||
hideTabView(function () {
|
||||
let callback = tests.shift();
|
||||
|
||||
if (!callback)
|
||||
callback = finish;
|
||||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
// ----------
|
||||
// [624265] testing undo close tab
|
||||
let testUndoCloseTabs = function () {
|
||||
gBrowser.loadOneTab('http://mochi.test:8888/', {inBackground: true});
|
||||
gBrowser.loadOneTab('http://mochi.test:8888/', {inBackground: true});
|
||||
|
||||
afterAllTabsLoaded(function () {
|
||||
assertNumberOfVisibleTabs(3);
|
||||
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
gBrowser.selectedTab = gBrowser.tabs[1];
|
||||
|
||||
restoreTab(function () {
|
||||
assertNumberOfVisibleTabs(3);
|
||||
assertOneSingleGroupItem();
|
||||
next();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ----------
|
||||
// [623792] duplicating tab via middle click on reload button
|
||||
let testDuplicateTab = function () {
|
||||
gBrowser.loadOneTab('http://mochi.test:8888/', {inBackground: true});
|
||||
|
||||
afterAllTabsLoaded(function () {
|
||||
duplicateTabIn(gBrowser.selectedTab, 'current');
|
||||
|
||||
afterAllTabsLoaded(function () {
|
||||
assertNumberOfVisibleTabs(3);
|
||||
assertOneSingleGroupItem();
|
||||
next();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ----------
|
||||
// [623792] duplicating tabs via middle click on forward/back buttons
|
||||
let testBackForwardDuplicateTab = function () {
|
||||
let tab = gBrowser.loadOneTab('http://mochi.test:8888/#1', {inBackground: true});
|
||||
gBrowser.selectedTab = tab;
|
||||
|
||||
let continueTest = function () {
|
||||
tab.linkedBrowser.loadURI('http://mochi.test:8888/#2');
|
||||
|
||||
afterAllTabsLoaded(function () {
|
||||
ok(gBrowser.canGoBack, 'browser can go back in history');
|
||||
BrowserBack({button: 1});
|
||||
|
||||
afterAllTabsLoaded(function () {
|
||||
assertNumberOfVisibleTabs(3);
|
||||
|
||||
ok(gBrowser.canGoForward, 'browser can go forward in history');
|
||||
BrowserForward({button: 1});
|
||||
|
||||
afterAllTabsLoaded(function () {
|
||||
assertNumberOfVisibleTabs(4);
|
||||
assertOneSingleGroupItem();
|
||||
next();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// The executeSoon() call is really needed here because there's probably
|
||||
// some callback waiting to be fired after gBrowser.loadOneTab(). After
|
||||
// that the browser is in a state where loadURI() will create a new entry
|
||||
// in the session history (that is vital for back/forward functionality).
|
||||
afterAllTabsLoaded(function () SimpleTest.executeSoon(continueTest));
|
||||
}
|
||||
|
||||
// ----------
|
||||
// [624102] check state after return from private browsing
|
||||
let testPrivateBrowsing = function () {
|
||||
gBrowser.loadOneTab('http://mochi.test:8888/#1', {inBackground: true});
|
||||
gBrowser.loadOneTab('http://mochi.test:8888/#2', {inBackground: true});
|
||||
|
||||
let cw = getContentWindow();
|
||||
let box = new cw.Rect(20, 20, 250, 200);
|
||||
let groupItem = new cw.GroupItem([], {bounds: box, immediately: true});
|
||||
cw.GroupItems.setActiveGroupItem(groupItem);
|
||||
|
||||
gBrowser.selectedTab = gBrowser.loadOneTab('http://mochi.test:8888/#3', {inBackground: true});
|
||||
gBrowser.loadOneTab('http://mochi.test:8888/#4', {inBackground: true});
|
||||
|
||||
afterAllTabsLoaded(function () {
|
||||
assertNumberOfVisibleTabs(2);
|
||||
|
||||
enterAndLeavePrivateBrowsing(function () {
|
||||
assertNumberOfVisibleTabs(2);
|
||||
next();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
// tests for #624265
|
||||
tests.push(testUndoCloseTabs);
|
||||
|
||||
// tests for #623792
|
||||
tests.push(testDuplicateTab);
|
||||
tests.push(testBackForwardDuplicateTab);
|
||||
|
||||
// tests for #624102
|
||||
tests.push(testPrivateBrowsing);
|
||||
|
||||
loadTabView(next);
|
||||
}
|
||||
|
||||
// ----------
|
||||
function loadTabView(callback) {
|
||||
window.addEventListener('tabviewshown', function () {
|
||||
window.removeEventListener('tabviewshown', arguments.callee, false);
|
||||
|
||||
hideTabView(function () {
|
||||
window.removeEventListener('tabviewhidden', arguments.callee, false);
|
||||
callback();
|
||||
});
|
||||
}, false);
|
||||
|
||||
TabView.show();
|
||||
}
|
||||
|
||||
// ----------
|
||||
function hideTabView(callback) {
|
||||
if (!TabView.isVisible())
|
||||
return callback();
|
||||
|
||||
window.addEventListener('tabviewhidden', function () {
|
||||
window.removeEventListener('tabviewhidden', arguments.callee, false);
|
||||
callback();
|
||||
}, false);
|
||||
|
||||
TabView.hide();
|
||||
}
|
||||
|
||||
// ----------
|
||||
function enterAndLeavePrivateBrowsing(callback) {
|
||||
function pbObserver(aSubject, aTopic, aData) {
|
||||
if (aTopic != "private-browsing-transition-complete")
|
||||
return;
|
||||
|
||||
if (pb.privateBrowsingEnabled)
|
||||
pb.privateBrowsingEnabled = false;
|
||||
else {
|
||||
Services.obs.removeObserver(pbObserver, "private-browsing-transition-complete");
|
||||
afterAllTabsLoaded(callback);
|
||||
}
|
||||
}
|
||||
|
||||
Services.obs.addObserver(pbObserver, "private-browsing-transition-complete", false);
|
||||
pb.privateBrowsingEnabled = true;
|
||||
}
|
|
@ -63,7 +63,7 @@ function onTabViewWindowLoaded() {
|
|||
let contentWindow = newWin.document.getElementById("tab-view").contentWindow;
|
||||
|
||||
// 1) the tab should belong to a group, and no orphan tabs
|
||||
ok(tabOne.tabItem.parent, "Tab one belongs to a group");
|
||||
ok(tabOne._tabViewTabItem.parent, "Tab one belongs to a group");
|
||||
is(contentWindow.GroupItems.getOrphanedTabs().length, 0, "No orphaned tabs");
|
||||
|
||||
// 2) create a group, add a blank tab
|
||||
|
|
|
@ -147,7 +147,7 @@ function verifyCleanState(mode) {
|
|||
let prefix = "we " + (mode || "finish") + " with ";
|
||||
is(gBrowser.tabs.length, 1, prefix + "one tab");
|
||||
is(contentWindow.GroupItems.groupItems.length, 1, prefix + "1 group");
|
||||
ok(gBrowser.tabs[0].tabItem.parent == contentWindow.GroupItems.groupItems[0],
|
||||
ok(gBrowser.tabs[0]._tabViewTabItem.parent == contentWindow.GroupItems.groupItems[0],
|
||||
"the tab is in the group");
|
||||
ok(!pb.privateBrowsingEnabled, prefix + "private browsing off");
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ function verifyPB() {
|
|||
ok(pb.privateBrowsingEnabled == true, "private browsing is on");
|
||||
is(gBrowser.tabs.length, 1, "we have 1 tab in private browsing");
|
||||
is(contentWindow.GroupItems.groupItems.length, 1, "we have 1 group in private browsing");
|
||||
ok(gBrowser.tabs[0].tabItem.parent == contentWindow.GroupItems.groupItems[0],
|
||||
ok(gBrowser.tabs[0]._tabViewTabItem.parent == contentWindow.GroupItems.groupItems[0],
|
||||
"the tab is in the group");
|
||||
|
||||
let browser = gBrowser.tabs[0].linkedBrowser;
|
||||
|
@ -184,7 +184,7 @@ function verifyNormal() {
|
|||
let groupItem = contentWindow.GroupItems.groupItems[a];
|
||||
is(groupItem.getTitle(), groupTitles[a], prefix + "correct group title");
|
||||
|
||||
ok(tab.tabItem.parent == groupItem,
|
||||
ok(tab._tabViewTabItem.parent == groupItem,
|
||||
prefix + "tab " + a + " is in group " + a);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,3 +49,27 @@ function createEmptyGroupItem(contentWindow, width, height, padding, noAnimation
|
|||
|
||||
return emptyGroupItem;
|
||||
}
|
||||
|
||||
// ----------
|
||||
function afterAllTabsLoaded(callback) {
|
||||
let stillToLoad = 0;
|
||||
|
||||
function onLoad() {
|
||||
this.removeEventListener("load", onLoad, true);
|
||||
|
||||
stillToLoad--;
|
||||
if (!stillToLoad)
|
||||
callback();
|
||||
}
|
||||
|
||||
for (let a = 0; a < gBrowser.tabs.length; a++) {
|
||||
let browser = gBrowser.tabs[a].linkedBrowser;
|
||||
if (browser.contentDocument.readyState != "complete") {
|
||||
stillToLoad++;
|
||||
browser.addEventListener("load", onLoad, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (!stillToLoad)
|
||||
callback();
|
||||
}
|
||||
|
|
|
@ -1075,31 +1075,6 @@
|
|||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="splitmenu">
|
||||
<content>
|
||||
<xul:menuitem anonid="item" flex="1"
|
||||
class="menuitem-tooltip split-menuitem-item"
|
||||
xbl:inherits="label,key"/>
|
||||
<xul:menu anonid="menu" class="split-menuitem-menu"
|
||||
oncommand="event.stopPropagation();">
|
||||
<children includes="menupopup"/>
|
||||
</xul:menu>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
if (this.getAttribute("iconic") == "true") {
|
||||
this.item.classList.remove("menuitem-tooltip");
|
||||
this.item.classList.add("menuitem-iconic-tooltip");
|
||||
this.item.classList.add("menuitem-iconic");
|
||||
}
|
||||
]]></constructor>
|
||||
<field name="item" readonly="true">
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "item");
|
||||
</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="addon-progress-notification" extends="chrome://global/content/bindings/notification.xml#popup-notification">
|
||||
<content align="start">
|
||||
<xul:image class="popup-notification-icon"
|
||||
|
@ -1309,6 +1284,31 @@
|
|||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="splitmenu">
|
||||
<content>
|
||||
<xul:menuitem anonid="item" flex="1"
|
||||
class="menuitem-tooltip split-menuitem-item"
|
||||
xbl:inherits="label,key"/>
|
||||
<xul:menu anonid="menu" class="split-menuitem-menu"
|
||||
oncommand="event.stopPropagation();">
|
||||
<children includes="menupopup"/>
|
||||
</xul:menu>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
if (this.getAttribute("iconic") == "true") {
|
||||
this.item.classList.remove("menuitem-tooltip");
|
||||
this.item.classList.add("menuitem-iconic-tooltip");
|
||||
this.item.classList.add("menuitem-iconic");
|
||||
}
|
||||
]]></constructor>
|
||||
<field name="item" readonly="true">
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "item");
|
||||
</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="menuitem-tooltip" extends="chrome://global/content/bindings/menu.xml#menuitem">
|
||||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
|
|
|
@ -44,4 +44,3 @@
|
|||
!define CompanyName "mozilla.org"
|
||||
!define URLInfoAbout "http://www.mozilla.org"
|
||||
!define URLUpdateInfo "http://www.mozilla.org/projects/firefox"
|
||||
!define SurveyURL "https://survey.mozilla.com/1/Mozilla%20Firefox/${AppVersion}/${AB_CD}/exit.html"
|
||||
|
|
|
@ -44,4 +44,3 @@
|
|||
!define CompanyName "mozilla.org"
|
||||
!define URLInfoAbout "http://www.mozilla.org"
|
||||
!define URLUpdateInfo "http://www.mozilla.org/projects/firefox"
|
||||
!define SurveyURL "https://survey.mozilla.com/1/Mozilla%20Firefox/${AppVersion}/${AB_CD}/exit.html"
|
||||
|
|
|
@ -173,13 +173,13 @@ var gAdvancedPane = {
|
|||
},
|
||||
|
||||
/**
|
||||
* When the user toggles the layers.accelerate-none pref,
|
||||
* When the user toggles the layers.acceleration.disabled pref,
|
||||
* sync its new value to the gfx.direct2d.disabled pref too.
|
||||
*/
|
||||
updateHardwareAcceleration: function()
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
var pref = document.getElementById("layers.accelerate-none");
|
||||
var pref = document.getElementById("layers.acceleration.disabled");
|
||||
Services.prefs.setBoolPref("gfx.direct2d.disabled", !pref.value);
|
||||
#endif
|
||||
},
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
|
||||
<preference id="general.autoScroll" name="general.autoScroll" type="bool"/>
|
||||
<preference id="general.smoothScroll" name="general.smoothScroll" type="bool"/>
|
||||
<preference id="layers.accelerate-none" name="layers.accelerate-none" type="bool" inverted="true"
|
||||
<preference id="layers.acceleration.disabled" name="layers.acceleration.disabled" type="bool" inverted="true"
|
||||
onchange="gAdvancedPane.updateHardwareAcceleration()"/>
|
||||
<preference id="layout.spellcheckDefault" name="layout.spellcheckDefault" type="int"/>
|
||||
|
||||
|
@ -184,7 +184,7 @@
|
|||
<checkbox id="allowHWAccel"
|
||||
label="&allowHWAccel.label;"
|
||||
accesskey="&allowHWAccel.accesskey;"
|
||||
preference="layers.accelerate-none"/>
|
||||
preference="layers.acceleration.disabled"/>
|
||||
<checkbox id="checkSpelling"
|
||||
label="&checkSpelling.label;"
|
||||
accesskey="&checkSpelling.accesskey;"
|
||||
|
|
|
@ -42,6 +42,7 @@ Components.utils.import("resource://gre/modules/Services.jsm");
|
|||
|
||||
const PAGE_NO_ACCOUNT = 0;
|
||||
const PAGE_HAS_ACCOUNT = 1;
|
||||
const PAGE_NEEDS_UPDATE = 2;
|
||||
|
||||
let gSyncPane = {
|
||||
_stringBundle: null,
|
||||
|
@ -60,84 +61,52 @@ let gSyncPane = {
|
|||
return Weave.Svc.Prefs.isSet("serverURL");
|
||||
},
|
||||
|
||||
onLoginStart: function () {
|
||||
if (this.page == PAGE_NO_ACCOUNT)
|
||||
return;
|
||||
|
||||
document.getElementById("loginFeedbackRow").hidden = true;
|
||||
document.getElementById("connectThrobber").hidden = false;
|
||||
},
|
||||
|
||||
onLoginError: function () {
|
||||
if (this.page == PAGE_NO_ACCOUNT)
|
||||
return;
|
||||
|
||||
document.getElementById("connectThrobber").hidden = true;
|
||||
document.getElementById("loginFeedbackRow").hidden = false;
|
||||
needsUpdate: function () {
|
||||
this.page = PAGE_NEEDS_UPDATE;
|
||||
let label = document.getElementById("loginError");
|
||||
label.value = Weave.Utils.getErrorString(Weave.Status.login);
|
||||
label.className = "error";
|
||||
},
|
||||
|
||||
onLoginFinish: function () {
|
||||
document.getElementById("connectThrobber").hidden = true;
|
||||
this.updateWeavePrefs();
|
||||
},
|
||||
|
||||
init: function () {
|
||||
let obs = [
|
||||
["weave:service:login:start", "onLoginStart"],
|
||||
["weave:service:login:error", "onLoginError"],
|
||||
["weave:service:login:finish", "onLoginFinish"],
|
||||
["weave:service:start-over", "updateWeavePrefs"],
|
||||
["weave:service:setup-complete","updateWeavePrefs"],
|
||||
["weave:service:logout:finish", "updateWeavePrefs"]];
|
||||
let topics = ["weave:service:login:error",
|
||||
"weave:service:login:finish",
|
||||
"weave:service:start-over",
|
||||
"weave:service:setup-complete",
|
||||
"weave:service:logout:finish"];
|
||||
|
||||
// Add the observers now and remove them on unload
|
||||
let self = this;
|
||||
let addRem = function(add) {
|
||||
obs.forEach(function([topic, func]) {
|
||||
//XXXzpao This should use Services.obs.* but Weave's Obs does nice handling
|
||||
// of `this`. Fix in a followup. (bug 583347)
|
||||
if (add)
|
||||
Weave.Svc.Obs.add(topic, self[func], self);
|
||||
else
|
||||
Weave.Svc.Obs.remove(topic, self[func], self);
|
||||
});
|
||||
};
|
||||
addRem(true);
|
||||
window.addEventListener("unload", function() addRem(false), false);
|
||||
//XXXzpao This should use Services.obs.* but Weave's Obs does nice handling
|
||||
// of `this`. Fix in a followup. (bug 583347)
|
||||
topics.forEach(function (topic) {
|
||||
Weave.Svc.Obs.add(topic, this.updateWeavePrefs, this);
|
||||
}, this);
|
||||
window.addEventListener("unload", function() {
|
||||
topics.forEach(function (topic) {
|
||||
Weave.Svc.Obs.remove(topic, this.updateWeavePrefs, this);
|
||||
}, gSyncPane);
|
||||
}, false);
|
||||
|
||||
this._stringBundle =
|
||||
Services.strings.createBundle("chrome://browser/locale/preferences/preferences.properties");;
|
||||
Services.strings.createBundle("chrome://browser/locale/preferences/preferences.properties");
|
||||
this.updateWeavePrefs();
|
||||
},
|
||||
|
||||
updateWeavePrefs: function () {
|
||||
if (Weave.Status.service == Weave.CLIENT_NOT_CONFIGURED ||
|
||||
Weave.Svc.Prefs.get("firstSync", "") == "notReady")
|
||||
Weave.Svc.Prefs.get("firstSync", "") == "notReady") {
|
||||
this.page = PAGE_NO_ACCOUNT;
|
||||
else {
|
||||
} else if (Weave.Status.login == Weave.LOGIN_FAILED_INVALID_PASSPHRASE ||
|
||||
Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED) {
|
||||
this.needsUpdate();
|
||||
} else {
|
||||
this.page = PAGE_HAS_ACCOUNT;
|
||||
document.getElementById("currentAccount").value = Weave.Service.account;
|
||||
document.getElementById("accountName").value = Weave.Service.account;
|
||||
document.getElementById("syncComputerName").value = Weave.Clients.localName;
|
||||
if (Weave.Status.service == Weave.LOGIN_FAILED)
|
||||
this.onLoginError();
|
||||
this.updateConnectButton();
|
||||
document.getElementById("tosPP").hidden = this._usingCustomServer;
|
||||
}
|
||||
},
|
||||
|
||||
updateConnectButton: function () {
|
||||
let str = Weave.Service.isLoggedIn ? this._stringBundle.GetStringFromName("disconnect.label")
|
||||
: this._stringBundle.GetStringFromName("connect.label");
|
||||
document.getElementById("connectButton").label = str;
|
||||
},
|
||||
|
||||
handleConnectCommand: function () {
|
||||
Weave.Service.isLoggedIn ? Weave.Service.logout() : Weave.Service.login();
|
||||
},
|
||||
|
||||
startOver: function (showDialog) {
|
||||
if (showDialog) {
|
||||
let flags = Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING +
|
||||
|
@ -155,11 +124,8 @@ let gSyncPane = {
|
|||
return;
|
||||
}
|
||||
|
||||
this.handleExpanderClick();
|
||||
Weave.Service.startOver();
|
||||
this.updateWeavePrefs();
|
||||
document.getElementById("manageAccountExpander").className = "expander-down";
|
||||
document.getElementById("manageAccountControls").hidden = true;
|
||||
},
|
||||
|
||||
updatePass: function () {
|
||||
|
@ -176,26 +142,6 @@ let gSyncPane = {
|
|||
gSyncUtils.resetPassphrase();
|
||||
},
|
||||
|
||||
handleExpanderClick: function () {
|
||||
//XXXzpao Might be fixed in bug 583441, otherwise we'll need a new bug.
|
||||
// ok, this is pretty evil, and likely fragile if the prefwindow
|
||||
// binding changes, but that won't happen in 3.6 *fingers crossed*
|
||||
let prefwindow = document.documentElement;
|
||||
let pane = document.getElementById("paneSync");
|
||||
if (prefwindow._shouldAnimate)
|
||||
prefwindow._currentHeight = pane.contentHeight;
|
||||
|
||||
let expander = document.getElementById("manageAccountExpander");
|
||||
let expand = expander.className == "expander-down";
|
||||
expander.className =
|
||||
expand ? "expander-up" : "expander-down";
|
||||
document.getElementById("manageAccountControls").hidden = !expand;
|
||||
|
||||
// and... shazam
|
||||
if (prefwindow._shouldAnimate)
|
||||
prefwindow.animate("null", pane);
|
||||
},
|
||||
|
||||
openSetup: function (resetSync) {
|
||||
var win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
|
||||
if (win)
|
||||
|
|
|
@ -84,75 +84,76 @@
|
|||
</description>
|
||||
<spacer flex="3"/>
|
||||
</vbox>
|
||||
|
||||
<vbox id="hasAccount">
|
||||
<groupbox>
|
||||
<caption label="&accountGroupboxCaption.label;"/>
|
||||
<grid>
|
||||
<rows>
|
||||
<row align="center">
|
||||
<label value="¤tAccount.label;" control="currentAccount"/>
|
||||
<textbox id="currentAccount" readonly="true">
|
||||
<image/>
|
||||
</textbox>
|
||||
<hbox align="center">
|
||||
<button id="connectButton" oncommand="gSyncPane.handleConnectCommand()"/>
|
||||
<image id="connectThrobber"
|
||||
hidden="true"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row id="loginFeedbackRow" hidden="true">
|
||||
<spacer/>
|
||||
<label id="loginError" value=""/>
|
||||
<hbox>
|
||||
<label class="text-link"
|
||||
onclick="gSyncPane.updatePass(); return false;"
|
||||
value="&updatePass.label;"/>
|
||||
<label class="text-link"
|
||||
onclick="gSyncPane.resetPass(); return false;"
|
||||
value="&resetPass.label;"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<!-- XXXzpao We should make this behave like the "details" view in CRH.
|
||||
do in followup (bug 583441) -->
|
||||
<row id="manageAccountControls" hidden="true">
|
||||
<spacer/>
|
||||
<vbox class="indent">
|
||||
<label class="text-link"
|
||||
onclick="gSyncPane.openQuotaDialog(); return false;"
|
||||
value="&viewQuota.label;"/>
|
||||
<label class="text-link"
|
||||
onclick="gSyncUtils.changePassword(); return false;"
|
||||
value="&changePassword.label;"/>
|
||||
<label class="text-link"
|
||||
onclick="gSyncUtils.resetPassphrase(); return false;"
|
||||
value="&mySyncKey.label;"/>
|
||||
<label class="text-link"
|
||||
onclick="gSyncPane.resetSync(); return false;"
|
||||
value="&resetSync.label;"/>
|
||||
<label class="text-link"
|
||||
onclick="gSyncPane.startOver(true); return false;"
|
||||
value="&stopUsingAccount.label;"/>
|
||||
</vbox>
|
||||
<spacer/>
|
||||
</row>
|
||||
<row>
|
||||
<spacer/>
|
||||
<button id="manageAccountExpander"
|
||||
class="expander-down"
|
||||
label="&manageAccount.label;"
|
||||
accesskey="&manageAccount.accesskey;"
|
||||
align="left"
|
||||
oncommand="gSyncPane.handleExpanderClick()"/>
|
||||
<spacer/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<label class="text-link"
|
||||
onclick="gSyncPane.openAddDevice(); return false;"
|
||||
value="&addDevice.label;"/>
|
||||
<groupbox class="syncGroupBox">
|
||||
<!-- label is set to account name -->
|
||||
<caption id="accountCaption" align="center">
|
||||
<image id="accountCaptionImage"/>
|
||||
<label id="accountName" value=""/>
|
||||
</caption>
|
||||
|
||||
<hbox>
|
||||
<button type="menu"
|
||||
label="&manageAccount.label;"
|
||||
accesskey="&manageAccount.accesskey;">
|
||||
<menupopup>
|
||||
<menuitem label="&viewQuota.label;"
|
||||
oncommand="gSyncPane.openQuotaDialog();"/>
|
||||
<menuseparator/>
|
||||
<menuitem label="&changePassword.label;"
|
||||
oncommand="gSyncUtils.changePassword();"/>
|
||||
<menuitem label="&mySyncKey.label;"
|
||||
oncommand="gSyncUtils.resetPassphrase();"/>
|
||||
<menuseparator/>
|
||||
<menuitem label="&resetSync.label;"
|
||||
oncommand="gSyncPane.resetSync();"/>
|
||||
</menupopup>
|
||||
</button>
|
||||
</hbox>
|
||||
|
||||
<hbox>
|
||||
<label id="syncAddDeviceLabel"
|
||||
class="text-link"
|
||||
onclick="gSyncPane.openAddDevice(); return false;"
|
||||
value="&addDevice.label;"/>
|
||||
</hbox>
|
||||
|
||||
<vbox>
|
||||
<label value="&syncMy.label;" />
|
||||
<richlistbox id="syncEnginesList"
|
||||
orient="vertical"
|
||||
onselect="if (this.selectedCount) this.clearSelection();">
|
||||
<richlistitem>
|
||||
<checkbox label="&engine.bookmarks.label;"
|
||||
accesskey="&engine.bookmarks.accesskey;"
|
||||
preference="engine.bookmarks"/>
|
||||
</richlistitem>
|
||||
<richlistitem>
|
||||
<checkbox label="&engine.passwords.label;"
|
||||
accesskey="&engine.passwords.accesskey;"
|
||||
preference="engine.passwords"/>
|
||||
</richlistitem>
|
||||
<richlistitem>
|
||||
<checkbox label="&engine.prefs.label;"
|
||||
accesskey="&engine.prefs.accesskey;"
|
||||
preference="engine.prefs"/>
|
||||
</richlistitem>
|
||||
<richlistitem>
|
||||
<checkbox label="&engine.history.label;"
|
||||
accesskey="&engine.history.accesskey;"
|
||||
preference="engine.history"/>
|
||||
</richlistitem>
|
||||
<richlistitem>
|
||||
<checkbox label="&engine.tabs.label;"
|
||||
accesskey="&engine.tabs.accesskey;"
|
||||
preference="engine.tabs"/>
|
||||
</richlistitem>
|
||||
</richlistbox>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
<groupbox>
|
||||
<caption label="&syncPrefsCaption.label;"/>
|
||||
|
||||
<groupbox class="syncGroupBox">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
|
@ -166,29 +167,13 @@
|
|||
<textbox id="syncComputerName"
|
||||
onchange="gSyncUtils.changeName(this)"/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="&syncMy.label;" />
|
||||
<vbox>
|
||||
<checkbox label="&engine.bookmarks.label;"
|
||||
accesskey="&engine.bookmarks.accesskey;"
|
||||
preference="engine.bookmarks"/>
|
||||
<checkbox label="&engine.passwords.label;"
|
||||
accesskey="&engine.passwords.accesskey;"
|
||||
preference="engine.passwords"/>
|
||||
<checkbox label="&engine.prefs.label;"
|
||||
accesskey="&engine.prefs.accesskey;"
|
||||
preference="engine.prefs"/>
|
||||
<checkbox label="&engine.history.label;"
|
||||
accesskey="&engine.history.accesskey;"
|
||||
preference="engine.history"/>
|
||||
<checkbox label="&engine.tabs.label;"
|
||||
accesskey="&engine.tabs.accesskey;"
|
||||
preference="engine.tabs"/>
|
||||
</vbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<separator/>
|
||||
<hbox>
|
||||
<label class="text-link"
|
||||
onclick="gSyncPane.startOver(true); return false;"
|
||||
value="&deactivateDevice.label;"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
<hbox id="tosPP" pack="center">
|
||||
<label class="text-link"
|
||||
|
@ -199,6 +184,21 @@
|
|||
value="&prefs.ppLink.label;"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
||||
<vbox id="needsUpdate" align="center" pack="center">
|
||||
<hbox>
|
||||
<label id="loginError" value=""/>
|
||||
<label class="text-link"
|
||||
onclick="gSyncPane.updatePass(); return false;"
|
||||
value="&updatePass.label;"/>
|
||||
<label class="text-link"
|
||||
onclick="gSyncPane.resetPass(); return false;"
|
||||
value="&resetPass.label;"/>
|
||||
</hbox>
|
||||
<label class="text-link"
|
||||
onclick="gSyncPane.startOver(true); return false;"
|
||||
value="&deactivateDevice.label;"/>
|
||||
</vbox>
|
||||
</deck>
|
||||
</prefpane>
|
||||
</overlay>
|
||||
|
|
|
@ -724,6 +724,21 @@ PrivateBrowsingService.prototype = {
|
|||
}
|
||||
}
|
||||
|
||||
// Indexed DB
|
||||
let (idbm = Cc["@mozilla.org/dom/indexeddb/manager;1"].
|
||||
getService(Ci.nsIIndexedDatabaseManager)) {
|
||||
// delete data from both HTTP and HTTPS sites
|
||||
let caUtils = {};
|
||||
let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
getService(Ci.mozIJSSubScriptLoader);
|
||||
scriptLoader.loadSubScript("chrome://global/content/contentAreaUtils.js",
|
||||
caUtils);
|
||||
let httpURI = caUtils.makeURI("http://" + aDomain);
|
||||
let httpsURI = caUtils.makeURI("https://" + aDomain);
|
||||
idbm.clearDatabasesForURI(httpURI);
|
||||
idbm.clearDatabasesForURI(httpsURI);
|
||||
}
|
||||
|
||||
// Everybody else (including extensions)
|
||||
this._obs.notifyObservers(null, "browser:purge-domain-data", aDomain);
|
||||
}
|
||||
|
|
|
@ -133,9 +133,11 @@ interface nsISessionStore : nsISupports
|
|||
*
|
||||
* @param aWindow is the browser window into which the tab will be duplicated.
|
||||
* @param aTab is the tabbrowser tab to duplicate (can be from a different window).
|
||||
* @param aDelta is the offset to the history entry to load in the duplicated tab.
|
||||
* @returns a reference to the newly created tab.
|
||||
*/
|
||||
nsIDOMNode duplicateTab(in nsIDOMWindow aWindow, in nsIDOMNode aTab);
|
||||
nsIDOMNode duplicateTab(in nsIDOMWindow aWindow, in nsIDOMNode aTab,
|
||||
[optional] in long aDelta);
|
||||
|
||||
/**
|
||||
* Get the number of restore-able tabs for a browser window
|
||||
|
|
|
@ -1162,7 +1162,7 @@ SessionStoreService.prototype = {
|
|||
this.restoreHistoryPrecursor(window, [aTab], [tabState], 0, 0, 0);
|
||||
},
|
||||
|
||||
duplicateTab: function sss_duplicateTab(aWindow, aTab) {
|
||||
duplicateTab: function sss_duplicateTab(aWindow, aTab, aDelta) {
|
||||
if (!aTab.ownerDocument || !aTab.ownerDocument.defaultView.__SSi ||
|
||||
!aWindow.getBrowser)
|
||||
throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
|
||||
|
@ -1170,6 +1170,8 @@ SessionStoreService.prototype = {
|
|||
var tabState = this._collectTabData(aTab, true);
|
||||
var sourceWindow = aTab.ownerDocument.defaultView;
|
||||
this._updateTextAndScrollDataForTab(sourceWindow, aTab.linkedBrowser, tabState, true);
|
||||
tabState.index += aDelta;
|
||||
tabState.index = Math.max(1, Math.min(tabState.index, tabState.entries.length));
|
||||
|
||||
this._sendWindowStateEvent(aWindow, "Busy");
|
||||
let newTab = aTab == aWindow.gBrowser.selectedTab ?
|
||||
|
|
|
@ -214,30 +214,31 @@ nsGNOMEShellService::SetDefaultBrowser(PRBool aClaimAllTypes,
|
|||
#endif
|
||||
|
||||
nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
|
||||
|
||||
nsCAutoString appKeyValue(mAppPath);
|
||||
appKeyValue.Append(" \"%s\"");
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
|
||||
if (appProtocols[i].essential || aClaimAllTypes) {
|
||||
gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name),
|
||||
appKeyValue);
|
||||
if (gconf) {
|
||||
nsCAutoString appKeyValue(mAppPath);
|
||||
appKeyValue.Append(" \"%s\"");
|
||||
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
|
||||
if (appProtocols[i].essential || aClaimAllTypes) {
|
||||
gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name),
|
||||
appKeyValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set handler for .html and xhtml files and MIME types:
|
||||
if (aClaimAllTypes) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIGIOService> giovfs =
|
||||
do_GetService(NS_GIOSERVICE_CONTRACTID);
|
||||
do_GetService(NS_GIOSERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(bundleService, NS_ERROR_OUT_OF_MEMORY);
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIStringBundle> brandBundle;
|
||||
bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle));
|
||||
NS_ENSURE_TRUE(brandBundle, NS_ERROR_FAILURE);
|
||||
rv = bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsString brandShortName, brandFullName;
|
||||
brandBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
|
||||
|
@ -247,17 +248,16 @@ nsGNOMEShellService::SetDefaultBrowser(PRBool aClaimAllTypes,
|
|||
|
||||
// use brandShortName as the application id.
|
||||
NS_ConvertUTF16toUTF8 id(brandShortName);
|
||||
if (giovfs) {
|
||||
nsCOMPtr<nsIGIOMimeApp> appInfo;
|
||||
giovfs->CreateAppFromCommand(mAppPath,
|
||||
id,
|
||||
getter_AddRefs(appInfo));
|
||||
nsCOMPtr<nsIGIOMimeApp> appInfo;
|
||||
rv = giovfs->CreateAppFromCommand(mAppPath,
|
||||
id,
|
||||
getter_AddRefs(appInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Add mime types for html, xhtml extension and set app to just created appinfo.
|
||||
for (i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) {
|
||||
appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType));
|
||||
appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions));
|
||||
}
|
||||
// Add mime types for html, xhtml extension and set app to just created appinfo.
|
||||
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) {
|
||||
appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType));
|
||||
appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
4.0b9pre
|
||||
4.0b10pre
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
!define PreReleaseSuffix "@PRE_RELEASE_SUFFIX@"
|
||||
!define BrandFullName "${BrandFullNameInternal}${PreReleaseSuffix}"
|
||||
|
||||
!define NO_UNINSTALL_SURVEY
|
||||
|
||||
# LSP_CATEGORIES is the permitted LSP categories for the application. Each LSP
|
||||
# category value is ANDed together to set multiple permitted categories.
|
||||
# See http://msdn.microsoft.com/en-us/library/ms742253%28VS.85%29.aspx
|
||||
|
|
|
@ -111,10 +111,6 @@ offlinepermissionstitle=Offline Data
|
|||
# %2$S = unit (MB, KB, etc.)
|
||||
actualCacheSize=Your cache is currently using %1$S %2$S of disk space
|
||||
|
||||
#### Syncing
|
||||
connect.label=Connect
|
||||
disconnect.label=Disconnect
|
||||
|
||||
stopUsingAccount.title=Do you want to stop using this account?
|
||||
differentAccount.label=This will reset all of your Sync account information and preferences.
|
||||
differentAccountConfirm.label=Reset All Information
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
<!ENTITY weaveDesc.label "&syncBrand.fullName.label; lets you access your history, bookmarks, passwords and open tabs across all your devices.">
|
||||
|
||||
<!-- The page shown when logged in... -->
|
||||
<!ENTITY accountGroupboxCaption.label "&syncBrand.fullName.label; Account">
|
||||
<!ENTITY currentAccount.label "Current Account:">
|
||||
|
||||
<!-- Login error feedback -->
|
||||
<!ENTITY updatePass.label "Update">
|
||||
|
@ -18,14 +16,8 @@
|
|||
<!ENTITY changePassword.label "Change Password">
|
||||
<!ENTITY mySyncKey.label "My Sync Key">
|
||||
<!ENTITY resetSync.label "Reset Sync">
|
||||
<!ENTITY stopUsingAccount.label "Stop Using This Account">
|
||||
<!ENTITY addDevice.label "Add a Device">
|
||||
|
||||
<!-- Sync Settings -->
|
||||
<!ENTITY syncPrefsCaption.label "Browser Sync">
|
||||
<!ENTITY syncComputerName.label "Computer Name:">
|
||||
<!ENTITY syncComputerName.accesskey "c">
|
||||
|
||||
<!ENTITY syncMy.label "Sync My">
|
||||
<!ENTITY engine.bookmarks.label "Bookmarks">
|
||||
<!ENTITY engine.bookmarks.accesskey "m">
|
||||
|
@ -38,6 +30,10 @@
|
|||
<!ENTITY engine.prefs.label "Preferences">
|
||||
<!ENTITY engine.prefs.accesskey "S">
|
||||
|
||||
<!-- Device Settings -->
|
||||
<!ENTITY syncComputerName.label "Computer Name:">
|
||||
<!ENTITY syncComputerName.accesskey "c">
|
||||
<!ENTITY deactivateDevice.label "Deactivate This Device">
|
||||
|
||||
<!-- Footer stuff -->
|
||||
<!ENTITY prefs.tosLink.label "Terms of Service">
|
||||
|
|
|
@ -13,5 +13,5 @@
|
|||
<Param name="rls" value="{moz:distributionID}:{moz:locale}:{moz:official}"/>
|
||||
<MozParam name="client" condition="defaultEngine" trueValue="firefox-a" falseValue="firefox"/>
|
||||
</Url>
|
||||
<SearchForm>http://www.google.com/firefox</SearchForm>
|
||||
<SearchForm>http://www.google.com/</SearchForm>
|
||||
</SearchPlugin>
|
||||
|
|
|
@ -64,6 +64,7 @@ sk
|
|||
sl
|
||||
son
|
||||
sq
|
||||
sr
|
||||
sv-SE
|
||||
ta
|
||||
ta-LK
|
||||
|
|
|
@ -156,7 +156,7 @@ toolbarbutton.bookmark-item[open="true"] {
|
|||
menu.bookmark-item,
|
||||
menuitem.bookmark-item {
|
||||
min-width: 0;
|
||||
max-width: 26em;
|
||||
max-width: 32em;
|
||||
}
|
||||
|
||||
.bookmark-item > .menu-iconic-left {
|
||||
|
@ -1790,21 +1790,27 @@ panel[dimmed="true"] {
|
|||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* Vertically-center the statusbar compatibility shim, because
|
||||
toolbars, even in small-icon mode, are a bit taller than
|
||||
statusbars. */
|
||||
#status-bar {
|
||||
margin-top: .3em;
|
||||
/* Add-on bar */
|
||||
|
||||
#addon-bar {
|
||||
padding: 0;
|
||||
min-height: 20px;
|
||||
}
|
||||
|
||||
#status-bar {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* Remove all borders from statusbarpanel children of
|
||||
the statusbar. */
|
||||
#status-bar > statusbarpanel {
|
||||
border-width: 0;
|
||||
-moz-appearance: none;
|
||||
}
|
||||
|
||||
/* Add-on bar close button */
|
||||
#addonbar-closebutton {
|
||||
list-style-image: url("moz-icon://stock/gtk-close?size=menu");
|
||||
}
|
||||
|
||||
#addonbar-closebutton > .toolbarbutton-icon {
|
||||
margin-top: -2px;
|
||||
margin-bottom: -2px;
|
||||
}
|
||||
|
|
|
@ -167,37 +167,22 @@ radio[pane=paneSync] {
|
|||
|
||||
%ifdef MOZ_SERVICES_SYNC
|
||||
/* Sync Pane */
|
||||
|
||||
#syncDesc {
|
||||
padding: 0 12em;
|
||||
}
|
||||
|
||||
#currentUser image {
|
||||
#accountCaptionImage {
|
||||
list-style-image: url("chrome://mozapps/skin/profile/profileicon.png");
|
||||
}
|
||||
|
||||
#connectThrobber {
|
||||
list-style-image: url("chrome://global/skin/icons/loading_16.png");
|
||||
}
|
||||
.expander-up,
|
||||
.expander-down {
|
||||
min-width: 0;
|
||||
padding: 2px 0;
|
||||
-moz-padding-start: 2px;
|
||||
#syncAddDeviceLabel {
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.expander-up {
|
||||
list-style-image: url("chrome://global/skin/arrow/arrow-up.gif");
|
||||
#syncEnginesList {
|
||||
height: 10em;
|
||||
}
|
||||
|
||||
.expander-down {
|
||||
list-style-image: url("chrome://global/skin/arrow/arrow-dn.gif");
|
||||
}
|
||||
|
||||
.expander-down:hover:active {
|
||||
list-style-image: url("chrome://global/skin/arrow/arrow-dn-hov.gif");
|
||||
}
|
||||
|
||||
.expander-up:hover:active {
|
||||
list-style-image: url("chrome://global/skin/arrow/arrow-up-hov.gif");
|
||||
}
|
||||
%endif
|
||||
|
|
|
@ -405,15 +405,14 @@ input.name {
|
|||
margin-bottom: 0;
|
||||
-moz-margin-start: 3px;
|
||||
padding: 1px;
|
||||
background-image: url(chrome://browser/skin/tabview/edit-light.png);
|
||||
-moz-padding-start: 20px;
|
||||
}
|
||||
|
||||
html[dir=rtl] input.name {
|
||||
background-position: right top;
|
||||
}
|
||||
|
||||
.title-container:hover input.name {
|
||||
.title-container:hover input.name,
|
||||
.title-container input.name:focus {
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
|
@ -426,13 +425,17 @@ input.name:focus {
|
|||
color: #555;
|
||||
}
|
||||
|
||||
input.defaultName {
|
||||
input.name:-moz-placeholder {
|
||||
font-style: italic !important;
|
||||
background-image-opacity: .1;
|
||||
color: transparent;
|
||||
background-image: url(chrome://browser/skin/tabview/edit-light.png);
|
||||
background-image-opacity: .1;
|
||||
background-repeat: no-repeat;
|
||||
-moz-padding-start: 20px;
|
||||
-moz-padding-end: -20px;
|
||||
}
|
||||
|
||||
.title-container:hover input.defaultName {
|
||||
.title-container:hover input.name:-moz-placeholder {
|
||||
color: #CCC;
|
||||
}
|
||||
|
||||
|
|
|
@ -2302,28 +2302,25 @@ panel[dimmed="true"] {
|
|||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* Vertically-center the statusbar compatibility shim, because
|
||||
toolbars, even in small-icon mode, are a bit taller than
|
||||
statusbars. Also turn off the statusbar border. On Windows
|
||||
we have to disable borders on statusbar *and* child statusbar
|
||||
elements. */
|
||||
#status-bar {
|
||||
margin-top: 0.3em;
|
||||
-moz-appearance: none;
|
||||
}
|
||||
/* Add-on bar */
|
||||
|
||||
/* Remove all borders from statusbarpanel children of
|
||||
the statusbar. */
|
||||
#status-bar > statusbarpanel {
|
||||
border-width: 0;
|
||||
-moz-appearance: none;
|
||||
#addon-bar {
|
||||
min-height: 18px;
|
||||
}
|
||||
|
||||
#addon-bar:not(:-moz-lwtheme) {
|
||||
-moz-appearance: statusbar;
|
||||
}
|
||||
|
||||
/* Add-on bar close button */
|
||||
#status-bar {
|
||||
-moz-appearance: none;
|
||||
}
|
||||
|
||||
#status-bar > statusbarpanel {
|
||||
border-width: 0;
|
||||
-moz-appearance: none;
|
||||
}
|
||||
|
||||
#addonbar-closebutton {
|
||||
padding: 0;
|
||||
margin: 0 4px;
|
||||
|
|
|
@ -258,27 +258,17 @@ caption {
|
|||
padding: 0 12em;
|
||||
}
|
||||
|
||||
#currentUser image {
|
||||
#accountCaptionImage {
|
||||
list-style-image: url("chrome://mozapps/skin/profile/profileicon.png");
|
||||
}
|
||||
|
||||
#connectThrobber {
|
||||
list-style-image: url("chrome://global/skin/icons/loading_16.png");
|
||||
#syncAddDeviceLabel {
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.expander-up,
|
||||
.expander-down {
|
||||
-moz-appearance: none;
|
||||
padding: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.expander-up {
|
||||
list-style-image: url("chrome://browser/skin/places/expander-open.png") !important;
|
||||
}
|
||||
|
||||
.expander-down {
|
||||
list-style-image: url('chrome://browser/skin/places/expander-closed.png') !important
|
||||
#syncEnginesList {
|
||||
height: 10em;
|
||||
}
|
||||
|
||||
%endif
|
||||
|
|
|
@ -395,17 +395,16 @@ input.name {
|
|||
margin-top: 3px;
|
||||
-moz-margin-end: 0;
|
||||
margin-bottom: 0;
|
||||
-moz-margin-begin: 3px;
|
||||
-moz-margin-start: 3px;
|
||||
padding: 1px;
|
||||
background-image: url(chrome://browser/skin/tabview/edit-light.png);
|
||||
-moz-padding-start: 20px;
|
||||
}
|
||||
|
||||
html[dir=rtl] input.name {
|
||||
background-position: right top;
|
||||
}
|
||||
|
||||
.title-container:hover input.name {
|
||||
.title-container:hover input.name,
|
||||
.title-container input.name:focus {
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
|
@ -418,13 +417,17 @@ input.name:focus {
|
|||
color: #555;
|
||||
}
|
||||
|
||||
input.defaultName {
|
||||
input.name:-moz-placeholder {
|
||||
font-style: italic !important;
|
||||
color: transparent;
|
||||
background-image: url(chrome://browser/skin/tabview/edit-light.png);
|
||||
background-image-opacity: .1;
|
||||
color: transparent;
|
||||
background-repeat: no-repeat;
|
||||
-moz-padding-start: 20px;
|
||||
-moz-margin-end: -20px;
|
||||
}
|
||||
|
||||
.title-container:hover input.defaultName {
|
||||
.title-container:hover input.name:-moz-placeholder {
|
||||
color: #CCC;
|
||||
}
|
||||
|
||||
|
@ -436,7 +439,7 @@ input.defaultName {
|
|||
margin-top: 3px;
|
||||
-moz-margin-end: 0;
|
||||
margin-bottom: 0;
|
||||
-moz-margin-begin: 3px;
|
||||
-moz-margin-start: 3px;
|
||||
padding: 1px;
|
||||
left: 0;
|
||||
top: 0;
|
||||
|
|
|
@ -39,6 +39,16 @@
|
|||
background-color: @customToolbarColor@;
|
||||
}
|
||||
|
||||
.tabbrowser-tab:not(:-moz-lwtheme),
|
||||
.tabs-newtab-button:not(:-moz-lwtheme) {
|
||||
background-image: @genericBgTabTexture@, -moz-linear-gradient(@customToolbarColor@, @customToolbarColor@);
|
||||
}
|
||||
|
||||
.tabbrowser-tab:not(:-moz-lwtheme):hover,
|
||||
.tabs-newtab-button:not(:-moz-lwtheme):hover {
|
||||
background-image: @genericBgTabTextureHover@, -moz-linear-gradient(@customToolbarColor@, @customToolbarColor@);
|
||||
}
|
||||
|
||||
.tabbrowser-tab[selected="true"]:not(:-moz-lwtheme) {
|
||||
background-image: -moz-linear-gradient(white, @toolbarHighlight@ 30%),
|
||||
-moz-linear-gradient(@customToolbarColor@, @customToolbarColor@);
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
%filter substitution
|
||||
%define toolbarHighlight rgba(255,255,255,.5)
|
||||
%define navbarTextboxCustomBorder border-color: rgba(0,0,0,.25) rgba(0,0,0,.32) rgba(0,0,0,.37);
|
||||
%define genericBgTabTexture -moz-linear-gradient(transparent, hsla(0,0%,36%,.15) 1px, hsla(0,0%,0%,.3) 60%)
|
||||
%define genericBgTabTextureHover -moz-linear-gradient(transparent, hsla(0,0%,70%,.15) 1px, hsla(0,0%,20%,.3) 60%)
|
||||
|
||||
#menubar-items {
|
||||
-moz-box-orient: vertical; /* for flex hack */
|
||||
|
@ -478,7 +480,7 @@ toolbarbutton.bookmark-item[open="true"] {
|
|||
menu.bookmark-item,
|
||||
menuitem.bookmark-item {
|
||||
min-width: 0;
|
||||
max-width: 26em;
|
||||
max-width: 32em;
|
||||
}
|
||||
|
||||
.bookmark-item > .menu-iconic-left {
|
||||
|
@ -970,6 +972,10 @@ toolbar:not([iconsize="small"])[mode="icons"] #forward-button:not([disabled="tru
|
|||
|
||||
/* ::::: fullscreen window controls ::::: */
|
||||
|
||||
#TabsToolbar > #window-controls {
|
||||
-moz-margin-start: 4px;
|
||||
}
|
||||
|
||||
#minimize-button,
|
||||
#restore-button,
|
||||
#close-button {
|
||||
|
@ -1498,7 +1504,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
|||
.tabbrowser-tab,
|
||||
.tabs-newtab-button {
|
||||
-moz-appearance: none;
|
||||
background: -moz-linear-gradient(hsla(0,0%,50%,.1), hsla(0,0%,37%,.1) 50%);
|
||||
background: @genericBgTabTexture@, -moz-linear-gradient(-moz-dialog, -moz-dialog);
|
||||
background-position: -5px -2px;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 200%;
|
||||
|
@ -1510,9 +1516,23 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
|||
|
||||
.tabbrowser-tab:hover,
|
||||
.tabs-newtab-button:hover {
|
||||
background-image: -moz-linear-gradient(hsla(0,0%,100%,.4), hsla(0,0%,75%,.4) 50%);
|
||||
background-image: @genericBgTabTextureHover@, -moz-linear-gradient(-moz-dialog, -moz-dialog);
|
||||
}
|
||||
|
||||
%ifndef WINSTRIPE_AERO
|
||||
@media all and (-moz-windows-theme: luna-blue) {
|
||||
.tabbrowser-tab,
|
||||
.tabs-newtab-button {
|
||||
background-image: -moz-linear-gradient(hsla(51,34%,89%,.9), hsla(51,15%,79%,.9) 1px, hsla(51,9%,68%,.9) 60%);
|
||||
}
|
||||
|
||||
.tabbrowser-tab:hover,
|
||||
.tabs-newtab-button:hover {
|
||||
background-image: -moz-linear-gradient(hsla(51,34%,100%,.9), hsla(51,15%,94%,.9) 1px, hsla(51,9%,83%,.9) 60%);
|
||||
}
|
||||
}
|
||||
%endif
|
||||
|
||||
.tabbrowser-tab[selected="true"] {
|
||||
background-image: -moz-linear-gradient(rgba(255,255,255,.7), @toolbarHighlight@ 30%),
|
||||
-moz-linear-gradient(-moz-dialog, -moz-dialog);
|
||||
|
@ -2183,28 +2203,26 @@ panel[dimmed="true"] {
|
|||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* Vertically-center the statusbar compatibility shim, because
|
||||
toolbars, even in small-icon mode, are a bit taller than
|
||||
statusbars. Also turn off the statusbar border. On Windows
|
||||
we have to disable borders on statusbar *and* child statusbar
|
||||
elements. */
|
||||
#status-bar {
|
||||
margin-top: .3em;
|
||||
border-width: 0;
|
||||
-moz-appearance: none;
|
||||
/* Add-on bar */
|
||||
|
||||
#addon-bar {
|
||||
min-height: 20px;
|
||||
}
|
||||
|
||||
#status-bar {
|
||||
border: none;
|
||||
-moz-appearance: none;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* Remove all borders from statusbarpanel children of
|
||||
the statusbar. */
|
||||
#status-bar > statusbarpanel {
|
||||
border-width: 0;
|
||||
-moz-appearance: none;
|
||||
}
|
||||
|
||||
/* Add-on bar close button */
|
||||
#addonbar-closebutton {
|
||||
border: none;
|
||||
padding: 3px 5px;
|
||||
padding: 0 5px;
|
||||
list-style-image: url("chrome://global/skin/icons/close.png");
|
||||
-moz-appearance: none;
|
||||
-moz-image-region: rect(0, 16px, 16px, 0);
|
||||
|
|
|
@ -181,35 +181,26 @@ radio[pane=paneSync] {
|
|||
|
||||
%ifdef MOZ_SERVICES_SYNC
|
||||
/* Sync Pane */
|
||||
|
||||
#syncDesc {
|
||||
padding: 0 12em;
|
||||
}
|
||||
|
||||
#currentUser image {
|
||||
.syncGroupBox {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#accountCaptionImage {
|
||||
list-style-image: url("chrome://mozapps/skin/profile/profileicon.png");
|
||||
}
|
||||
|
||||
#connectThrobber {
|
||||
list-style-image: url("chrome://global/skin/icons/loading_16.png");
|
||||
#syncAddDeviceLabel {
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
#syncEnginesList {
|
||||
height: 11em;
|
||||
}
|
||||
|
||||
.expander-up,
|
||||
.expander-down {
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
-moz-margin-end: 4px;
|
||||
}
|
||||
|
||||
.expander-up > .button-box,
|
||||
.expander-down > .button-box {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.expander-up {
|
||||
list-style-image: url("chrome://global/skin/icons/collapse.png");
|
||||
}
|
||||
|
||||
.expander-down {
|
||||
list-style-image: url("chrome://global/skin/icons/expand.png");
|
||||
}
|
||||
%endif
|
||||
|
|
|
@ -424,15 +424,14 @@ input.name {
|
|||
margin-bottom: 0;
|
||||
-moz-margin-start: 3px;
|
||||
padding: 1px;
|
||||
background-image: url(chrome://browser/skin/tabview/edit-light.png);
|
||||
-moz-padding-start: 20px;
|
||||
}
|
||||
|
||||
html[dir=rtl] input.name {
|
||||
background-position: right top;
|
||||
}
|
||||
|
||||
.title-container:hover input.name {
|
||||
.title-container:hover input.name,
|
||||
.title-container input.name:focus {
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
|
@ -445,13 +444,17 @@ input.name:focus {
|
|||
color: #555;
|
||||
}
|
||||
|
||||
input.defaultName {
|
||||
input.name:-moz-placeholder {
|
||||
font-style: italic !important;
|
||||
background-image-opacity: .1;
|
||||
color: transparent;
|
||||
background-image: url(chrome://browser/skin/tabview/edit-light.png);
|
||||
background-image-opacity: .1;
|
||||
background-repeat: no-repeat;
|
||||
-moz-padding-start: 20px;
|
||||
-moz-padding-end: -20px;
|
||||
}
|
||||
|
||||
.title-container:hover input.defaultName {
|
||||
.title-container:hover input.name:-moz-placeholder {
|
||||
color: #CCC;
|
||||
}
|
||||
|
||||
|
|
|
@ -509,7 +509,8 @@ nsChromeRegistryChrome::SendRegisteredChrome(
|
|||
|
||||
mOverrideTable.EnumerateRead(&EnumerateOverride, &overrides);
|
||||
|
||||
bool success = aParent->SendRegisterChrome(packages, resources, overrides);
|
||||
bool success = aParent->SendRegisterChrome(packages, resources, overrides,
|
||||
mSelectedLocale);
|
||||
NS_ENSURE_TRUE(success, );
|
||||
}
|
||||
|
||||
|
|
|
@ -52,8 +52,12 @@ void
|
|||
nsChromeRegistryContent::RegisterRemoteChrome(
|
||||
const nsTArray<ChromePackage>& aPackages,
|
||||
const nsTArray<ResourceMapping>& aResources,
|
||||
const nsTArray<OverrideMapping>& aOverrides)
|
||||
const nsTArray<OverrideMapping>& aOverrides,
|
||||
const nsACString& aLocale)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(mLocale == nsDependentCString(""),
|
||||
"RegisterChrome twice?");
|
||||
|
||||
for (PRUint32 i = aPackages.Length(); i > 0; ) {
|
||||
--i;
|
||||
RegisterPackage(aPackages[i]);
|
||||
|
@ -68,6 +72,8 @@ nsChromeRegistryContent::RegisterRemoteChrome(
|
|||
--i;
|
||||
RegisterOverride(aOverrides[i]);
|
||||
}
|
||||
|
||||
mLocale = aLocale;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -243,7 +249,12 @@ NS_IMETHODIMP
|
|||
nsChromeRegistryContent::GetSelectedLocale(const nsACString& aPackage,
|
||||
nsACString& aLocale)
|
||||
{
|
||||
CONTENT_NOT_IMPLEMENTED();
|
||||
if (aPackage != nsDependentCString("global")) {
|
||||
NS_ERROR("Uh-oh, caller wanted something other than 'some local'");
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
aLocale = mLocale;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -55,7 +55,8 @@ class nsChromeRegistryContent : public nsChromeRegistry
|
|||
|
||||
void RegisterRemoteChrome(const nsTArray<ChromePackage>& aPackages,
|
||||
const nsTArray<ResourceMapping>& aResources,
|
||||
const nsTArray<OverrideMapping>& aOverrides);
|
||||
const nsTArray<OverrideMapping>& aOverrides,
|
||||
const nsACString& aLocale);
|
||||
|
||||
NS_OVERRIDE NS_IMETHOD GetLocalesForPackage(const nsACString& aPackage,
|
||||
nsIUTF8StringEnumerator* *aResult);
|
||||
|
@ -95,6 +96,7 @@ class nsChromeRegistryContent : public nsChromeRegistry
|
|||
NS_OVERRIDE nsresult GetFlagsFromPackage(const nsCString& aPackage, PRUint32* aFlags);
|
||||
|
||||
nsClassHashtable<nsCStringHashKey, PackageEntry> mPackagesHash;
|
||||
nsCString mLocale;
|
||||
|
||||
virtual void ManifestContent(ManifestProcessingContext& cx, int lineno,
|
||||
char *const * argv, bool platform,
|
||||
|
|
|
@ -606,6 +606,8 @@ OS_TARGET=@OS_TARGET@
|
|||
OS_ARCH=@OS_ARCH@
|
||||
OS_RELEASE=@OS_RELEASE@
|
||||
OS_TEST=@OS_TEST@
|
||||
CPU_ARCH=@CPU_ARCH@
|
||||
INTEL_ARCHITECTURE=@INTEL_ARCHITECTURE@
|
||||
|
||||
# For Solaris build
|
||||
SOLARIS_SUNPRO_CC = @SOLARIS_SUNPRO_CC@
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
# hardcoded milestones in the tree from these two files.
|
||||
#--------------------------------------------------------
|
||||
|
||||
2.0b9pre
|
||||
2.0b10pre
|
||||
|
|
11
configure.in
11
configure.in
|
@ -683,6 +683,7 @@ case "$target" in
|
|||
_MOZ_RTTI_FLAGS_OFF='-GR-'
|
||||
_MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
|
||||
_MOZ_EXCEPTIONS_FLAGS_OFF=''
|
||||
AC_DEFINE(HAVE_SEH_EXCEPTIONS)
|
||||
|
||||
if test -n "$WIN32_REDIST_DIR"; then
|
||||
WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
|
||||
|
@ -1562,6 +1563,14 @@ if test -z "$OS_TARGET"; then
|
|||
fi
|
||||
OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
|
||||
|
||||
dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
|
||||
dnl ===============================================================
|
||||
INTEL_ARCHITECTURE=
|
||||
case "$OS_TEST" in
|
||||
x86_64|i?86)
|
||||
INTEL_ARCHITECTURE=1
|
||||
esac
|
||||
|
||||
dnl ========================================================
|
||||
dnl GNU specific defaults
|
||||
dnl ========================================================
|
||||
|
@ -9121,6 +9130,8 @@ AC_SUBST(OS_TARGET)
|
|||
AC_SUBST(OS_ARCH)
|
||||
AC_SUBST(OS_RELEASE)
|
||||
AC_SUBST(OS_TEST)
|
||||
AC_SUBST(CPU_ARCH)
|
||||
AC_SUBST(INTEL_ARCHITECTURE)
|
||||
|
||||
AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
|
||||
AC_SUBST(MOZ_CHROME_FILE_FORMAT)
|
||||
|
|
|
@ -45,6 +45,102 @@ interface nsIFrame;
|
|||
interface nsIChromeFrameMessageManager;
|
||||
interface nsIVariant;
|
||||
|
||||
typedef unsigned long long nsContentViewId;
|
||||
|
||||
/**
|
||||
* These interfaces do *not* scroll or scale the content document;
|
||||
* instead they set a "goal" scroll/scale wrt the current content
|
||||
* view. When the content document is painted, the scroll*
|
||||
* attributes are used to set a compensating transform. If the
|
||||
* metrics of the content document's current pixels don't match the
|
||||
* view config, the transform matrix may need to translate
|
||||
* content pixels and/or perform a "fuzzy-scale" that doesn't
|
||||
* re-rasterize fonts or intelligently resample images.
|
||||
*
|
||||
* The attrs are allowed to transform content pixels in
|
||||
* such a way that the <browser>'s visible rect encloses pixels that
|
||||
* the content document does not (yet) define.
|
||||
*
|
||||
* The view scroll values are in units of chrome-document CSS
|
||||
* pixels.
|
||||
*
|
||||
* These APIs are designed to be used with nsIDOMWindowUtils
|
||||
* setDisplayPort() and setResolution().
|
||||
*/
|
||||
[scriptable, uuid(fbd25468-d2cf-487b-bc58-a0e105398b47)]
|
||||
interface nsIContentView : nsISupports
|
||||
{
|
||||
/**
|
||||
* Scroll view to or by the given chrome-document CSS pixels.
|
||||
* Fails if the view is no longer valid.
|
||||
*/
|
||||
void scrollTo(in float xPx, in float yPx);
|
||||
void scrollBy(in float dxPx, in float dyPx);
|
||||
|
||||
void setScale(in float xScale, in float yScale);
|
||||
|
||||
/**
|
||||
* Scroll offset in chrome-document CSS pixels.
|
||||
*
|
||||
* When this view is active (i.e. it is being painted because it's in the
|
||||
* visible region of the screen), this value is at first lined up with the
|
||||
* content's scroll offset.
|
||||
*
|
||||
* Note that when this view becomes inactive, the new content view will have
|
||||
* scroll values that are reset to the default!
|
||||
*/
|
||||
readonly attribute float scrollX;
|
||||
readonly attribute float scrollY;
|
||||
|
||||
/**
|
||||
* Dimensions of the viewport in chrome-document CSS pixels.
|
||||
*/
|
||||
readonly attribute float viewportWidth;
|
||||
readonly attribute float viewportHeight;
|
||||
|
||||
/**
|
||||
* Dimensions of scrolled content in chrome-document CSS pixels.
|
||||
*/
|
||||
readonly attribute float contentWidth;
|
||||
readonly attribute float contentHeight;
|
||||
|
||||
/**
|
||||
* ID that can be used in conjunction with nsIDOMWindowUtils to change
|
||||
* the actual document, instead of just how it is transformed.
|
||||
*/
|
||||
readonly attribute nsContentViewId id;
|
||||
};
|
||||
|
||||
[scriptable, uuid(ba5af90d-ece5-40b2-9a1d-a0154128db1c)]
|
||||
interface nsIContentViewManager : nsISupports
|
||||
{
|
||||
/**
|
||||
* Retrieve view scrolling/scaling interfaces in a given area,
|
||||
* used to support asynchronous re-paints of content pixels.
|
||||
* These interfaces are only meaningful for <browser>.
|
||||
*
|
||||
* Pixels are in chrome device pixels and are relative to the browser
|
||||
* element.
|
||||
*
|
||||
* @param aX x coordinate that will be in target rectangle
|
||||
* @param aY y coordinate that will be in target rectangle
|
||||
* @param aTopSize How much to expand up the rectangle
|
||||
* @param aRightSize How much to expand right the rectangle
|
||||
* @param aBottomSize How much to expand down the rectangle
|
||||
* @param aLeftSize How much to expand left the rectangle
|
||||
*/
|
||||
void getContentViewsIn(in float aXPx, in float aYPx,
|
||||
in float aTopSize, in float aRightSize,
|
||||
in float aBottomSize, in float aLeftSize,
|
||||
[optional] out unsigned long aLength,
|
||||
[retval, array, size_is(aLength)] out nsIContentView aResult);
|
||||
|
||||
/**
|
||||
* The root content view.
|
||||
*/
|
||||
readonly attribute nsIContentView rootContentView;
|
||||
};
|
||||
|
||||
[scriptable, uuid(50a67436-bb44-11df-8d9a-001e37d2764a)]
|
||||
interface nsIFrameLoader : nsISupports
|
||||
{
|
||||
|
@ -121,34 +217,14 @@ interface nsIFrameLoader : nsISupports
|
|||
|
||||
attribute boolean delayRemoteDialogs;
|
||||
|
||||
|
||||
/**
|
||||
* Implement viewport scrolling/scaling, used to support
|
||||
* asynchronous re-paints of content pixels. These interfaces are
|
||||
* only meaningful for <browser>.
|
||||
*
|
||||
* These interfaces do *not* scroll or scale the content document;
|
||||
* instead they set a "goal" scroll/scale wrt the current content
|
||||
* viewport. When the content document is painted, the viewport*
|
||||
* attributes are used to set a compensating transform. If the
|
||||
* metrics of the content document's current pixels don't match the
|
||||
* viewport* config, the transform matrix may need to translate
|
||||
* content pixels and/or perform a "fuzzy-scale" that doesn't
|
||||
* re-rasterize fonts or intelligently resample images.
|
||||
*
|
||||
* The viewport* attrs are allowed to transform content pixels in
|
||||
* such a way that the <browser>'s visible rect encloses pixels that
|
||||
* the content document does not (yet) define.
|
||||
*
|
||||
* The viewport scroll values are in units of chrome-document CSS
|
||||
* pixels.
|
||||
*
|
||||
* These APIs are designed to be used with nsIDOMWindowUtils
|
||||
* setDisplayPort() and setResolution().
|
||||
* DEPRECATED. Please QI to nsIContentViewManager.
|
||||
* FIXME 615368
|
||||
*/
|
||||
void scrollViewportTo(in float xPx, in float yPx);
|
||||
void scrollViewportBy(in float dxPx, in float dyPx);
|
||||
void setViewportScale(in float xScale, in float yScale);
|
||||
|
||||
readonly attribute float viewportScrollX;
|
||||
readonly attribute float viewportScrollY;
|
||||
};
|
||||
|
@ -176,3 +252,25 @@ interface nsIFrameLoaderOwner : nsISupports
|
|||
*/
|
||||
void swapFrameLoaders(in nsIFrameLoaderOwner aOtherOwner);
|
||||
};
|
||||
|
||||
/** Please merge me into something else after 2.0 branches. */
|
||||
[scriptable, uuid(e3e2d3f8-1397-4984-abb3-435c29a1ca55)]
|
||||
interface nsIFrameLoader_MOZILLA_2_0_BRANCH : nsISupports
|
||||
{
|
||||
/**
|
||||
* The default rendering mode is synchronous scrolling. In this
|
||||
* mode, it's an error to try to set a target viewport.
|
||||
*/
|
||||
const unsigned long RENDER_MODE_DEFAULT = 0x00000000;
|
||||
/**
|
||||
* When asynchronous scrolling is enabled, a target viewport can be
|
||||
* set to transform content pixels wrt its CSS viewport.
|
||||
*
|
||||
* NB: when async scrolling is enabled, it's the *user's*
|
||||
* responsibility to update the target scroll offset. In effect,
|
||||
* the platform hands over control of scroll offset to the user.
|
||||
*/
|
||||
const unsigned long RENDER_MODE_ASYNC_SCROLL = 0x00000001;
|
||||
|
||||
attribute unsigned long renderMode;
|
||||
};
|
||||
|
|
|
@ -110,14 +110,20 @@
|
|||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/unused.h"
|
||||
|
||||
#include "Layers.h"
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "ContentParent.h"
|
||||
#include "TabParent.h"
|
||||
#include "mozilla/layout/RenderFrameParent.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
#endif
|
||||
|
||||
using namespace mozilla::layers;
|
||||
typedef FrameMetrics::ViewID ViewID;
|
||||
|
||||
#include "jsapi.h"
|
||||
|
||||
class nsAsyncDocShellDestroyer : public nsRunnable
|
||||
|
@ -139,6 +145,134 @@ public:
|
|||
nsRefPtr<nsIDocShell> mDocShell;
|
||||
};
|
||||
|
||||
static void InvalidateFrame(nsIFrame* aFrame)
|
||||
{
|
||||
nsRect rect = nsRect(nsPoint(0, 0), aFrame->GetRect().Size());
|
||||
// NB: we pass INVALIDATE_NO_THEBES_LAYERS here to keep view
|
||||
// semantics the same for both in-process and out-of-process
|
||||
// <browser>. This is just a transform of the layer subtree in
|
||||
// both.
|
||||
aFrame->InvalidateWithFlags(rect, nsIFrame::INVALIDATE_NO_THEBES_LAYERS);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsContentView, nsIContentView)
|
||||
|
||||
bool
|
||||
nsContentView::IsRoot() const
|
||||
{
|
||||
return mScrollId == FrameMetrics::ROOT_SCROLL_ID;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentView::Update(const ViewConfig& aConfig)
|
||||
{
|
||||
if (aConfig == mConfig) {
|
||||
return NS_OK;
|
||||
}
|
||||
mConfig = aConfig;
|
||||
|
||||
// View changed. Try to locate our subdoc frame and invalidate
|
||||
// it if found.
|
||||
if (!mOwnerContent) {
|
||||
if (IsRoot()) {
|
||||
// Oops, don't have a frame right now. That's OK; the view
|
||||
// config persists and will apply to the next frame we get, if we
|
||||
// ever get one.
|
||||
return NS_OK;
|
||||
} else {
|
||||
// This view is no longer valid.
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame* frame = mOwnerContent->GetPrimaryFrame();
|
||||
|
||||
// XXX could be clever here and compute a smaller invalidation
|
||||
// rect
|
||||
InvalidateFrame(frame);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentView::ScrollTo(float aXpx, float aYpx)
|
||||
{
|
||||
ViewConfig config(mConfig);
|
||||
config.mScrollOffset = nsPoint(nsPresContext::CSSPixelsToAppUnits(aXpx),
|
||||
nsPresContext::CSSPixelsToAppUnits(aYpx));
|
||||
return Update(config);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentView::ScrollBy(float aDXpx, float aDYpx)
|
||||
{
|
||||
ViewConfig config(mConfig);
|
||||
config.mScrollOffset.MoveBy(nsPresContext::CSSPixelsToAppUnits(aDXpx),
|
||||
nsPresContext::CSSPixelsToAppUnits(aDYpx));
|
||||
return Update(config);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentView::SetScale(float aXScale, float aYScale)
|
||||
{
|
||||
ViewConfig config(mConfig);
|
||||
config.mXScale = aXScale;
|
||||
config.mYScale = aYScale;
|
||||
return Update(config);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentView::GetScrollX(float* aViewScrollX)
|
||||
{
|
||||
*aViewScrollX = nsPresContext::AppUnitsToFloatCSSPixels(
|
||||
mConfig.mScrollOffset.x);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentView::GetScrollY(float* aViewScrollY)
|
||||
{
|
||||
*aViewScrollY = nsPresContext::AppUnitsToFloatCSSPixels(
|
||||
mConfig.mScrollOffset.y);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentView::GetViewportWidth(float* aWidth)
|
||||
{
|
||||
*aWidth = nsPresContext::AppUnitsToFloatCSSPixels(mViewportSize.width);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentView::GetViewportHeight(float* aHeight)
|
||||
{
|
||||
*aHeight = nsPresContext::AppUnitsToFloatCSSPixels(mViewportSize.height);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentView::GetContentWidth(float* aWidth)
|
||||
{
|
||||
*aWidth = nsPresContext::AppUnitsToFloatCSSPixels(mContentSize.width);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentView::GetContentHeight(float* aHeight)
|
||||
{
|
||||
*aHeight = nsPresContext::AppUnitsToFloatCSSPixels(mContentSize.height);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentView::GetId(nsContentViewId* aId)
|
||||
{
|
||||
NS_ASSERTION(sizeof(nsContentViewId) == sizeof(ViewID),
|
||||
"ID size for XPCOM ID and internal ID type are not the same!");
|
||||
*aId = mScrollId;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Bug 136580: Limit to the number of nested content frames that can have the
|
||||
// same URL. This is to stop content that is recursively loading
|
||||
// itself. Note that "#foo" on the end of URL doesn't affect
|
||||
|
@ -171,14 +305,36 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsFrameLoader)
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mChildMessageManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFrameLoader)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameLoader)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIFrameLoader)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIFrameLoader_MOZILLA_2_0_BRANCH)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContentViewManager)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFrameLoader)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
nsFrameLoader::nsFrameLoader(nsIContent *aOwner, PRBool aNetworkCreated)
|
||||
: mOwnerContent(aOwner)
|
||||
, mDepthTooGreat(PR_FALSE)
|
||||
, mIsTopLevelContent(PR_FALSE)
|
||||
, mDestroyCalled(PR_FALSE)
|
||||
, mNeedsAsyncDestroy(PR_FALSE)
|
||||
, mInSwap(PR_FALSE)
|
||||
, mInShow(PR_FALSE)
|
||||
, mHideCalled(PR_FALSE)
|
||||
, mNetworkCreated(aNetworkCreated)
|
||||
#ifdef MOZ_IPC
|
||||
, mDelayRemoteDialogs(PR_FALSE)
|
||||
, mRemoteBrowserShown(PR_FALSE)
|
||||
, mRemoteFrame(false)
|
||||
, mCurrentRemoteFrame(nsnull)
|
||||
, mRemoteBrowser(nsnull)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
nsFrameLoader*
|
||||
nsFrameLoader::Create(nsIContent* aOwner, PRBool aNetworkCreated)
|
||||
{
|
||||
|
@ -996,8 +1152,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
|||
ourWindow->SetFrameElementInternal(otherFrameElement);
|
||||
otherWindow->SetFrameElementInternal(ourFrameElement);
|
||||
|
||||
mOwnerContent = otherContent;
|
||||
aOther->mOwnerContent = ourContent;
|
||||
SetOwnerContent(otherContent);
|
||||
aOther->SetOwnerContent(ourContent);
|
||||
|
||||
nsRefPtr<nsFrameMessageManager> ourMessageManager = mMessageManager;
|
||||
nsRefPtr<nsFrameMessageManager> otherMessageManager = aOther->mMessageManager;
|
||||
|
@ -1098,7 +1254,7 @@ nsFrameLoader::Destroy()
|
|||
doc->SetSubDocumentFor(mOwnerContent, nsnull);
|
||||
}
|
||||
|
||||
mOwnerContent = nsnull;
|
||||
SetOwnerContent(nsnull);
|
||||
}
|
||||
DestroyChild();
|
||||
|
||||
|
@ -1153,6 +1309,15 @@ nsFrameLoader::GetDepthTooGreat(PRBool* aDepthTooGreat)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameLoader::SetOwnerContent(nsIContent* aContent)
|
||||
{
|
||||
mOwnerContent = aContent;
|
||||
if (RenderFrameParent* rfp = GetCurrentRemoteFrame()) {
|
||||
rfp->OwnerContentChanged(aContent);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
bool
|
||||
nsFrameLoader::ShouldUseRemoteProcess()
|
||||
|
@ -1504,73 +1669,49 @@ nsFrameLoader::UpdateBaseWindowPositionAndSize(nsIFrame *aIFrame)
|
|||
NS_IMETHODIMP
|
||||
nsFrameLoader::ScrollViewportTo(float aXpx, float aYpx)
|
||||
{
|
||||
ViewportConfig config(mViewportConfig);
|
||||
config.mScrollOffset = nsPoint(nsPresContext::CSSPixelsToAppUnits(aXpx),
|
||||
nsPresContext::CSSPixelsToAppUnits(aYpx));
|
||||
return UpdateViewportConfig(config);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::ScrollViewportBy(float aDXpx, float aDYpx)
|
||||
{
|
||||
ViewportConfig config(mViewportConfig);
|
||||
config.mScrollOffset.MoveBy(nsPresContext::CSSPixelsToAppUnits(aDXpx),
|
||||
nsPresContext::CSSPixelsToAppUnits(aDYpx));
|
||||
return UpdateViewportConfig(config);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::SetViewportScale(float aXScale, float aYScale)
|
||||
{
|
||||
ViewportConfig config(mViewportConfig);
|
||||
config.mXScale = aXScale;
|
||||
config.mYScale = aYScale;
|
||||
return UpdateViewportConfig(config);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetViewportScrollX(float* aViewportScrollX)
|
||||
{
|
||||
*aViewportScrollX =
|
||||
nsPresContext::AppUnitsToFloatCSSPixels(mViewportConfig.mScrollOffset.x);
|
||||
return NS_OK;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetViewportScrollY(float* aViewportScrollY)
|
||||
{
|
||||
*aViewportScrollY =
|
||||
nsPresContext::AppUnitsToFloatCSSPixels(mViewportConfig.mScrollOffset.y);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetRenderMode(PRUint32* aRenderMode)
|
||||
{
|
||||
*aRenderMode = mRenderMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFrameLoader::UpdateViewportConfig(const ViewportConfig& aNewConfig)
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::SetRenderMode(PRUint32 aRenderMode)
|
||||
{
|
||||
if (aNewConfig == mViewportConfig) {
|
||||
return NS_OK;
|
||||
}
|
||||
mViewportConfig = aNewConfig;
|
||||
|
||||
// Viewport changed. Try to locate our subdoc frame and invalidate
|
||||
// it if found.
|
||||
nsIFrame* frame = GetPrimaryFrameOfOwningContent();
|
||||
if (!frame) {
|
||||
// Oops, don't have a frame right now. That's OK; the viewport
|
||||
// config persists and will apply to the next frame we get, if we
|
||||
// ever get one.
|
||||
if (aRenderMode == mRenderMode) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX could be clever here and compute a smaller invalidation
|
||||
// rect
|
||||
nsRect rect = nsRect(nsPoint(0, 0), frame->GetRect().Size());
|
||||
// NB: we pass INVALIDATE_NO_THEBES_LAYERS here to keep viewport
|
||||
// semantics the same for both in-process and out-of-process
|
||||
// <browser>. This is just a transform of the layer subtree in
|
||||
// both.
|
||||
frame->InvalidateWithFlags(rect, nsIFrame::INVALIDATE_NO_THEBES_LAYERS);
|
||||
|
||||
mRenderMode = aRenderMode;
|
||||
InvalidateFrame(GetPrimaryFrameOfOwningContent());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1859,6 +2000,60 @@ nsFrameLoader::GetMessageManager(nsIChromeFrameMessageManager** aManager)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetContentViewsIn(float aXPx, float aYPx,
|
||||
float aTopSize, float aRightSize,
|
||||
float aBottomSize, float aLeftSize,
|
||||
PRUint32* aLength,
|
||||
nsIContentView*** aResult)
|
||||
{
|
||||
nscoord x = nsPresContext::CSSPixelsToAppUnits(aXPx - aLeftSize);
|
||||
nscoord y = nsPresContext::CSSPixelsToAppUnits(aYPx - aTopSize);
|
||||
nscoord w = nsPresContext::CSSPixelsToAppUnits(aLeftSize + aRightSize) + 1;
|
||||
nscoord h = nsPresContext::CSSPixelsToAppUnits(aTopSize + aBottomSize) + 1;
|
||||
nsRect target(x, y, w, h);
|
||||
|
||||
nsIFrame* frame = GetPrimaryFrameOfOwningContent();
|
||||
|
||||
nsTArray<ViewID> ids;
|
||||
nsLayoutUtils::GetRemoteContentIds(frame, target, ids, true);
|
||||
if (ids.Length() == 0 || !GetCurrentRemoteFrame()) {
|
||||
*aResult = nsnull;
|
||||
*aLength = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIContentView** result = reinterpret_cast<nsIContentView**>(
|
||||
NS_Alloc(ids.Length() * sizeof(nsIContentView*)));
|
||||
|
||||
for (PRUint32 i = 0; i < ids.Length(); i++) {
|
||||
nsIContentView* view = GetCurrentRemoteFrame()->GetContentView(ids[i]);
|
||||
NS_ABORT_IF_FALSE(view, "Retrieved ID from RenderFrameParent, it should be valid!");
|
||||
nsRefPtr<nsIContentView>(view).forget(&result[i]);
|
||||
}
|
||||
|
||||
*aResult = result;
|
||||
*aLength = ids.Length();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetRootContentView(nsIContentView** aContentView)
|
||||
{
|
||||
RenderFrameParent* rfp = GetCurrentRemoteFrame();
|
||||
if (!rfp) {
|
||||
*aContentView = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsContentView* view = rfp->GetContentView();
|
||||
NS_ABORT_IF_FALSE(view, "Should always be able to create root scrollable!");
|
||||
nsRefPtr<nsIContentView>(view).forget(aContentView);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFrameLoader::EnsureMessageManager()
|
||||
{
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsFrameMessageManager.h"
|
||||
#include "Layers.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIURI;
|
||||
|
@ -80,47 +81,24 @@ class QX11EmbedContainer;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
class nsFrameLoader : public nsIFrameLoader
|
||||
/**
|
||||
* Defines a target configuration for this <browser>'s content
|
||||
* document's view. If the content document's actual view
|
||||
* doesn't match this nsIContentView, then on paints its pixels
|
||||
* are transformed to compensate for the difference.
|
||||
*
|
||||
* Used to support asynchronous re-paints of content pixels; see
|
||||
* nsIContentView.
|
||||
*/
|
||||
class nsContentView : public nsIContentView
|
||||
{
|
||||
friend class AutoResetInShow;
|
||||
#ifdef MOZ_IPC
|
||||
typedef mozilla::dom::PBrowserParent PBrowserParent;
|
||||
typedef mozilla::dom::TabParent TabParent;
|
||||
typedef mozilla::layout::RenderFrameParent RenderFrameParent;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsFrameLoader(nsIContent *aOwner, PRBool aNetworkCreated) :
|
||||
mOwnerContent(aOwner),
|
||||
mDepthTooGreat(PR_FALSE),
|
||||
mIsTopLevelContent(PR_FALSE),
|
||||
mDestroyCalled(PR_FALSE),
|
||||
mNeedsAsyncDestroy(PR_FALSE),
|
||||
mInSwap(PR_FALSE),
|
||||
mInShow(PR_FALSE),
|
||||
mHideCalled(PR_FALSE),
|
||||
mNetworkCreated(aNetworkCreated)
|
||||
#ifdef MOZ_IPC
|
||||
, mDelayRemoteDialogs(PR_FALSE)
|
||||
, mRemoteBrowserShown(PR_FALSE)
|
||||
, mRemoteFrame(false)
|
||||
, mCurrentRemoteFrame(nsnull)
|
||||
, mRemoteBrowser(nsnull)
|
||||
#endif
|
||||
{}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Defines a target configuration for this <browser>'s content
|
||||
* document's viewport. If the content document's actual viewport
|
||||
* doesn't match a desired ViewportConfig, then on paints its pixels
|
||||
* are transformed to compensate for the difference.
|
||||
*
|
||||
* Used to support asynchronous re-paints of content pixels; see
|
||||
* nsIFrameLoader.scrollViewport* and viewportScale.
|
||||
*/
|
||||
struct ViewportConfig {
|
||||
ViewportConfig()
|
||||
typedef mozilla::layers::FrameMetrics::ViewID ViewID;
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICONTENTVIEW
|
||||
|
||||
struct ViewConfig {
|
||||
ViewConfig()
|
||||
: mScrollOffset(0, 0)
|
||||
, mXScale(1.0)
|
||||
, mYScale(1.0)
|
||||
|
@ -128,7 +106,7 @@ public:
|
|||
|
||||
// Default copy ctor and operator= are fine
|
||||
|
||||
PRBool operator==(const ViewportConfig& aOther) const
|
||||
PRBool operator==(const ViewConfig& aOther) const
|
||||
{
|
||||
return (mScrollOffset == aOther.mScrollOffset &&
|
||||
mXScale == aOther.mXScale &&
|
||||
|
@ -151,6 +129,55 @@ public:
|
|||
float mYScale;
|
||||
};
|
||||
|
||||
nsContentView(nsIContent* aOwnerContent, ViewID aScrollId,
|
||||
ViewConfig aConfig = ViewConfig())
|
||||
: mViewportSize(0, 0)
|
||||
, mContentSize(0, 0)
|
||||
, mOwnerContent(aOwnerContent)
|
||||
, mScrollId(aScrollId)
|
||||
, mConfig(aConfig)
|
||||
{}
|
||||
|
||||
bool IsRoot() const;
|
||||
|
||||
ViewID GetId() const
|
||||
{
|
||||
return mScrollId;
|
||||
}
|
||||
|
||||
ViewConfig GetViewConfig() const
|
||||
{
|
||||
return mConfig;
|
||||
}
|
||||
|
||||
nsSize mViewportSize;
|
||||
nsSize mContentSize;
|
||||
|
||||
nsIContent *mOwnerContent; // WEAK
|
||||
|
||||
private:
|
||||
nsresult Update(const ViewConfig& aConfig);
|
||||
|
||||
ViewID mScrollId;
|
||||
ViewConfig mConfig;
|
||||
};
|
||||
|
||||
|
||||
class nsFrameLoader : public nsIFrameLoader,
|
||||
public nsIFrameLoader_MOZILLA_2_0_BRANCH,
|
||||
public nsIContentViewManager
|
||||
{
|
||||
friend class AutoResetInShow;
|
||||
#ifdef MOZ_IPC
|
||||
typedef mozilla::dom::PBrowserParent PBrowserParent;
|
||||
typedef mozilla::dom::TabParent TabParent;
|
||||
typedef mozilla::layout::RenderFrameParent RenderFrameParent;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsFrameLoader(nsIContent *aOwner, PRBool aNetworkCreated);
|
||||
|
||||
public:
|
||||
~nsFrameLoader() {
|
||||
mNeedsAsyncDestroy = PR_TRUE;
|
||||
if (mMessageManager) {
|
||||
|
@ -159,11 +186,18 @@ public:
|
|||
nsFrameLoader::Destroy();
|
||||
}
|
||||
|
||||
PRBool AsyncScrollEnabled() const
|
||||
{
|
||||
return !!(mRenderMode & RENDER_MODE_ASYNC_SCROLL);
|
||||
}
|
||||
|
||||
static nsFrameLoader* Create(nsIContent* aOwner, PRBool aNetworkCreated);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsFrameLoader)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
|
||||
NS_DECL_NSIFRAMELOADER
|
||||
NS_DECL_NSIFRAMELOADER_MOZILLA_2_0_BRANCH
|
||||
NS_DECL_NSICONTENTVIEWMANAGER
|
||||
NS_HIDDEN_(nsresult) CheckForRecursiveLoad(nsIURI* aURI);
|
||||
nsresult ReallyStartLoading();
|
||||
void Finalize();
|
||||
|
@ -248,7 +282,8 @@ public:
|
|||
#endif
|
||||
nsFrameMessageManager* GetFrameMessageManager() { return mMessageManager; }
|
||||
|
||||
const ViewportConfig& GetViewportConfig() { return mViewportConfig; }
|
||||
nsIContent* GetOwnerContent() { return mOwnerContent; }
|
||||
void SetOwnerContent(nsIContent* aContent);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -282,8 +317,6 @@ private:
|
|||
bool ShowRemoteFrame(const nsIntSize& size);
|
||||
#endif
|
||||
|
||||
nsresult UpdateViewportConfig(const ViewportConfig& aNewConfig);
|
||||
|
||||
nsCOMPtr<nsIDocShell> mDocShell;
|
||||
nsCOMPtr<nsIURI> mURIToLoad;
|
||||
nsIContent *mOwnerContent; // WEAK
|
||||
|
@ -314,7 +347,10 @@ private:
|
|||
TabParent* mRemoteBrowser;
|
||||
#endif
|
||||
|
||||
ViewportConfig mViewportConfig;
|
||||
// See nsIFrameLoader.idl. Short story, if !(mRenderMode &
|
||||
// RENDER_MODE_ASYNC_SCROLL), all the fields below are ignored in
|
||||
// favor of what content tells.
|
||||
PRUint32 mRenderMode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1747,6 +1747,7 @@ GK_ATOM(DeleteTxnName, "Deleting")
|
|||
|
||||
// IPC stuff
|
||||
GK_ATOM(Remote, "remote")
|
||||
GK_ATOM(RemoteId, "_remote_id")
|
||||
|
||||
// Names for system metrics
|
||||
GK_ATOM(scrollbar_start_backward, "scrollbar-start-backward")
|
||||
|
|
|
@ -225,6 +225,13 @@ private:
|
|||
void CancelImageRequests(nsresult aReason, PRBool aEvenIfSizeAvailable,
|
||||
PRInt16 aNewImageStatus);
|
||||
|
||||
/**
|
||||
* Method to fire an event once we know what's going on with the image load.
|
||||
*
|
||||
* @param aEventType "load" or "error" depending on how things went
|
||||
*/
|
||||
nsresult FireEvent(const nsAString& aEventType);
|
||||
protected:
|
||||
/**
|
||||
* Method to create an nsIURI object from the given string (will
|
||||
* handle getting the right charset, base, etc). You MUST pass in a
|
||||
|
@ -237,13 +244,6 @@ private:
|
|||
nsresult StringToURI(const nsAString& aSpec, nsIDocument* aDocument,
|
||||
nsIURI** aURI);
|
||||
|
||||
/**
|
||||
* Method to fire an event once we know what's going on with the image load.
|
||||
*
|
||||
* @param aEventType "load" or "error" depending on how things went
|
||||
*/
|
||||
nsresult FireEvent(const nsAString& aEventType);
|
||||
protected:
|
||||
void CreateStaticImageClone(nsImageLoadingContent* aDest) const;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1524,7 +1524,7 @@ nsObjectLoadingContent::RemovedFromDocument()
|
|||
void
|
||||
nsObjectLoadingContent::Traverse(nsCycleCollectionTraversalCallback &cb)
|
||||
{
|
||||
cb.NoteXPCOMChild(mFrameLoader);
|
||||
cb.NoteXPCOMChild(static_cast<nsIFrameLoader*>(mFrameLoader));
|
||||
}
|
||||
|
||||
// <private>
|
||||
|
|
|
@ -15,6 +15,44 @@
|
|||
<iframe style="width:100%;height:300px;" id="harness"></iframe>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
function examiner() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
var obsvc = Components.classes['@mozilla.org/observer-service;1']
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
obsvc.addObserver(this, "http-on-examine-response", false);
|
||||
}
|
||||
examiner.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
if(!subject.QueryInterface)
|
||||
return;
|
||||
|
||||
if (topic == "http-on-examine-response") {
|
||||
var chan = subject.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
var uri = chan.URI
|
||||
if (!uri.path.match(/^\/tests\/content\/base\/test\/file_x-frame-options_page\.sjs/))
|
||||
return;
|
||||
dump(">>>> PATH: "+uri.path+"\n");
|
||||
dump(">>> REQUEST:\n>>> "+chan.requestMethod+" "+uri.asciiSpec+"\n");
|
||||
dump(">>> RESPONSE HEADERS:\n");
|
||||
chan.visitResponseHeaders({
|
||||
visitHeader: function(header, value) {
|
||||
dump(">>> "+header+": "+value+"\n");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
var obsvc = Components.classes['@mozilla.org/observer-service;1']
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
obsvc.removeObserver(this, "http-on-examine-response");
|
||||
}
|
||||
}
|
||||
|
||||
window.examiner = new examiner();
|
||||
|
||||
var path = "/tests/content/base/test/";
|
||||
|
||||
var testFramesLoaded = function() {
|
||||
|
@ -81,6 +119,7 @@ var testFrameInDataURI = function() {
|
|||
win.close();
|
||||
|
||||
// finalize test
|
||||
window.examiner.remove();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
win.location.href = "data:text/html,"+html;
|
||||
|
|
|
@ -3198,9 +3198,17 @@ WebGLContext::DOMElementToImageSurface(nsIDOMElement *imageOrCanvas,
|
|||
{
|
||||
gfxImageSurface *surf = nsnull;
|
||||
|
||||
PRUint32 flags =
|
||||
nsLayoutUtils::SFE_WANT_NEW_SURFACE |
|
||||
nsLayoutUtils::SFE_WANT_IMAGE_SURFACE;
|
||||
|
||||
if (mPixelStoreColorspaceConversion == LOCAL_GL_NONE)
|
||||
flags |= nsLayoutUtils::SFE_NO_COLORSPACE_CONVERSION;
|
||||
if (!mPixelStorePremultiplyAlpha)
|
||||
flags |= nsLayoutUtils::SFE_NO_PREMULTIPLY_ALPHA;
|
||||
|
||||
nsLayoutUtils::SurfaceFromElementResult res =
|
||||
nsLayoutUtils::SurfaceFromElement(imageOrCanvas,
|
||||
nsLayoutUtils::SFE_WANT_NEW_SURFACE | nsLayoutUtils::SFE_WANT_IMAGE_SURFACE);
|
||||
nsLayoutUtils::SurfaceFromElement(imageOrCanvas, flags);
|
||||
if (!res.mSurface)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -4011,7 +4019,7 @@ WebGLContext::TexImage2D_dom(WebGLenum target, WebGLint level, WebGLenum interna
|
|||
isurf->Width(), isurf->Height(), isurf->Stride(), 0,
|
||||
format, type,
|
||||
isurf->Data(), byteLength,
|
||||
srcFormat, PR_TRUE);
|
||||
srcFormat, mPixelStorePremultiplyAlpha);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -1238,9 +1238,6 @@ nsCanvasRenderingContext2D::Render(gfxContext *ctx, gfxPattern::GraphicsFilter a
|
|||
if (mOpaque)
|
||||
ctx->SetOperator(op);
|
||||
|
||||
mIsEntireFrameInvalid = PR_FALSE;
|
||||
mInvalidateCount = 0;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -2576,7 +2573,6 @@ struct NS_STACK_CLASS nsCanvasBidiProcessor : public nsBidiPresUtils::BidiProces
|
|||
0,
|
||||
mTextRun->GetLength(),
|
||||
nsnull,
|
||||
nsnull,
|
||||
nsnull);
|
||||
}
|
||||
|
||||
|
@ -2924,7 +2920,6 @@ nsCanvasRenderingContext2D::MozDrawText(const nsAString& textToDraw)
|
|||
/* offset = */ 0,
|
||||
textToDraw.Length(),
|
||||
nsnull,
|
||||
nsnull,
|
||||
nsnull);
|
||||
|
||||
return Redraw();
|
||||
|
@ -3061,7 +3056,7 @@ nsCanvasRenderingContext2D::MozTextAlongPath(const nsAString& textToDraw, PRBool
|
|||
if(stroke) {
|
||||
textRun->DrawToPath(mThebes, pt, i, 1, nsnull, nsnull);
|
||||
} else {
|
||||
textRun->Draw(mThebes, pt, i, 1, nsnull, nsnull, nsnull);
|
||||
textRun->Draw(mThebes, pt, i, 1, nsnull, nsnull);
|
||||
}
|
||||
mThebes->SetMatrix(matrix);
|
||||
}
|
||||
|
@ -3694,7 +3689,7 @@ nsCanvasRenderingContext2D::AsyncDrawXULElement(nsIDOMXULElement* aElem, float a
|
|||
if (!loaderOwner)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsFrameLoader> frameloader = loaderOwner->GetFrameLoader();
|
||||
nsRefPtr<nsFrameLoader> frameloader = loaderOwner->GetFrameLoader();
|
||||
if (!frameloader)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -4063,8 +4058,13 @@ nsCanvasRenderingContext2D::GetCanvasLayer(CanvasLayer *aOldLayer,
|
|||
if (!mResetLayer && aOldLayer &&
|
||||
aOldLayer->HasUserData(&g2DContextLayerUserData)) {
|
||||
NS_ADDREF(aOldLayer);
|
||||
// XXX Need to just update the changed area here
|
||||
aOldLayer->Updated(nsIntRect(0, 0, mWidth, mHeight));
|
||||
if (mIsEntireFrameInvalid || mInvalidateCount > 0) {
|
||||
// XXX Need to just update the changed area here; we should keep track
|
||||
// of the rectangle based on Redraw args.
|
||||
aOldLayer->Updated(nsIntRect(0, 0, mWidth, mHeight));
|
||||
MarkContextClean();
|
||||
}
|
||||
|
||||
return aOldLayer;
|
||||
}
|
||||
|
||||
|
@ -4086,6 +4086,9 @@ nsCanvasRenderingContext2D::GetCanvasLayer(CanvasLayer *aOldLayer,
|
|||
canvasLayer->Updated(nsIntRect(0, 0, mWidth, mHeight));
|
||||
|
||||
mResetLayer = PR_FALSE;
|
||||
|
||||
MarkContextClean();
|
||||
|
||||
return canvasLayer.forget().get();
|
||||
}
|
||||
|
||||
|
@ -4093,5 +4096,6 @@ void
|
|||
nsCanvasRenderingContext2D::MarkContextClean()
|
||||
{
|
||||
mIsEntireFrameInvalid = PR_FALSE;
|
||||
mInvalidateCount = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -3052,7 +3052,7 @@ nsGenericHTMLFrameElement::~nsGenericHTMLFrameElement()
|
|||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericHTMLFrameElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGenericHTMLFrameElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFrameLoader)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mFrameLoader, nsIFrameLoader)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsGenericHTMLFrameElement)
|
||||
|
|
|
@ -3377,12 +3377,6 @@ nsHTMLDocument::EditingStateChanged()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
presShell->ReconstructStyleData();
|
||||
|
||||
if (designMode) {
|
||||
// We need to flush styles here because we're setting an XBL binding in
|
||||
// designmode.css.
|
||||
FlushPendingNotifications(Flush_Style);
|
||||
}
|
||||
}
|
||||
|
||||
mEditingState = newState;
|
||||
|
|
|
@ -192,16 +192,19 @@ PRBool nsBuiltinDecoderStateMachine::HaveNextFrameData() const {
|
|||
(!HasVideo() || mReader->mVideoQueue.GetSize() > 0);
|
||||
}
|
||||
|
||||
PRInt64 nsBuiltinDecoderStateMachine::GetDecodedAudioDuration() {
|
||||
NS_ASSERTION(OnDecodeThread(), "Should be on decode thread.");
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
PRInt64 audioDecoded = mReader->mAudioQueue.Duration();
|
||||
if (mAudioEndTime != -1) {
|
||||
audioDecoded += mAudioEndTime - GetMediaTime();
|
||||
}
|
||||
return audioDecoded;
|
||||
}
|
||||
|
||||
void nsBuiltinDecoderStateMachine::DecodeLoop()
|
||||
{
|
||||
NS_ASSERTION(OnDecodeThread(), "Should be on decode thread.");
|
||||
PRBool videoPlaying = PR_FALSE;
|
||||
PRBool audioPlaying = PR_FALSE;
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
videoPlaying = HasVideo();
|
||||
audioPlaying = HasAudio();
|
||||
}
|
||||
|
||||
// We want to "pump" the decode until we've got a few frames/samples decoded
|
||||
// before we consider whether decode is falling behind.
|
||||
|
@ -228,58 +231,37 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
|
|||
PRInt64 lowAudioThreshold = LOW_AUDIO_MS;
|
||||
|
||||
// Our local ample audio threshold. If we increase lowAudioThreshold, we'll
|
||||
// also increase this to appropriately (we don't want lowAudioThreshold to
|
||||
// also increase this too appropriately (we don't want lowAudioThreshold to
|
||||
// be greater than ampleAudioThreshold, else we'd stop decoding!).
|
||||
PRInt64 ampleAudioThreshold = AMPLE_AUDIO_MS;
|
||||
|
||||
// Main decode loop.
|
||||
while (videoPlaying || audioPlaying) {
|
||||
PRBool audioWait = !audioPlaying;
|
||||
PRBool videoWait = !videoPlaying;
|
||||
{
|
||||
// Wait for more data to download if we've exhausted all our
|
||||
// buffered data.
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
if (mState == DECODER_STATE_SHUTDOWN || mStopDecodeThreads)
|
||||
break;
|
||||
}
|
||||
MediaQueue<VideoData>& videoQueue = mReader->mVideoQueue;
|
||||
MediaQueue<SoundData>& audioQueue = mReader->mAudioQueue;
|
||||
|
||||
PRUint32 videoQueueSize = mReader->mVideoQueue.GetSize();
|
||||
// Don't decode any more frames if we've filled our buffers.
|
||||
// Limits memory consumption.
|
||||
if (videoQueueSize > AMPLE_VIDEO_FRAMES) {
|
||||
videoWait = PR_TRUE;
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
|
||||
PRBool videoPlaying = HasVideo();
|
||||
PRBool audioPlaying = HasAudio();
|
||||
|
||||
// Main decode loop.
|
||||
while (mState != DECODER_STATE_SHUTDOWN &&
|
||||
!mStopDecodeThreads &&
|
||||
(videoPlaying || audioPlaying))
|
||||
{
|
||||
// We don't want to consider skipping to the next keyframe if we've
|
||||
// only just started up the decode loop, so wait until we've decoded
|
||||
// some frames before enabling the keyframe skip logic on video.
|
||||
if (videoPump && videoQueue.GetSize() >= videoPumpThreshold) {
|
||||
videoPump = PR_FALSE;
|
||||
}
|
||||
|
||||
// We don't want to consider skipping to the next keyframe if we've
|
||||
// only just started up the decode loop, so wait until we've decoded
|
||||
// some frames before allowing the keyframe skip.
|
||||
if (videoPump && videoQueueSize >= videoPumpThreshold) {
|
||||
videoPump = PR_FALSE;
|
||||
}
|
||||
|
||||
// Determine how much audio data is decoded ahead of the current playback
|
||||
// position.
|
||||
PRInt64 currentTime = 0;
|
||||
PRInt64 audioDecoded = 0;
|
||||
PRBool decodeCloseToDownload = PR_FALSE;
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
currentTime = GetMediaTime();
|
||||
audioDecoded = mReader->mAudioQueue.Duration();
|
||||
if (mAudioEndTime != -1) {
|
||||
audioDecoded += mAudioEndTime - currentTime;
|
||||
}
|
||||
decodeCloseToDownload = IsDecodeCloseToDownload();
|
||||
}
|
||||
|
||||
// Don't decode any audio if the audio decode is way ahead.
|
||||
if (audioDecoded > ampleAudioThreshold) {
|
||||
audioWait = PR_TRUE;
|
||||
}
|
||||
if (audioPump && audioDecoded > audioPumpThresholdMs) {
|
||||
// some audio data before enabling the keyframe skip logic on audio.
|
||||
if (audioPump && GetDecodedAudioDuration() >= audioPumpThresholdMs) {
|
||||
audioPump = PR_FALSE;
|
||||
}
|
||||
|
||||
// We'll skip the video decode to the nearest keyframe if we're low on
|
||||
// audio, or if we're low on video, provided we're not running low on
|
||||
// data to decode. If we're running low on downloaded data to decode,
|
||||
|
@ -288,23 +270,28 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
|
|||
// after buffering finishes.
|
||||
if (!skipToNextKeyframe &&
|
||||
videoPlaying &&
|
||||
!decodeCloseToDownload &&
|
||||
((!audioPump && audioPlaying && audioDecoded < lowAudioThreshold) ||
|
||||
(!videoPump && videoQueueSize < LOW_VIDEO_FRAMES)))
|
||||
!IsDecodeCloseToDownload() &&
|
||||
((!audioPump && audioPlaying && GetDecodedAudioDuration() < lowAudioThreshold) ||
|
||||
(!videoPump && videoPlaying && videoQueue.GetSize() < LOW_VIDEO_FRAMES)))
|
||||
{
|
||||
skipToNextKeyframe = PR_TRUE;
|
||||
LOG(PR_LOG_DEBUG, ("Skipping video decode to the next keyframe"));
|
||||
}
|
||||
|
||||
// Video decode.
|
||||
if (videoPlaying && !videoWait) {
|
||||
if (videoPlaying && videoQueue.GetSize() < AMPLE_VIDEO_FRAMES) {
|
||||
// Time the video decode, so that if it's slow, we can increase our low
|
||||
// audio threshold to reduce the chance of an audio underrun while we're
|
||||
// waiting for a video decode to complete.
|
||||
TimeStamp start = TimeStamp::Now();
|
||||
videoPlaying = mReader->DecodeVideoFrame(skipToNextKeyframe, currentTime);
|
||||
TimeDuration decodeTime = TimeStamp::Now() - start;
|
||||
if (!decodeCloseToDownload &&
|
||||
TimeDuration decodeTime;
|
||||
{
|
||||
PRInt64 currentTime = GetMediaTime();
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
TimeStamp start = TimeStamp::Now();
|
||||
videoPlaying = mReader->DecodeVideoFrame(skipToNextKeyframe, currentTime);
|
||||
decodeTime = TimeStamp::Now() - start;
|
||||
}
|
||||
if (!IsDecodeCloseToDownload() &&
|
||||
THRESHOLD_FACTOR * decodeTime.ToMilliseconds() > lowAudioThreshold)
|
||||
{
|
||||
lowAudioThreshold =
|
||||
|
@ -317,50 +304,55 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
|
|||
lowAudioThreshold, ampleAudioThreshold));
|
||||
}
|
||||
}
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
}
|
||||
|
||||
// Audio decode.
|
||||
if (audioPlaying && !audioWait) {
|
||||
if (audioPlaying &&
|
||||
(GetDecodedAudioDuration() < ampleAudioThreshold || audioQueue.GetSize() == 0))
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
audioPlaying = mReader->DecodeAudioData();
|
||||
}
|
||||
|
||||
// Notify to ensure that the AudioLoop() is not waiting, in case it was
|
||||
// waiting for more audio to be decoded.
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
|
||||
if (!IsPlaying()) {
|
||||
// Update the ready state, so that the play DOM events fire. We only
|
||||
// need to do this if we're not playing; if we're playing the playback
|
||||
// code will do an update whenever it advances a frame.
|
||||
UpdateReadyState();
|
||||
}
|
||||
|
||||
if (mState == DECODER_STATE_SHUTDOWN || mStopDecodeThreads) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ((!HasAudio() || audioWait) &&
|
||||
(!HasVideo() || videoWait))
|
||||
{
|
||||
// All active bitstreams' decode is well ahead of the playback
|
||||
// position, we may as well wait for the playback to catch up.
|
||||
mon.Wait();
|
||||
}
|
||||
if (!IsPlaying()) {
|
||||
// Update the ready state, so that the play DOM events fire. We only
|
||||
// need to do this if we're not playing; if we're playing the playback
|
||||
// code will do an update whenever it advances a frame.
|
||||
UpdateReadyState();
|
||||
}
|
||||
}
|
||||
|
||||
if (mState != DECODER_STATE_SHUTDOWN &&
|
||||
!mStopDecodeThreads &&
|
||||
(!audioPlaying || (GetDecodedAudioDuration() >= ampleAudioThreshold &&
|
||||
audioQueue.GetSize() > 0))
|
||||
&&
|
||||
(!videoPlaying || videoQueue.GetSize() >= AMPLE_VIDEO_FRAMES))
|
||||
{
|
||||
// All active bitstreams' decode is well ahead of the playback
|
||||
// position, we may as well wait for the playback to catch up. Note the
|
||||
// audio push thread acquires and notifies the decoder monitor every time
|
||||
// it pops SoundData off the audio queue. So if the audio push thread pops
|
||||
// the last SoundData off the audio queue right after that queue reported
|
||||
// it was non-empty here, we'll receive a notification on the decoder
|
||||
// monitor which will wake us up shortly after we sleep, thus preventing
|
||||
// both the decode and audio push threads waiting at the same time.
|
||||
// See bug 620326.
|
||||
mon.Wait();
|
||||
}
|
||||
|
||||
} // End decode loop.
|
||||
|
||||
if (!mStopDecodeThreads &&
|
||||
mState != DECODER_STATE_SHUTDOWN &&
|
||||
mState != DECODER_STATE_SEEKING)
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
if (!mStopDecodeThreads &&
|
||||
mState != DECODER_STATE_SHUTDOWN &&
|
||||
mState != DECODER_STATE_SEEKING)
|
||||
{
|
||||
mState = DECODER_STATE_COMPLETED;
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
}
|
||||
mState = DECODER_STATE_COMPLETED;
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
}
|
||||
|
||||
LOG(PR_LOG_DEBUG, ("Shutting down DecodeLoop this=%p", this));
|
||||
}
|
||||
|
||||
|
|
|
@ -370,6 +370,15 @@ protected:
|
|||
return mStartTime + mCurrentFrameTime;
|
||||
}
|
||||
|
||||
// Returns an upper bound on the number of milliseconds of audio that is
|
||||
// decoded and playable. This is the sum of the number of ms of audio which
|
||||
// is decoded and in the reader's audio queue, and the ms of unplayed audio
|
||||
// which has been pushed to the audio hardware for playback. Note that after
|
||||
// calling this, the audio hardware may play some of the audio pushed to
|
||||
// hardware, so this can only be used as a upper bound. The decoder monitor
|
||||
// must be held when calling this. Called on the decoder thread.
|
||||
PRInt64 GetDecodedAudioDuration();
|
||||
|
||||
// Monitor on mAudioStream. This monitor must be held in order to delete
|
||||
// or use the audio stream. This stops us destroying the audio stream
|
||||
// while it's being used on another thread (typically when it's being
|
||||
|
|
|
@ -277,6 +277,10 @@ function getPlayableVideo(candidates) {
|
|||
// virtual address space. Beware!
|
||||
var PARALLEL_TESTS = 2;
|
||||
|
||||
// When true, we'll loop forever on whatever test we run. Use this to debug
|
||||
// intermittent test failures.
|
||||
const DEBUG_TEST_LOOP_FOREVER = false;
|
||||
|
||||
// Manages a run of media tests. Runs them in chunks in order to limit
|
||||
// the number of media elements/threads running in parallel. This limits peak
|
||||
// memory use, particularly on Linux x86 where thread stacks use 10MB of
|
||||
|
@ -341,7 +345,7 @@ function MediaTestManager() {
|
|||
// thread stacks' address space.
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
Components.utils.forceGC();
|
||||
if (this.testNum == this.tests.length) {
|
||||
if (this.testNum == this.tests.length && !DEBUG_TEST_LOOP_FOREVER) {
|
||||
if (this.onFinished) {
|
||||
this.onFinished();
|
||||
}
|
||||
|
@ -354,6 +358,10 @@ function MediaTestManager() {
|
|||
var token = (test.name ? (test.name + "-"): "") + this.testNum;
|
||||
this.testNum++;
|
||||
|
||||
if (DEBUG_TEST_LOOP_FOREVER && this.testNum == this.tests.length) {
|
||||
this.testNum = 0;
|
||||
}
|
||||
|
||||
// Ensure we can play the resource type.
|
||||
if (test.type && !document.createElement('video').canPlayType(test.type))
|
||||
continue;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<svg xmlns='http://www.w3.org/2000/svg'
|
||||
xmlns:xlink='http://www.w3.org/1999/xlink'
|
||||
width='16' height='16'>
|
||||
<image id='i' xlink:href='a.png' width='16' height='16'/>
|
||||
<filter id="f" x="0%" y="0%" width="100%" height="100%">
|
||||
<feImage xlink:href="#image1" />
|
||||
</filter>
|
||||
<rect filter="url(#f)" x="0" y="0" width="16" height="16"/>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 351 B |
|
@ -0,0 +1,7 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<set/>
|
||||
<filter id="disp">
|
||||
<feImage xlink:href="#THIS_SVG_FILE_AS_AN_IMAGE"/>
|
||||
</filter>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 193 B |
|
@ -55,4 +55,6 @@ load 595608-1.svg
|
|||
load 601251-1.html
|
||||
load 601406-1.svg
|
||||
load 603145-1.svg
|
||||
load zero-size-image.svg
|
||||
load 613899-1.svg
|
||||
load 613899-2.svg
|
||||
load zero-size-image.svg
|
||||
|
|
|
@ -5405,6 +5405,19 @@ nsSVGFEImageElement::LoadSVGImage(PRBool aForce, PRBool aNotify)
|
|||
if (baseURI && !href.IsEmpty())
|
||||
NS_MakeAbsoluteURI(href, href, baseURI);
|
||||
|
||||
// Make sure we don't get in a recursive death-spiral
|
||||
nsIDocument* doc = GetOurDocument();
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIURI> hrefAsURI;
|
||||
if (NS_SUCCEEDED(StringToURI(href, doc, getter_AddRefs(hrefAsURI)))) {
|
||||
PRBool isEqual;
|
||||
if (NS_SUCCEEDED(hrefAsURI->Equals(baseURI, &isEqual)) && isEqual) {
|
||||
// Image URI matches our URI exactly! Bail out.
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return LoadImage(href, aForce, aNotify);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,9 @@ _TEST_FILES = \
|
|||
test_pointer-events.xhtml \
|
||||
test_scientific.html \
|
||||
scientific-helper.svg \
|
||||
test_SVGAnimatedImageSMILDisabled.html \
|
||||
animated-svg-image-helper.html \
|
||||
animated-svg-image-helper.svg \
|
||||
test_SVGLengthList.xhtml \
|
||||
test_SVGPathSegList.xhtml \
|
||||
test_SVGStyleElement.xhtml \
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<html>
|
||||
<img src="animated-svg-image-helper.svg">
|
||||
</html>
|
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<set attributeName="font-size" to="50"/>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 91 B |
|
@ -0,0 +1,58 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=623945
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 623945</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=623945">Mozilla Bug 623945</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 623945 **/
|
||||
/* This test makes sure we don't crash when using an animated SVG image with
|
||||
* the 'svg.smil.enabled' pref turned off. */
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function setSMILEnabled(enabled) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
prefs.setBoolPref("svg.smil.enabled", enabled);
|
||||
}
|
||||
|
||||
function iframeLoaded() {
|
||||
// Woo-hoo, we didn't crash! Declare success!
|
||||
ok(true, "got through the test without crashing");
|
||||
|
||||
// Re-enable SMIL pref for future tests.
|
||||
setSMILEnabled(true);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function main() {
|
||||
// First, we turn off the SMIL pref:
|
||||
setSMILEnabled(false);
|
||||
|
||||
// Then, we load an HTML document with an animated SVG image.
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.onload = iframeLoaded;
|
||||
iframe.src = "animated-svg-image-helper.html";
|
||||
document.getElementById("content").appendChild(iframe);
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -670,10 +670,12 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(DOMPrototype, nsDOMConstructorSH,
|
||||
DOM_BASE_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_PRECREATE |
|
||||
nsIXPCScriptable::WANT_HASINSTANCE |
|
||||
nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE)
|
||||
NS_DEFINE_CLASSINFO_DATA(DOMConstructor, nsDOMConstructorSH,
|
||||
DOM_BASE_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_PRECREATE |
|
||||
nsIXPCScriptable::WANT_HASINSTANCE |
|
||||
nsIXPCScriptable::WANT_CALL |
|
||||
nsIXPCScriptable::WANT_CONSTRUCT |
|
||||
|
@ -2249,17 +2251,32 @@ nsDOMClassInfo::Init()
|
|||
rv = stack->GetSafeJSContext(&cx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
if (nsGlobalWindow::HasIndexedDBSupport()) {
|
||||
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
} else {
|
||||
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
}
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WindowUtils, nsIDOMWindowUtils)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowUtils)
|
||||
|
@ -2964,6 +2981,7 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
@ -3854,6 +3872,7 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMModalContentWindow)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
|
@ -5735,6 +5754,8 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOMDOMCONSTRUCTOR
|
||||
|
||||
nsresult PreCreate(JSContext *cx, JSObject *globalObj, JSObject **parentObj);
|
||||
|
||||
nsresult Construct(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, PRUint32 argc, jsval *argv,
|
||||
jsval *vp, PRBool *_retval);
|
||||
|
@ -5745,7 +5766,7 @@ public:
|
|||
|
||||
nsresult Install(JSContext *cx, JSObject *target, jsval thisAsVal)
|
||||
{
|
||||
JSBool ok =
|
||||
JSBool ok = JS_WrapValue(cx, &thisAsVal) &&
|
||||
::JS_DefineUCProperty(cx, target,
|
||||
reinterpret_cast<const jschar *>(mClassName),
|
||||
nsCRT::strlen(mClassName), thisAsVal, nsnull,
|
||||
|
@ -5875,6 +5896,20 @@ NS_INTERFACE_MAP_BEGIN(nsDOMConstructor)
|
|||
} else
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
nsresult
|
||||
nsDOMConstructor::PreCreate(JSContext *cx, JSObject *globalObj, JSObject **parentObj)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> owner(do_QueryReferent(mWeakOwner));
|
||||
if (!owner) {
|
||||
// Can't do anything.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsGlobalWindow *win = static_cast<nsGlobalWindow *>(owner.get());
|
||||
*parentObj = win->FastGetGlobalJSObject();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMConstructor::Construct(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
|
||||
JSObject * obj, PRUint32 argc, jsval * argv,
|
||||
|
@ -6155,6 +6190,12 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
|
|||
const char *class_parent_name = nsnull;
|
||||
|
||||
if (!primary_iid->Equals(NS_GET_IID(nsISupports))) {
|
||||
JSAutoEnterCompartment ac;
|
||||
|
||||
if (!ac.enter(cx, class_obj)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
rv = DefineInterfaceConstants(cx, class_obj, primary_iid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -6280,6 +6321,11 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
|
|||
|
||||
v = OBJECT_TO_JSVAL(dot_prototype);
|
||||
|
||||
JSAutoEnterCompartment ac;
|
||||
if (!ac.enter(cx, class_obj)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// Per ECMA, the prototype property is {DontEnum, DontDelete, ReadOnly}
|
||||
if (!JS_WrapValue(cx, &v) ||
|
||||
!JS_DefineProperty(cx, class_obj, "prototype", v, nsnull, nsnull,
|
||||
|
@ -10606,6 +10652,23 @@ nsEventListenerThisTranslator::TranslateThis(nsISupports *aInitialThis,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMConstructorSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj)
|
||||
{
|
||||
nsDOMConstructor *wrapped = static_cast<nsDOMConstructor *>(nativeObj);
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsIDOMDOMConstructor> is_constructor =
|
||||
do_QueryInterface(nativeObj);
|
||||
NS_ASSERTION(is_constructor, "How did we not get a constructor?");
|
||||
}
|
||||
#endif
|
||||
|
||||
return wrapped->PreCreate(cx, globalObj, parentObj);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMConstructorSH::Call(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, PRUint32 argc, jsval *argv, jsval *vp,
|
||||
|
|
|
@ -1702,6 +1702,8 @@ protected:
|
|||
}
|
||||
|
||||
public:
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj);
|
||||
NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto)
|
||||
{
|
||||
return NS_OK;
|
||||
|
|
|
@ -992,6 +992,25 @@ nsDOMWindowUtils::GetFocusedInputType(char** aType)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::FindElementWithViewId(nsViewID aID,
|
||||
nsIDOMElement** aResult)
|
||||
{
|
||||
if (aID == FrameMetrics::ROOT_SCROLL_ID) {
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
nsIDocument* document = presContext->Document();
|
||||
mozilla::dom::Element* rootElement = document->GetRootElement();
|
||||
if (!rootElement) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
CallQueryInterface(rootElement, aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<nsIContent> content = nsLayoutUtils::FindContentFor(aID);
|
||||
return CallQueryInterface(content, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetScreenPixelsPerCSSPixel(float* aScreenPixels)
|
||||
{
|
||||
|
|
|
@ -66,7 +66,6 @@
|
|||
#include "jsdbgapi.h" // for JS_ClearWatchPointsForObject
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
// Other Classes
|
||||
#include "nsIEventListenerManager.h"
|
||||
|
@ -1316,6 +1315,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindow)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIDOMViewCSS)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMAbstractView)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMStorageWindow)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMStorageIndexedDB)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
|
||||
|
@ -6277,6 +6277,13 @@ nsGlobalWindow::EnterModalState()
|
|||
nsContentUtils::ContentIsCrossDocDescendantOf(activeShell->GetDocument(), mDoc) ||
|
||||
nsContentUtils::ContentIsCrossDocDescendantOf(mDoc, activeShell->GetDocument()))) {
|
||||
nsEventStateManager::ClearGlobalActiveContent(activeESM);
|
||||
|
||||
activeShell->SetCapturingContent(nsnull, 0);
|
||||
|
||||
if (activeShell) {
|
||||
nsCOMPtr<nsFrameSelection> frameSelection = activeShell->FrameSelection();
|
||||
frameSelection->SetMouseDownState(PR_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8001,6 +8008,10 @@ nsGlobalWindow::GetLocalStorage(nsIDOMStorage ** aLocalStorage)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsGlobalWindow::nsIDOMStorageIndexedDB
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetMozIndexedDB(nsIIDBFactory** _retval)
|
||||
{
|
||||
|
|
|
@ -102,6 +102,7 @@
|
|||
#include "nsIDOMStorageList.h"
|
||||
#include "nsIDOMStorageWindow.h"
|
||||
#include "nsIDOMStorageEvent.h"
|
||||
#include "nsIDOMStorageIndexedDB.h"
|
||||
#include "nsIDOMOfflineResourceList.h"
|
||||
#include "nsPIDOMEventTarget.h"
|
||||
#include "nsIArray.h"
|
||||
|
@ -109,6 +110,7 @@
|
|||
#include "nsIIDBFactory.h"
|
||||
#include "nsFrameMessageManager.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
// JS includes
|
||||
#include "jsapi.h"
|
||||
|
@ -280,6 +282,7 @@ class nsGlobalWindow : public nsPIDOMWindow,
|
|||
public nsIDOMNSEventTarget,
|
||||
public nsIDOMViewCSS,
|
||||
public nsIDOMStorageWindow,
|
||||
public nsIDOMStorageIndexedDB,
|
||||
public nsSupportsWeakReference,
|
||||
public nsIInterfaceRequestor,
|
||||
public nsIDOMWindow_2_0_BRANCH,
|
||||
|
@ -574,6 +577,10 @@ public:
|
|||
return sOuterWindowsById ? sOuterWindowsById->Get(aWindowID) : nsnull;
|
||||
}
|
||||
|
||||
static bool HasIndexedDBSupport() {
|
||||
return nsContentUtils::GetBoolPref("indexedDB.feature.enabled", PR_TRUE);
|
||||
}
|
||||
|
||||
private:
|
||||
// Enable updates for the accelerometer.
|
||||
void EnableAccelerationUpdates();
|
||||
|
|
|
@ -325,6 +325,9 @@ NS_IMETHODIMP
|
|||
nsHistory::Item(PRUint32 aIndex, nsAString& aReturn)
|
||||
{
|
||||
aReturn.Truncate();
|
||||
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsISHistory> session_history;
|
||||
|
@ -332,8 +335,8 @@ nsHistory::Item(PRUint32 aIndex, nsAString& aReturn)
|
|||
GetSessionHistoryFromDocShell(mDocShell, getter_AddRefs(session_history));
|
||||
NS_ENSURE_TRUE(session_history, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIHistoryEntry> sh_entry;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsCOMPtr<nsIHistoryEntry> sh_entry;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
rv = session_history->GetEntryAtIndex(aIndex, PR_FALSE,
|
||||
getter_AddRefs(sh_entry));
|
||||
|
|
|
@ -4000,14 +4000,10 @@ SetMemoryHighWaterMarkPrefChangedCallback(const char* aPrefName, void* aClosure)
|
|||
static int
|
||||
SetMemoryMaxPrefChangedCallback(const char* aPrefName, void* aClosure)
|
||||
{
|
||||
PRUint32 max = nsContentUtils::GetIntPref(aPrefName, -1);
|
||||
if (max == -1UL)
|
||||
max = 0xffffffff;
|
||||
else
|
||||
max = max * 1024L * 1024L;
|
||||
|
||||
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MAX_BYTES,
|
||||
max);
|
||||
PRInt32 pref = nsContentUtils::GetIntPref(aPrefName, -1);
|
||||
// handle overflow and negative pref values
|
||||
PRUint32 max = (pref <= 0 || pref >= 0x1000) ? -1 : (PRUint32)pref * 1024 * 1024;
|
||||
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MAX_BYTES, max);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -843,14 +843,15 @@ IndexedDatabaseManager::OriginClearRunnable::Run()
|
|||
|
||||
mFirstCallback = false;
|
||||
|
||||
nsCOMPtr<nsIThread> thread;
|
||||
mThread.swap(thread);
|
||||
|
||||
// Dispatch to the IO thread.
|
||||
if (NS_FAILED(mThread->Dispatch(this, NS_DISPATCH_NORMAL))) {
|
||||
if (NS_FAILED(thread->Dispatch(this, NS_DISPATCH_NORMAL))) {
|
||||
NS_WARNING("Failed to dispatch to IO thread!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Don't need this any longer.
|
||||
mThread = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче