In WebCore/html/TextMetrics.idl it says: readonly attribute float width; in .../TextMetrics.h: float m_width; But there's a getter with this confusing comment: // FIXME: Is coercing to an integer value intentional? If so, there should be a static_cast<unsigned>() here. unsigned width() const { return m_width; } From my greps around, it appears this getter is unused, but I unsure how the idl interacts with this (perhaps the idl generates code that calls width().)
CC hyatt, original author of the code (correct bug this time)
in LayoutTests/fast/canvas/canvas-text-baseline.html if I dump out all the widths found by ctx.measureText(text).width they are always integers. Not sure if it's intentional (or perhaps in Chrome we always have integer width fonts for other reasons)
I tried changing it to a float and still got integers out. Spec says the width should be "CSS pixels", which I think can be floating point. I'll upload a patch and see what y'all think. http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-measuretext
Created attachment 77385 [details] Patch
I tried modifying the test to use text of width 32.1 pixels, but even after this change the "width" field came out as an integer. Again, this could be due to some other code in Chrome rounding text widths.
The commit-queue encountered the following flaky tests while processing attachment 77385 [details]: inspector/elements-panel-styles.html bug 50987 (author: pfeldman@chromium.org) The commit-queue is continuing to process your patch.
Comment on attachment 77385 [details] Patch Clearing flags on attachment: 77385 Committed r74628: <http://trac.webkit.org/changeset/74628>
All reviewed patches have been landed. Closing bug.