From 8100182808805dfaaf3681df23726f445a89fdd1 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Fri, 8 Dec 2017 16:50:45 +0300 Subject: [PATCH 01/20] fontType<->fontStyle mismatch --- src/TextContent.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TextContent.ts b/src/TextContent.ts index aaa2be7286..8e334ea016 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; } From bddf11db70e18380cda8b03d893e8365c627f164 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Wed, 20 Dec 2017 19:33:41 +0300 Subject: [PATCH 02/20] LOL i found one more bug --- src/avm2/nat.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/avm2/nat.ts b/src/avm2/nat.ts index 807719b285..30fd08f006 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; From 34425e049b05f4072e2978809d4b31ac88230196 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Thu, 21 Dec 2017 15:22:55 +0300 Subject: [PATCH 03/20] forgot return --- src/avm2/nat.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/avm2/nat.ts b/src/avm2/nat.ts index 30fd08f006..ff832c36be 100644 --- a/src/avm2/nat.ts +++ b/src/avm2/nat.ts @@ -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; From 7ef1cdb3b2456b0990ddd19a8bf67fbe066f3137 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Mon, 25 Dec 2017 15:21:48 +0300 Subject: [PATCH 04/20] and more mistakes --- src/rtmp/flvparser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From 6f0dadbf67e64d7fd9476faa935acf5a68fc36d6 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Mon, 25 Dec 2017 19:44:01 +0300 Subject: [PATCH 05/20] ha-ha --- src/flash/display/BitmapData.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flash/display/BitmapData.ts b/src/flash/display/BitmapData.ts index 243a386344..6e9744596d 100644 --- a/src/flash/display/BitmapData.ts +++ b/src/flash/display/BitmapData.ts @@ -698,8 +698,8 @@ 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); + var outputVector = new this.sec.Uint32Vector(pixelData.length); if (!pixelData) { return outputVector; } From c3bfbfe13dfb9dc7d0ca0e4e3b3958b67548039b Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Tue, 26 Dec 2017 01:09:40 +0300 Subject: [PATCH 06/20] context leak! --- src/avm1/runtime.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From b7b93b41593f5ecd390cd907d7c639ebffa95a8a Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Tue, 26 Dec 2017 01:25:35 +0300 Subject: [PATCH 07/20] debugger bug --- src/avm1/interpreter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From 61db2619a87ca30c639c8b99b1ba9399c95571f1 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Thu, 28 Dec 2017 18:04:23 +0300 Subject: [PATCH 08/20] lets update nodejs! --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 2b9645eb63a09e6cc9646cd1dec672746f306643 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Fri, 29 Dec 2017 01:24:34 +0300 Subject: [PATCH 09/20] certain files has to stay with unix endings, no auto-clrf --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes 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 From 26346279698f0a6c78d3ce75eaa17cf44eb731e3 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Fri, 29 Dec 2017 14:21:49 +0300 Subject: [PATCH 10/20] another typo --- utils/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From c6e7a9ed4ac0aa46df0f4dacef4f2b0f2fe11311 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Fri, 29 Dec 2017 16:03:06 +0300 Subject: [PATCH 11/20] pixeldata, again --- src/flash/display/BitmapData.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/flash/display/BitmapData.ts b/src/flash/display/BitmapData.ts index 6e9744596d..47e74f6864 100644 --- a/src/flash/display/BitmapData.ts +++ b/src/flash/display/BitmapData.ts @@ -699,10 +699,10 @@ module Shumway.AVMX.AS.flash.display { getVector(rect: flash.geom.Rectangle): Uint32Vector { var pixelData = this._getPixelData(rect); - var outputVector = new this.sec.Uint32Vector(pixelData.length); 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; From 6a30732ab09683e2dff6c97cd506ea8010e35c20 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Wed, 10 Jan 2018 20:11:37 +0300 Subject: [PATCH 12/20] log typo --- src/player/avmLoader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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}; From e11a991999d7a70206202fb69082da1b9a4ad84e Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Fri, 19 Jan 2018 20:13:36 +0300 Subject: [PATCH 13/20] parentheses in filters alpha parameter --- src/flash/filters/GradientBevelFilter.ts | 2 +- src/flash/filters/GradientGlowFilter.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 From 8b3971f19cfadd917721be25a70f655a3efb0dab Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Tue, 27 Mar 2018 15:57:05 +0300 Subject: [PATCH 14/20] serious TextField append bug --- src/TextContent.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/TextContent.ts b/src/TextContent.ts index 8e334ea016..a874b5fe91 100644 --- a/src/TextContent.ts +++ b/src/TextContent.ts @@ -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) { From fb91335767815ee3cb052317a2750b40d7ddf2c4 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Mon, 9 Apr 2018 17:11:35 +0300 Subject: [PATCH 15/20] fun with filters --- src/gfx/2d/surface.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gfx/2d/surface.ts b/src/gfx/2d/surface.ts index be329961af..2a38afb926 100644 --- a/src/gfx/2d/surface.ts +++ b/src/gfx/2d/surface.ts @@ -352,7 +352,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 +362,7 @@ module Shumway.GFX.Canvas2D { copyContext = sourceContext; sourceContext = _cc; sx = dx; - sy = dx; + sy = dy; dx = _sx; dy = _sy; } From c5d583afaaa49ac3f62d3fa1eb71d2d012731c5d Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Mon, 9 Apr 2018 18:57:22 +0300 Subject: [PATCH 16/20] filters fun - 2 --- src/gfx/2d/surface.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gfx/2d/surface.ts b/src/gfx/2d/surface.ts index 2a38afb926..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; From 2b8005295cc0206c30eee891224ccce47cc376d7 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Wed, 29 Aug 2018 16:40:12 +0300 Subject: [PATCH 17/20] pixel snapping didnt work at all. --- src/gfx/2d/2d.ts | 3 +++ 1 file changed, 3 insertions(+) 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); } From bf807af9f292a11fed6afea23f92d4992a0658ef Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Mon, 10 Dec 2018 13:14:14 +0300 Subject: [PATCH 18/20] TextField problems --- src/flash/text/TextField.ts | 12 ++++++++++++ src/gfx/renderables/renderables.ts | 2 +- src/swf/parser/module.ts | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) 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/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/swf/parser/module.ts b/src/swf/parser/module.ts index b0eba89a3b..a827dcd0b5 100644 --- a/src/swf/parser/module.ts +++ b/src/swf/parser/module.ts @@ -488,7 +488,7 @@ module Shumway.SWF.Parser.LowLevel { if (flags & TextRecordFlags.HasMoveY) { record.moveY = stream.readSi16(); } - if (flags & TextRecordFlags.HasFont) { + if (flags & (TextRecordFlags.HasFont | TextRecordFlags.HasFontClass)) { record.fontHeight = stream.readUi16(); } var glyphCount = stream.readUi8(); From b44d7633518c31deb6375c498c9483831a49ce90 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Mon, 10 Dec 2018 14:17:31 +0300 Subject: [PATCH 19/20] derp HasFontClass --- src/swf/parser/module.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/swf/parser/module.ts b/src/swf/parser/module.ts index a827dcd0b5..bb0d4e3254 100644 --- a/src/swf/parser/module.ts +++ b/src/swf/parser/module.ts @@ -488,7 +488,7 @@ module Shumway.SWF.Parser.LowLevel { if (flags & TextRecordFlags.HasMoveY) { record.moveY = stream.readSi16(); } - if (flags & (TextRecordFlags.HasFont | TextRecordFlags.HasFontClass)) { + if (flags & TextRecordFlags.HasFont) { record.fontHeight = stream.readUi16(); } var glyphCount = stream.readUi8(); @@ -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) { From a12b79cf4f607d7ace0f8631060bc01872661a16 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Wed, 16 Jan 2019 11:13:15 +0300 Subject: [PATCH 20/20] index mistake --- src/flash/display/Graphics.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;