This commit is contained in:
Ryan VanderMeulen 2013-03-13 08:01:01 -04:00
Родитель 344fe4e6ea d431a51493
Коммит b22d28df84
19 изменённых файлов: 18 добавлений и 280 удалений

Просмотреть файл

@ -1042,7 +1042,7 @@ pref("devtools.toolbox.footer.height", 250);
pref("devtools.toolbox.sidebar.width", 500);
pref("devtools.toolbox.host", "bottom");
pref("devtools.toolbox.selectedTool", "webconsole");
pref("devtools.toolbox.toolbarSpec", '["paintflashing toggle","tilt toggle","scratchpad","resize toggle"]');
pref("devtools.toolbox.toolbarSpec", '["tilt toggle","scratchpad","resize toggle"]');
pref("devtools.toolbox.sideEnabled", false);
// Enable the Inspector

Просмотреть файл

@ -15,7 +15,6 @@ Cu.import("resource:///modules/devtools/gcli.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/osfile.jsm")
Cu.import("resource:///modules/devtools/EventEmitter.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "gDevTools",
"resource:///modules/devtools/gDevTools.jsm");
@ -1687,122 +1686,3 @@ XPCOMUtils.defineLazyModuleGetter(this, "TargetFactory",
}
});
}(this));
/* CmdPaintFlashing ------------------------------------------------------- */
(function(module) {
/**
* 'paintflashing' command
*/
gcli.addCommand({
name: 'paintflashing',
description: gcli.lookup('paintflashingDesc')
});
gcli.addCommand({
name: 'paintflashing on',
description: gcli.lookup('paintflashingOnDesc'),
manual: gcli.lookup('paintflashingManual'),
params: [{
group: "options",
params: [
{
type: "boolean",
name: "chrome",
get hidden() gcli.hiddenByChromePref(),
description: gcli.lookup("paintflashingChromeDesc"),
}
]
}],
exec: function(args, context) {
var window;
if (args.chrome) {
window = context.environment.chromeDocument.defaultView;
} else {
window = context.environment.contentDocument.defaultView;
}
window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils).
paintFlashing = true;
onPaintFlashingChanged(context);
}
});
gcli.addCommand({
name: 'paintflashing off',
description: gcli.lookup('paintflashingOffDesc'),
manual: gcli.lookup('paintflashingManual'),
params: [{
group: "options",
params: [
{
type: "boolean",
name: "chrome",
get hidden() gcli.hiddenByChromePref(),
description: gcli.lookup("paintflashingChromeDesc"),
}
]
}],
exec: function(args, context) {
if (args.chrome) {
var window = context.environment.chromeDocument.defaultView;
} else {
var window = context.environment.contentDocument.defaultView;
}
window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils).
paintFlashing = false;
onPaintFlashingChanged(context);
}
});
gcli.addCommand({
name: 'paintflashing toggle',
hidden: true,
buttonId: "command-button-paintflashing",
buttonClass: "command-button",
state: {
isChecked: function(aTarget) {
if (aTarget.isLocalTab) {
let window = aTarget.tab.linkedBrowser.contentWindow;
let wUtils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
return wUtils.paintFlashing;
} else {
throw new Error("Unsupported target");
}
},
onChange: function(aTarget, aChangeHandler) {
eventEmitter.on("changed", aChangeHandler);
},
offChange: function(aTarget, aChangeHandler) {
eventEmitter.off("changed", aChangeHandler);
},
},
tooltipText: gcli.lookup("paintflashingTooltip"),
description: gcli.lookup('paintflashingOnDesc'),
manual: gcli.lookup('paintflashingManual'),
exec: function(args, context) {
var gBrowser = context.environment.chromeDocument.defaultView.gBrowser;
var window = gBrowser.contentWindow;
var wUtils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
wUtils.paintFlashing = !wUtils.paintFlashing;
onPaintFlashingChanged(context);
}
});
let eventEmitter = new EventEmitter();
function onPaintFlashingChanged(context) {
var gBrowser = context.environment.chromeDocument.defaultView.gBrowser;
var tab = gBrowser.selectedTab;
eventEmitter.emit("changed", tab);
function fireChange() {
eventEmitter.emit("changed", tab);
}
var target = TargetFactory.forTab(tab);
target.off("navigate", fireChange);
target.once("navigate", fireChange);
}
}(this));

Просмотреть файл

@ -1006,27 +1006,3 @@ callLogChromeEvalNeedsObject=The JavaScript source must evaluate to an object wh
# LOCALIZATION NOTE (scratchpadOpenTooltip) A string displayed as the
# tooltip of button in devtools toolbox which opens Scratchpad.
scratchpadOpenTooltip=Scratchpad
# LOCALIZATION NOTE (paintflashingDesc) A very short string used to describe the
# function of the "paintflashing" command
paintflashingDesc=Highlight painted area
# LOCALIZATION NOTE (paintflashingOnDesc) A very short string used to describe the
# function of the "paintflashing on" command.
paintflashingOnDesc=Turn on paint flashing
# LOCALIZATION NOTE (paintflashingOffDesc) A very short string used to describe the
# function of the "paintflashing off" command.
paintflashingOffDesc=Turn off paint flashing
# LOCALIZATION NOTE (paintflashingChrome) A very short string used to describe the
# function of the "paintflashing on/off chrome" command.
paintflashingChromeDesc=chrome frames
# LOCALIZATION NOTE (paintflashingManual) A longer description describing the
# set of commands that control paint flashing.
paintflashingManual=Draw repainted areas in different colors
# LOCALIZATION NOTE (paintflashingTooltip) A string displayed as the
# tooltip of button in devtools toolbox which toggles paint flashing.
paintflashingTooltip=Highlight painted area

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 961 B

Просмотреть файл

@ -71,20 +71,6 @@
background-color: hsla(206,37%,4%,.4);
}
#command-button-paintflashing {
list-style-image: url("chrome://browser/skin/devtools/command-paintflashing.png");
-moz-image-region: rect(0px, 16px, 16px, 0px);
}
#command-button-paintflashing:hover {
-moz-image-region: rect(0px, 32px, 16px, 16px);
}
#command-button-paintflashing:hover:active {
-moz-image-region: rect(0px, 48px, 16px, 32px);
}
#command-button-paintflashing[checked=true] {
-moz-image-region: rect(0px, 64px, 16px, 48px);
}
#command-button-responsive {
list-style-image: url("chrome://browser/skin/devtools/command-responsivemode.png");
-moz-image-region: rect(0px, 16px, 16px, 0px);

Просмотреть файл

@ -114,7 +114,6 @@ browser.jar:
skin/classic/browser/devtools/arrows.png (devtools/arrows.png)
skin/classic/browser/devtools/widgets.css (devtools/widgets.css)
skin/classic/browser/devtools/commandline.png (devtools/commandline.png)
skin/classic/browser/devtools/command-paintflashing.png (devtools/command-paintflashing.png)
skin/classic/browser/devtools/command-responsivemode.png (devtools/command-responsivemode.png)
skin/classic/browser/devtools/command-scratchpad.png (devtools/command-scratchpad.png)
skin/classic/browser/devtools/command-tilt.png (devtools/command-tilt.png)

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 961 B

Просмотреть файл

@ -59,20 +59,6 @@
background-color: hsla(206,37%,4%,.4);
}
#command-button-paintflashing {
list-style-image: url("chrome://browser/skin/devtools/command-paintflashing.png");
-moz-image-region: rect(0px, 16px, 16px, 0px);
}
#command-button-paintflashing:hover {
-moz-image-region: rect(0px, 32px, 16px, 16px);
}
#command-button-paintflashing:hover:active {
-moz-image-region: rect(0px, 48px, 16px, 32px);
}
#command-button-paintflashing[checked=true] {
-moz-image-region: rect(0px, 64px, 16px, 48px);
}
#command-button-responsive {
list-style-image: url("chrome://browser/skin/devtools/command-responsivemode.png");
-moz-image-region: rect(0px, 16px, 16px, 0px);

Просмотреть файл

@ -194,7 +194,6 @@ browser.jar:
skin/classic/browser/devtools/widgets.css (devtools/widgets.css)
skin/classic/browser/devtools/arrows.png (devtools/arrows.png)
skin/classic/browser/devtools/commandline.png (devtools/commandline.png)
skin/classic/browser/devtools/command-paintflashing.png (devtools/command-paintflashing.png)
skin/classic/browser/devtools/command-responsivemode.png (devtools/command-responsivemode.png)
skin/classic/browser/devtools/command-scratchpad.png (devtools/command-scratchpad.png)
skin/classic/browser/devtools/command-tilt.png (devtools/command-tilt.png)

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 961 B

Просмотреть файл

@ -74,20 +74,6 @@
background-color: hsla(206,37%,4%,.4);
}
#command-button-paintflashing {
list-style-image: url("chrome://browser/skin/devtools/command-paintflashing.png");
-moz-image-region: rect(0px, 16px, 16px, 0px);
}
#command-button-paintflashing:hover {
-moz-image-region: rect(0px, 32px, 16px, 16px);
}
#command-button-paintflashing:hover:active {
-moz-image-region: rect(0px, 48px, 16px, 32px);
}
#command-button-paintflashing[checked=true] {
-moz-image-region: rect(0px, 64px, 16px, 48px);
}
#command-button-responsive {
list-style-image: url("chrome://browser/skin/devtools/command-responsivemode.png");
-moz-image-region: rect(0px, 16px, 16px, 0px);

Просмотреть файл

@ -144,7 +144,6 @@ browser.jar:
skin/classic/browser/devtools/goto-mdn.png (devtools/goto-mdn.png)
skin/classic/browser/devtools/csshtmltree.css (devtools/csshtmltree.css)
skin/classic/browser/devtools/commandline.css (devtools/commandline.css)
skin/classic/browser/devtools/command-paintflashing.png (devtools/command-paintflashing.png)
skin/classic/browser/devtools/command-responsivemode.png (devtools/command-responsivemode.png)
skin/classic/browser/devtools/command-scratchpad.png (devtools/command-scratchpad.png)
skin/classic/browser/devtools/command-tilt.png (devtools/command-tilt.png)
@ -371,7 +370,6 @@ browser.jar:
skin/classic/aero/browser/devtools/widgets.css (devtools/widgets.css)
skin/classic/aero/browser/devtools/arrows.png (devtools/arrows.png)
skin/classic/aero/browser/devtools/commandline.png (devtools/commandline.png)
skin/classic/aero/browser/devtools/command-paintflashing.png (devtools/command-paintflashing.png)
skin/classic/aero/browser/devtools/command-responsivemode.png (devtools/command-responsivemode.png)
skin/classic/aero/browser/devtools/command-scratchpad.png (devtools/command-scratchpad.png)
skin/classic/aero/browser/devtools/command-tilt.png (devtools/command-tilt.png)

Просмотреть файл

@ -3210,35 +3210,6 @@ nsDOMWindowUtils::IsNodeDisabledForEvents(nsIDOMNode* aNode, bool* aRetVal)
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::SetPaintFlashing(bool aPaintFlashing)
{
nsPresContext* presContext = GetPresContext();
if (presContext) {
presContext->RefreshDriver()->SetPaintFlashing(aPaintFlashing);
// Clear paint flashing colors
nsIPresShell* presShell = GetPresShell();
if (!aPaintFlashing && presShell) {
nsIFrame* rootFrame = presShell->GetRootFrame();
if (rootFrame) {
rootFrame->InvalidateFrameSubtree();
}
}
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetPaintFlashing(bool* aRetVal)
{
*aRetVal = false;
nsPresContext* presContext = GetPresContext();
if (presContext) {
*aRetVal = presContext->RefreshDriver()->GetPaintFlashing();
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::DispatchEventToChromeOnly(nsIDOMEventTarget* aTarget,
nsIDOMEvent* aEvent,

Просмотреть файл

@ -1349,9 +1349,4 @@ interface nsIDOMWindowUtils : nsISupports {
* attribute or -moz-user-input: none/disabled.
*/
boolean isNodeDisabledForEvents(in nsIDOMNode aNode);
/**
* Setting paintFlashing to true will flash newly painted area.
*/
attribute boolean paintFlashing;
};

Просмотреть файл

@ -759,11 +759,22 @@ FrameLayerBuilder::Init(nsDisplayListBuilder* aBuilder, LayerManager* aManager)
void
FrameLayerBuilder::FlashPaint(gfxContext *aContext)
{
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
aContext->SetColor(gfxRGBA(r, g, b, 0.4));
aContext->Paint();
static bool sPaintFlashingEnabled;
static bool sPaintFlashingPrefCached = false;
if (!sPaintFlashingPrefCached) {
sPaintFlashingPrefCached = true;
mozilla::Preferences::AddBoolVarCache(&sPaintFlashingEnabled,
"nglayout.debug.paint_flashing");
}
if (sPaintFlashingEnabled) {
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
aContext->SetColor(gfxRGBA(r, g, b, 0.2));
aContext->Paint();
}
}
FrameLayerBuilder::DisplayItemData*
@ -3350,10 +3361,7 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
aContext->Restore();
}
if (presContext->RefreshDriver()->GetPaintFlashing()) {
FlashPaint(aContext);
}
FlashPaint(aContext);
if (!aRegionToInvalidate.IsEmpty()) {
aLayer->AddInvalidRect(aRegionToInvalidate.GetBounds());
}

Просмотреть файл

@ -528,8 +528,6 @@ nsRefreshDriver::nsRefreshDriver(nsPresContext* aPresContext)
mMostRecentRefreshEpochTime = JS_Now();
mMostRecentRefresh = TimeStamp::Now();
mPaintFlashing = Preferences::GetBool("nglayout.debug.paint_flashing");
mRequests.Init();
}

Просмотреть файл

@ -229,17 +229,6 @@ public:
*/
static int32_t DefaultInterval();
/**
* Enable/disable paint flashing.
*/
void SetPaintFlashing(bool aPaintFlashing) {
mPaintFlashing = aPaintFlashing;
}
bool GetPaintFlashing() {
return mPaintFlashing;
}
private:
typedef nsTObserverArray<nsARefreshObserver*> ObserverArray;
typedef nsTHashtable<nsISupportsHashKey> RequestTable;
@ -276,7 +265,6 @@ private:
bool mTestControllingRefreshes;
bool mViewManagerFlushIsPending;
bool mRequestedHighPrecision;
bool mPaintFlashing;
int64_t mMostRecentRefreshEpochTime;
mozilla::TimeStamp mMostRecentRefresh;

Просмотреть файл

@ -51,7 +51,6 @@ MOCHITEST_CHROME_FILES = \
test_passpointerevents.html \
passpointerevents_window.html \
test_bug812817.xul \
test_bug847890_paintFlashing.html \
$(NULL)
ifdef MOZ_DEBUG

Просмотреть файл

@ -1,31 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Tests for paint flashing</title>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
function startTest() {
waitForAllPaintsFlushed(function () {
var before = snapshotWindow(window, false);
SpecialPowers.getDOMWindowUtils(window).paintFlashing = true;
document.body.innerHTML = "bar";
waitForAllPaintsFlushed(function () {
document.body.innerHTML = "foo";
waitForAllPaintsFlushed(function () {
var after = snapshotWindow(window, false);
ok(compareSnapshots(before, after, false)[0], "windows are different");
SpecialPowers.getDOMWindowUtils(window).paintFlashing = false;
SimpleTest.finish();
});
});
});
}
</script>
</head>
<body onload="startTest()">foo</body>
</html>