diff --git a/core/mutator.js b/core/mutator.js index 852f49b41..19a0fe86b 100644 --- a/core/mutator.js +++ b/core/mutator.js @@ -118,32 +118,20 @@ Blockly.Mutator.prototype.createEditor_ = function() { var quarkXml = null; } var workspaceOptions = { - horizontalLayout: false, languageTree: quarkXml, parentWorkspace: this.block_.workspace, pathToMedia: this.block_.workspace.options.pathToMedia, RTL: this.block_.RTL, - hasCategories: false, toolboxPosition: this.block_.RTL ? Blockly.TOOLBOX_AT_RIGHT : Blockly.TOOLBOX_AT_LEFT, + horizontalLayout: false, getMetrics: this.getFlyoutMetrics_.bind(this), setMetrics: null }; this.workspace_ = new Blockly.WorkspaceSvg(workspaceOptions); this.workspace_.isMutator = true; - //this.flyout_ = new Blockly.Flyout(); - //this.flyout_.autoClose = false; - //this.svgDialog_.appendChild(this.flyout_.createDom()); this.svgDialog_.appendChild( - this.workspace_.createDom('blocklyMutatorBackground')); - - //when mutator bubble is clicked, do not close mutator - Blockly.bindEvent_(this.svgDialog_, 'mousedown', this.svgDialog_, - function(e) { - e.preventDefault(); - e.stopPropagation(); - }); - + this.workspace_.createDom('blocklyMutatorBackground')); return this.svgDialog_; }; @@ -177,12 +165,7 @@ Blockly.Mutator.prototype.updateEditable = function() { */ Blockly.Mutator.prototype.resizeBubble_ = function() { var doubleBorderWidth = 2 * Blockly.Bubble.BORDER_WIDTH; - try { - var workspaceSize = this.workspace_.getCanvas().getBBox(); - } catch (e) { - // Firefox has trouble with hidden elements (Bug 528969). - return; - } + var workspaceSize = this.workspace_.getCanvas().getBBox(); var width; if (this.block_.RTL) { width = -workspaceSize.x; diff --git a/core/scrollbar.js b/core/scrollbar.js index 5fae5e13a..da2dd942d 100644 --- a/core/scrollbar.js +++ b/core/scrollbar.js @@ -125,6 +125,7 @@ Blockly.ScrollbarPair.prototype.resize = function() { this.oldHostMetrics_.absoluteTop != hostMetrics.absoluteTop) { this.corner_.setAttribute('y', this.hScroll.position_.y); } + // Cache the current metrics to potentially short-cut the next resize event. this.oldHostMetrics_ = hostMetrics; }; diff --git a/core/workspace.js b/core/workspace.js index deac51b6f..a8e97c04b 100644 --- a/core/workspace.js +++ b/core/workspace.js @@ -117,8 +117,6 @@ Blockly.Workspace.SCAN_ANGLE = 3; * @param {!Blockly.Block} block Block to remove. */ Blockly.Workspace.prototype.addTopBlock = function(block) { - if (block.workspace == Blockly.mainWorkspace) //Do not reset arrangements for the flyout - this.resetArrangements(); this.topBlocks_.push(block); if (this.isFlyout) { // This is for the (unlikely) case where you have a variable in a block in @@ -138,8 +136,6 @@ Blockly.Workspace.prototype.addTopBlock = function(block) { * @param {!Blockly.Block} block Block to remove. */ Blockly.Workspace.prototype.removeTopBlock = function(block) { - if (block.workspace == Blockly.mainWorkspace) //Do not reset arrangements for the flyout - this.resetArrangements(); var found = false; for (var child, i = 0; child = this.topBlocks_[i]; i++) { if (child == block) { @@ -160,7 +156,6 @@ Blockly.Workspace.prototype.removeTopBlock = function(block) { * @return {!Array.} The top-level block objects. */ Blockly.Workspace.prototype.getTopBlocks = function(ordered) { - var start = new Date().getTime(); //*** lyn instrumentation // Copy the topBlocks_ list. var blocks = [].concat(this.topBlocks_); if (ordered && blocks.length > 1) { @@ -174,10 +169,6 @@ Blockly.Workspace.prototype.getTopBlocks = function(ordered) { return (aXY.y + offset * aXY.x) - (bXY.y + offset * bXY.x); }); } - var stop = new Date().getTime(); //*** lyn instrumentation - var timeDiff = stop - start; //*** lyn instrumentation - Blockly.Instrument.stats.getTopBlocksCalls++; - Blockly.Instrument.stats.getTopBlocksTime += timeDiff; return blocks; }; diff --git a/core/workspace_svg.js b/core/workspace_svg.js index 371f6008a..f17cd3d86 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -947,7 +947,13 @@ Blockly.WorkspaceSvg.prototype.showContextMenu_ = function(e) { var expandOption = {enabled: hasCollapsedBlocks}; expandOption.text = Blockly.Msg.EXPAND_ALL; expandOption.callback = function() { - toggleOption(false); + Blockly.Instrument.initializeStats('expandAllCollapsedBlocks'); + Blockly.Instrument.timer( + function() { toggleOption(false); }, + function(result, timeDiff) { + Blockly.Instrument.stats.totalTime = timeDiff; + Blockly.Instrument.displayStats('expandAllCollapsedBlocks'); + }); }; menuOptions.push(expandOption); } diff --git a/core/xml.js b/core/xml.js index cd94880d8..2567560cd 100644 --- a/core/xml.js +++ b/core/xml.js @@ -156,7 +156,7 @@ Blockly.Xml.blockToDom = function(block) { var nextBlock = block.getNextBlock(); if (nextBlock) { var container = goog.dom.createDom('next', null, - Blockly.Xml.blockToDom(nextBlock)); + Blockly.Xml.blockToDom(nextBlock)); element.appendChild(container); } var shadow = block.nextConnection && block.nextConnection.getShadowDom();