summaryrefslogtreecommitdiffstats
path: root/o3d/samples/o3djs
diff options
context:
space:
mode:
authorapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-19 23:21:19 +0000
committerapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-19 23:21:19 +0000
commit3723b75614a6af7d941c6db60d8a614dfe914664 (patch)
treebb63a5f652541098f8b7012a165661f9555589cb /o3d/samples/o3djs
parent7e8d231820546f985729d5c44b7a7da13ab02cd4 (diff)
downloadchromium_src-3723b75614a6af7d941c6db60d8a614dfe914664.zip
chromium_src-3723b75614a6af7d941c6db60d8a614dfe914664.tar.gz
chromium_src-3723b75614a6af7d941c6db60d8a614dfe914664.tar.bz2
Removed workaround for Chrome 1.0 from o3djs library.
Fix big causing Canvas sample to crash. Review URL: http://codereview.chromium.org/303008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29477 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/o3djs')
-rw-r--r--o3d/samples/o3djs/base.js8
-rw-r--r--o3d/samples/o3djs/util.js149
2 files changed, 65 insertions, 92 deletions
diff --git a/o3d/samples/o3djs/base.js b/o3d/samples/o3djs/base.js
index 30657bb..e7765c4 100644
--- a/o3d/samples/o3djs/base.js
+++ b/o3d/samples/o3djs/base.js
@@ -793,11 +793,3 @@ o3djs.base.IsMSIE = function() {
var msie = /msie/.test(ua) && !/opera/.test(ua);
return msie;
};
-/**
- * Returns true if the user's browser is Chrome 1.0, that requires a workaround
- * to create the plugin.
- * @return {boolean} true if the user's browser is Chrome 1.0.
- */
-o3djs.base.IsChrome10 = function() {
- return navigator.userAgent.indexOf('Chrome/1.0') >= 0;
-};
diff --git a/o3d/samples/o3djs/util.js b/o3d/samples/o3djs/util.js
index 88f797b..2c9ad61 100644
--- a/o3d/samples/o3djs/util.js
+++ b/o3d/samples/o3djs/util.js
@@ -927,95 +927,76 @@ o3djs.util.makeClients = function(callback,
}
}
- // Chrome 1.0 sometimes doesn't create the plugin instance. To work
- // around this, force a re-layout by changing the plugin size until it
- // is loaded. We toggle between 1 pixel and 100% until the plugin has
- // loaded.
- var chromeWorkaround = o3djs.base.IsChrome10();
- {
- // Wait for the browser to initialize the clients.
- var clearId = window.setInterval(function() {
- var initStatus = 0;
- var error = '';
- var o3d;
+ // Wait for the browser to initialize the clients.
+ var clearId = window.setInterval(function() {
+ var initStatus = 0;
+ var error = '';
+ var o3d;
+ for (var cc = 0; cc < clientElements.length; ++cc) {
+ var element = clientElements[cc];
+ o3d = element.o3d;
+ var ready = o3d &&
+ element.client &&
+ element.client.rendererInitStatus >
+ o3djs.util.rendererInitStatus.UNINITIALIZED;
+ if (!ready) {
+ return;
+ }
+ var status = clientElements[cc].client.rendererInitStatus;
+ // keep the highest status. This is the worst status.
+ if (status > initStatus) {
+ initStatus = status;
+ error = clientElements[cc].client.lastError;
+ }
+ }
+
+ window.clearInterval(clearId);
+
+ // If the plugin could not initialize the graphics delete all of
+ // the plugin objects
+ if (initStatus > 0 && initStatus != o3d.Renderer.SUCCESS) {
for (var cc = 0; cc < clientElements.length; ++cc) {
- var element = clientElements[cc];
- o3d = element.o3d;
- var ready = o3d &&
- element.client &&
- element.client.rendererInitStatus >
- o3djs.util.rendererInitStatus.UNINITIALIZED;
- if (!ready) {
- if (chromeWorkaround) {
- if (element.style.width != '100%') {
- element.style.width = '100%';
- } else {
- element.style.width = '1px';
- }
- }
- return;
- }
- if (chromeWorkaround && element.style.width != '100%') {
- // The plugin has loaded but it may not be the right size yet.
- element.style.width = '100%';
- return;
- }
- var status = clientElements[cc].client.rendererInitStatus;
- // keep the highest status. This is the worst status.
- if (status > initStatus) {
- initStatus = status;
- error = clientElements[cc].client.lastError;
- }
+ var clientElement = clientElements[cc];
+ clientElement.parentNode.removeChild(clientElement);
}
+ opt_failureCallback(initStatus, error, opt_id, opt_tag);
+ } else {
+ o3djs.base.snapshotProvidedNamespaces();
- window.clearInterval(clearId);
+ // TODO: Is this needed with the new event code?
+ for (var cc = 0; cc < clientElements.length; ++cc) {
+ o3djs.base.initV8(clientElements[cc]);
+ o3djs.event.startKeyboardEventSynthesis(clientElements[cc]);
+ o3djs.error.setDefaultErrorHandler(clientElements[cc].client);
+ }
+ o3djs.base.init(clientElements[0]);
+
+ switch (o3djs.util.mainEngine_) {
+ case o3djs.util.Engine.BROWSER:
+ callback(clientElements);
+ break;
+ case o3djs.util.Engine.V8:
+ if (!mainClientElement) {
+ throw 'V8 engine was requested but there is no element with' +
+ ' the id "o3d"';
+ }
- // If the plugin could not initialize the graphics delete all of
- // the plugin objects
- if (initStatus > 0 && initStatus != o3d.Renderer.SUCCESS) {
- for (var cc = 0; cc < clientElements.length; ++cc) {
- var clientElement = clientElements[cc];
- clientElement.parentNode.removeChild(clientElement);
- }
- opt_failureCallback(initStatus, error, opt_id, opt_tag);
- } else {
- o3djs.base.snapshotProvidedNamespaces();
-
- // TODO: Is this needed with the new event code?
- for (var cc = 0; cc < clientElements.length; ++cc) {
- o3djs.base.initV8(clientElements[cc]);
- o3djs.event.startKeyboardEventSynthesis(clientElements[cc]);
- o3djs.error.setDefaultErrorHandler(clientElements[cc].client);
- }
- o3djs.base.init(clientElements[0]);
-
- switch (o3djs.util.mainEngine_) {
- case o3djs.util.Engine.BROWSER:
- callback(clientElements);
- break;
- case o3djs.util.Engine.V8:
- if (!mainClientElement) {
- throw 'V8 engine was requested but there is no element with' +
- ' the id "o3d"';
- }
-
- // Retreive the code from the script tags and eval it in V8 to
- // duplicate the browser environment.
- var scriptTagText = o3djs.util.getScriptTagText_();
- mainClientElement.eval(scriptTagText);
-
- // Invoke the vallback in V8.
- o3djs.util.callV8(mainClientElement,
- callback,
- o3djs.global,
- [clientElements]);
- break;
- default:
- throw 'Unknown engine ' + o3djs.util.mainEngine_;
- }
+ // Retreive the code from the script tags and eval it in V8 to
+ // duplicate the browser environment.
+ var scriptTagText = o3djs.util.getScriptTagText_();
+ mainClientElement.eval(scriptTagText);
+
+ // Invoke the vallback in V8.
+ o3djs.util.callV8(mainClientElement,
+ callback,
+ o3djs.global,
+ [clientElements]);
+ break;
+ default:
+ throw 'Unknown engine ' + o3djs.util.mainEngine_;
}
- }, 10);
- }
+ }
+ }, 10);
}
};