Commit 1e8ccee227 for handsontable.com
commit 1e8ccee227dd8c40bbca03cc02b44a4d8373bb7e
Author: Artur Mędrygał <artur.medrygal@handsontable.com>
Date: Fri Nov 20 09:23:18 2026 +0100
DEV-3459: Measure all borders before painting any (18.1 backport of #13908) (#14364)
* DEV-3459: Measure all borders before painting any (18.1 backport of #13908)
Rewrite of #13908 for the 18.1 line: Border#appear() is split into a read-only measure() and a writing paint(), and SelectionManager#render measures every border before painting any. The develop-only parts of the original (adjust-handle planning, merged-block edges, fixedColumnsEnd) do not exist on 18.1 and are left out.
* DEV-3459: Pin the Playwright browser jobs to ubuntu-24.04 on the 18.1 line
ubuntu-latest now resolves to 26.04, where Playwright 1.61.1 (the 18.1 pin) cannot install Chromium: 'Playwright does not support chromium on ubuntu26.04-x64'. Visual, Performance and the docs visual jobs failed on that step, and Visual also runs in the RC test matrix. Develop fixed this with a 26.04 pin plus a Playwright bump; the 18.1 line keeps its Playwright version and pins these four jobs to 24.04 instead.
* DEV-3459: Cover every empty measure() path, drop unused measurement fields
measure() must answer null without hiding the border on all five early returns, not only the header-only one: a hide is a style write, and a write between two measurements brings back one layout per border. BorderMeasurement.fromRow and fromColumn were never read by paint() on the 18.1 line.
* DEV-3450: Pin every CI runner on the 18.1 line to ubuntu-24.04
ubuntu-latest moved to Ubuntu 26.04 after 18.1.2 shipped, so the RC, stable publish, docs and test jobs of an 18.1.x release would run on an image this line was never built or released on. Pure label swap: the remaining 67 runs-on values and the build-all matrix entry. With this, the lts/18.x branch cut from the last 18 tag inherits the pin.
* DEV-3450: Drop the per-job runner comments, every job is pinned now
diff --git a/.changelogs/13908.json b/.changelogs/13908.json
new file mode 100644
index 0000000000..1189a6a6aa
--- /dev/null
+++ b/.changelogs/13908.json
@@ -0,0 +1,8 @@
+{
+ "issuesOrigin": "private",
+ "title": "Fixed slow scrolling of grids with many custom borders.",
+ "type": "fixed",
+ "issueOrPR": 13908,
+ "breaking": false,
+ "framework": "none"
+}
diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml
index 5c87ac27bd..4f8804b403 100644
--- a/.github/workflows/build-all.yml
+++ b/.github/workflows/build-all.yml
@@ -30,7 +30,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [ ubuntu-latest, macos-latest ]
+ os: [ ubuntu-24.04, macos-latest ]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 30b8a45594..63da4dd1e5 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -31,7 +31,7 @@ on:
jobs:
umd:
name: UMD
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: inputs.run-all || inputs.run-umd
outputs:
# Set by a step AFTER a successful build+upload (canonical GHA mechanism)
@@ -63,7 +63,7 @@ jobs:
es-cjs:
name: ES + CJS
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: inputs.run-all || inputs.run-es-cjs
outputs:
built: ${{ steps.mark.outputs.built }}
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
index 5fe9847d22..f11163ce31 100644
--- a/.github/workflows/checks.yml
+++ b/.github/workflows/checks.yml
@@ -42,7 +42,7 @@ on:
jobs:
scope:
name: scope
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
outputs:
run-all: ${{ endsWith(github.ref, '/master') || endsWith(github.ref, '/develop') || contains(github.ref, '/release/') || inputs.test-all == true }}
build-handsontable-es-cjs: ${{ steps.path-filter.outputs.build-handsontable-es-cjs }}
@@ -216,7 +216,7 @@ jobs:
presence:
name: test presence
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# Pillar 1: source changed ⇒ a matching test changed (warn mode — reports,
# does not block yet). PR-only; needs git history, no build.
if: github.event_name == 'pull_request'
@@ -236,7 +236,7 @@ jobs:
changelog:
name: changelog
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# PR-only, and path-aware: an entry is required only when shippable source
# changed (handsontable/src/** or wrappers/**, tests + markdown excluded) —
# docs/test/CI-only PRs pass automatically, and `[skip changelog]` (outside
@@ -256,7 +256,7 @@ jobs:
tooling-tests:
name: tooling tests
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# Runs the enforcement machinery's OWN unit tests (node --test) so a regression
# in the presence-gate classifier, diff-coverage parser, weakening detector, eval
# scorer, or the hooks is caught in CI — otherwise those tests exist but nothing
diff --git a/.github/workflows/code-quality-baseline.yml b/.github/workflows/code-quality-baseline.yml
index 8b14b844d5..4d911b2b4a 100644
--- a/.github/workflows/code-quality-baseline.yml
+++ b/.github/workflows/code-quality-baseline.yml
@@ -28,7 +28,7 @@ concurrency:
jobs:
sonarcloud:
name: "[SCAN] SonarCloud (baseline)"
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
with:
@@ -45,7 +45,7 @@ jobs:
codeql:
name: "[SCAN] CodeQL (baseline)"
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 60
permissions:
security-events: write
@@ -67,7 +67,7 @@ jobs:
fossa-scan:
name: "[SCAN] FOSSA (baseline)"
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
@@ -78,7 +78,7 @@ jobs:
audit:
name: "[SCAN] audit (baseline)"
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# Trunk audit signal. The old audit.yml ran `pnpm audit` on every push; the PR
# audit is now PR-only, which left the default branch with no audit at all. This
# restores a nightly signal. Non-blocking while the ~380-vuln backlog burns down
diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml
index 336d8a0535..ed796bffab 100644
--- a/.github/workflows/code-quality.yml
+++ b/.github/workflows/code-quality.yml
@@ -10,7 +10,7 @@ on:
jobs:
sonarcloud:
name: SonarCloud
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# Secret-dependent: fork PRs and Dependabot PRs get no Actions secrets (a
# Dependabot run reads a separate store), so this cannot run
# at all there. Skip rather than fail: CI Gate accepts `skipped`, and a red
@@ -35,7 +35,7 @@ jobs:
codeql:
name: CodeQL
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 60
permissions:
security-events: write
@@ -57,7 +57,7 @@ jobs:
fossa:
name: FOSSA
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# Secret-dependent: fork PRs and Dependabot PRs get no Actions secrets (a
# Dependabot run reads a separate store), so this cannot run
# at all there. Skip rather than fail: CI Gate accepts `skipped`, and a red
@@ -76,7 +76,7 @@ jobs:
audit:
name: audit (warn)
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# Non-blocking by design (~380 known vulns to burn down before this can gate).
continue-on-error: true
steps:
diff --git a/.github/workflows/componentsource.yml b/.github/workflows/componentsource.yml
index d1169803de..88bb843d4f 100644
--- a/.github/workflows/componentsource.yml
+++ b/.github/workflows/componentsource.yml
@@ -45,7 +45,7 @@ permissions:
jobs:
build-componentsource:
name: Build component source artifact
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# A manual dispatch always runs. An automatic run needs a green `Publish`
# run that actually pushed a customer-facing version to npm: a `release`
# event (stable release, or the first RC) or a push to a release branch
diff --git a/.github/workflows/docs-algolia-reindex.yml b/.github/workflows/docs-algolia-reindex.yml
index ab3954817a..bafbad7836 100644
--- a/.github/workflows/docs-algolia-reindex.yml
+++ b/.github/workflows/docs-algolia-reindex.yml
@@ -7,7 +7,7 @@ on:
jobs:
docker:
name: Docs Algolia Reindex Previous Versions Manual Action
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
diff --git a/.github/workflows/docs-angular-typecheck.yml b/.github/workflows/docs-angular-typecheck.yml
index 9f99ae4708..9dc8caed39 100644
--- a/.github/workflows/docs-angular-typecheck.yml
+++ b/.github/workflows/docs-angular-typecheck.yml
@@ -37,7 +37,7 @@ concurrency:
jobs:
typecheck:
name: typecheck
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: read
diff --git a/.github/workflows/docs-examples-sync.yml b/.github/workflows/docs-examples-sync.yml
index 66df3d9139..7193caa8b9 100644
--- a/.github/workflows/docs-examples-sync.yml
+++ b/.github/workflows/docs-examples-sync.yml
@@ -23,7 +23,7 @@ concurrency:
jobs:
dispatch:
name: Trigger examples snapshot import
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
# Push events are already filtered by the branch patterns above, but
# workflow_dispatch bypasses that filter, so validate the ref here
diff --git a/.github/workflows/docs-production.yml b/.github/workflows/docs-production.yml
index fbd06da55f..b7986f3497 100644
--- a/.github/workflows/docs-production.yml
+++ b/.github/workflows/docs-production.yml
@@ -21,7 +21,7 @@ jobs:
docker:
name: Build and push Docker image
if: ${{ github.ref != 'refs/heads/prod-docs/latest' }} # Exclude the prod-docs-latest branch from triggering the workflow
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
diff --git a/.github/workflows/docs-staging.yml b/.github/workflows/docs-staging.yml
index 1daa4e5020..d40a41170c 100644
--- a/.github/workflows/docs-staging.yml
+++ b/.github/workflows/docs-staging.yml
@@ -44,7 +44,7 @@ jobs:
# The prefix match is intentionally broader than the release/x.y.z version
# pattern; any release/* head PR defers to its push build.
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }}
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
outputs:
preview-url: ${{ steps.cf-target.outputs.deploy == 'true' && format('https://{0}.handsontable-docs-staging.pages.dev/docs', steps.cf-target.outputs.branch) || '' }}
diff --git a/.github/workflows/docs-visual-tests.yml b/.github/workflows/docs-visual-tests.yml
index 1175843125..64078772e6 100644
--- a/.github/workflows/docs-visual-tests.yml
+++ b/.github/workflows/docs-visual-tests.yml
@@ -45,7 +45,7 @@ jobs:
# triggerable from inside the pipeline).
gate:
name: "[CHECK] Docs visual label"
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
outputs:
run: ${{ steps.check.outputs.run }}
steps:
@@ -73,7 +73,7 @@ jobs:
name: "[TEST] Docs Visual"
needs: [ gate ]
if: needs.gate.outputs.run == 'true'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 90
env:
PASS_COOKIE: ${{ secrets.PASS_COOKIE }}
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index bb1fb4f398..258c01ace0 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -15,7 +15,7 @@ on:
jobs:
lint:
name: lint
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: ./.github/actions/setup-workspace
@@ -24,7 +24,7 @@ jobs:
plugins:
name: plugins
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: ./.github/actions/setup-workspace
@@ -33,7 +33,7 @@ jobs:
angular-types:
name: Angular types
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 15
# PR-only, and only when the Angular-relevant scope changed.
if: inputs.is-pr && (inputs.run-all || inputs.run-angular)
@@ -51,7 +51,7 @@ jobs:
# suite mid-review.
visual-label:
name: visual label
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: inputs.is-pr
outputs:
run: ${{ steps.check.outputs.run }}
@@ -101,7 +101,7 @@ jobs:
visual:
name: visual
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 90
needs: [ visual-label, preview ]
if: |
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index f71130c539..219e44e82d 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -34,7 +34,7 @@ on:
jobs:
puppeteer:
name: "${{ matrix.bundle.label }} (theme: ${{ matrix.theme }})"
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# matrix context is unavailable in a job-level if (evaluated before matrix
# expansion). The e2e and e2e-min scope filters are identical, so a single
# job-level gate is exactly equivalent to the old per-bundle gating.
@@ -73,7 +73,7 @@ jobs:
# stylesheet and the dist bundle the fixture loads).
playwright:
name: "Playwright ${{ matrix.bundle.label }} (theme: ${{ matrix.theme }})"
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
container:
image: mcr.microsoft.com/playwright:v1.61.1-noble
if: inputs.run-all || inputs.run-playwright
diff --git a/.github/workflows/emitted-types.yml b/.github/workflows/emitted-types.yml
index b6bf789dd6..6f4e30c596 100644
--- a/.github/workflows/emitted-types.yml
+++ b/.github/workflows/emitted-types.yml
@@ -14,7 +14,7 @@ on:
jobs:
check:
name: check
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 15
env:
HOT_PREBUILT: ${{ inputs.hot-prebuilt }}
diff --git a/.github/workflows/ghcr-cleanup.yml b/.github/workflows/ghcr-cleanup.yml
index 5918ad2586..da6be76392 100644
--- a/.github/workflows/ghcr-cleanup.yml
+++ b/.github/workflows/ghcr-cleanup.yml
@@ -10,7 +10,7 @@ on:
jobs:
clean-ghcr:
name: Delete old unused images
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- name: Delete documentation images older than a month
uses: snok/container-retention-policy@754c94da17832ea399f34da9f3efa7194055010b # https://github.com/snok/container-retention-policy/releases/tag/v2.0.1
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml
index 93eeebdc3c..13ca790efb 100644
--- a/.github/workflows/integration.yml
+++ b/.github/workflows/integration.yml
@@ -25,7 +25,7 @@ jobs:
# ready, alongside the E2E jobs.
wrapper:
name: ${{ matrix.name }}
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: ${{ inputs.wrapper-matrix != '' && inputs.wrapper-matrix != '[]' }}
strategy:
fail-fast: false
@@ -60,7 +60,7 @@ jobs:
# unexpanded "matrix.label". They share the reusable esm-cjs composite.
esm:
name: ESM
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: inputs.run-all
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
@@ -70,7 +70,7 @@ jobs:
cjs:
name: CJS
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: inputs.run-all
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
@@ -82,7 +82,7 @@ jobs:
# publish step to post a PR comment with install links.
preview-packages:
name: preview packages
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# Only THIS job needs pull-requests: write (it posts the preview comment) —
# job-level keeps the rest of the module least-privilege. NOTE: job-scoping
# alone does NOT protect the release path: GitHub validates every job-level
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 9cfb9f4d1c..895276664a 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -14,7 +14,7 @@ on:
jobs:
core:
name: core
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: ./.github/actions/setup-workspace
@@ -25,7 +25,7 @@ jobs:
visual-tests:
name: visual tests
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: inputs.run-visual
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
diff --git a/.github/workflows/manual-qa.yml b/.github/workflows/manual-qa.yml
index 0e18998f0f..eefa73af81 100644
--- a/.github/workflows/manual-qa.yml
+++ b/.github/workflows/manual-qa.yml
@@ -11,7 +11,7 @@ on:
jobs:
verify:
name: verify
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- name: Evaluate the manual-QA tickbox and sign-off
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # https://github.com/actions/github-script/releases/tag/v8.0.0
diff --git a/.github/workflows/performance-tests.yml b/.github/workflows/performance-tests.yml
index f9ccb25a3a..38b0a785f6 100644
--- a/.github/workflows/performance-tests.yml
+++ b/.github/workflows/performance-tests.yml
@@ -33,7 +33,7 @@ permissions:
jobs:
performance-tests:
name: run
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 90
env:
PERF_MODE: ${{ github.event_name == 'push' && 'golden' || 'compare' }}
diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml
index 404158d97c..1d48d101e4 100644
--- a/.github/workflows/performance.yml
+++ b/.github/workflows/performance.yml
@@ -14,7 +14,7 @@ on:
jobs:
run:
name: run
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 90
permissions:
contents: write
diff --git a/.github/workflows/pr-cleanup.yml b/.github/workflows/pr-cleanup.yml
index 33f2442db3..a1d1b40e43 100644
--- a/.github/workflows/pr-cleanup.yml
+++ b/.github/workflows/pr-cleanup.yml
@@ -14,7 +14,7 @@ defaults:
jobs:
delete-preview-on-pull-request:
name: Delete Cloudflare Pages previews
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
@@ -78,7 +78,7 @@ jobs:
if: github.event_name == 'pull_request'
&& (github.event.pull_request.head.repo.full_name == github.repository
&& github.actor != 'dependabot[bot]')
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
defaults:
run:
working-directory: .
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 3836d6f986..ca2eda8247 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -48,7 +48,7 @@ jobs:
# ============================================================
pre-release:
name: Build and publish a pre-release
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# Publishes ONLY after a fully green Develop run — stricter than the old
# Tests-triggered version: the Develop run also contains the multi-OS
# build-all (and, on src/perf merges, the golden perf job), so a broken
@@ -121,7 +121,7 @@ jobs:
# scenarios below.
pre-release-dispatch:
name: Build and publish a pre-release (on demand)
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
environment: approvers
if: |
github.event_name == 'workflow_dispatch' &&
@@ -178,7 +178,7 @@ jobs:
# ============================================================
first-rc-build:
name: Build first RC
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: |
github.event_name == 'release' &&
github.event.release.prerelease == true
@@ -426,7 +426,7 @@ jobs:
first-rc-publish:
name: Publish first RC
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: ${{ !cancelled() && needs.first-rc-build.result == 'success' && needs.first-rc-test.result == 'success' }}
needs: [first-rc-build, first-rc-test]
environment: approvers
@@ -465,7 +465,7 @@ jobs:
# ============================================================
first-rc-build-nuget:
name: Build NuGet package (first RC)
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
needs: [first-rc-build]
if: ${{ !cancelled() && needs.first-rc-build.result == 'success' }}
outputs:
@@ -520,7 +520,7 @@ jobs:
first-rc-publish-nuget:
name: Publish NuGet package (first RC)
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: ${{ !cancelled() && needs.first-rc-build.result == 'success' && needs.first-rc-test.result == 'success' && needs.first-rc-build-nuget.result == 'success' }}
needs: [first-rc-build, first-rc-test, first-rc-build-nuget]
environment: approvers
@@ -546,7 +546,7 @@ jobs:
first-rc-notify:
name: Notify Slack (first RC)
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: ${{ !cancelled() && needs.first-rc-publish.result != 'skipped' }}
needs: [first-rc-build, first-rc-publish, first-rc-publish-nuget]
steps:
@@ -639,7 +639,7 @@ jobs:
# ============================================================
rc-check:
name: Guard RC build
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/')
outputs:
allowed: ${{ steps.check.outputs.allowed }}
@@ -668,7 +668,7 @@ jobs:
rc-build:
name: Build RC
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
needs: [rc-check]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/') && needs.rc-check.outputs.allowed == 'true'
outputs:
@@ -902,7 +902,7 @@ jobs:
rc-publish:
name: Publish RC
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: ${{ !cancelled() && needs.rc-build.result == 'success' && needs.rc-test.result == 'success' }}
needs: [rc-build, rc-test]
environment: approvers
@@ -941,7 +941,7 @@ jobs:
# ============================================================
rc-build-nuget:
name: Build NuGet package (RC)
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
needs: [rc-build]
if: ${{ !cancelled() && needs.rc-build.result == 'success' }}
outputs:
@@ -996,7 +996,7 @@ jobs:
rc-publish-nuget:
name: Publish NuGet package (RC)
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: ${{ !cancelled() && needs.rc-build.result == 'success' && needs.rc-test.result == 'success' && needs.rc-build-nuget.result == 'success' }}
needs: [rc-build, rc-test, rc-build-nuget]
environment: approvers
@@ -1022,7 +1022,7 @@ jobs:
rc-notify:
name: Notify Slack (RC)
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: ${{ !cancelled() && needs.rc-publish.result != 'skipped' }}
needs: [rc-build, rc-publish, rc-publish-nuget]
steps:
@@ -1160,7 +1160,7 @@ jobs:
# ============================================================
stable-prepare:
name: Prepare stable release
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
if: |
github.event_name == 'release' &&
github.event.release.prerelease == false
@@ -1304,7 +1304,7 @@ jobs:
stable-merge:
name: Merge release to develop and master
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
needs: [stable-prepare]
outputs:
version: ${{ needs.stable-prepare.outputs.version }}
@@ -1515,7 +1515,7 @@ jobs:
stable-build:
name: Build stable release
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
needs: [stable-merge]
outputs:
version: ${{ needs.stable-merge.outputs.version }}
@@ -1597,7 +1597,7 @@ jobs:
# ============================================================
stable-build-nuget:
name: Build NuGet package
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
needs: [stable-build]
outputs:
version: ${{ needs.stable-build.outputs.version }}
@@ -1651,7 +1651,7 @@ jobs:
stable-publish:
name: Publish stable release
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
needs: [stable-build]
environment: approvers
outputs:
@@ -2058,7 +2058,7 @@ jobs:
# ============================================================
stable-publish-nuget:
name: Publish NuGet package
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
needs: [stable-build-nuget]
environment: approvers
steps:
@@ -2086,7 +2086,7 @@ jobs:
# ============================================================
stable-cleanup:
name: Delete release branch
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
needs: [stable-build, stable-publish, stable-publish-nuget]
if: always() && needs.stable-build.result == 'success' && needs.stable-publish.result == 'success' && needs.stable-publish-nuget.result == 'success' && needs.stable-publish.outputs.docs-result == 'success'
steps:
@@ -2107,7 +2107,7 @@ jobs:
# ============================================================
stable-notify:
name: Notify Slack — stable release
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
needs: [stable-build, stable-publish, stable-publish-nuget]
if: ${{ !cancelled() && needs.stable-build.result == 'success' && (needs.stable-publish.result == 'success' || needs.stable-publish.result == 'failure') }}
steps:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 035343de8c..db7c79c8c0 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -231,7 +231,7 @@ jobs:
- performance
- visual
- docs
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- name: Verify every pipeline job passed or was scope-skipped
run: |
diff --git a/.github/workflows/types.yml b/.github/workflows/types.yml
index 50c35cf96a..c04685f44b 100644
--- a/.github/workflows/types.yml
+++ b/.github/workflows/types.yml
@@ -9,7 +9,7 @@ on:
jobs:
test:
name: test
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: ./.github/actions/setup-workspace
diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml
index 4871b31730..927fb8bd07 100644
--- a/.github/workflows/unit.yml
+++ b/.github/workflows/unit.yml
@@ -14,7 +14,7 @@ on:
jobs:
test:
name: test
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
with:
diff --git a/.github/workflows/visual-cleanup.yml b/.github/workflows/visual-cleanup.yml
index 3647fdc1ea..af6f709e13 100644
--- a/.github/workflows/visual-cleanup.yml
+++ b/.github/workflows/visual-cleanup.yml
@@ -25,7 +25,7 @@ jobs:
&& (github.event.action == 'synchronize' || github.event.action == 'reopened')
&& (github.event.pull_request.head.repo.full_name == github.repository
&& github.actor != 'dependabot[bot]')
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
permissions:
contents: read
pull-requests: write
diff --git a/.github/workflows/visual.yml b/.github/workflows/visual.yml
index cb4efc3c1f..46787fe6b1 100644
--- a/.github/workflows/visual.yml
+++ b/.github/workflows/visual.yml
@@ -16,7 +16,7 @@ env:
jobs:
render:
name: ${{ matrix.config.name }}
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
@@ -135,7 +135,7 @@ jobs:
compare:
name: Compare
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
needs: [ render ]
# Tags reach here through publish.yml -> test.yml. They are not base
# branches: publishing would leave a full tree under `base/<tag>/` that
diff --git a/.github/workflows/walkontable.yml b/.github/workflows/walkontable.yml
index 6132438ca6..3ca1b8c313 100644
--- a/.github/workflows/walkontable.yml
+++ b/.github/workflows/walkontable.yml
@@ -9,7 +9,7 @@ on:
jobs:
build:
name: build
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: ./.github/actions/setup-workspace
@@ -29,7 +29,7 @@ jobs:
test:
name: test
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
needs: [ build ]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
diff --git a/handsontable/src/3rdparty/walkontable/src/selection/border/border.ts b/handsontable/src/3rdparty/walkontable/src/selection/border/border.ts
index b208d94b6c..59c26df168 100644
--- a/handsontable/src/3rdparty/walkontable/src/selection/border/border.ts
+++ b/handsontable/src/3rdparty/walkontable/src/selection/border/border.ts
@@ -19,6 +19,22 @@ const MOVE_ZONE_THICKNESS = 6;
const BORDER_STYLE_VERTICAL_SUFFIX = '-vertical';
const BORDER_STYLE_HORIZONTAL_SUFFIX = '-horizontal';
+/**
+ * Everything `Border#paint()` needs, read by `Border#measure()` before any border writes a style.
+ */
+interface BorderMeasurement {
+ toRow: number;
+ toColumn: number;
+ toTDEl: HTMLElement;
+ toOffset: { top: number, left: number };
+ isRtl: boolean;
+ top: number;
+ inlineStartPos: number;
+ width: number;
+ height: number;
+ tableSize: { width: number, height: number } | null;
+}
+
/**
*
*/
@@ -611,9 +627,13 @@ class Border {
* @param {number} left The left position of the handler.
* @param {number} width The width of the handler.
* @param {number} height The height of the handler.
+ * @param {{width: number, height: number}|null} [tableSize] The table size `measure()` read, so the
+ * handles are positioned without a geometry read between style writes.
*/
updateMultipleSelectionHandlesPosition(
- row: number, col: number, top: number, left: number, width: number, height: number) {
+ row: number, col: number, top: number, left: number, width: number, height: number,
+ tableSize: { width: number, height: number } | null = null,
+ ) {
const isRtl = this.wot.wtSettings.getSetting('rtlMode');
const inlinePosProperty = isRtl ? 'right' : 'left';
const {
@@ -626,8 +646,8 @@ class Border {
const handleBorderSize = parseInt(topStyles.borderWidth, 10);
const handleSize = parseInt(topStyles.width, 10);
const hitAreaSize = parseInt(topHitAreaStyles.width, 10);
- const totalTableWidth = this.wot.wtTable.getWidth();
- const totalTableHeight = this.wot.wtTable.getHeight();
+ const totalTableWidth = tableSize?.width ?? this.wot.wtTable.getWidth();
+ const totalTableHeight = tableSize?.height ?? this.wot.wtTable.getHeight();
topStyles.top = `${parseInt(String(top - handleSize - 1), 10)}px`;
topStyles[inlinePosProperty] = `${parseInt(String(left - handleSize - 1), 10)}px`;
@@ -1320,13 +1340,8 @@ class Border {
}
/**
- * Show border around one or many cells.
- *
- * The fill handle is normally centered on the selection's bottom-end corner, so half of it hangs
- * past that corner. Where that overhang cannot survive — a container edge, or a frozen pane that
- * clips or covers it — the handle is pulled back inside instead, and `wtCornerInlineEndEdge` /
- * `wtCornerBlockEndEdge` pull its hit area along. See {@link Border#isCornerLiftedAtInlineEnd} and
- * {@link Border#isCornerLiftedAtBlockEnd} for which edges those are.
+ * Show border around one or many cells: {@link Border#measure} first, then {@link Border#paint}.
+ * A pass over many borders measures all of them before painting any (see `SelectionManager#render`).
*
* @param {Array} corners The corner coordinates.
*/
@@ -1335,34 +1350,30 @@ class Border {
return;
}
- // A selection flush against a frozen-pane boundary has its top/inline-start edge rendered by the
- // master on the freeze line, where the frozen overlay occludes it. Re-draw it inside the frozen
- // overlay so it stays visible; no-op unless `fixedRowsTop`/`fixedColumnsStart` is used.
- //
- // When it draws, we return early and intentionally skip the rest of `appear` (corner/fill handle,
- // the other edges): in these overlays the selection's cell isn't rendered here — only the seam
- // edge slice is — so there is nothing else to draw.
- if (this.drawFrozenBoundaryEdge(corners)) {
- return;
+ this.paint(corners, this.measure(corners));
+ }
+
+ /**
+ * Reads every piece of geometry {@link Border#paint} needs. It must not write to the DOM: a write
+ * between two geometry reads forces the browser to lay the table out again, and a pass over
+ * thousands of borders then costs one layout per border.
+ *
+ * @param {Array} corners The corner coordinates.
+ * @returns {BorderMeasurement|null} The measurement, or `null` when nothing is to be drawn.
+ */
+ measure(corners: number[]): BorderMeasurement | null {
+ if (this.disabled) {
+ return null;
}
let [fromRow, fromColumn, toRow, toColumn] = corners;
- // Capture the top-start corner before the clamping below mutates it — used to suppress the
- // master's boundary edge (so it isn't doubled by the frozen overlay's edge).
- const originalFromRow = fromRow;
- const originalFromColumn = fromColumn;
- const originalToRow = toRow;
- const originalToColumn = toColumn;
-
// borders can not be rendered on headers so hide them
if (fromRow < 0 && toRow < 0 || fromColumn < 0 && toColumn < 0) {
- this.disappear();
-
- return;
+ return null;
}
- const { wtTable, rootDocument, rootWindow } = this.wot;
+ const { wtTable, rootWindow } = this.wot;
const { geometryReader } = this.wot.domBindings;
const isMultiple = (fromRow !== toRow || fromColumn !== toColumn);
const firstRenderedRow = wtTable.getFirstRenderedRow();
@@ -1375,9 +1386,7 @@ class Border {
firstRenderedRow < 0 && lastRenderedRow < 0
) {
// ...also when overlays have rendered only headers skip it
- this.disappear();
-
- return;
+ return null;
}
let fromTD: HTMLElement | number;
@@ -1389,26 +1398,20 @@ class Border {
toRow = Math.min(toRow, lastRenderedRow);
if (toColumn < fromColumn || toRow < fromRow) {
- this.disappear();
-
- return;
+ return null;
}
fromTD = wtTable.getCell(this.wot.createCellCoords(fromRow, fromColumn));
if (!isHTMLElement(fromTD)) {
- this.disappear();
-
- return;
+ return null;
}
} else {
fromTD = wtTable.getCell(this.wot.createCellCoords(fromRow, fromColumn));
if (!isHTMLElement(fromTD)) {
- this.disappear();
-
- return;
+ return null;
}
}
@@ -1480,6 +1483,62 @@ class Border {
width = width > 0 ? width - 1 : 0;
}
+ return {
+ toRow,
+ toColumn,
+ toTDEl,
+ toOffset,
+ isRtl,
+ top,
+ inlineStartPos,
+ width,
+ height,
+ // The mobile handles are clamped to the table size, which paint() must not read between writes.
+ tableSize: isMobileBrowser() && this.wot.getSetting('isDataViewInstance') ?
+ { width: wtTable.getWidth(), height: wtTable.getHeight() } : null,
+ };
+ }
+
+ /**
+ * Writes the border from the measurement {@link Border#measure} took.
+ *
+ * The fill handle is normally centered on the selection's bottom-end corner, so half of it hangs
+ * past that corner. Where that overhang cannot survive — a container edge, or a frozen pane that
+ * clips or covers it — the handle is pulled back inside instead, and `wtCornerInlineEndEdge` /
+ * `wtCornerBlockEndEdge` pull its hit area along. See {@link Border#isCornerLiftedAtInlineEnd} and
+ * {@link Border#isCornerLiftedAtBlockEnd} for which edges those are.
+ *
+ * @param {Array} corners The corner coordinates.
+ * @param {BorderMeasurement|null} measurement The measurement, or `null` to hide the border.
+ */
+ paint(corners: number[], measurement: BorderMeasurement | null) {
+ if (this.disabled) {
+ return;
+ }
+
+ // A selection flush against a frozen-pane boundary has its top/inline-start edge rendered by the
+ // master on the freeze line, where the frozen overlay occludes it. Re-draw it inside the frozen
+ // overlay so it stays visible; no-op unless `fixedRowsTop`/`fixedColumnsStart` is used.
+ //
+ // When it draws, we return early and intentionally skip the rest: in these overlays the
+ // selection's cell isn't rendered here, only the seam edge slice is.
+ if (this.drawFrozenBoundaryEdge(corners)) {
+ return;
+ }
+
+ if (!measurement) {
+ this.disappear();
+
+ return;
+ }
+
+ const { rootDocument, rootWindow, wtTable } = this.wot;
+ const {
+ toRow, toColumn, toTDEl, toOffset, isRtl, top, inlineStartPos, width, height, tableSize,
+ } = measurement;
+ // The raw corners, before `measure()` clamped them to the rendered range: used to suppress the
+ // master's boundary edge (so it isn't doubled by the frozen overlay's edge).
+ const [originalFromRow, originalFromColumn, originalToRow, originalToColumn] = corners;
const inlinePosProperty = isRtl ? 'right' : 'left';
// Corner geometry is resolved per edge rather than from a single `settings.border.width` delta,
@@ -1639,7 +1698,7 @@ class Border {
}
if (isMobileBrowser() && this.wot.getSetting('isDataViewInstance')) {
- this.updateMultipleSelectionHandlesPosition(toRow, toColumn, top, inlineStartPos, width, height);
+ this.updateMultipleSelectionHandlesPosition(toRow, toColumn, top, inlineStartPos, width, height, tableSize);
}
let adjustVisible = this.settings.border?.adjustHandlesVisible;
diff --git a/handsontable/src/3rdparty/walkontable/src/selection/manager.ts b/handsontable/src/3rdparty/walkontable/src/selection/manager.ts
index 67e1cdbf6d..85289c3fc8 100644
--- a/handsontable/src/3rdparty/walkontable/src/selection/manager.ts
+++ b/handsontable/src/3rdparty/walkontable/src/selection/manager.ts
@@ -234,6 +234,7 @@ export class SelectionManager {
const selections: Selection[] = Array.from(this.#selections);
const classNamesMap = new Map<HTMLElement, Map<string, number>>();
const headerAttributesMap = new Map();
+ const toDraw: Array<[Border, number[]]> = [];
for (let i = 0; i < selections.length; i++) {
const selection = selections[i];
@@ -250,11 +251,11 @@ export class SelectionManager {
}
// Virtualize custom borders. A per-cell custom-border selection outside this overlay's rendered
- // range draws nothing anyway - `appear()` early-outs once `getCell()` reports the cell as not
- // rendered. Skipping it here (without calling `getBorderInstance`) means its Border DOM is never
- // created while off-screen, which is what lets grids with very many bordered cells scale: only
- // the visible borders get DOM and layout work, mirroring cell virtualization. The visual result
- // is identical to letting `appear()` early-out, just without the O(all-borders) DOM.
+ // range draws nothing anyway - `measure()` finds nothing to draw once `getCell()` reports the cell
+ // as not rendered. Skipping it here (without calling `getBorderInstance`) means its Border DOM is
+ // never created while off-screen, which is what lets grids with very many bordered cells scale:
+ // only the visible borders get DOM and layout work, mirroring cell virtualization. The visual
+ // result is identical to letting the border hide itself, just without the O(all-borders) DOM.
if (selectionType === CUSTOM_SELECTION_TYPE && this.#isCustomSelectionOffscreen(selection)) {
this.#selectionBorders.get(selection)?.get(this.#activeOverlaysWot!)?.disappear();
@@ -318,9 +319,18 @@ export class SelectionManager {
}
this.#activeOverlaysWot!.getSetting('onBeforeDrawBorders', corners, selectionType);
- borderInstance?.appear(corners);
+
+ if (borderInstance) {
+ toDraw.push([borderInstance, corners]);
+ }
}
+ // Measure every border before painting any: a style write between two geometry reads makes the
+ // browser lay the table out again, which cost one layout per visible border.
+ const measurements = toDraw.map(([border, corners]) => border.measure(corners));
+
+ toDraw.forEach(([border, corners], index) => border.paint(corners, measurements[index]));
+
classNamesMap.forEach((classNamesLayers, element) => {
const classNames: string[] = Array.from(classNamesLayers).map(([className, occurrenceCount]) => {
if (occurrenceCount === 1) {
diff --git a/handsontable/src/3rdparty/walkontable/test/unit/selection/border/measure.unit.ts b/handsontable/src/3rdparty/walkontable/test/unit/selection/border/measure.unit.ts
new file mode 100644
index 0000000000..9a133f9e64
--- /dev/null
+++ b/handsontable/src/3rdparty/walkontable/test/unit/selection/border/measure.unit.ts
@@ -0,0 +1,98 @@
+import Border from 'walkontable/selection/border/border';
+
+describe('Border#measure', () => {
+ const createBorder = () => {
+ const border = Object.create(Border.prototype);
+
+ border.disabled = false;
+ border.disappear = jest.fn();
+
+ return border as Border;
+ };
+
+ it('should answer null for a header-only selection without hiding the border', () => {
+ // Hiding writes a style, and a write between two measurements brings back one layout per border.
+ const border = createBorder();
+
+ expect(border.measure([-1, 0, -1, 3])).toBeNull();
+ expect(border.disappear).not.toHaveBeenCalled();
+ });
+
+ it('should answer null for a disabled border', () => {
+ const border = createBorder();
+
+ (border as unknown as { disabled: boolean }).disabled = true;
+
+ expect(border.measure([0, 0, 1, 1])).toBeNull();
+ expect(border.disappear).not.toHaveBeenCalled();
+ });
+
+ describe('with a rendered range', () => {
+ // A table that renders rows 0-9 and columns 0-4. `getCell()` answers a negative number for any
+ // cell that is not rendered, as `Table#getCell` does.
+ const createBorderOnTable = ({
+ firstRow = 0,
+ lastRow = 9,
+ firstColumn = 0,
+ lastColumn = 4,
+ getCell = () => -1,
+ }: {
+ firstRow?: number, lastRow?: number, firstColumn?: number, lastColumn?: number,
+ getCell?: (coords: { row: number, col: number }) => HTMLElement | number,
+ } = {}) => {
+ const border = createBorder();
+
+ (border as unknown as { wot: unknown }).wot = {
+ rootWindow: window,
+ domBindings: { geometryReader: {} },
+ createCellCoords: (row: number, col: number) => ({ row, col }),
+ wtTable: {
+ getFirstRenderedRow: () => firstRow,
+ getLastRenderedRow: () => lastRow,
+ getFirstRenderedColumn: () => firstColumn,
+ getLastRenderedColumn: () => lastColumn,
+ getCell: jest.fn(getCell),
+ },
+ };
+
+ return border;
+ };
+
+ it('should answer null without hiding the border when the overlay rendered only headers', () => {
+ const border = createBorderOnTable({ firstRow: -1, lastRow: -1 });
+
+ expect(border.measure([0, 0, 1, 1])).toBeNull();
+ expect(border.disappear).not.toHaveBeenCalled();
+ });
+
+ it('should answer null without hiding the border when a range lies outside the rendered range', () => {
+ const border = createBorderOnTable();
+
+ expect(border.measure([2, 6, 4, 8])).toBeNull();
+ expect(border.disappear).not.toHaveBeenCalled();
+ });
+
+ it('should answer null without hiding the border when the start cell of a range is not rendered', () => {
+ const border = createBorderOnTable();
+
+ expect(border.measure([1, 1, 3, 3])).toBeNull();
+ expect(border.disappear).not.toHaveBeenCalled();
+ });
+
+ it('should answer null without hiding the border when a single cell is not rendered', () => {
+ const border = createBorderOnTable();
+
+ expect(border.measure([2, 2, 2, 2])).toBeNull();
+ expect(border.disappear).not.toHaveBeenCalled();
+ });
+ });
+
+ it('should hide the border in paint when the measurement is empty', () => {
+ const border = createBorder();
+
+ border.drawFrozenBoundaryEdge = jest.fn(() => false);
+ border.paint([-1, 0, -1, 3], null);
+
+ expect(border.disappear).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/tests/e2e/custom-borders-scroll-layout.spec.ts b/tests/e2e/custom-borders-scroll-layout.spec.ts
new file mode 100644
index 0000000000..6de9d73d95
--- /dev/null
+++ b/tests/e2e/custom-borders-scroll-layout.spec.ts
@@ -0,0 +1,69 @@
+import { test, expect } from '../fixtures/test';
+import { CustomBordersLabPage } from '../fixtures/pages/CustomBordersLabPage';
+
+const ROWS = 30;
+const COLS = 70;
+const SCROLL_STEPS = 40;
+
+/**
+ * One bottom border per cell, the layout from the original report.
+ */
+function everyCellBorders() {
+ const borders = [];
+
+ for (let row = 0; row < ROWS; row++) {
+ for (let col = 0; col < COLS; col++) {
+ borders.push({ row, col, bottom: { width: 1, color: 'rgb(255, 0, 0)' } });
+ }
+ }
+
+ return borders;
+}
+
+test.describe('CustomBorders scrolling cost', () => {
+ // `Performance.getMetrics` is a Chromium DevTools call; an untagged spec runs on Chromium only.
+ test('a horizontal scroll forces no more layouts with 2,100 borders than without', async({ page, theme, bundle }) => {
+ const lab = new CustomBordersLabPage(page, theme, bundle);
+
+ await lab.goto();
+ await lab.createGrid({ dataRows: ROWS, dataCols: COLS, height: 420 });
+
+ const withoutBorders = await lab.measureHorizontalScrollLayouts(SCROLL_STEPS);
+
+ await lab.createGrid({ dataRows: ROWS, dataCols: COLS, height: 420, customBorders: everyCellBorders() });
+
+ const withBorders = await lab.measureHorizontalScrollLayouts(SCROLL_STEPS);
+
+ // The scroll must really have drawn, or both counts are vacuously small. A slow runner may fold
+ // several steps into one frame, so the bar is a quarter of the steps, not most of them.
+ expect(withoutBorders.renders).toBeGreaterThanOrEqual(SCROLL_STEPS / 4);
+ expect(withBorders.renders).toBeGreaterThanOrEqual(SCROLL_STEPS / 4);
+ // Every visible border used to read cell geometry right after the previous one wrote its
+ // styles, which cost one forced layout per border and draw (about 180 per draw here).
+ expect(withBorders.layouts / withBorders.renders)
+ .toBeLessThanOrEqual(withoutBorders.layouts / withoutBorders.renders + 5);
+ // The borders must still be drawn.
+ expect(await lab.countVisibleCustomBorders()).toBeGreaterThan(0);
+ });
+
+ test('measuring the borders writes nothing to the DOM', async({ page, theme, bundle }) => {
+ const lab = new CustomBordersLabPage(page, theme, bundle);
+
+ await lab.goto();
+ // Frozen panes put the cell (0, 0) in the clones, which `createGrid` does not wait for.
+ await page.evaluate(settings => (window as any).createHot(settings), {
+ dataRows: ROWS,
+ dataCols: COLS,
+ fixedRowsTop: 2,
+ fixedColumnsStart: 2,
+ customBorders: everyCellBorders().slice(0, 300),
+ });
+ await page.evaluate(() => (window as any).hot.selectCells([[3, 3, 6, 6]]));
+
+ const layers = await lab.measureBordersAndCountWrites();
+
+ // The focus layer, the area layer and the custom borders in the viewport all measure something.
+ expect(layers.filter(layer => layer.measured).length).toBeGreaterThan(2);
+ expect(layers.map(layer => layer.mutations)).toEqual(layers.map(() => 0));
+ });
+});
diff --git a/tests/fixtures/pages/CustomBordersLabPage.ts b/tests/fixtures/pages/CustomBordersLabPage.ts
index 49f3ea7d20..d5454c4e74 100644
--- a/tests/fixtures/pages/CustomBordersLabPage.ts
+++ b/tests/fixtures/pages/CustomBordersLabPage.ts
@@ -167,6 +167,92 @@ export class CustomBordersLabPage {
s => (window as any).borderUtils.countCustomBordersIn(s), overlaySelector);
}
+ /**
+ * Scroll the master holder to the right in `steps` equal steps, one animation frame apart, and
+ * report how many forced layouts the browser ran (Chromium `Performance.getMetrics`
+ * `LayoutCount`) and how many view renders the steps caused. A warm-up pass runs first so the
+ * measured pass starts from a settled grid.
+ */
+ async measureHorizontalScrollLayouts(steps: number): Promise<{ layouts: number, renders: number }> {
+ const cdp = await this.page.context().newCDPSession(this.page);
+
+ await cdp.send('Performance.enable');
+
+ const readLayoutCount = async() => {
+ const { metrics } = await cdp.send('Performance.getMetrics');
+
+ return metrics.find(metric => metric.name === 'LayoutCount')!.value;
+ };
+ const scrollPass = () => this.page.evaluate(async(stepCount) => {
+ const hot = (window as any).hot;
+ const holder = document.querySelector('.ht_master .wtHolder') as HTMLElement;
+ const stepSize = (holder.scrollWidth - holder.clientWidth) / stepCount;
+ let renders = 0;
+ const onRender = () => {
+ renders += 1;
+ };
+
+ hot.addHook('afterViewRender', onRender);
+ holder.scrollLeft = 0;
+ await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)));
+ renders = 0;
+
+ for (let i = 1; i <= stepCount; i++) {
+ holder.scrollLeft = stepSize * i;
+ await new Promise(resolve => requestAnimationFrame(resolve));
+ }
+
+ hot.removeHook('afterViewRender', onRender);
+
+ return renders;
+ }, steps);
+
+ try {
+ await scrollPass();
+
+ const before = await readLayoutCount();
+ const renders = await scrollPass();
+ const after = await readLayoutCount();
+
+ return { layouts: after - before, renders };
+ } finally {
+ await cdp.detach();
+ }
+ }
+
+ /**
+ * Run `Border#measure()` on every selection layer the grid draws (focus, area, custom borders)
+ * and report, per layer, whether it measured something and how many DOM mutations it caused.
+ * Walkontable's measure pass must write nothing: one write between two geometry reads brings
+ * back a forced layout per border.
+ */
+ async measureBordersAndCountWrites(): Promise<Array<{ measured: boolean, mutations: number }>> {
+ return this.page.evaluate(() => {
+ const hot = (window as any).hot;
+ const manager = hot.view._wt.selectionManager;
+ const { highlight } = hot.selection;
+ const selections = [highlight.getFocus(), ...highlight.areas.values(), ...highlight.customSelections];
+ const observer = new MutationObserver(() => {});
+
+ observer.observe(document.body, { attributes: true, childList: true, subtree: true, characterData: true });
+ observer.takeRecords();
+
+ const results = [];
+
+ for (const selection of selections) {
+ for (const border of manager.getBorderInstances(selection)) {
+ const measurement = border.measure(selection.getCorners());
+
+ results.push({ measured: measurement !== null, mutations: observer.takeRecords().length });
+ }
+ }
+
+ observer.disconnect();
+
+ return results;
+ });
+ }
+
/** The bounding box of a master-overlay cell. */
async cellRect(row: number, col: number): Promise<{ top: number, right: number, bottom: number, left: number }> {
return this.page.evaluate(([r, c]) => {