1ex should equal .5em when the font has no x-height metric
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Oct 2012 00:35:56 +0000 (00:35 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Oct 2012 00:35:56 +0000 (00:35 +0000)
commitf3be5fad5cc605c570dc6d19245587a0db932747
treeafa5914c9b7091e7924046ee694c51830a3918fd
parent894d72b3f6ab5b813d5c59cd35c70971f1fb6c81
1ex should equal .5em when the font has no x-height metric
https://bugs.webkit.org/show_bug.cgi?id=80360

Patch by Tab Atkins <tabatkins@google.com> on 2012-10-04
Reviewed by Eric Seidel.

Source/WebCore:

Updated FontMetrics and CSSPrimitiveValue to have/use an explicit "hasXHeight" flag to determine how to size an 'ex' unit.

Updated a few of the platform font files to set the flag properly.

Patch cleanup by David Barr <davidbarr@chromium.org>.

Test: fast/css/ex-unit-with-no-x-height.html

* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::computeLengthDouble):
* platform/graphics/FontMetrics.h:
(WebCore::FontMetrics::FontMetrics):
(WebCore::FontMetrics::setXHeight):
(FontMetrics):
(WebCore::FontMetrics::hasXHeight):
(WebCore::FontMetrics::setHasXHeight):
(WebCore::FontMetrics::reset):
* platform/graphics/skia/SimpleFontDataSkia.cpp:
(WebCore::SimpleFontData::platformInit):

LayoutTests:

If a font has no x-height metric, 1ex should equal .5em.

Test layout tweaked by David Barr <davidbarr@chromium.org>.

* fast/css/ex-unit-with-no-x-height-expected.txt: Added.
* fast/css/ex-unit-with-no-x-height.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@130437 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/css/ex-unit-with-no-x-height-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/ex-unit-with-no-x-height.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/platform/graphics/FontMetrics.h
Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp