[webkit-dev] calcPrefWidths, SimpleFontData, and text fields (oh my!)

Mike Pinkerton pinkerton at chromium.org
Wed Nov 19 13:17:32 PST 2008

In tracking down something for Mac Chromium, I came across something
in WebCore that I can't explain, and hopefully someone on this list
can vend me a clue.

RenderTextControl::calcPrefWidths() checks the average character width
of the primary font if the width isn't explicitly set. This calls into
SimpleFontData to return its |m_avgCharWidth| member. However, there's
nothing I can find (blame Spotlight, perhaps?) in the WebKit source
that actually sets m_avgCharWidth, besides an initialization to 0 in
SimpleFontData.cpp. If this is the case, shouldn't text fields always
get a 0 width + some padding?

Am I missing the obvious code that sets this member variable in the
font code? Or am I reading this chunk incorrectly?


Mike Pinkerton
Mac Weenie
pinkerton at google.com

More information about the webkit-dev mailing list