Commit 0346117d authored by jamesr@google.com's avatar jamesr@google.com

2010-11-22 James Robinson <jamesr@chromium.org>

        Reviewed by Dimitri Glazkov.

        [chromium] font-size:0 text runs should have zero width
        https://bugs.webkit.org/show_bug.cgi?id=49871

        Expands test to check width in addition to height.

        * fast/text/font-size-zero-expected.txt:
        * fast/text/font-size-zero.html:
        * fast/text/script-tests/font-size-zero.js:
2010-11-22  James Robinson  <jamesr@chromium.org>

        Reviewed by Dimitri Glazkov.

        [chromium] font-size:0 text runs should have zero width
        https://bugs.webkit.org/show_bug.cgi?id=49871

        Returns 0 from platformWidthForGlyph if the specified font size is 0.

        Test: fast/text/font-size-zero.html

        * platform/graphics/chromium/SimpleFontDataChromiumWin.cpp:
        (WebCore::SimpleFontData::platformWidthForGlyph):
        * platform/graphics/chromium/SimpleFontDataLinux.cpp:
        (WebCore::SimpleFontData::platformWidthForGlyph):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72567 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3c9be217
2010-11-22 James Robinson <jamesr@chromium.org>
Reviewed by Dimitri Glazkov.
[chromium] font-size:0 text runs should have zero width
https://bugs.webkit.org/show_bug.cgi?id=49871
Expands test to check width in addition to height.
* fast/text/font-size-zero-expected.txt:
* fast/text/font-size-zero.html:
* fast/text/script-tests/font-size-zero.js:
2010-11-22 Charlie Reis <creis@chromium.org>
Reviewed by Darin Fisher.
Tests that text with font-size:0 has zero height.
Tests that text with font-size:0 has zero height and width.
PASS s.getBoundingClientRect().height is 0
PASS s.getBoundingClientRect().width is 0
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -5,7 +5,7 @@
<script src="../js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description">Tests that text with font-size:0 has zero height.</p>
<p id="description">Tests that text with font-size:0 has zero height and width.</p>
<div id="console"></div>
<script src="script-tests/font-size-zero.js"></script>
<script src="../js/resources/js-test-post.js"></script>
......
......@@ -4,6 +4,7 @@ s.innerHTML = 'Text';
document.body.appendChild(s);
shouldBe("s.getBoundingClientRect().height", "0");
shouldBe("s.getBoundingClientRect().width", "0");
document.body.removeChild(s);
......
2010-11-22 James Robinson <jamesr@chromium.org>
Reviewed by Dimitri Glazkov.
[chromium] font-size:0 text runs should have zero width
https://bugs.webkit.org/show_bug.cgi?id=49871
Returns 0 from platformWidthForGlyph if the specified font size is 0.
Test: fast/text/font-size-zero.html
* platform/graphics/chromium/SimpleFontDataChromiumWin.cpp:
(WebCore::SimpleFontData::platformWidthForGlyph):
* platform/graphics/chromium/SimpleFontDataLinux.cpp:
(WebCore::SimpleFontData::platformWidthForGlyph):
2010-11-22 Charlie Reis <creis@chromium.org>
Reviewed by Darin Fisher.
......@@ -167,6 +167,9 @@ FloatRect SimpleFontData::platformBoundsForGlyph(Glyph) const
float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
{
if (!m_platformData.size())
return 0;
HDC dc = GetDC(0);
HGDIOBJ oldFont = SelectObject(dc, m_platformData.hfont());
......
......@@ -53,6 +53,18 @@ static const size_t maxVDMXTableSize = 1024 * 1024; // 1 MB
void SimpleFontData::platformInit()
{
if (!m_platformData.size()) {
m_ascent = 0;
m_descent = 0;
m_lineGap = 0;
m_lineSpacing = 0;
m_avgCharWidth = 0;
m_maxCharWidth = 0;
m_xHeight = 0;
m_unitsPerEm = 0;
return;
}
SkPaint paint;
SkPaint::FontMetrics metrics;
......@@ -177,6 +189,9 @@ FloatRect SimpleFontData::platformBoundsForGlyph(Glyph) const
float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
{
if (!m_platformData.size())
return 0;
SkASSERT(sizeof(glyph) == 2); // compile-time assert
SkPaint paint;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment