This commit is contained in:
Tim Taubert 2012-01-17 13:22:31 +01:00
Родитель 775cc13e36 9001f693a7
Коммит 2aa1f0fb42
9 изменённых файлов: 59 добавлений и 29 удалений

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

@ -1033,9 +1033,6 @@ pref("devtools.styleinspector.enabled", true);
// Enable the Tilt inspector
pref("devtools.tilt.enabled", true);
// Enable the Tilt inspector even if WebGL capabilities are not detected
pref("devtools.tilt.force-enabled", false);
// Enable the rules view
pref("devtools.ruleview.enabled", true);

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

@ -1014,8 +1014,8 @@
<toolbarbutton id="inspector-3D-button"
class="devtools-toolbarbutton"
hidden="true"
label="&inspect3DButton.label;"
accesskey="&inspect3DButton.accesskey;"
label="&inspect3DViewButton.label;"
accesskey="&inspect3DViewButton.accesskey;"
command="Inspector:Tilt"/>
<toolbarbutton id="inspector-style-button"
class="devtools-toolbarbutton"

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

@ -271,7 +271,7 @@ Tilt.prototype = {
get enabled()
{
return (TiltVisualizer.Prefs.enabled &&
(TiltVisualizer.Prefs.forceEnabled || TiltGL.isWebGLSupported()));
(TiltGL.isWebGLForceEnabled() || TiltGL.isWebGLSupported()));
},
/**

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

@ -37,7 +37,7 @@
*
***** END LICENSE BLOCK *****/
/*global Components, TiltMath, TiltUtils, mat4 */
/*global Components, Services, TiltMath, TiltUtils, mat4 */
"use strict";
const Cc = Components.classes;
@ -46,6 +46,7 @@ const Cu = Components.utils;
const WEBGL_CONTEXT_NAME = "experimental-webgl";
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource:///modules/devtools/TiltMath.jsm");
Cu.import("resource:///modules/devtools/TiltUtils.jsm");
@ -1554,6 +1555,11 @@ TiltGL.ColorShader = {
].join("\n")
};
TiltGL.isWebGLForceEnabled = function TGL_isWebGLForceEnabled()
{
return Services.prefs.getBoolPref("webgl.force-enabled");
};
/**
* Tests if the WebGL OpenGL or Angle renderer is available using the
* GfxInfo service.

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

@ -1548,20 +1548,6 @@ TiltVisualizer.Prefs = {
this._enabled = value;
},
/**
* Specifies if Tilt should be enabled even if WebGL may not be available.
*/
get forceEnabled()
{
return this._forceEnabled;
},
set forceEnabled(value)
{
TiltUtils.Preferences.set("force-enabled", "boolean", value);
this._forceEnabled = value;
},
/**
* Loads the preferences.
*/
@ -1570,7 +1556,6 @@ TiltVisualizer.Prefs = {
let prefs = TiltUtils.Preferences;
TiltVisualizer.Prefs._enabled = prefs.get("enabled", "boolean");
TiltVisualizer.Prefs._forceEnabled = prefs.get("force-enabled", "boolean");
}
};

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

@ -51,6 +51,7 @@ _BROWSER_TEST_FILES = \
browser_tilt_03_tab_switch.js \
browser_tilt_04_initialization.js \
browser_tilt_05_destruction-esc.js \
browser_tilt_05_destruction-url.js \
browser_tilt_05_destruction.js \
browser_tilt_arcball.js \
browser_tilt_controller.js \

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

@ -31,11 +31,6 @@ function test() {
is(Tilt.visualizers[id], null,
"A instance of the visualizer shouldn't be initialized yet.");
is(typeof TiltVisualizer.Prefs.enabled, "boolean",
"The 'enabled' pref should have been loaded by now.");
is(typeof TiltVisualizer.Prefs.forceEnabled, "boolean",
"The 'force-enabled' pref should have been loaded by now.");
},
onTiltOpen: function(instance)
{

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

@ -0,0 +1,41 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/*global ok, is, info, waitForExplicitFinish, finish, gBrowser */
/*global isTiltEnabled, isWebGLSupported, createTab, createTilt */
/*global Services, EventUtils, Tilt, TiltUtils, InspectorUI, TILT_DESTROYED */
"use strict";
function test() {
if (!isTiltEnabled()) {
info("Skipping destruction test because Tilt isn't enabled.");
return;
}
if (!isWebGLSupported()) {
info("Skipping destruction test because WebGL isn't supported.");
return;
}
waitForExplicitFinish();
createTab(function() {
createTilt({
onTiltOpen: function()
{
Services.obs.addObserver(cleanup, TILT_DESTROYED, false);
window.content.location = "about:mozilla";
}
});
});
}
function cleanup() {
let id = TiltUtils.getWindowId(gBrowser.selectedBrowser.contentWindow);
is(Tilt.visualizers[id], null,
"The current instance of the visualizer wasn't destroyed properly.");
Services.obs.removeObserver(cleanup, TILT_DESTROYED);
gBrowser.removeCurrentTab();
finish();
}

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

@ -217,8 +217,13 @@ can reach it easily. -->
<!ENTITY inspectButton.label "Inspect">
<!ENTITY inspectButton.accesskey "I">
<!ENTITY inspectCloseButton.tooltiptext "Close Inspector">
<!ENTITY inspect3DButton.label "3D">
<!ENTITY inspect3DButton.accesskey "M">
<!-- LOCALIZATION NOTE (inspect3DViewButton.label): This button shows an
- alternate view for the Inspector, creating a 3D visualization of the
- webpage. -->
<!ENTITY inspect3DViewButton.label "3D View">
<!ENTITY inspect3DViewButton.accesskey "W">
<!ENTITY inspectStyleButton.label "Style">
<!ENTITY inspectStyleButton.accesskey "S">