diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..5bedc4e57f --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.package eol=lf +test/avm2/shumway.txt eol=lf diff --git a/.travis.yml b/.travis.yml index 66c39764d4..f2d7713d90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - "0.10" + - "9.2.0" before_script: - npm update -g npm diff --git a/src/TextContent.ts b/src/TextContent.ts index aaa2be7286..a874b5fe91 100644 --- a/src/TextContent.ts +++ b/src/TextContent.ts @@ -479,13 +479,13 @@ module Shumway { if (font.fontType === flash.text.FontType.DEVICE) { if (textFormat.bold === null) { bold = font.fontStyle === flash.text.FontStyle.BOLD || - font.fontType === flash.text.FontStyle.BOLD_ITALIC; + font.fontStyle === flash.text.FontStyle.BOLD_ITALIC; } else { bold = !!textFormat.bold; } if (textFormat.italic === null) { italic = font.fontStyle === flash.text.FontStyle.ITALIC || - font.fontType === flash.text.FontStyle.BOLD_ITALIC; + font.fontStyle === flash.text.FontStyle.BOLD_ITALIC; } else { italic = !!textFormat.italic; } @@ -517,6 +517,7 @@ module Shumway { this._plainText = plainText + newText; this.textRuns.push(newRun); this._writeTextRun(newRun); + this.flags |= TextContentFlags.DirtyContent; } prependText(newText: string, format?: flash.text.TextFormat) { diff --git a/src/avm1/interpreter.ts b/src/avm1/interpreter.ts index fdc978af33..6cfeea8a6f 100644 --- a/src/avm1/interpreter.ts +++ b/src/avm1/interpreter.ts @@ -2730,12 +2730,12 @@ module Shumway.AVM1 { var instructionsExecuted = 0; var abortExecutionAt = currentContext.abortExecutionAt; + var ir = actionsData.ir; if (avm1DebuggerEnabled.value && (Debugger.pause || Debugger.breakpoints[(ir).dataId])) { debugger; } - var ir = actionsData.ir; release || Debug.assert(ir); var position = 0; diff --git a/src/avm1/runtime.ts b/src/avm1/runtime.ts index 1ff0686612..a1a5eee10b 100644 --- a/src/avm1/runtime.ts +++ b/src/avm1/runtime.ts @@ -242,7 +242,7 @@ module Shumway.AVM1 { } public alGet(p): any { - name = this.context.normalizeName(p); + var name = this.context.normalizeName(p); var desc = this.alGetProperty(name); if (!desc) { return undefined; diff --git a/src/avm2/nat.ts b/src/avm2/nat.ts index 807719b285..ff832c36be 100644 --- a/src/avm2/nat.ts +++ b/src/avm2/nat.ts @@ -778,7 +778,7 @@ module Shumway.AVMX.AS { var descriptor = Object.getOwnPropertyDescriptor(this.value, nm); return !!descriptor && descriptor.enumerable; } - super.native_propertyIsEnumerable(nm); + return super.native_propertyIsEnumerable(nm); } $Bglength: number; @@ -1553,7 +1553,7 @@ module Shumway.AVMX.AS { if (as3Compatibility) { return as3ToLowerCase(String(receiver)); } - String.prototype.toLowerCase.call(receiver); + return String.prototype.toLowerCase.call(receiver); } generic_toUpperCase() { var receiver = this == undefined ? '' : this; diff --git a/src/flash/display/BitmapData.ts b/src/flash/display/BitmapData.ts index 243a386344..47e74f6864 100644 --- a/src/flash/display/BitmapData.ts +++ b/src/flash/display/BitmapData.ts @@ -698,11 +698,11 @@ module Shumway.AVMX.AS.flash.display { } getVector(rect: flash.geom.Rectangle): Uint32Vector { - var outputVector = new this.sec.Uint32Vector(pixelData.length); var pixelData = this._getPixelData(rect); if (!pixelData) { - return outputVector; + return new this.sec.Uint32Vector(0); } + var outputVector = new this.sec.Uint32Vector(pixelData.length); outputVector.length = pixelData.length; outputVector._view().set(pixelData); return outputVector; diff --git a/src/flash/display/Graphics.ts b/src/flash/display/Graphics.ts index cc265cf358..ffc650e548 100644 --- a/src/flash/display/Graphics.ts +++ b/src/flash/display/Graphics.ts @@ -908,7 +908,7 @@ module Shumway.AVMX.AS.flash.display { fromY = formOpenY = coordinates[coordinatesIndex++]; if (ratio) { fromX = formOpenX += (morphCoordinates[coordinatesIndex - 2] - formOpenX) * ratio; - fromY = formOpenY += (morphCoordinates[coordinatesIndex - 2] - formOpenY) * ratio; + fromY = formOpenY += (morphCoordinates[coordinatesIndex - 1] - formOpenY) * ratio; } // Continue outer loop. continue; diff --git a/src/flash/filters/GradientBevelFilter.ts b/src/flash/filters/GradientBevelFilter.ts index 9c5bc070cf..e09869cdf0 100644 --- a/src/flash/filters/GradientBevelFilter.ts +++ b/src/flash/filters/GradientBevelFilter.ts @@ -40,7 +40,7 @@ module Shumway.AVMX.AS.flash.filters { for (var i = 0; i < obj.colors.length; i++) { var color = obj.colors[i]; colors.push(color >>> 8); - alphas.push(color & 0xff) / 0xff; + alphas.push((color & 0xff) / 0xff); } // type is derived from obj.onTop and obj.innerShadow // obj.onTop true: type is FULL diff --git a/src/flash/filters/GradientGlowFilter.ts b/src/flash/filters/GradientGlowFilter.ts index f0fefca671..e27da0d95f 100644 --- a/src/flash/filters/GradientGlowFilter.ts +++ b/src/flash/filters/GradientGlowFilter.ts @@ -33,7 +33,7 @@ module Shumway.AVMX.AS.flash.filters { for (var i = 0; i < obj.colors.length; i++) { var color = obj.colors[i]; colors.push(color >>> 8); - alphas.push(color & 0xff) / 0xff; + alphas.push((color & 0xff) / 0xff); } // type is derived from obj.onTop and obj.innerShadow // obj.onTop true: type is FULL diff --git a/src/flash/text/TextField.ts b/src/flash/text/TextField.ts index 5a5899b7d8..626d98cc1e 100644 --- a/src/flash/text/TextField.ts +++ b/src/flash/text/TextField.ts @@ -644,6 +644,14 @@ module Shumway.AVMX.AS.flash.text { release || notImplemented("public flash.text.TextField::insertXMLText"); } + private _invalidateFillAndLineBoundsParents() { + if (this.parent) { + this.parent._propagateFlagsUp(DisplayObjectFlags.DirtyDescendents | + DisplayObjectFlags.InvalidFillBounds | + DisplayObjectFlags.InvalidLineBounds); + } + } + private _ensureLineMetrics() { if (!this._hasDirtyFlags(DisplayObjectDirtyFlags.DirtyTextContent)) { return; @@ -658,6 +666,7 @@ module Shumway.AVMX.AS.flash.text { bounds.xMin = offsetX; bounds.xMax = offsetX + textWidth + 80; bounds.yMax = bounds.yMin + textHeight + 80; + this._invalidateFillAndLineBoundsParents(); } this._textWidth = textWidth; this._textHeight = textHeight; @@ -940,6 +949,9 @@ module Shumway.AVMX.AS.flash.text { warning("Font " + tag.fontId + " is not defined."); } } + if (tag.flags & TextFlags.HasFontClass) { + symbol.size = tag.fontHeight; + } if (tag.flags & TextFlags.HasLayout) { symbol.align = flash.text.TextFormatAlign.fromNumber(tag.align); symbol.leftMargin = tag.leftMargin; diff --git a/src/gfx/2d/2d.ts b/src/gfx/2d/2d.ts index fadd0ef1a4..9ebfe02bd6 100644 --- a/src/gfx/2d/2d.ts +++ b/src/gfx/2d/2d.ts @@ -757,10 +757,12 @@ module Shumway.GFX.Canvas2D { if (!this._intersectsClipList(node, state)) { return; } + var oldMatrix = state.matrix; var matrix = state.matrix; if (state.flags & RenderFlags.PixelSnapping) { matrix = matrix.clone(); matrix.snap(); + state.matrix = matrix; } var context = state.target.context; Filters._applyColorMatrix(context, state.colorMatrix); @@ -772,6 +774,7 @@ module Shumway.GFX.Canvas2D { } if (state.flags & RenderFlags.PixelSnapping) { matrix.free(); + state.matrix = oldMatrix; } Filters._removeFilter(context); } diff --git a/src/gfx/2d/surface.ts b/src/gfx/2d/surface.ts index be329961af..838d119a21 100644 --- a/src/gfx/2d/surface.ts +++ b/src/gfx/2d/surface.ts @@ -345,6 +345,8 @@ module Shumway.GFX.Canvas2D { _cc = copyContext; copyContext = sourceContext; sourceContext = _cc; + dx = source.region.x; + dy = source.region.y; } else { Canvas2DSurfaceRegion._ensureCopyCanvasSize(w, h); copyContext = Canvas2DSurfaceRegion._copyCanvasContext; @@ -352,7 +354,7 @@ module Shumway.GFX.Canvas2D { dy = 0; } for (;i < filters.length - 1; i++) { - copyContext.clearRect(0, 0, w, h); + copyContext.clearRect(dx, dy, w, h); Filters._applyFilter(devicePixelRatio, copyContext, filters[i]); copyContext.drawImage(sourceContext.canvas, sx, sy, w, h, dx, dy, w, h); Filters._removeFilter(copyContext); @@ -362,7 +364,7 @@ module Shumway.GFX.Canvas2D { copyContext = sourceContext; sourceContext = _cc; sx = dx; - sy = dx; + sy = dy; dx = _sx; dy = _sy; } diff --git a/src/gfx/renderables/renderables.ts b/src/gfx/renderables/renderables.ts index f365cf46aa..9ff70385fd 100644 --- a/src/gfx/renderables/renderables.ts +++ b/src/gfx/renderables/renderables.ts @@ -1312,7 +1312,7 @@ module Shumway.GFX { chunk = chunk.substr(k); wordWidth = measureText(measureContext, chunk, letterSpacing); } - } while (chunk && spaceLeft < 0); + } while (chunk.length > 0 && spaceLeft < 0); } else { spaceLeft = spaceLeft - wordWidth; } diff --git a/src/player/avmLoader.ts b/src/player/avmLoader.ts index 5ad47913d1..aea9f6e917 100644 --- a/src/player/avmLoader.ts +++ b/src/player/avmLoader.ts @@ -28,7 +28,7 @@ module Shumway { export function createSecurityDomain(libraries: AVM2LoadLibrariesFlags): Promise { var result = new PromiseWrapper(); release || assert (!!(libraries & AVM2LoadLibrariesFlags.Builtin)); - SWF.enterTimeline('Load builton.abc file'); + SWF.enterTimeline('Load builtin.abc file'); SystemResourcesLoadingService.instance.load(SystemResourceId.BuiltinAbc).then(function (buffer) { var sec = new Shumway.AVMX.AXSecurityDomain(); var env = {url: 'builtin.abc', app: sec.system}; diff --git a/src/rtmp/flvparser.ts b/src/rtmp/flvparser.ts index e76cdd262a..ac7681cb2d 100644 --- a/src/rtmp/flvparser.ts +++ b/src/rtmp/flvparser.ts @@ -136,7 +136,7 @@ module RtmpJs.FLV { var needPreprocessing = !!(flags & 0x20); var timestamp = (parseBuffer[parsed + 8] << 16) | (parseBuffer[parsed + 9] << 8) | parseBuffer[parsed + 10] | - (parseBuffer[parseBuffer + 11] << 24) /* signed part */; + (parseBuffer[parsed + 11] << 24) /* signed part */; this.onTag && this.onTag({ type: dataType, needPreprocessing: needPreprocessing, diff --git a/src/swf/parser/module.ts b/src/swf/parser/module.ts index b0eba89a3b..bb0d4e3254 100644 --- a/src/swf/parser/module.ts +++ b/src/swf/parser/module.ts @@ -606,7 +606,7 @@ module Shumway.SWF.Parser.LowLevel { if (flags & TextFlags.HasFontClass) { tag.fontClass = stream.readString(-1); } - if (flags & TextFlags.HasFont) { + if (flags & (TextFlags.HasFont | TextFlags.HasFontClass)) { tag.fontHeight = stream.readUi16(); } if (flags & TextFlags.HasColor) { diff --git a/utils/Makefile b/utils/Makefile index 187634cb50..5ee06f4063 100755 --- a/utils/Makefile +++ b/utils/Makefile @@ -99,7 +99,7 @@ install-tamarin-tests: $(TAMARIN_HOME)/configure.py $(TAMARIN_HOME)/configure.py: hg clone $(TAMARIN_URL) $(TAMARIN_HOME) - cd $(TAMARIN_HOME) hg update -C 2b38aa82c803 # get a stable version + cd $(TAMARIN_HOME); hg update -C 2b38aa82c803 # get a stable version cd $(TAMARIN_HOME); patch -p 1 < ../patches/tamarin-108-fix.patch cd $(TAMARIN_HOME); patch -p 1 < ../patches/tamarin-npexp-fix.patch cd $(TAMARIN_HOME); patch -p 1 < ../patches/tamarin-gcc47-fix.patch