[webkit-changes] [WebKit/WebKit] b3809e: .measureText() returns TextMetrics object with rou...
Rob Buis
noreply at github.com
Sat Jan 4 12:20:33 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b3809e07dc65e5678706c3ee334ca12930ebf129
https://github.com/WebKit/WebKit/commit/b3809e07dc65e5678706c3ee334ca12930ebf129
Author: Rob Buis <rbuis at igalia.com>
Date: 2025-01-04 (Sat, 04 Jan 2025)
Changed paths:
M LayoutTests/fast/canvas/canvas-measureText-2-expected.txt
M LayoutTests/fast/canvas/canvas-measureText-2.html
M LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/text/2d.text.measure.baselines-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt
A LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/canvas/element/text/2d.text.measure.baselines-expected.txt
A LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines-expected.txt
A LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt
A LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/canvas/element/text/2d.text.measure.baselines-expected.txt
A LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines-expected.txt
A LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt
M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
M Source/WebCore/platform/graphics/FontCascade.cpp
Log Message:
-----------
.measureText() returns TextMetrics object with rounded values for bounding box
https://bugs.webkit.org/show_bug.cgi?id=240213
Reviewed by Said Abou-Hallawa.
Stop rounding intermediate calculations to integer values, potentially ending up with float values for TextMetrics bounding box.
Note that iOS/glib platforms seem to always round ascent/descent to integer values so have some different test results. Stopping the rounding
there would lead to a big amount of needed rebaselines, so it is left out of this PR.
* LayoutTests/fast/canvas/canvas-measureText-2-expected.txt:
* LayoutTests/fast/canvas/canvas-measureText-2.html:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/text/2d.text.measure.baselines-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/canvas/element/text/2d.text.measure.baselines-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/text/2d.text.measure.baselines-expected.txt.
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines-expected.txt.
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt.
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/canvas/element/text/2d.text.measure.baselines-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/text/2d.text.measure.baselines-expected.txt.
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines-expected.txt.
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt.
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::measureTextInternal):
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::widthForSimpleText const):
(WebCore::FontCascade::widthForComplexText const):
Canonical link: https://commits.webkit.org/288439@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list