Merge mozilla-central and fx-team

This commit is contained in:
Ed Morley 2014-06-10 16:41:30 +01:00
commit 2493a61193
21 changed files with 275 additions and 103 deletions

View File

@ -1929,13 +1929,21 @@ let CustomizableUIInternal = {
this.notifyListeners("onWidgetCreated", widget.id); this.notifyListeners("onWidgetCreated", widget.id);
if (widget.defaultArea) { if (widget.defaultArea) {
let addToDefaultPlacements = false;
let area = gAreas.get(widget.defaultArea); let area = gAreas.get(widget.defaultArea);
//XXXgijs this won't have any effect for legacy items. Sort of OK because if (widget.source == CustomizableUI.SOURCE_BUILTIN) {
// consumers can modify currentset? Maybe? addToDefaultPlacements = true;
if (area.has("defaultPlacements")) { } else if (!CustomizableUI.isBuiltinToolbar(widget.defaultArea) &&
area.get("defaultPlacements").push(widget.id); widget.defaultArea != CustomizableUI.AREA_PANEL) {
} else { addToDefaultPlacements = true;
area.set("defaultPlacements", [widget.id]); }
if (addToDefaultPlacements) {
if (area.has("defaultPlacements")) {
area.get("defaultPlacements").push(widget.id);
} else {
area.set("defaultPlacements", [widget.id]);
}
} }
} }

View File

@ -665,7 +665,7 @@ CustomizeMode.prototype = {
if (customizationTarget && customizationTarget != areaNode) { if (customizationTarget && customizationTarget != areaNode) {
areas.push(customizationTarget.id); areas.push(customizationTarget.id);
} }
let overflowTarget = areaNode.getAttribute("overflowtarget"); let overflowTarget = areaNode && areaNode.getAttribute("overflowtarget");
if (overflowTarget) { if (overflowTarget) {
areas.push(overflowTarget); areas.push(overflowTarget);
} }

View File

@ -94,6 +94,7 @@ skip-if = os == "linux"
[browser_978084_dragEnd_after_move.js] [browser_978084_dragEnd_after_move.js]
[browser_980155_add_overflow_toolbar.js] [browser_980155_add_overflow_toolbar.js]
[browser_981418-widget-onbeforecreated-handler.js] [browser_981418-widget-onbeforecreated-handler.js]
[browser_982656_restore_defaults_builtin_widgets.js]
[browser_984455_bookmarks_items_reparenting.js] [browser_984455_bookmarks_items_reparenting.js]
skip-if = os == "linux" skip-if = os == "linux"

View File

@ -0,0 +1,58 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// Restoring default should not place addon widgets back in the toolbar
add_task(function() {
ok(CustomizableUI.inDefaultState, "Default state to begin");
const kWidgetId = "bug982656-add-on-widget-should-not-restore-to-default-area";
let widgetSpec = {
id: kWidgetId,
defaultArea: CustomizableUI.AREA_NAVBAR
};
CustomizableUI.createWidget(widgetSpec);
ok(!CustomizableUI.inDefaultState, "Not in default state after widget added");
is(CustomizableUI.getPlacementOfWidget(kWidgetId).area, CustomizableUI.AREA_NAVBAR, "Widget should be in navbar");
yield resetCustomization();
ok(CustomizableUI.inDefaultState, "Back in default state after reset");
is(CustomizableUI.getPlacementOfWidget(kWidgetId), null, "Widget now in palette");
CustomizableUI.destroyWidget(kWidgetId);
});
// resetCustomization shouldn't move 3rd party widgets out of custom toolbars
add_task(function() {
const kToolbarId = "bug982656-toolbar-with-defaultset";
const kWidgetId = "bug982656-add-on-widget-should-restore-to-default-area-when-area-is-not-builtin";
ok(CustomizableUI.inDefaultState, "Everything should be in its default state.");
let toolbar = createToolbarWithPlacements(kToolbarId, [kWidgetId]);
ok(CustomizableUI.areas.indexOf(kToolbarId) != -1,
"Toolbar has been registered.");
is(CustomizableUI.getAreaType(kToolbarId), CustomizableUI.TYPE_TOOLBAR,
"Area should be registered as toolbar");
let widgetSpec = {
id: kWidgetId,
defaultArea: kToolbarId
};
CustomizableUI.createWidget(widgetSpec);
ok(!CustomizableUI.inDefaultState, "No longer in default state after toolbar is registered and visible.");
is(CustomizableUI.getPlacementOfWidget(kWidgetId).area, kToolbarId, "Widget should be in custom toolbar");
yield resetCustomization();
debugger;
ok(CustomizableUI.inDefaultState, "Back in default state after reset");
is(CustomizableUI.getPlacementOfWidget(kWidgetId).area, kToolbarId, "Widget still in custom toolbar");
ok(toolbar.collapsed, "Custom toolbar should be collapsed after reset");
toolbar.remove();
CustomizableUI.destroyWidget(kWidgetId);
CustomizableUI.unregisterArea(kToolbarId);
});

View File

@ -20,7 +20,12 @@ function* performTest() {
doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;"); doc.body.setAttribute("style", "position: fixed; width: 100%; height: 100%; margin: 0;");
let graph = new LineGraphWidget(doc.body, "fps"); let graph = new LineGraphWidget(doc.body, "fps");
yield graph.once("ready");
let readyEventEmitted;
graph.once("ready", () => readyEventEmitted = true);
yield graph.ready();
ok(readyEventEmitted, "The 'ready' event should have been emitted");
testGraph(host, graph); testGraph(host, graph);

View File

@ -5,8 +5,9 @@
const Cu = Components.utils; const Cu = Components.utils;
Cu.import("resource://gre/modules/devtools/event-emitter.js");
Cu.import("resource:///modules/devtools/ViewHelpers.jsm"); Cu.import("resource:///modules/devtools/ViewHelpers.jsm");
const promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;
const {EventEmitter} = Cu.import("resource://gre/modules/devtools/event-emitter.js", {});
this.EXPORTED_SYMBOLS = ["LineGraphWidget"]; this.EXPORTED_SYMBOLS = ["LineGraphWidget"];
@ -116,6 +117,7 @@ GraphSelectionResizer.prototype = {
this.AbstractCanvasGraph = function(parent, name, sharpness) { this.AbstractCanvasGraph = function(parent, name, sharpness) {
EventEmitter.decorate(this); EventEmitter.decorate(this);
this._ready = promise.defer();
this._parent = parent; this._parent = parent;
this._uid = "canvas-graph-" + Date.now(); this._uid = "canvas-graph-" + Date.now();
@ -165,6 +167,7 @@ this.AbstractCanvasGraph = function(parent, name, sharpness) {
this._animationId = this._window.requestAnimationFrame(this._onAnimationFrame); this._animationId = this._window.requestAnimationFrame(this._onAnimationFrame);
this._ready.resolve(this);
this.emit("ready", this); this.emit("ready", this);
}); });
} }
@ -181,6 +184,13 @@ AbstractCanvasGraph.prototype = {
return this._height; return this._height;
}, },
/**
* Returns a promise resolved once this graph is ready to receive data.
*/
ready: function() {
return this._ready.promise;
},
/** /**
* Destroys this graph. * Destroys this graph.
*/ */
@ -501,15 +511,16 @@ AbstractCanvasGraph.prototype = {
let ctx = this._ctx; let ctx = this._ctx;
ctx.clearRect(0, 0, this._width, this._height); ctx.clearRect(0, 0, this._width, this._height);
// Draw the graph underneath the cursor and selection.
if (this.hasData()) {
ctx.drawImage(this._cachedGraphImage, 0, 0, this._width, this._height);
}
if (this.hasCursor()) { if (this.hasCursor()) {
this._drawCliphead(); this._drawCliphead();
} }
if (this.hasSelection() || this.hasSelectionInProgress()) { if (this.hasSelection() || this.hasSelectionInProgress()) {
this._drawSelection(); this._drawSelection();
} }
if (this.hasData()) {
ctx.drawImage(this._cachedGraphImage, 0, 0, this._width, this._height);
}
this._shouldRedraw = false; this._shouldRedraw = false;
}, },
@ -957,24 +968,17 @@ LineGraphWidget.prototype = Heritage.extend(AbstractCanvasGraph.prototype, {
let width = canvas.width = this._width; let width = canvas.width = this._width;
let height = canvas.height = this._height; let height = canvas.height = this._height;
let totalTicks = this._data.length;
let firstTick = this._data[0].delta;
let lastTick = this._data[totalTicks - 1].delta;
let maxValue = Number.MIN_SAFE_INTEGER; let maxValue = Number.MIN_SAFE_INTEGER;
let minValue = Number.MAX_SAFE_INTEGER; let minValue = Number.MAX_SAFE_INTEGER;
let sumValues = 0; let sumValues = 0;
let totalTicks = 0;
let firstTick;
let lastTick;
for (let { delta, value } of this._data) { for (let { delta, value } of this._data) {
maxValue = Math.max(value, maxValue); maxValue = Math.max(value, maxValue);
minValue = Math.min(value, minValue); minValue = Math.min(value, minValue);
sumValues += value; sumValues += value;
totalTicks++;
if (!firstTick) {
firstTick = delta;
} else {
lastTick = delta;
}
} }
let dataScaleX = this.dataScaleX = width / lastTick; let dataScaleX = this.dataScaleX = width / lastTick;
@ -997,7 +1001,6 @@ LineGraphWidget.prototype = Heritage.extend(AbstractCanvasGraph.prototype, {
ctx.fillStyle = gradient; ctx.fillStyle = gradient;
ctx.strokeStyle = LINE_GRAPH_STROKE_COLOR; ctx.strokeStyle = LINE_GRAPH_STROKE_COLOR;
ctx.lineWidth = LINE_GRAPH_STROKE_WIDTH; ctx.lineWidth = LINE_GRAPH_STROKE_WIDTH;
ctx.setLineDash([]);
ctx.beginPath(); ctx.beginPath();
let prevX = 0; let prevX = 0;

View File

@ -1829,14 +1829,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
margin: 0 0 @tabToolbarNavbarOverlap@; margin: 0 0 @tabToolbarNavbarOverlap@;
} }
.tabbrowser-arrowscrollbox > .scrollbutton-up {
-moz-border-start: 0;
-moz-border-end: 2px solid transparent;
}
.tabbrowser-arrowscrollbox > .scrollbutton-down { .tabbrowser-arrowscrollbox > .scrollbutton-down {
-moz-border-start: 2px solid transparent;
-moz-border-end: 0;
transition: 1s box-shadow ease-out; transition: 1s box-shadow ease-out;
border-radius: 4px; border-radius: 4px;
} }
@ -1846,20 +1839,6 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
transition: none; transition: none;
} }
.tabbrowser-arrowscrollbox > .scrollbutton-up:not([disabled]):-moz-locale-dir(ltr),
.tabbrowser-arrowscrollbox > .scrollbutton-down:not([disabled]):-moz-locale-dir(rtl) {
border-width: 0 2px 0 0;
border-style: solid;
border-image: url("chrome://browser/skin/tabbrowser/tab-overflow-border.png") 0 2 0 2 fill;
}
.tabbrowser-arrowscrollbox > .scrollbutton-down:not([disabled]):-moz-locale-dir(ltr),
.tabbrowser-arrowscrollbox > .scrollbutton-up:not([disabled]):-moz-locale-dir(rtl) {
border-width: 0 0 0 2px;
border-style: solid;
border-image: url("chrome://browser/skin/tabbrowser/tab-overflow-border.png") 0 2 0 2 fill;
}
#TabsToolbar .toolbarbutton-1 { #TabsToolbar .toolbarbutton-1 {
margin-bottom: @tabToolbarNavbarOverlap@; margin-bottom: @tabToolbarNavbarOverlap@;
} }

View File

@ -165,7 +165,7 @@ browser.jar:
skin/classic/browser/tabbrowser/tab-background-end.png (tabbrowser/tab-background-end.png) skin/classic/browser/tabbrowser/tab-background-end.png (tabbrowser/tab-background-end.png)
skin/classic/browser/tabbrowser/tab-background-middle.png (tabbrowser/tab-background-middle.png) skin/classic/browser/tabbrowser/tab-background-middle.png (tabbrowser/tab-background-middle.png)
skin/classic/browser/tabbrowser/tab-background-start.png (tabbrowser/tab-background-start.png) skin/classic/browser/tabbrowser/tab-background-start.png (tabbrowser/tab-background-start.png)
skin/classic/browser/tabbrowser/tab-overflow-border.png (tabbrowser/tab-overflow-border.png) skin/classic/browser/tabbrowser/tab-overflow-indicator.png (../shared/tabbrowser/tab-overflow-indicator.png)
# NOTE: The following two files (tab-selected-end.svg, tab-selected-start.svg) get pre-processed in # NOTE: The following two files (tab-selected-end.svg, tab-selected-start.svg) get pre-processed in
# Makefile.in with a non-default marker of "%" and the result of that gets packaged. # Makefile.in with a non-default marker of "%" and the result of that gets packaged.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

View File

@ -2971,20 +2971,6 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
} }
} }
.tabbrowser-arrowscrollbox > .scrollbutton-up:not([disabled]):-moz-locale-dir(ltr),
.tabbrowser-arrowscrollbox > .scrollbutton-down:not([disabled]):-moz-locale-dir(rtl) {
border-width: 0 2px 0 0;
border-style: solid;
border-image: url("chrome://browser/skin/tabbrowser/tab-overflow-border.png") 0 2 0 2 fill;
}
.tabbrowser-arrowscrollbox > .scrollbutton-down:not([disabled]):-moz-locale-dir(ltr),
.tabbrowser-arrowscrollbox > .scrollbutton-up:not([disabled]):-moz-locale-dir(rtl) {
border-width: 0 0 0 2px;
border-style: solid;
border-image: url("chrome://browser/skin/tabbrowser/tab-overflow-border.png") 0 2 0 2 fill;
}
/** /**
* Tabstrip & add-on bar toolbar buttons * Tabstrip & add-on bar toolbar buttons
*/ */

View File

@ -277,6 +277,7 @@ browser.jar:
skin/classic/browser/tabbrowser/tab-background-middle@2x.png (tabbrowser/tab-background-middle@2x.png) skin/classic/browser/tabbrowser/tab-background-middle@2x.png (tabbrowser/tab-background-middle@2x.png)
skin/classic/browser/tabbrowser/tab-background-start.png (tabbrowser/tab-background-start.png) skin/classic/browser/tabbrowser/tab-background-start.png (tabbrowser/tab-background-start.png)
skin/classic/browser/tabbrowser/tab-background-start@2x.png (tabbrowser/tab-background-start@2x.png) skin/classic/browser/tabbrowser/tab-background-start@2x.png (tabbrowser/tab-background-start@2x.png)
skin/classic/browser/tabbrowser/tab-overflow-indicator.png (../shared/tabbrowser/tab-overflow-indicator.png)
# NOTE: The following two files (tab-selected-end.svg, tab-selected-start.svg) get pre-processed in # NOTE: The following two files (tab-selected-end.svg, tab-selected-start.svg) get pre-processed in
# Makefile.in with a non-default marker of "%" and the result of that gets packaged. # Makefile.in with a non-default marker of "%" and the result of that gets packaged.
@ -287,7 +288,6 @@ browser.jar:
skin/classic/browser/tabbrowser/tab-stroke-end@2x.png (tabbrowser/tab-stroke-end@2x.png) skin/classic/browser/tabbrowser/tab-stroke-end@2x.png (tabbrowser/tab-stroke-end@2x.png)
skin/classic/browser/tabbrowser/tab-stroke-start.png (tabbrowser/tab-stroke-start.png) skin/classic/browser/tabbrowser/tab-stroke-start.png (tabbrowser/tab-stroke-start.png)
skin/classic/browser/tabbrowser/tab-stroke-start@2x.png (tabbrowser/tab-stroke-start@2x.png) skin/classic/browser/tabbrowser/tab-stroke-start@2x.png (tabbrowser/tab-stroke-start@2x.png)
skin/classic/browser/tabbrowser/tab-overflow-border.png (tabbrowser/tab-overflow-border.png)
skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png) skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png)
skin/classic/browser/tabbrowser/tabDragIndicator@2x.png (tabbrowser/tabDragIndicator@2x.png) skin/classic/browser/tabbrowser/tabDragIndicator@2x.png (tabbrowser/tabDragIndicator@2x.png)
skin/classic/browser/tabbrowser/tab-separator.png (tabbrowser/tab-separator.png) skin/classic/browser/tabbrowser/tab-separator.png (tabbrowser/tab-separator.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

View File

@ -130,6 +130,43 @@
-moz-padding-start: @tabCurveHalfWidth@; -moz-padding-start: @tabCurveHalfWidth@;
} }
/* Tab Overflow */
.tabbrowser-arrowscrollbox > .arrowscrollbox-overflow-start-indicator:not([collapsed]),
.tabbrowser-arrowscrollbox > .arrowscrollbox-overflow-end-indicator:not([collapsed]) {
background-image: url(chrome://browser/skin/tabbrowser/tab-overflow-indicator.png);
background-size: 100% 100%;
width: 14px;
margin-bottom: @tabToolbarNavbarOverlap@;
pointer-events: none;
position: relative;
z-index: 3; /* the selected tab's z-index + 1 */
}
.tabbrowser-arrowscrollbox > .arrowscrollbox-overflow-start-indicator:-moz-locale-dir(rtl),
.tabbrowser-arrowscrollbox > .arrowscrollbox-overflow-end-indicator:-moz-locale-dir(ltr) {
transform: scaleX(-1);
}
.tabbrowser-arrowscrollbox > .arrowscrollbox-overflow-start-indicator:not([collapsed]) {
-moz-margin-start: -2px;
-moz-margin-end: -12px;
}
.tabbrowser-arrowscrollbox > .arrowscrollbox-overflow-end-indicator:not([collapsed]) {
-moz-margin-start: -12px;
-moz-margin-end: -2px;
}
.tabbrowser-arrowscrollbox > .arrowscrollbox-overflow-start-indicator[collapsed],
.tabbrowser-arrowscrollbox > .arrowscrollbox-overflow-end-indicator[collapsed] {
opacity: 0;
}
.tabbrowser-arrowscrollbox > .arrowscrollbox-overflow-start-indicator,
.tabbrowser-arrowscrollbox > .arrowscrollbox-overflow-end-indicator {
transition: opacity 150ms ease;
}
.tab-background-start[selected=true]::after, .tab-background-start[selected=true]::after,
.tab-background-start[selected=true]::before, .tab-background-start[selected=true]::before,
.tab-background-start, .tab-background-start,

View File

@ -1855,9 +1855,6 @@ toolbarbutton[type="socialmark"] > .toolbarbutton-icon {
.tabbrowser-arrowscrollbox > .scrollbutton-down { .tabbrowser-arrowscrollbox > .scrollbutton-down {
list-style-image: url("chrome://browser/skin/tabbrowser/tab-arrow-left.png"); list-style-image: url("chrome://browser/skin/tabbrowser/tab-arrow-left.png");
margin: 0 0 @tabToolbarNavbarOverlap@; margin: 0 0 @tabToolbarNavbarOverlap@;
padding-right: 2px;
border-right: 2px solid transparent;
background-origin: border-box;
} }
#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-arrowscrollbox > .scrollbutton-up, #TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-arrowscrollbox > .scrollbutton-up,
@ -1884,13 +1881,6 @@ toolbarbutton[type="socialmark"] > .toolbarbutton-icon {
transition: none; transition: none;
} }
.tabbrowser-arrowscrollbox > .scrollbutton-up:not([disabled]),
.tabbrowser-arrowscrollbox > .scrollbutton-down:not([disabled]) {
border-width: 0 2px 0 0;
border-style: solid;
border-image: url("chrome://browser/skin/tabbrowser/tab-overflow-border.png") 0 2 0 2 fill;
}
.tabs-newtab-button > .toolbarbutton-icon { .tabs-newtab-button > .toolbarbutton-icon {
margin-top: -1px; margin-top: -1px;
margin-bottom: -1px; margin-bottom: -1px;

View File

@ -196,7 +196,7 @@ browser.jar:
skin/classic/browser/tabbrowser/tab-background-middle@2x.png (tabbrowser/tab-background-middle@2x.png) skin/classic/browser/tabbrowser/tab-background-middle@2x.png (tabbrowser/tab-background-middle@2x.png)
skin/classic/browser/tabbrowser/tab-background-end.png (tabbrowser/tab-background-end.png) skin/classic/browser/tabbrowser/tab-background-end.png (tabbrowser/tab-background-end.png)
skin/classic/browser/tabbrowser/tab-background-end@2x.png (tabbrowser/tab-background-end@2x.png) skin/classic/browser/tabbrowser/tab-background-end@2x.png (tabbrowser/tab-background-end@2x.png)
skin/classic/browser/tabbrowser/tab-overflow-border.png (tabbrowser/tab-overflow-border.png) skin/classic/browser/tabbrowser/tab-overflow-indicator.png (../shared/tabbrowser/tab-overflow-indicator.png)
# NOTE: The following two files (tab-selected-end.svg, tab-selected-start.svg) get pre-processed in # NOTE: The following two files (tab-selected-end.svg, tab-selected-start.svg) get pre-processed in
# Makefile.in with a non-default marker of "%" and the result of that gets packaged. # Makefile.in with a non-default marker of "%" and the result of that gets packaged.
@ -601,7 +601,7 @@ browser.jar:
skin/classic/aero/browser/tabbrowser/tab-background-middle@2x.png (tabbrowser/tab-background-middle@2x.png) skin/classic/aero/browser/tabbrowser/tab-background-middle@2x.png (tabbrowser/tab-background-middle@2x.png)
skin/classic/aero/browser/tabbrowser/tab-background-end.png (tabbrowser/tab-background-end.png) skin/classic/aero/browser/tabbrowser/tab-background-end.png (tabbrowser/tab-background-end.png)
skin/classic/aero/browser/tabbrowser/tab-background-end@2x.png (tabbrowser/tab-background-end@2x.png) skin/classic/aero/browser/tabbrowser/tab-background-end@2x.png (tabbrowser/tab-background-end@2x.png)
skin/classic/aero/browser/tabbrowser/tab-overflow-border.png (tabbrowser/tab-overflow-border.png) skin/classic/aero/browser/tabbrowser/tab-overflow-indicator.png (../shared/tabbrowser/tab-overflow-indicator.png)
# NOTE: The following two files (tab-selected-end.svg, tab-selected-start.svg) get pre-processed in # NOTE: The following two files (tab-selected-end.svg, tab-selected-start.svg) get pre-processed in
# Makefile.in with a non-default marker of "%" and the result of that gets packaged. # Makefile.in with a non-default marker of "%" and the result of that gets packaged.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

View File

@ -27,23 +27,30 @@
<content> <content>
<xul:autorepeatbutton class="autorepeatbutton-up" <xul:autorepeatbutton class="autorepeatbutton-up"
anonid="scrollbutton-up" anonid="scrollbutton-up"
collapsed="true" xbl:inherits="orient,collapsed=notoverflowing,disabled=scrolledtostart"
xbl:inherits="orient"
oncommand="_autorepeatbuttonScroll(event);"/> oncommand="_autorepeatbuttonScroll(event);"/>
<xul:spacer class="arrowscrollbox-overflow-start-indicator"
xbl:inherits="collapsed=scrolledtostart"/>
<xul:scrollbox class="arrowscrollbox-scrollbox" <xul:scrollbox class="arrowscrollbox-scrollbox"
anonid="scrollbox" anonid="scrollbox"
flex="1" flex="1"
xbl:inherits="orient,align,pack,dir"> xbl:inherits="orient,align,pack,dir">
<children/> <children/>
</xul:scrollbox> </xul:scrollbox>
<xul:spacer class="arrowscrollbox-overflow-end-indicator"
xbl:inherits="collapsed=scrolledtoend"/>
<xul:autorepeatbutton class="autorepeatbutton-down" <xul:autorepeatbutton class="autorepeatbutton-down"
anonid="scrollbutton-down" anonid="scrollbutton-down"
collapsed="true" xbl:inherits="orient,collapsed=notoverflowing,disabled=scrolledtoend"
xbl:inherits="orient"
oncommand="_autorepeatbuttonScroll(event);"/> oncommand="_autorepeatbuttonScroll(event);"/>
</content> </content>
<implementation> <implementation>
<constructor><![CDATA[
this.setAttribute("notoverflowing", "true");
this._updateScrollButtonsDisabledState();
]]></constructor>
<destructor><![CDATA[ <destructor><![CDATA[
this._stopSmoothScroll(); this._stopSmoothScroll();
]]></destructor> ]]></destructor>
@ -454,28 +461,39 @@
<method name="_updateScrollButtonsDisabledState"> <method name="_updateScrollButtonsDisabledState">
<body><![CDATA[ <body><![CDATA[
var disableUpButton = false; var scrolledToStart = false;
var disableDownButton = false; var scrolledToEnd = false;
if (this.scrollPosition == 0) { if (this.hasAttribute("notoverflowing")) {
scrolledToStart = true;
scrolledToEnd = true;
}
else if (this.scrollPosition == 0) {
// In the RTL case, this means the _last_ element in the // In the RTL case, this means the _last_ element in the
// scrollbox is visible // scrollbox is visible
if (this._isRTLScrollbox) if (this._isRTLScrollbox)
disableDownButton = true; scrolledToEnd = true;
else else
disableUpButton = true; scrolledToStart = true;
} }
else if (this.scrollClientSize + this.scrollPosition == this.scrollSize) { else if (this.scrollClientSize + this.scrollPosition == this.scrollSize) {
// In the RTL case, this means the _first_ element in the // In the RTL case, this means the _first_ element in the
// scrollbox is visible // scrollbox is visible
if (this._isRTLScrollbox) if (this._isRTLScrollbox)
disableUpButton = true; scrolledToStart = true;
else else
disableDownButton = true; scrolledToEnd = true;
} }
this._scrollButtonUp.disabled = disableUpButton; if (scrolledToEnd)
this._scrollButtonDown.disabled = disableDownButton; this.setAttribute("scrolledtoend", "true");
else
this.removeAttribute("scrolledtoend");
if (scrolledToStart)
this.setAttribute("scrolledtostart", "true");
else
this.removeAttribute("scrolledtostart");
]]></body> ]]></body>
</method> </method>
</implementation> </implementation>
@ -535,8 +553,8 @@
return; return;
} }
this._scrollButtonUp.collapsed = true; this.setAttribute("notoverflowing", "true");
this._scrollButtonDown.collapsed = true;
try { try {
// See bug 341047 and comments in overflow handler as to why // See bug 341047 and comments in overflow handler as to why
// try..catch is needed here // try..catch is needed here
@ -545,8 +563,7 @@
this.ensureElementIsVisible(childNodes[0], false); this.ensureElementIsVisible(childNodes[0], false);
} }
catch(e) { catch(e) {
this._scrollButtonUp.collapsed = false; this.removeAttribute("notoverflowing");
this._scrollButtonDown.collapsed = false;
} }
]]></handler> ]]></handler>
@ -569,20 +586,18 @@
return; return;
} }
this._scrollButtonUp.collapsed = false; this.removeAttribute("notoverflowing");
this._scrollButtonDown.collapsed = false;
try { try {
// See bug 341047, the overflow event is dispatched when the // See bug 341047, the overflow event is dispatched when the
// scrollbox already is mostly destroyed. This causes some code in // scrollbox already is mostly destroyed. This causes some code in
// _updateScrollButtonsDisabledState() to throw an error. It also // _updateScrollButtonsDisabledState() to throw an error. It also
// means that the scrollbarbuttons were uncollapsed when that should // means that the notoverflowing attribute was removed erroneously,
// not be happening, because the whole overflow event should not be // as the whole overflow event should not be happening in that case.
// happening in that case.
this._updateScrollButtonsDisabledState(); this._updateScrollButtonsDisabledState();
} }
catch(e) { catch(e) {
this._scrollButtonUp.collapsed = true; this.setAttribute("notoverflowing", "true");
this._scrollButtonDown.collapsed = true;
} }
]]></handler> ]]></handler>
@ -598,22 +613,26 @@
<binding id="arrowscrollbox-clicktoscroll" extends="chrome://global/content/bindings/scrollbox.xml#arrowscrollbox"> <binding id="arrowscrollbox-clicktoscroll" extends="chrome://global/content/bindings/scrollbox.xml#arrowscrollbox">
<content> <content>
<xul:toolbarbutton class="scrollbutton-up" collapsed="true" <xul:toolbarbutton class="scrollbutton-up"
xbl:inherits="orient" xbl:inherits="orient,collapsed=notoverflowing,disabled=scrolledtostart"
anonid="scrollbutton-up" anonid="scrollbutton-up"
onclick="_distanceScroll(event);" onclick="_distanceScroll(event);"
onmousedown="if (event.button == 0) _startScroll(-1);" onmousedown="if (event.button == 0) _startScroll(-1);"
onmouseup="if (event.button == 0) _stopScroll();" onmouseup="if (event.button == 0) _stopScroll();"
onmouseover="_continueScroll(-1);" onmouseover="_continueScroll(-1);"
onmouseout="_pauseScroll();"/> onmouseout="_pauseScroll();"/>
<xul:spacer class="arrowscrollbox-overflow-start-indicator"
xbl:inherits="collapsed=scrolledtostart"/>
<xul:scrollbox class="arrowscrollbox-scrollbox" <xul:scrollbox class="arrowscrollbox-scrollbox"
anonid="scrollbox" anonid="scrollbox"
flex="1" flex="1"
xbl:inherits="orient,align,pack,dir"> xbl:inherits="orient,align,pack,dir">
<children/> <children/>
</xul:scrollbox> </xul:scrollbox>
<xul:toolbarbutton class="scrollbutton-down" collapsed="true" <xul:spacer class="arrowscrollbox-overflow-end-indicator"
xbl:inherits="orient" xbl:inherits="collapsed=scrolledtoend"/>
<xul:toolbarbutton class="scrollbutton-down"
xbl:inherits="orient,collapsed=notoverflowing,disabled=scrolledtoend"
anonid="scrollbutton-down" anonid="scrollbutton-down"
onclick="_distanceScroll(event);" onclick="_distanceScroll(event);"
onmousedown="if (event.button == 0) _startScroll(1);" onmousedown="if (event.button == 0) _startScroll(1);"

View File

@ -54,18 +54,22 @@ let FramerateActor = exports.FramerateActor = protocol.ActorClass({
/** /**
* Stops monitoring framerate, returning the recorded values. * Stops monitoring framerate, returning the recorded values.
*/ */
stopRecording: method(function() { stopRecording: method(function(beginAt = 0, endAt = Number.MAX_SAFE_INTEGER) {
if (!this._recording) { if (!this._recording) {
return []; return [];
} }
this._recording = false; this._recording = false;
// We don't need to store the ticks array for future use, release it. // We don't need to store the ticks array for future use, release it.
let ticks = this._ticks; let ticks = this._ticks.filter(e => e >= beginAt && e <= endAt);
this._ticks = null; this._ticks = null;
return ticks; return ticks;
}, { }, {
response: { timeline: RetVal("array:number") } request: {
beginAt: Arg(0, "nullable:number"),
endAt: Arg(1, "nullable:number")
},
response: { ticks: RetVal("array:number") }
}), }),
/** /**

View File

@ -21,6 +21,7 @@ support-files =
[test_device.html] [test_device.html]
[test_framerate_01.html] [test_framerate_01.html]
[test_framerate_02.html] [test_framerate_02.html]
[test_framerate_03.html]
[test_inspector-changeattrs.html] [test_inspector-changeattrs.html]
[test_inspector-changevalue.html] [test_inspector-changevalue.html]
[test_inspector-hide.html] [test_inspector-hide.html]

View File

@ -0,0 +1,81 @@
<!DOCTYPE HTML>
<html>
<!--
Bug 1023018 - Tests whether or not the framerate actor can handle time ranges.
-->
<head>
<meta charset="utf-8">
<title>Framerate actor test</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body>
<pre id="test">
<script>
window.onload = function() {
var Cu = Components.utils;
var Cc = Components.classes;
var Ci = Components.interfaces;
Cu.import("resource://gre/modules/Services.jsm");
// Always log packets when running tests.
Services.prefs.setBoolPref("devtools.debugger.log", true);
SimpleTest.registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.debugger.log");
});
Cu.import("resource://gre/modules/devtools/Loader.jsm");
Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
SimpleTest.waitForExplicitFinish();
var {FramerateFront} = devtools.require("devtools/server/actors/framerate");
var START_TICK = 2000;
var STOP_TICK = 3000;
var TOTAL_TIME = 5000;
DebuggerServer.init(function () { return true; });
DebuggerServer.addBrowserActors();
var client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect(function onConnect() {
client.listTabs(function onListTabs(aResponse) {
var form = aResponse.tabs[aResponse.selected];
var front = FramerateFront(client, form);
front.startRecording().then(() => {
window.setTimeout(() => {
front.stopRecording(START_TICK, STOP_TICK).then(rawData => {
onRecordingStopped(front, rawData);
});
}, TOTAL_TIME);
});
});
});
function onRecordingStopped(front, rawData) {
ok(rawData, "There should be a recording available.");
ok(!rawData.find(e => e < START_TICK),
"There should be no tick before 2000ms.");
ok(!rawData.find(e => e > STOP_TICK),
"There should be no tick after 3000ms.");
for (var tick of rawData) {
info("Testing tick: " + tick);
is(typeof tick, "number", "All values should be numbers.");
}
client.close(() => {
DebuggerServer.destroy();
SimpleTest.finish()
});
}
}
</script>
</pre>
</body>
</html>