Merge mozilla-central to mozilla-inbound

This commit is contained in:
Ed Morley 2012-10-01 14:04:36 +01:00
commit 88444517d8
10 changed files with 63 additions and 141 deletions

View File

@ -61,7 +61,6 @@ function PrivateBrowsingService() {
this._obs.addObserver(this, "private-browsing", true);
this._obs.addObserver(this, "command-line-startup", true);
this._obs.addObserver(this, "sessionstore-browser-state-restored", true);
this._obs.addObserver(this, "domwindowopened", true);
// List of nsIXULWindows we are going to be closing during the transition
this._windowsToClose = [];
@ -497,18 +496,6 @@ PrivateBrowsingService.prototype = {
this._notifyIfTransitionComplete();
}
break;
case "domwindowopened":
let aWindow = aSubject;
let self = this;
aWindow.addEventListener("load", function PBS__onWindowLoad(aEvent) {
aWindow.removeEventListener("load", arguments.callee);
if (aWindow.document
.documentElement
.getAttribute("windowtype") == "navigator:browser") {
self._setPerWindowPBFlag(aWindow, self._inPrivateBrowsing);
}
}, false);
break;
}
},

View File

@ -60,8 +60,7 @@ let DebuggerController = {
DebuggerView.StackFrames.initialize();
DebuggerView.Breakpoints.initialize();
DebuggerView.Properties.initialize();
DebuggerView.toggleCloseButton(!this._isRemoteDebugger &&
!this._isChromeDebugger);
DebuggerView.showCloseButton(!this._isRemoteDebugger && !this._isChromeDebugger);
this.dispatchEvent("Debugger:Loaded");
this._connect();

View File

@ -6,7 +6,6 @@
"use strict";
const BREAKPOINT_LINE_TOOLTIP_MAX_SIZE = 1000; // chars
const PANES_APPEARANCE_DELAY = 50; // ms
const PROPERTY_VIEW_FLASH_DURATION = 400; // ms
const GLOBAL_SEARCH_MATCH_FLASH_DURATION = 100; // ms
const GLOBAL_SEARCH_URL_MAX_SIZE = 100; // chars
@ -104,8 +103,8 @@ let DebuggerView = {
this._stackframesAndBreakpoints.setAttribute("width", Prefs.stackframesWidth);
this._variables.setAttribute("width", Prefs.variablesWidth);
this.toggleStackframesAndBreakpointsPane({ silent: true });
this.toggleVariablesPane({ silent: true });
this.showStackframesAndBreakpointsPane(Prefs.stackframesPaneVisible);
this.showVariablesPane(Prefs.variablesPaneVisible);
},
/**
@ -174,42 +173,34 @@ let DebuggerView = {
* Called when the panes toggle button is clicked.
*/
_onTogglePanesButtonPressed: function DV__onTogglePanesButtonPressed() {
this.toggleStackframesAndBreakpointsPane({
visible: !!this._togglePanesButton.getAttribute("stackframesAndBreakpointsHidden"),
animated: true
});
this.toggleVariablesPane({
visible: !!this._togglePanesButton.getAttribute("variablesHidden"),
animated: true
});
this._onPanesToggle();
this.showStackframesAndBreakpointsPane(
this._togglePanesButton.getAttribute("stackframesAndBreakpointsHidden"), true);
this.showVariablesPane(
this._togglePanesButton.getAttribute("variablesHidden"), true);
},
/**
* Sets the close button hidden or visible. It's hidden by default.
* @param boolean aVisibleFlag
*/
toggleCloseButton: function DV_toggleCloseButton(aVisibleFlag) {
showCloseButton: function DV_showCloseButton(aVisibleFlag) {
document.getElementById("close").setAttribute("hidden", !aVisibleFlag);
},
/**
* Sets the stackframes and breakpoints pane hidden or visible.
*
* @param object aFlags [optional]
* An object containing some of the following booleans:
* - visible: true if the pane should be shown, false for hidden
* - animated: true to display an animation on toggle
* - silent: true to not update any designated prefs
* @param boolean aVisibleFlag
* @param boolean aAnimatedFlag
*/
toggleStackframesAndBreakpointsPane:
function DV_toggleStackframesAndBreakpointsPane(aFlags = {}) {
if (aFlags.animated) {
showStackframesAndBreakpointsPane:
function DV_showStackframesAndBreakpointsPane(aVisibleFlag, aAnimatedFlag) {
if (aAnimatedFlag) {
this._stackframesAndBreakpoints.setAttribute("animated", "");
} else {
this._stackframesAndBreakpoints.removeAttribute("animated");
}
if (aFlags.visible) {
if (aVisibleFlag) {
this._stackframesAndBreakpoints.style.marginLeft = "0";
this._togglePanesButton.removeAttribute("stackframesAndBreakpointsHidden");
this._togglePanesButton.setAttribute("tooltiptext", L10N.getStr("collapsePanes"));
@ -219,28 +210,22 @@ let DebuggerView = {
this._togglePanesButton.setAttribute("stackframesAndBreakpointsHidden", "true");
this._togglePanesButton.setAttribute("tooltiptext", L10N.getStr("expandPanes"));
}
if (!aFlags.silent) {
Prefs.stackframesPaneVisible = !!aFlags.visible;
}
Prefs.stackframesPaneVisible = aVisibleFlag;
},
/**
* Sets the variable spane hidden or visible.
*
* @param object aFlags [optional]
* An object containing some of the following booleans:
* - visible: true if the pane should be shown, false for hidden
* - animated: true to display an animation on toggle
* - silent: true to not update any designated prefs
* @param boolean aVisibleFlag
* @param boolean aAnimatedFlag
*/
toggleVariablesPane:
function DV_toggleVariablesPane(aFlags = {}) {
if (aFlags.animated) {
showVariablesPane:
function DV_showVariablesPane(aVisibleFlag, aAnimatedFlag) {
if (aAnimatedFlag) {
this._variables.setAttribute("animated", "");
} else {
this._variables.removeAttribute("animated");
}
if (aFlags.visible) {
if (aVisibleFlag) {
this._variables.style.marginRight = "0";
this._togglePanesButton.removeAttribute("variablesHidden");
this._togglePanesButton.setAttribute("tooltiptext", L10N.getStr("collapsePanes"));
@ -250,54 +235,7 @@ let DebuggerView = {
this._togglePanesButton.setAttribute("variablesHidden", "true");
this._togglePanesButton.setAttribute("tooltiptext", L10N.getStr("expandPanes"));
}
if (!aFlags.silent) {
Prefs.variablesPaneVisible = !!aFlags.visible;
}
},
/**
* Shows the stackframes, breakpoints and variable panes if currently hidden
* and the preferences dictate otherwise.
*/
showPanesIfAllowed: function DV_showPanesIfAllowed() {
// Try to keep animations as smooth as possible, so wait a few cycles.
window.setTimeout(function() {
let shown;
if (Prefs.stackframesPaneVisible &&
this._togglePanesButton.getAttribute("stackframesAndBreakpointsHidden")) {
this.toggleStackframesAndBreakpointsPane({
visible: true,
animated: true,
silent: true
});
shown = true;
}
if (Prefs.variablesPaneVisible &&
this._togglePanesButton.getAttribute("variablesHidden")) {
this.toggleVariablesPane({
visible: true,
animated: true,
silent: true
});
shown = true;
}
if (shown) {
this._onPanesToggle();
}
}.bind(this), PANES_APPEARANCE_DELAY);
},
/**
* Displaying the panes may have the effect of triggering scrollbars to
* appear in the source editor, which would render the currently highlighted
* line to appear behind them in some cases.
*/
_onPanesToggle: function DV__onPanesToggle() {
document.addEventListener("transitionend", function onEvent() {
document.removeEventListener("transitionend", onEvent);
DebuggerController.StackFrames.updateEditorLocation();
});
Prefs.variablesPaneVisible = aVisibleFlag;
},
/**
@ -1687,8 +1625,6 @@ StackFramesView.prototype = {
if (document.getElementById("stackframe-" + aDepth)) {
return null;
}
// Stackframes are UI elements which benefit from visible panes.
DebuggerView.showPanesIfAllowed();
let frame = document.createElement("box");
let frameName = document.createElement("label");

View File

@ -19,32 +19,12 @@ function test() {
gDebugger = gPane.contentWindow;
gView = gDebugger.DebuggerView;
testPanesState();
gView.toggleStackframesAndBreakpointsPane({ visible: true });
gView.toggleVariablesPane({ visible: true });
testPaneCollapse1();
testPaneCollapse2();
closeDebuggerAndFinish();
});
}
function testPanesState() {
let togglePanesButton =
gDebugger.document.getElementById("toggle-panes");
ok(togglePanesButton.getAttribute("stackframesAndBreakpointsHidden"),
"The stackframes and breakpoints pane should initially be invisible.");
is(gDebugger.Prefs.stackframesPaneVisible, true,
"The stackframes and breakpoints pane should initially be preffed as visible.");
ok(togglePanesButton.getAttribute("variablesHidden"),
"The stackframes and breakpoints pane should initially be invisible.");
is(gDebugger.Prefs.variablesPaneVisible, true,
"The stackframes and breakpoints pane should initially be preffed as visible.");
}
function testPaneCollapse1() {
let stackframesAndBrekpoints =
gDebugger.document.getElementById("stackframes+breakpoints");
@ -55,16 +35,16 @@ function testPaneCollapse1() {
is(width, gDebugger.Prefs.stackframesWidth,
"The stackframes and breakpoints pane has an incorrect width.");
is(stackframesAndBrekpoints.style.marginLeft, "0px",
"The stackframes and breakpoints pane has an incorrect left margin.");
"The stackframes and breakpoints pane has an incorrect initial left margin.");
ok(!stackframesAndBrekpoints.hasAttribute("animated"),
"The stackframes and breakpoints pane has an incorrect animated attribute.");
"The stackframes and breakpoints pane has an incorrect initial animated attribute.");
ok(!togglePanesButton.getAttribute("stackframesAndBreakpointsHidden"),
"The stackframes and breakpoints pane should at this point be visible.");
"The stackframes and breakpoints pane should initially be visible.");
is(gDebugger.Prefs.stackframesPaneVisible, true,
"The stackframes and breakpoints pane should at this point be visible.");
"The stackframes and breakpoints pane should initially be visible.");
gView.toggleStackframesAndBreakpointsPane({ visible: false, animated: true });
gView.showStackframesAndBreakpointsPane(false, true);
is(gDebugger.Prefs.stackframesPaneVisible, false,
"The stackframes and breakpoints pane should be hidden after collapsing.");
@ -82,7 +62,7 @@ function testPaneCollapse1() {
is(gDebugger.Prefs.stackframesPaneVisible, false,
"The stackframes and breakpoints pane should be hidden before uncollapsing.");
gView.toggleStackframesAndBreakpointsPane({ visible: true, animated: false });
gView.showStackframesAndBreakpointsPane(true, false);
is(gDebugger.Prefs.stackframesPaneVisible, true,
"The stackframes and breakpoints pane should be visible after uncollapsing.");
@ -107,16 +87,16 @@ function testPaneCollapse2() {
is(width, gDebugger.Prefs.variablesWidth,
"The variables pane has an incorrect width.");
is(variables.style.marginRight, "0px",
"The variables pane has an incorrect right margin.");
"The variables pane has an incorrect initial right margin.");
ok(!variables.hasAttribute("animated"),
"The variables pane has an incorrect animated attribute.");
"The variables pane has an incorrect initial animated attribute.");
ok(!togglePanesButton.getAttribute("variablesHidden"),
"The variables pane should at this point be visible.");
"The variables pane should initially be visible.");
is(gDebugger.Prefs.variablesPaneVisible, true,
"The variables pane should at this point be visible.");
"The variables pane should initially be visible.");
gView.toggleVariablesPane({ visible: false, animated: true });
gView.showVariablesPane(false, true);
is(gDebugger.Prefs.variablesPaneVisible, false,
"The variables pane should be hidden after collapsing.");
@ -134,7 +114,7 @@ function testPaneCollapse2() {
is(gDebugger.Prefs.variablesPaneVisible, false,
"The variables pane should be hidden before uncollapsing.");
gView.toggleVariablesPane({ visible: true, animated: false });
gView.showVariablesPane(true, false);
is(gDebugger.Prefs.variablesPaneVisible, true,
"The variables pane should be visible after uncollapsing.");

View File

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#body {
background-color: white;
background: -moz-dialog;
}
/**

View File

@ -7,7 +7,7 @@
%include ../shared.inc
#body {
background-color: white;
background: -moz-dialog;
}
/**

View File

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#body {
background-color: white;
background: -moz-dialog;
}
/**

View File

@ -193,6 +193,10 @@
#include "mozilla/Telemetry.h"
#include "nsISecurityUITelemetry.h"
#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
#include "nsIPrivateBrowsingService.h"
#endif
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID,
NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
@ -2722,12 +2726,23 @@ nsDocShell::SetDocLoaderParent(nsDocLoader * aParent)
}
SetAllowDNSPrefetch(value);
}
#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
// Set the PB flag on the docshell based on the global PB mode for now
nsCOMPtr<nsIPrivateBrowsingService> pbs =
do_GetService(NS_PRIVATE_BROWSING_SERVICE_CONTRACTID);
if (pbs) {
bool inPrivateBrowsing = false;
pbs->GetPrivateBrowsingEnabled(&inPrivateBrowsing);
SetUsePrivateBrowsing(inPrivateBrowsing);
}
#else
nsCOMPtr<nsILoadContext> parentAsLoadContext(do_QueryInterface(parent));
if (parentAsLoadContext &&
NS_SUCCEEDED(parentAsLoadContext->GetUsePrivateBrowsing(&value)))
{
SetUsePrivateBrowsing(value);
}
#endif
nsCOMPtr<nsIURIContentListener> parentURIListener(do_GetInterface(parent));
if (parentURIListener)

View File

@ -64,7 +64,7 @@ struct LayerPropertiesBase : public LayerProperties
LayerPropertiesBase(Layer* aLayer)
: mLayer(aLayer)
, mMaskLayer(nullptr)
, mVisibleBounds(aLayer->GetVisibleRegion().GetBounds())
, mVisibleRegion(aLayer->GetVisibleRegion())
, mTransform(aLayer->GetTransform())
, mOpacity(aLayer->GetOpacity())
, mUseClipRect(!!aLayer->GetClipRect())
@ -118,6 +118,10 @@ struct LayerPropertiesBase : public LayerProperties
}
}
nsIntRegion visible;
visible.Xor(mVisibleRegion, mLayer->GetVisibleRegion());
result = result.Union(TransformRect(visible.GetBounds(), mTransform));
result = result.Union(ComputeChangeInternal(aCallback));
result = result.Union(TransformRect(mLayer->GetInvalidRegion().GetBounds(), mTransform));
@ -145,14 +149,14 @@ struct LayerPropertiesBase : public LayerProperties
nsIntRect OldTransformedBounds()
{
return TransformRect(mVisibleBounds, mTransform);
return TransformRect(mVisibleRegion.GetBounds(), mTransform);
}
virtual nsIntRect ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback) { return nsIntRect(); }
nsRefPtr<Layer> mLayer;
nsAutoPtr<LayerPropertiesBase> mMaskLayer;
nsIntRect mVisibleBounds;
nsIntRegion mVisibleRegion;
gfx3DMatrix mTransform;
float mOpacity;
nsIntRect mClipRect;

View File

@ -2265,9 +2265,10 @@ public:
* tree composite.
*/
enum {
PAINT_COMPOSITE_ONLY
PAINT_DEFAULT = 0,
PAINT_COMPOSITE_ONLY = 1 << 0
};
void SchedulePaint(uint32_t aFlags = 0);
void SchedulePaint(uint32_t aFlags = PAINT_DEFAULT);
/**
* Checks if the layer tree includes a dedicated layer for this