From 4253453fa3834a91ebbb15820d62f7ebeeda28f1 Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 18 Oct 2021 11:06:33 -0400 Subject: [PATCH 1/5] test mathjax using firefox v82 and latest --- .circleci/config.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index ffe18aee896..4462f4d8743 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -163,6 +163,43 @@ jobs: name: Test MathJax on firefox-81 command: .circleci/test.sh mathjax-firefox + mathjax-firefox82: + docker: + # need '-browsers' version to test in real (xvfb-wrapped) browsers + - image: cimg/node:16.8.0-browsers + environment: + # Alaska time (arbitrary timezone to test date logic) + TZ: "America/Anchorage" + working_directory: ~/plotly.js + steps: + - browser-tools/install-browser-tools: &browser-versions + firefox-version: '82.0' + install-chrome: false + install-chromedriver: false + - attach_workspace: + at: ~/ + - run: + name: Test MathJax on firefox-81 + command: .circleci/test.sh mathjax-firefox + + mathjax-firefoxLatest: + docker: + # need '-browsers' version to test in real (xvfb-wrapped) browsers + - image: cimg/node:16.8.0-browsers + environment: + # Alaska time (arbitrary timezone to test date logic) + TZ: "America/Anchorage" + working_directory: ~/plotly.js + steps: + - browser-tools/install-browser-tools: &browser-versions + install-chrome: false + install-chromedriver: false + - attach_workspace: + at: ~/ + - run: + name: Test MathJax on firefox-81 + command: .circleci/test.sh mathjax-firefox + make-baselines: parallelism: 4 docker: @@ -343,6 +380,12 @@ workflows: - mathjax-firefox81: requires: - install-and-cibuild + - mathjax-firefox82: + requires: + - install-and-cibuild + - mathjax-firefoxLatest: + requires: + - install-and-cibuild - no-gl-jasmine: requires: - install-and-cibuild From ba2032199346969078daa41afe1a701d0819579c Mon Sep 17 00:00:00 2001 From: archmoj Date: Wed, 20 Oct 2021 09:22:51 -0400 Subject: [PATCH 2/5] temporary fix for firefox v82+ bounding box issue --- src/lib/svg_text_utils.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/lib/svg_text_utils.js b/src/lib/svg_text_utils.js index a29128777f3..caa6b13e076 100644 --- a/src/lib/svg_text_utils.js +++ b/src/lib/svg_text_utils.js @@ -94,9 +94,12 @@ exports.convertToTspans = function(_context, gd, _callback) { newSvg.node().firstChild); } + var w0 = _svgBBox.width; + var h0 = _svgBBox.height; + newSvg.attr({ 'class': svgClass, - height: _svgBBox.height, + height: h0, preserveAspectRatio: 'xMinYMin meet' }) .style({overflow: 'visible', 'pointer-events': 'none'}); @@ -105,9 +108,18 @@ exports.convertToTspans = function(_context, gd, _callback) { var g = newSvg.select('g'); g.attr({fill: fill, stroke: fill}); - var gBB = g.node().getBoundingClientRect(); - var newSvgW = gBB.width; - var newSvgH = gBB.height; + var bb = g.node().getBoundingClientRect(); + var w = bb.width; + var h = bb.height; + + if(w > w0 || h > h0) { + // this happen in firefox v82+ | see https://bugzilla.mozilla.org/show_bug.cgi?id=1709251 addressed + // temporary fix: + newSvg.style('overflow', 'hidden'); + bb = newSvg.node().getBoundingClientRect(); + w = bb.width; + h = bb.height; + } var x = +_context.attr('x'); var y = +_context.attr('y'); @@ -119,21 +131,21 @@ exports.convertToTspans = function(_context, gd, _callback) { if(svgClass[0] === 'y') { mathjaxGroup.attr({ transform: 'rotate(' + [-90, x, y] + - ')' + strTranslate(-newSvgW / 2, dy - newSvgH / 2) + ')' + strTranslate(-w / 2, dy - h / 2) }); } else if(svgClass[0] === 'l') { - y = dy - newSvgH / 2; + y = dy - h / 2; } else if(svgClass[0] === 'a' && svgClass.indexOf('atitle') !== 0) { x = 0; y = dy; } else { var anchor = _context.attr('text-anchor'); - x = x - newSvgW * ( + x = x - w * ( anchor === 'middle' ? 0.5 : anchor === 'end' ? 1 : 0 ); - y = y + dy - newSvgH / 2; + y = y + dy - h / 2; } newSvg.attr({ From 9bb7e769f30ca0be8464a5e4f883a8176422a86d Mon Sep 17 00:00:00 2001 From: archmoj Date: Wed, 20 Oct 2021 11:23:31 -0400 Subject: [PATCH 3/5] do not run one mathjax test until firefox bug fixed --- .circleci/config.yml | 4 ++-- .circleci/test.sh | 5 +++++ tasks/test_syntax.js | 2 +- test/jasmine/bundle_tests/mathjax_test.js | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4462f4d8743..078667308bc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -180,7 +180,7 @@ jobs: at: ~/ - run: name: Test MathJax on firefox-81 - command: .circleci/test.sh mathjax-firefox + command: .circleci/test.sh mathjax-firefox82+ mathjax-firefoxLatest: docker: @@ -198,7 +198,7 @@ jobs: at: ~/ - run: name: Test MathJax on firefox-81 - command: .circleci/test.sh mathjax-firefox + command: .circleci/test.sh mathjax-firefox82+ make-baselines: parallelism: 4 diff --git a/.circleci/test.sh b/.circleci/test.sh index 69da8c1cea7..211b7bc2e69 100755 --- a/.circleci/test.sh +++ b/.circleci/test.sh @@ -74,6 +74,11 @@ case $1 in exit $EXIT_STATE ;; + mathjax-firefox82+) + ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --skip-tags=noFF82 --bundleTest=mathjax --nowatch || EXIT_STATE=$? + exit $EXIT_STATE + ;; + make-baselines) SUITE=$(find $ROOT/test/image/mocks/ -type f -printf "%f\n" | sed 's/\.json$//1' | circleci tests split) python3 test/image/make_baseline.py $SUITE || EXIT_STATE=$? diff --git a/tasks/test_syntax.js b/tasks/test_syntax.js index ea70e71e84b..63343fb7de5 100644 --- a/tasks/test_syntax.js +++ b/tasks/test_syntax.js @@ -31,7 +31,7 @@ assertCircularDeps(); // check for for focus and exclude jasmine blocks function assertJasmineSuites() { var BLACK_LIST = ['fdescribe', 'fit', 'xdescribe', 'xit']; - var TAGS = ['noCI', 'noCIdep', 'gl', 'flaky']; + var TAGS = ['noCI', 'noCIdep', 'noFF82', 'gl', 'flaky']; var IT_ONLY_TAGS = ['gl', 'flaky']; var logs = []; diff --git a/test/jasmine/bundle_tests/mathjax_test.js b/test/jasmine/bundle_tests/mathjax_test.js index 706e1e61911..51104ae71be 100644 --- a/test/jasmine/bundle_tests/mathjax_test.js +++ b/test/jasmine/bundle_tests/mathjax_test.js @@ -98,7 +98,7 @@ describe('Test MathJax:', function() { .then(done, done.fail); }); - it('should scoot x-axis title (with MathJax) below x-axis ticks', function(done) { + it('@noFF82 should scoot x-axis title (with MathJax) below x-axis ticks', function(done) { expect(window.MathJax).toBeDefined(); testTitleScoot({ From 71f28df6c844b05bf5eb684f4a4ba821f17a72f7 Mon Sep 17 00:00:00 2001 From: archmoj Date: Wed, 20 Oct 2021 12:12:03 -0400 Subject: [PATCH 4/5] edit test descriptions --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 078667308bc..28edd417ee8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -179,7 +179,7 @@ jobs: - attach_workspace: at: ~/ - run: - name: Test MathJax on firefox-81 + name: Test MathJax on firefox-82 command: .circleci/test.sh mathjax-firefox82+ mathjax-firefoxLatest: @@ -197,7 +197,7 @@ jobs: - attach_workspace: at: ~/ - run: - name: Test MathJax on firefox-81 + name: Test MathJax on firefox-latest command: .circleci/test.sh mathjax-firefox82+ make-baselines: From e75ea199d6824ac0db48d1a1798ae7c2688a688a Mon Sep 17 00:00:00 2001 From: archmoj Date: Wed, 20 Oct 2021 12:16:08 -0400 Subject: [PATCH 5/5] draft log for PR 5993 --- draftlogs/5993_fix.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 draftlogs/5993_fix.md diff --git a/draftlogs/5993_fix.md b/draftlogs/5993_fix.md new file mode 100644 index 00000000000..60a70b4f579 --- /dev/null +++ b/draftlogs/5993_fix.md @@ -0,0 +1 @@ + - Temporary fix to improve rendering of graphs with Mathjax on Firefox v82 and higher [[#5993](https://github.com/plotly/plotly.js/pull/5993)]