Commit 34914674 authored by Neil Fraser's avatar Neil Fraser

Remove dependency on goog.cssom.

parent fbab0608
This diff is collapsed.
...@@ -33,7 +33,7 @@ goog.addDependency("../../../" + dir + "/core/bubble.js", ['Blockly.Bubble'], [' ...@@ -33,7 +33,7 @@ goog.addDependency("../../../" + dir + "/core/bubble.js", ['Blockly.Bubble'], ['
goog.addDependency("../../../" + dir + "/core/comment.js", ['Blockly.Comment'], ['Blockly.Bubble', 'Blockly.Icon', 'goog.userAgent']); goog.addDependency("../../../" + dir + "/core/comment.js", ['Blockly.Comment'], ['Blockly.Bubble', 'Blockly.Icon', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/connection.js", ['Blockly.Connection', 'Blockly.ConnectionDB'], ['goog.dom']); goog.addDependency("../../../" + dir + "/core/connection.js", ['Blockly.Connection', 'Blockly.ConnectionDB'], ['goog.dom']);
goog.addDependency("../../../" + dir + "/core/contextmenu.js", ['Blockly.ContextMenu'], ['goog.dom', 'goog.events', 'goog.style', 'goog.ui.Menu', 'goog.ui.MenuItem']); goog.addDependency("../../../" + dir + "/core/contextmenu.js", ['Blockly.ContextMenu'], ['goog.dom', 'goog.events', 'goog.style', 'goog.ui.Menu', 'goog.ui.MenuItem']);
goog.addDependency("../../../" + dir + "/core/css.js", ['Blockly.Css'], ['goog.cssom']); goog.addDependency("../../../" + dir + "/core/css.js", ['Blockly.Css'], []);
goog.addDependency("../../../" + dir + "/core/field.js", ['Blockly.Field'], ['goog.asserts', 'goog.dom', 'goog.math.Size', 'goog.style', 'goog.userAgent']); goog.addDependency("../../../" + dir + "/core/field.js", ['Blockly.Field'], ['goog.asserts', 'goog.dom', 'goog.math.Size', 'goog.style', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/field_angle.js", ['Blockly.FieldAngle'], ['Blockly.FieldTextInput', 'goog.math', 'goog.userAgent']); goog.addDependency("../../../" + dir + "/core/field_angle.js", ['Blockly.FieldAngle'], ['Blockly.FieldTextInput', 'goog.math', 'goog.userAgent']);
goog.addDependency("../../../" + dir + "/core/field_checkbox.js", ['Blockly.FieldCheckbox'], ['Blockly.Field']); goog.addDependency("../../../" + dir + "/core/field_checkbox.js", ['Blockly.FieldCheckbox'], ['Blockly.Field']);
...@@ -77,7 +77,6 @@ goog.addDependency("async/run.js", ['goog.async.run'], ['goog.async.WorkQueue', ...@@ -77,7 +77,6 @@ goog.addDependency("async/run.js", ['goog.async.run'], ['goog.async.WorkQueue',
goog.addDependency("async/workqueue.js", ['goog.async.WorkItem', 'goog.async.WorkQueue'], ['goog.asserts', 'goog.async.FreeList']); goog.addDependency("async/workqueue.js", ['goog.async.WorkItem', 'goog.async.WorkQueue'], ['goog.asserts', 'goog.async.FreeList']);
goog.addDependency("color/color.js", ['goog.color', 'goog.color.Hsl', 'goog.color.Hsv', 'goog.color.Rgb'], ['goog.color.names', 'goog.math']); goog.addDependency("color/color.js", ['goog.color', 'goog.color.Hsl', 'goog.color.Hsv', 'goog.color.Rgb'], ['goog.color.names', 'goog.math']);
goog.addDependency("color/names.js", ['goog.color.names'], []); goog.addDependency("color/names.js", ['goog.color.names'], []);
goog.addDependency("cssom/cssom.js", ['goog.cssom', 'goog.cssom.CssRuleType'], ['goog.array', 'goog.dom', 'goog.dom.TagName']);
goog.addDependency("debug/debug.js", ['goog.debug'], ['goog.array', 'goog.html.SafeHtml', 'goog.html.SafeUrl', 'goog.html.uncheckedconversions', 'goog.string.Const', 'goog.structs.Set', 'goog.userAgent']); goog.addDependency("debug/debug.js", ['goog.debug'], ['goog.array', 'goog.html.SafeHtml', 'goog.html.SafeUrl', 'goog.html.uncheckedconversions', 'goog.string.Const', 'goog.structs.Set', 'goog.userAgent']);
goog.addDependency("debug/entrypointregistry.js", ['goog.debug.EntryPointMonitor', 'goog.debug.entryPointRegistry'], ['goog.asserts']); goog.addDependency("debug/entrypointregistry.js", ['goog.debug.EntryPointMonitor', 'goog.debug.entryPointRegistry'], ['goog.asserts']);
goog.addDependency("debug/error.js", ['goog.debug.Error'], []); goog.addDependency("debug/error.js", ['goog.debug.Error'], []);
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
// Top level object for Blockly. // Top level object for Blockly.
goog.provide('Blockly'); goog.provide('Blockly');
// Blockly core dependencies.
goog.require('Blockly.BlockSvg'); goog.require('Blockly.BlockSvg');
goog.require('Blockly.FieldAngle'); goog.require('Blockly.FieldAngle');
goog.require('Blockly.FieldCheckbox'); goog.require('Blockly.FieldCheckbox');
...@@ -54,8 +53,6 @@ goog.require('Blockly.WidgetDiv'); ...@@ -54,8 +53,6 @@ goog.require('Blockly.WidgetDiv');
goog.require('Blockly.WorkspaceSvg'); goog.require('Blockly.WorkspaceSvg');
goog.require('Blockly.inject'); goog.require('Blockly.inject');
goog.require('Blockly.utils'); goog.require('Blockly.utils');
// Closure dependencies.
goog.require('goog.color'); goog.require('goog.color');
goog.require('goog.userAgent'); goog.require('goog.userAgent');
......
...@@ -19,19 +19,14 @@ ...@@ -19,19 +19,14 @@
*/ */
/** /**
* @fileoverview Flexible templating system for defining blocks. * @fileoverview Name space for the Blocks singleton.
* @author spertus@google.com (Ellen Spertus) * @author spertus@google.com (Ellen Spertus)
*/ */
'use strict'; 'use strict';
/**
* Name space for the Blocks singleton.
* Blocks gets populated in the blocks files, possibly through calls to
* Blocks.addTemplate().
*/
goog.provide('Blockly.Blocks'); goog.provide('Blockly.Blocks');
/** /**
* Unique ID counter for created blocks. * Unique ID counter for created blocks.
* @private * @private
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
goog.provide('Blockly.Css'); goog.provide('Blockly.Css');
goog.require('goog.cssom');
/** /**
* List of cursors. * List of cursors.
...@@ -86,7 +84,12 @@ Blockly.Css.inject = function(hasCss, pathToMedia) { ...@@ -86,7 +84,12 @@ Blockly.Css.inject = function(hasCss, pathToMedia) {
// Strip off any trailing slash (either Unix or Windows). // Strip off any trailing slash (either Unix or Windows).
Blockly.Css.mediaPath_ = pathToMedia.replace(/[\\\/]$/, ''); Blockly.Css.mediaPath_ = pathToMedia.replace(/[\\\/]$/, '');
text = text.replace(/<<<PATH>>>/g, Blockly.Css.mediaPath_); text = text.replace(/<<<PATH>>>/g, Blockly.Css.mediaPath_);
Blockly.Css.styleSheet_ = goog.cssom.addCssText(text).sheet; // Inject CSS tag.
var cssNode = document.createElement('style');
document.head.appendChild(cssNode);
var cssTextNode = document.createTextNode(text);
cssNode.appendChild(cssTextNode);
Blockly.Css.styleSheet_ = cssNode.sheet;
Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN); Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN);
}; };
...@@ -99,22 +102,12 @@ Blockly.Css.setCursor = function(cursor) { ...@@ -99,22 +102,12 @@ Blockly.Css.setCursor = function(cursor) {
return; return;
} }
Blockly.Css.currentCursor_ = cursor; Blockly.Css.currentCursor_ = cursor;
/* var url = 'url(' + Blockly.Css.mediaPath_ + '/' + cursor + '.cur), auto';
Hotspot coordinates are baked into the CUR file, but they are still
required in the CSS due to a Chrome bug.
https://code.google.com/p/chromium/issues/detail?id=1446
*/
if (cursor == Blockly.Css.Cursor.OPEN) {
var xy = '8 5';
} else {
var xy = '7 3';
}
var url = 'url(' + Blockly.Css.mediaPath_ + '/' + cursor +
'.cur) ' + xy + ', auto';
// There are potentially hundreds of draggable objects. Changing their style // There are potentially hundreds of draggable objects. Changing their style
// properties individually is too slow, so change the CSS rule instead. // properties individually is too slow, so change the CSS rule instead.
var rule = '.blocklyDraggable {\n cursor: ' + url + ';\n}\n'; var rule = '.blocklyDraggable {\n cursor: ' + url + ';\n}\n';
goog.cssom.replaceCssRule('', rule, Blockly.Css.styleSheet_, 0); Blockly.Css.styleSheet_.deleteRule(0);
Blockly.Css.styleSheet_.insertRule(rule, 0);
// There is probably only one toolbox, so just change its style property. // There is probably only one toolbox, so just change its style property.
var toolboxen = document.getElementsByClassName('blocklyToolboxDiv'); var toolboxen = document.getElementsByClassName('blocklyToolboxDiv');
for (var i = 0, toolbox; toolbox = toolboxen[i]; i++) { for (var i = 0, toolbox; toolbox = toolboxen[i]; i++) {
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
*/ */
goog.provide('Blockly.Msg'); goog.provide('Blockly.Msg');
/** /**
* Back up original getMsg function. * Back up original getMsg function.
* @type {!Function} * @type {!Function}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment