merge m-c to fx-team

This commit is contained in:
Tim Taubert 2011-12-29 13:59:50 +01:00
commit ed3cb6f833
32 changed files with 361 additions and 230 deletions

View File

@ -67,7 +67,7 @@ pref("extensions.getAddons.maxResults", 15);
pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/guid:%IDS%?src=firefox&appOS=%OS%&appVersion=%VERSION%");
pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%");
pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/%OS%/%VERSION%/%COMPATIBILITY_MODE%?src=firefox");
pref("extensions.webservice.discoverURL", "https://services.addons.mozilla.org/%LOCALE%/firefox/discovery/pane/%VERSION%/%OS%");
pref("extensions.webservice.discoverURL", "https://services.addons.mozilla.org/%LOCALE%/firefox/discovery/pane/%VERSION%/%OS%/%COMPATIBILITY_MODE%");
// Blocklist preferences
pref("extensions.blocklist.enabled", true);

View File

@ -100,10 +100,15 @@ toolbar[printpreview="true"] {
}
%endif
toolbarpaletteitem[place="palette"] > toolbaritem > hbox[type="places"] {
.bookmarks-toolbar-customize,
#wrapper-personal-bookmarks > #personal-bookmarks > #PlacesToolbar > hbox > #PlacesToolbarItems {
display: none;
}
#wrapper-personal-bookmarks[place="toolbar"] > #personal-bookmarks > #PlacesToolbar > .bookmarks-toolbar-customize {
display: -moz-box;
}
#main-window[disablechrome] #navigator-toolbox[tabsontop="true"] > toolbar:not(#toolbar-menubar):not(#TabsToolbar) {
visibility: collapse;
}

View File

@ -1564,23 +1564,27 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
}
catch (ex) { /* never mind; suppose SessionStore is broken */ }
if (shouldCheck && !shell.isDefaultBrowser(true) && !willRecoverSession) {
var brandBundle = document.getElementById("bundle_brand");
var shellBundle = document.getElementById("bundle_shell");
// Delay the set-default-browser prompt so it doesn't block
// initialisation of the session store service.
setTimeout(function () {
var brandBundle = document.getElementById("bundle_brand");
var shellBundle = document.getElementById("bundle_shell");
var brandShortName = brandBundle.getString("brandShortName");
var promptTitle = shellBundle.getString("setDefaultBrowserTitle");
var promptMessage = shellBundle.getFormattedString("setDefaultBrowserMessage",
[brandShortName]);
var checkboxLabel = shellBundle.getFormattedString("setDefaultBrowserDontAsk",
[brandShortName]);
var checkEveryTime = { value: shouldCheck };
var ps = Services.prompt;
var rv = ps.confirmEx(window, promptTitle, promptMessage,
ps.STD_YES_NO_BUTTONS,
null, null, null, checkboxLabel, checkEveryTime);
if (rv == 0)
shell.setDefaultBrowser(true, false);
shell.shouldCheckDefaultBrowser = checkEveryTime.value;
var brandShortName = brandBundle.getString("brandShortName");
var promptTitle = shellBundle.getString("setDefaultBrowserTitle");
var promptMessage = shellBundle.getFormattedString("setDefaultBrowserMessage",
[brandShortName]);
var checkboxLabel = shellBundle.getFormattedString("setDefaultBrowserDontAsk",
[brandShortName]);
var checkEveryTime = { value: shouldCheck };
var ps = Services.prompt;
var rv = ps.confirmEx(window, promptTitle, promptMessage,
ps.STD_YES_NO_BUTTONS,
null, null, null, checkboxLabel, checkEveryTime);
if (rv == 0)
shell.setDefaultBrowser(true, false);
shell.shouldCheckDefaultBrowser = checkEveryTime.value;
}, 0);
}
}
#endif

View File

@ -2,15 +2,6 @@ tree[type="places"] {
-moz-binding: url("chrome://browser/content/places/tree.xml#places-tree");
}
.bookmarks-toolbar-customize,
toolbarpaletteitem #PlacesToolbarItems {
display: none;
}
toolbarpaletteitem .bookmarks-toolbar-customize {
display: -moz-box;
}
.toolbar-drop-indicator {
position: relative;
z-index: 1;

View File

@ -160,6 +160,7 @@ Highlighter.prototype = {
this.transitionDisabler = null;
this.computeZoomFactor();
this.handleResize();
},
@ -441,16 +442,10 @@ Highlighter.prototype = {
return this._highlighting; // same rectangle
}
// get page zoom factor, if any
let zoom =
this.win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.screenPixelsPerCSSPixel;
// adjust rect for zoom scaling
let aRectScaled = {};
for (let prop in aRect) {
aRectScaled[prop] = aRect[prop] * zoom;
aRectScaled[prop] = aRect[prop] * this.zoom;
}
if (aRectScaled.left >= 0 && aRectScaled.top >= 0 &&
@ -523,14 +518,29 @@ Highlighter.prototype = {
*/
moveInfobar: function Highlighter_moveInfobar()
{
let rect = this._highlightRect;
if (rect && this._highlighting) {
if (this._highlightRect) {
let winHeight = this.win.innerHeight * this.zoom;
let winWidth = this.win.innerWidth * this.zoom;
let rect = {top: this._highlightRect.top,
left: this._highlightRect.left,
width: this._highlightRect.width,
height: this._highlightRect.height};
rect.top = Math.max(rect.top, 0);
rect.left = Math.max(rect.left, 0);
rect.width = Math.max(rect.width, 0);
rect.height = Math.max(rect.height, 0);
rect.top = Math.min(rect.top, winHeight);
rect.left = Math.min(rect.left, winWidth);
this.nodeInfo.container.removeAttribute("disabled");
// Can the bar be above the node?
if (rect.top < this.nodeInfo.barHeight) {
// No. Can we move the toolbar under the node?
if (rect.top + rect.height +
this.nodeInfo.barHeight > this.win.innerHeight) {
this.nodeInfo.barHeight > winHeight) {
// No. Let's move it inside.
this.nodeInfo.container.style.top = rect.top + "px";
this.nodeInfo.container.setAttribute("position", "overlap");
@ -554,8 +564,8 @@ Highlighter.prototype = {
left = 0;
this.nodeInfo.container.setAttribute("hide-arrow", "true");
} else {
if (left + barWidth > this.win.innerWidth) {
left = this.win.innerWidth - barWidth;
if (left + barWidth > winWidth) {
left = winWidth - barWidth;
this.nodeInfo.container.setAttribute("hide-arrow", "true");
} else {
this.nodeInfo.container.removeAttribute("hide-arrow");
@ -638,6 +648,16 @@ Highlighter.prototype = {
return !INSPECTOR_INVISIBLE_ELEMENTS[nodeName];
},
/**
* Store page zoom factor.
*/
computeZoomFactor: function Highlighter_computeZoomFactor() {
this.zoom =
this.win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.screenPixelsPerCSSPixel;
},
/////////////////////////////////////////////////////////////////////////
//// Event Handling
@ -676,6 +696,7 @@ Highlighter.prototype = {
this.handleMouseMove(aEvent);
break;
case "resize":
this.computeZoomFactor();
this.brieflyDisableTransitions();
this.handleResize(aEvent);
break;

View File

@ -153,29 +153,27 @@ function finishTestComparisons()
.QueryInterface(Ci.nsIMarkupDocumentViewer);
contentViewer.fullZoom = 2;
// check what zoom factor we're at, should be 2
let zoom =
InspectorUI.win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.screenPixelsPerCSSPixel;
executeSoon(function() {
// check what zoom factor we're at, should be 2
let zoom = InspectorUI.highlighter.zoom;
is(zoom, 2, "zoom is 2?");
is(zoom, 2, "zoom is 2?");
// simulate the zoomed dimensions of the div element
let divDims = div.getBoundingClientRect();
let divWidth = divDims.width * zoom;
let divHeight = divDims.height * zoom;
// simulate the zoomed dimensions of the div element
let divDims = div.getBoundingClientRect();
let divWidth = divDims.width * zoom;
let divHeight = divDims.height * zoom;
// now zoomed, get new dimensions of transparent veil box over element
let veilBoxDims = InspectorUI.highlighter.veilTransparentBox.getBoundingClientRect();
let veilBoxWidth = veilBoxDims.width;
let veilBoxHeight = veilBoxDims.height;
// now zoomed, get new dimensions of transparent veil box over element
let veilBoxDims = InspectorUI.highlighter.veilTransparentBox.getBoundingClientRect();
let veilBoxWidth = veilBoxDims.width;
let veilBoxHeight = veilBoxDims.height;
is(veilBoxWidth, divWidth, "transparent veil box width matches width of element (2x zoom)");
is(veilBoxHeight, divHeight, "transparent veil box height matches width of element (2x zoom)");
is(veilBoxWidth, divWidth, "transparent veil box width matches width of element (2x zoom)");
is(veilBoxHeight, divHeight, "transparent veil box height matches width of element (2x zoom)");
doc = h1 = div = null;
executeSoon(finishUp);
doc = h1 = div = null;
executeSoon(finishUp);
});
}
function finishUp() {

View File

@ -17,8 +17,8 @@ function test()
waitForFocus(setupInfobarTest, content);
}, true);
let style = "body{width:100%;height: 100%} div {position: absolute;height: 100px;width: 500px}#bottom {bottom: 0px}#vertical {height: 100%}";
let html = "<style>" + style + "</style><div id=vertical></div><div id=top class='class1 class2'></div><div id=bottom></div>"
let style = "body{width:100%;height: 100%} div {position: absolute;height: 100px;width: 500px}#bottom {bottom: 0px}#vertical {height: 100%}#farbottom{bottom: -200px}";
let html = "<style>" + style + "</style><div id=vertical></div><div id=top class='class1 class2'></div><div id=bottom></div><div id=farbottom></div>"
content.location = "data:text/html," + encodeURIComponent(html);
@ -29,6 +29,7 @@ function test()
{node: doc.querySelector("#vertical"), position: "overlap", tag: "DIV", id: "#vertical", classes: ""},
{node: doc.querySelector("#bottom"), position: "top", tag: "DIV", id: "#bottom", classes: ""},
{node: doc.querySelector("body"), position: "overlap", tag: "BODY", id: "", classes: ""},
{node: doc.querySelector("#farbottom"), position: "top", tag: "DIV", id: "#farbottom", classes: ""},
]
for (let i = 0; i < nodes.length; i++) {
@ -47,10 +48,8 @@ function test()
cursor = 0;
executeSoon(function() {
Services.obs.addObserver(nodeSelected,
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
InspectorUI.inspectNode(nodes[0].node);
nodeSelected();
});
}
@ -61,8 +60,6 @@ function test()
cursor++;
if (cursor >= nodes.length) {
Services.obs.removeObserver(nodeSelected,
InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
Services.obs.addObserver(finishUp,
InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
@ -72,6 +69,7 @@ function test()
} else {
let node = nodes[cursor].node;
InspectorUI.inspectNode(node);
nodeSelected();
}
});
}

View File

@ -581,8 +581,12 @@ var Scratchpad = {
let content = null;
if (Components.isSuccessCode(aStatus)) {
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
content = NetUtil.readInputStreamToString(aInputStream,
aInputStream.available());
content = converter.ConvertToUnicode(content);
self.setText(content);
self.editor.resetUndo();
}

View File

@ -89,7 +89,8 @@ li.error > .stylesheet-info > .stylesheet-more > .stylesheet-error-message {
}
.stylesheet-rule-count,
li:hover > hgroup > .stylesheet-more > h3 > .stylesheet-saveButton {
li.splitview-active > hgroup > .stylesheet-more > h3 > .stylesheet-saveButton,
li:hover > hgroup > .stylesheet-more > h3 > .stylesheet-saveButton {
display: -moz-box;
}
@ -99,6 +100,7 @@ li:hover > hgroup > .stylesheet-more > h3 > .stylesheet-saveButton {
/* portrait mode */
@media (max-aspect-ratio: 5/3) {
li.splitview-active > hgroup > .stylesheet-more > .stylesheet-rule-count,
li:hover > hgroup > .stylesheet-more > .stylesheet-rule-count {
display: none;
}

View File

@ -13,7 +13,7 @@
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla Inspector Module.
* The Original Code is the Mozilla CSS Rule View.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
@ -21,7 +21,8 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Dave Camp (dcamp@mozilla.com) (Original Author)
* Dave Camp <dcamp@mozilla.com> (Original Author)
* Rob Campbell <rcampbell@mozilla.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
@ -778,7 +779,16 @@ RuleEditor.prototype = {
class: "ruleview-selector",
textContent: this.rule.selectorText
});
appendText(header, " {");
this.openBrace = createChild(header, "span", {
class: "ruleview-ruleopen",
tabindex: "0",
textContent: " {"
});
this.openBrace.addEventListener("click", function() {
this.newProperty();
}.bind(this), true);
this.propertyList = createChild(code, "ul", {
class: "ruleview-propertylist"

View File

@ -853,6 +853,7 @@ TiltVisualizer.Controller = function TV_Controller(aCanvas, aPresenter)
aCanvas.addEventListener("MozMousePixelScroll", this.onMozScroll, false);
aCanvas.addEventListener("keydown", this.onKeyDown, false);
aCanvas.addEventListener("keyup", this.onKeyUp, false);
aCanvas.addEventListener("blur", this.onBlur, false);
// handle resize events to change the arcball dimensions
aPresenter.contentWindow.addEventListener("resize", this.onResize, false);
@ -1008,6 +1009,13 @@ TiltVisualizer.Controller.prototype = {
this.arcball.keyUp(code);
},
/**
* Called when the canvas looses focus.
*/
onBlur: function TVC_onBlur(e) {
this.arcball._keyCode = {};
},
/**
* Called when the content window of the current browser is resized.
*/
@ -1049,6 +1057,7 @@ TiltVisualizer.Controller.prototype = {
canvas.removeEventListener("MozMousePixelScroll", this.onMozScroll, false);
canvas.removeEventListener("keydown", this.onKeyDown, false);
canvas.removeEventListener("keyup", this.onKeyUp, false);
canvas.removeEventListener("blur", this.onBlur, false);
presenter.contentWindow.removeEventListener("resize", this.onResize,false);
presenter.ondraw = null;
}

View File

@ -53,6 +53,7 @@ _BROWSER_TEST_FILES = \
browser_tilt_05_destruction-esc.js \
browser_tilt_05_destruction.js \
browser_tilt_arcball.js \
browser_tilt_controller.js \
browser_tilt_gl01.js \
browser_tilt_gl02.js \
browser_tilt_gl03.js \

View File

@ -0,0 +1,86 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/*global ok, is, info, waitForExplicitFinish, finish, executeSoon, gBrowser */
/*global isEqualVec, isTiltEnabled, isWebGLSupported, createTab, createTilt */
/*global EventUtils, vec3, mat4, quat4 */
"use strict";
function test() {
if (!isTiltEnabled()) {
info("Skipping controller test because Tilt isn't enabled.");
return;
}
if (!isWebGLSupported()) {
info("Skipping controller test because WebGL isn't supported.");
return;
}
waitForExplicitFinish();
createTab(function() {
createTilt({
onTiltOpen: function(instance)
{
let canvas = instance.presenter.canvas;
let prev_tran = vec3.create([0, 0, 0]);
let prev_rot = quat4.create([0, 0, 0, 1]);
function tran() {
return instance.presenter.transforms.translation;
}
function rot() {
return instance.presenter.transforms.rotation;
}
function save() {
prev_tran = vec3.create(tran());
prev_rot = quat4.create(rot());
}
ok(isEqualVec(tran(), prev_tran),
"At init, the translation should be zero.");
ok(isEqualVec(rot(), prev_rot),
"At init, the rotation should be zero.");
EventUtils.synthesizeKey("VK_A", { type: "keydown" });
EventUtils.synthesizeKey("VK_LEFT", { type: "keydown" });
instance.controller.update();
ok(!isEqualVec(tran(), prev_tran),
"After a translation key is pressed, the vector should change.");
ok(!isEqualVec(rot(), prev_rot),
"After a rotation key is pressed, the quaternion should change.");
save();
gBrowser.selectedBrowser.contentWindow.focus();
instance.controller.update();
ok(!isEqualVec(tran(), prev_tran),
"Even if the canvas lost focus, the vector has some inertia.");
ok(!isEqualVec(rot(), prev_rot),
"Even if the canvas lost focus, the quaternion has some inertia.");
save();
while (!isEqualVec(tran(), prev_tran) || !isEqualVec(rot(), prev_rot)) {
instance.controller.update();
save();
}
ok(isEqualVec(tran(), prev_tran) && isEqualVec(rot(), prev_rot),
"After the focus is lost, the transforms inertia eventually stops.");
},
onEnd: function()
{
gBrowser.removeCurrentTab();
finish();
}
}, true);
});
}

View File

@ -69,6 +69,17 @@ function isApproxVec(vec1, vec2) {
return true;
}
function isEqualVec(vec1, vec2) {
if (vec1.length !== vec2.length) {
return false;
}
for (let i = 0, len = vec1.length; i < len; i++) {
if (vec1[i] !== vec2[i]) {
return false;
}
}
return true;
}
function createCanvas() {
return document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");

View File

@ -31,7 +31,7 @@
<!ENTITY bottomLinks.license "Licensing Information">
<!-- LOCALIZATION NOTE (bottomLinks.rights): This is a link title that links to about:rights. -->
<!ENTITY bottomLinks.rights "End User Rights">
<!ENTITY bottomLinks.rights "End-User Rights">
<!-- LOCALIZATION NOTE (bottomLinks.privacy): This is a link title that links to http://www.mozilla.com/legal/privacy/. -->
<!ENTITY bottomLinks.privacy "Privacy Policy">

View File

@ -148,9 +148,7 @@ toolbarbutton.bookmark-item[open="true"] {
}
#wrapper-personal-bookmarks[place="palette"] > .toolbarpaletteitem-box {
width: 16px;
height: 16px;
background: url("chrome://browser/skin/places/bookmarksToolbar.png") no-repeat;
background: url("chrome://browser/skin/places/bookmarksToolbar.png") no-repeat center;
}
.bookmarks-toolbar-customize {

View File

@ -23,6 +23,7 @@
* Mihai Șucan <mihai.sucan@gmail.com>
* Michael Ratcliffe <mratcliffe@mozilla.com>
* Dão Gottwald <dao@mozilla.com>
* Rob Campbell <rcampbell@mozilla.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
@ -229,6 +230,10 @@
padding: 2px 5px;
}
.ruleview-ruleopen {
-moz-padding-end: 5px;
}
.ruleview-propertylist {
list-style: none;
padding: 0;

View File

@ -267,9 +267,7 @@ toolbarbutton.bookmark-item > menupopup {
}
#wrapper-personal-bookmarks[place="palette"] > .toolbarpaletteitem-box {
width: 16px;
height: 16px;
background: url("chrome://browser/skin/places/bookmarksToolbar.png") no-repeat;
background: url("chrome://browser/skin/places/bookmarksToolbar.png") no-repeat center;
}
.bookmarks-toolbar-customize {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -43,7 +43,7 @@
-moz-appearance: none;
padding: 4px 3px;
box-shadow: 0 1px 0 0 hsla(210, 16%, 76%, .2) inset;
background-image: -moz-linear-gradient(top, hsl(210,11%,36%), hsl(210,11%,18%));
background-image: url(background-noise-toolbar.png), -moz-linear-gradient(top, hsl(210,11%,36%), hsl(210,11%,18%));
}
.devtools-toolbarbutton {

View File

@ -23,6 +23,7 @@
* Mihai Șucan <mihai.sucan@gmail.com>
* Michael Ratcliffe <mratcliffe@mozilla.com>
* Dão Gottwald <dao@mozilla.com>
* Rob Campbell <rcampbell@mozilla.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
@ -231,6 +232,10 @@
padding: 2px 5px;
}
.ruleview-ruleopen {
-moz-padding-end: 5px;
}
.ruleview-propertylist {
list-style: none;
padding: 0;

View File

@ -160,6 +160,7 @@ browser.jar:
skin/classic/browser/devtools/itemToggle.png (devtools/itemToggle.png)
skin/classic/browser/devtools/itemArrow-rtl.png (devtools/itemArrow-rtl.png)
skin/classic/browser/devtools/itemArrow-ltr.png (devtools/itemArrow-ltr.png)
skin/classic/browser/devtools/background-noise-toolbar.png (devtools/background-noise-toolbar.png)
#ifdef MOZ_SERVICES_SYNC
skin/classic/browser/sync-throbber.png
skin/classic/browser/sync-16.png

View File

@ -563,9 +563,7 @@ toolbarbutton.bookmark-item[open="true"] {
}
#wrapper-personal-bookmarks[place="palette"] > .toolbarpaletteitem-box {
width: 16px;
height: 16px;
background: url("chrome://browser/skin/places/bookmarksToolbar.png") no-repeat;
background: url("chrome://browser/skin/places/bookmarksToolbar.png") no-repeat center;
}
.bookmarks-toolbar-customize {

View File

@ -23,6 +23,7 @@
* Mihai Șucan <mihai.sucan@gmail.com>
* Michael Ratcliffe <mratcliffe@mozilla.com>
* Dão Gottwald <dao@mozilla.com>
* Rob Campbell <rcampbell@mozilla.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
@ -230,6 +231,10 @@
padding: 2px 5px;
}
.ruleview-ruleopen {
-moz-padding-end: 5px;
}
.ruleview-propertylist {
list-style: none;
padding: 0;

View File

@ -20,8 +20,9 @@
the Initial Developer. All Rights Reserved.
Contributor(s):
David Hyatt (hyatt@apple.com)
Blake Ross (blaker@netscape.com)
David Hyatt <hyatt@apple.com>
Blake Ross <blaker@netscape.com>
Jared Wein <jwein@mozilla.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
@ -41,17 +42,27 @@
@namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for HTML elements */
#palette-box {
overflow: auto;
margin: 0px 15px 10px 15px;
overflow: auto;
display: block;
min-height: 3em;
}
#palette-box > hbox > toolbarpaletteitem {
padding-top: 8px;
padding-bottom: 8px;
#palette-box > toolbarpaletteitem {
width: 110px;
height: 94px;
overflow: hidden;
display: inline-block;
}
#palette-box > hbox {
min-height: 8em;
.toolbarpaletteitem-box {
-moz-box-pack: center;
-moz-box-flex: 1;
width: 110px;
max-width: 110px;
}
toolbarpaletteitem > label {
text-align: center;
}
#main-box > box {

View File

@ -20,9 +20,10 @@
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# David Hyatt (hyatt@apple.com)
# Blake Ross (blaker@netscape.com)
# Joe Hewitt (hewitt@netscape.com)
# David Hyatt <hyatt@apple.com>
# Blake Ross <blaker@netscape.com>
# Joe Hewitt <hewitt@netscape.com>
# Jared Wein <jwein@mozilla.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
@ -38,13 +39,12 @@
#
# ***** END LICENSE BLOCK *****
const kRowMax = 4;
var gToolboxDocument = null;
var gToolbox = null;
var gCurrentDragOverItem = null;
var gToolboxChanged = false;
var gToolboxSheet = false;
var gPaletteBox = null;
function onLoad()
{
@ -69,6 +69,7 @@ function InitWithToolbox(aToolbox)
forEachCustomizableToolbar(function (toolbar) {
toolbar.setAttribute("customizing", "true");
});
gPaletteBox = document.getElementById("palette-box");
var elts = getRootElements();
for (let i=0; i < elts.length; i++) {
@ -278,18 +279,12 @@ function createWrapper(aId, aDocument)
/**
* Wraps an item that has been cloned from a template and adds
* it to the end of a row in the palette.
* it to the end of the palette.
*/
function wrapPaletteItem(aPaletteItem, aCurrentRow, aSpacer)
function wrapPaletteItem(aPaletteItem)
{
var wrapper = createWrapper(aPaletteItem.id, document);
wrapper.setAttribute("flex", 1);
wrapper.setAttribute("align", "center");
wrapper.setAttribute("pack", "center");
wrapper.setAttribute("minheight", "0");
wrapper.setAttribute("minwidth", "0");
wrapper.appendChild(aPaletteItem);
// XXX We need to call this AFTER the palette item has been appended
@ -297,11 +292,7 @@ function wrapPaletteItem(aPaletteItem, aCurrentRow, aSpacer)
// palette due to removal of the command and disabled attributes - JRH
cleanUpItemForPalette(aPaletteItem, wrapper);
if (aSpacer)
aCurrentRow.insertBefore(wrapper, aSpacer);
else
aCurrentRow.appendChild(wrapper);
gPaletteBox.appendChild(wrapper);
}
/**
@ -345,35 +336,28 @@ function getCurrentItemIds()
function buildPalette()
{
// Empty the palette first.
var paletteBox = document.getElementById("palette-box");
while (paletteBox.lastChild)
paletteBox.removeChild(paletteBox.lastChild);
var currentRow = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"hbox");
currentRow.setAttribute("class", "paletteRow");
while (gPaletteBox.lastChild)
gPaletteBox.removeChild(gPaletteBox.lastChild);
// Add the toolbar separator item.
var templateNode = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"toolbarseparator");
templateNode.id = "separator";
wrapPaletteItem(templateNode, currentRow, null);
wrapPaletteItem(templateNode);
// Add the toolbar spring item.
templateNode = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"toolbarspring");
templateNode.id = "spring";
templateNode.flex = 1;
wrapPaletteItem(templateNode, currentRow, null);
wrapPaletteItem(templateNode);
// Add the toolbar spacer item.
templateNode = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"toolbarspacer");
templateNode.id = "spacer";
templateNode.flex = 1;
wrapPaletteItem(templateNode, currentRow, null);
var rowSlot = 3;
wrapPaletteItem(templateNode);
var currentItems = getCurrentItemIds();
templateNode = gToolbox.palette.firstChild;
@ -381,74 +365,11 @@ function buildPalette()
// Check if the item is already in a toolbar before adding it to the palette.
if (!(templateNode.id in currentItems)) {
var paletteItem = document.importNode(templateNode, true);
if (rowSlot == kRowMax) {
// Append the old row.
paletteBox.appendChild(currentRow);
// Make a new row.
currentRow = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"hbox");
currentRow.setAttribute("class", "paletteRow");
rowSlot = 0;
}
++rowSlot;
wrapPaletteItem(paletteItem, currentRow, null);
wrapPaletteItem(paletteItem);
}
templateNode = templateNode.nextSibling;
}
if (currentRow) {
fillRowWithFlex(currentRow);
paletteBox.appendChild(currentRow);
}
}
/**
* Creates a new palette item for a cloned template node and
* adds it to the last slot in the palette.
*/
function appendPaletteItem(aItem)
{
var paletteBox = document.getElementById("palette-box");
var lastRow = paletteBox.lastChild;
var lastSpacer = lastRow.lastChild;
if (lastSpacer.localName != "spacer") {
// The current row is full, so we have to create a new row.
lastRow = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"hbox");
lastRow.setAttribute("class", "paletteRow");
paletteBox.appendChild(lastRow);
wrapPaletteItem(aItem, lastRow, null);
fillRowWithFlex(lastRow);
} else {
// Decrement the flex of the last spacer or remove it entirely.
var flex = lastSpacer.getAttribute("flex");
if (flex == 1) {
lastRow.removeChild(lastSpacer);
lastSpacer = null;
} else
lastSpacer.setAttribute("flex", --flex);
// Insert the wrapper where the last spacer was.
wrapPaletteItem(aItem, lastRow, lastSpacer);
}
}
function fillRowWithFlex(aRow)
{
var remainingFlex = kRowMax - aRow.childNodes.length;
if (remainingFlex > 0) {
var spacer = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"spacer");
spacer.setAttribute("flex", remainingFlex);
aRow.appendChild(spacer);
}
}
/**
@ -471,6 +392,7 @@ function cleanUpItemForPalette(aItem, aWrapper)
var title = stringBundle.getString(aItem.localName.slice(7) + "Title");
aWrapper.setAttribute("title", title);
}
aWrapper.setAttribute("tooltiptext", aWrapper.getAttribute("title"));
// Remove attributes that screw up our appearance.
aItem.removeAttribute("command");
@ -865,48 +787,10 @@ function onToolbarDrop(aEvent)
wrapper.flex = newItem.flex;
// Remove the wrapper from the palette.
var currentRow = draggedPaletteWrapper.parentNode;
if (draggedItemId != "separator" &&
draggedItemId != "spring" &&
draggedItemId != "spacer")
{
currentRow.removeChild(draggedPaletteWrapper);
while (currentRow) {
// Pull the first child of the next row up
// into this row.
var nextRow = currentRow.nextSibling;
if (!nextRow) {
var last = currentRow.lastChild;
var first = currentRow.firstChild;
if (first == last) {
// Kill the row.
currentRow.parentNode.removeChild(currentRow);
break;
}
if (last.localName == "spacer") {
var flex = last.getAttribute("flex");
last.setAttribute("flex", ++flex);
// Reflow doesn't happen for some reason. Trigger it with a hide/show. ICK! -dwh
last.hidden = true;
last.hidden = false;
break;
} else {
// Make a spacer and give it a flex of 1.
var spacer = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"spacer");
spacer.setAttribute("flex", "1");
currentRow.appendChild(spacer);
}
break;
}
currentRow.appendChild(nextRow.firstChild);
currentRow = currentRow.nextSibling;
}
}
gPaletteBox.removeChild(draggedPaletteWrapper);
}
gCurrentDragOverItem = null;
@ -937,7 +821,7 @@ function onPaletteDrop(aEvent)
wrapperType != "spacer" &&
wrapperType != "spring") {
restoreItemForToolbar(wrapper.firstChild, wrapper);
appendPaletteItem(document.importNode(wrapper.firstChild, true));
wrapPaletteItem(document.importNode(wrapper.firstChild, true));
gToolbox.palette.appendChild(wrapper.firstChild);
}

View File

@ -1823,9 +1823,20 @@ var gDiscoverView = {
this._error = document.getElementById("discover-error");
this._browser = document.getElementById("discover-browser");
var url = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
.getService(Ci.nsIURLFormatter)
.formatURLPref(PREF_DISCOVERURL);
let checkCompatibility = true;
try {
checkCompatibility = Services.prefs.getBoolPref(PREF_CHECK_COMPATIBILITY);
} catch(e) { }
let compatMode = "normal";
if (!checkCompatibility)
compatMode = "ignore";
else if (AddonManager.strictCompatibility)
compatMode = "strict";
var url = Services.prefs.getCharPref(PREF_DISCOVERURL);
url = url.replace("%COMPATIBILITY_MODE%", compatMode);
url = Services.urlFormatter.formatURL(url);
var self = this;

View File

@ -538,3 +538,41 @@ add_test(function() {
});
});
});
// Bug 711693 - Send the compatibility mode when loading the Discovery pane
add_test(function() {
info("Test '%COMPATIBILITY_MODE%' in the URL is correctly replaced by 'normal'");
Services.prefs.setCharPref(PREF_DISCOVERURL, MAIN_URL + "?mode=%COMPATIBILITY_MODE%");
Services.prefs.setBoolPref(PREF_STRICT_COMPAT, false);
open_manager("addons://discover/", function(aWindow) {
gManagerWindow = aWindow;
var browser = gManagerWindow.document.getElementById("discover-browser");
is(getURL(browser), MAIN_URL + "?mode=normal", "Should have loaded the right url");
close_manager(gManagerWindow, run_next_test);
});
});
add_test(function() {
info("Test '%COMPATIBILITY_MODE%' in the URL is correctly replaced by 'strict'");
Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
open_manager("addons://discover/", function(aWindow) {
gManagerWindow = aWindow;
var browser = gManagerWindow.document.getElementById("discover-browser");
is(getURL(browser), MAIN_URL + "?mode=strict", "Should have loaded the right url");
close_manager(gManagerWindow, run_next_test);
});
});
add_test(function() {
info("Test '%COMPATIBILITY_MODE%' in the URL is correctly replaced by 'ignore'");
Services.prefs.setBoolPref(PREF_CHECK_COMPATIBILITY, false);
open_manager("addons://discover/", function(aWindow) {
gManagerWindow = aWindow;
var browser = gManagerWindow.document.getElementById("discover-browser");
is(getURL(browser), MAIN_URL + "?mode=ignore", "Should have loaded the right url");
close_manager(gManagerWindow, run_next_test);
});
});

View File

@ -29,6 +29,22 @@ const PREF_LOGGING_ENABLED = "extensions.logging.enabled";
const PREF_SEARCH_MAXRESULTS = "extensions.getAddons.maxResults";
const PREF_STRICT_COMPAT = "extensions.strictCompatibility";
var PREF_CHECK_COMPATIBILITY;
(function() {
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
} catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
var version = "nightly";
} else {
version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1");
}
PREF_CHECK_COMPATIBILITY = "extensions.checkCompatibility." + version;
})();
var gPendingTests = [];
var gTestsRun = 0;
var gTestStart = null;
@ -43,7 +59,8 @@ var gRestorePrefs = [{name: PREF_LOGGING_ENABLED},
{name: "extensions.getAddons.search.url"},
{name: "extensions.getAddons.cache.enabled"},
{name: PREF_SEARCH_MAXRESULTS},
{name: PREF_STRICT_COMPAT}];
{name: PREF_STRICT_COMPAT},
{name: PREF_CHECK_COMPATIBILITY}];
gRestorePrefs.forEach(function(aPref) {
if (!Services.prefs.prefHasUserValue(aPref.name)) {

View File

@ -38,10 +38,13 @@
#palette-box {
margin-top: 2px;
-moz-appearance: listbox;
margin: 0 0 10px;
}
#palette-box > hbox > toolbarpaletteitem {
padding: 2px;
margin: 0px;
#palette-box > toolbarpaletteitem {
padding: 8px 2px;
margin: 0 8px;
}
#main-box {

View File

@ -117,10 +117,17 @@ toolbarpaletteitem[type="spacer"] {
.toolbarpaletteitem-box[type="spacer"][place="palette"],
.toolbarpaletteitem-box[type="spring"][place="palette"] {
margin-top: 0;
margin-bottom: 2px;
height: 32px;
}
.toolbarpaletteitem-box[type="spring"][place="palette"] {
background-position: center;
margin-left: 8px;
margin-right: 8px;
}
/* ..... drag and drop feedback ..... */
toolbarpaletteitem[dragover="left"] {

View File

@ -46,3 +46,13 @@ dialog {
font-weight: bold;
font-size: larger;
}
#palette-box {
-moz-appearance: listbox;
margin: 0 0 10px;
}
#palette-box > toolbarpaletteitem {
padding: 8px 2px;
margin: 0 8px;
}