summaryrefslogtreecommitdiff
path: root/blocks.js
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-03-19 08:12:57 +0100
committerjmoenig <jens@moenig.org>2013-03-19 08:12:57 +0100
commitcbdc6df58619742317fb35afaa4b60df5dd940fe (patch)
tree54f0d8154cb6fa154ddab062ca2f9f2298126b23 /blocks.js
parenta4241f1a53fc6bce57ae22b5a351b08bbbe88e43 (diff)
downloadsnap-yow-cbdc6df58619742317fb35afaa4b60df5dd940fe.tar.gz
snap-yow-cbdc6df58619742317fb35afaa4b60df5dd940fe.zip
Blocks layout optimization
SyntaxElementMorph fixLayout() optimization for active highlights
Diffstat (limited to 'blocks.js')
-rw-r--r--blocks.js28
1 files changed, 13 insertions, 15 deletions
diff --git a/blocks.js b/blocks.js
index 9e74358..cb03adf 100644
--- a/blocks.js
+++ b/blocks.js
@@ -153,7 +153,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph*/
// Global stuff ////////////////////////////////////////////////////////
-modules.blocks = '2013-March-18';
+modules.blocks = '2013-March-19';
var SyntaxElementMorph;
var BlockMorph;
@@ -1151,8 +1151,6 @@ SyntaxElementMorph.prototype.fixLayout = function () {
space = this.isPrototype ?
1 : Math.floor(fontHeight(this.fontSize) / 3),
bottomCorrection,
- needsHighlight = false,
- top = this.topBlock(),
initialExtent = this.extent();
if ((this instanceof MultiArgMorph) && (this.slotSpec !== '%c')) {
@@ -1183,11 +1181,9 @@ SyntaxElementMorph.prototype.fixLayout = function () {
lines.push([part]);
}
} else if (part instanceof BlockHighlightMorph) {
- if (!(myself.parent.topBlock)) { // I am on top
- needsHighlight = true;
- }
- myself.fullChanged();
- myself.removeChild(part);
+ nop(); // should be redundant now
+ // myself.fullChanged();
+ // myself.removeChild(part);
} else {
if (part.isVisible) {
x += part.fullBounds().width() + space;
@@ -1363,24 +1359,26 @@ SyntaxElementMorph.prototype.fixLayout = function () {
affected.fixLayout();
}
}
+ if (affected) {
+ return;
+ }
} else if (this instanceof ReporterBlockMorph) {
if (this.parent) {
if (this.parent.fixLayout) {
- this.parent.fixLayout();
+ return this.parent.fixLayout();
}
}
}
- // fix highlights, if any
+ this.fixHighlight();
+};
+
+SyntaxElementMorph.prototype.fixHighlight = function () {
+ var top = this.topBlock();
if (top.getHighlight && top.getHighlight()) {
top.removeHighlight();
top.addHighlight();
}
-
- // restore highlight:
- if (needsHighlight) {
- this.addHighlight();
- }
};
// SyntaxElementMorph evaluating: