Skip to content

Commit 6ce2152

Browse files
authored
Merge pull request #2299 from splitice/exp/reduce-paints
add paint fast path for when text does not change
2 parents ce34682 + 1756e84 commit 6ce2152

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/tools/text-scrolling.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ export function applyScrollingEffect(context, element, text) {
103103
const { scrolling_effect: scrollingEffect = true } = context.config;
104104

105105
if (!scrollingEffect) {
106-
applyNonScrollingStyle(element, text);
106+
if (element.previousText !== text || scrollState.has(element)) {
107+
applyNonScrollingStyle(element, text);
108+
}
107109
if (resizeObs) try { resizeObs.unobserve(element); } catch (e) {}
108110
if (intersectionObs) try { intersectionObs.unobserve(element); } catch (e) {}
109111
scrollState.delete(element);

0 commit comments

Comments
 (0)