Skip to content

Commit

Permalink
Reviewed by Darin.
Browse files Browse the repository at this point in the history
        <rdar://problem/4077676> Inline hole line adheres to the Japanese characters in inline hole

        This happens because the underline is always 2 pixels thick, and placed 3 pixels above the bottom of the text box.

        Test case added:
        * manual-tests/inline-input-marking.html: Added.
        Check that underlining of the inline input hole does not obscure the glyphs.
        
        * rendering/InlineTextBox.cpp:
        (WebCore::InlineTextBox::paintMarkedTextUnderline):
        Position underline at bottom of text box.
        Height of underline is reduced to 1 px when font's descent is less than or equal to 2 px.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15971 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
harrison committed Aug 22, 2006
1 parent 509e0a2 commit bd92f87
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
17 changes: 17 additions & 0 deletions WebCore/ChangeLog
@@ -1,3 +1,20 @@
2006-08-22 David Harrison <harrison@apple.com>

Reviewed by Darin.

<rdar://problem/4077676> Inline hole line adheres to the Japanese characters in inline hole

This happens because the underline is always 2 pixels thick, and placed 3 pixels above the bottom of the text box.

Test case added:
* manual-tests/inline-input-marking.html: Added.
Check that underlining of the inline input hole does not obscure the glyphs.

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintMarkedTextUnderline):
Position underline at bottom of text box.
Height of underline is reduced to 1 px when font's descent is less than or equal to 2 px.

2006-08-22 Rob Buis <buis@kde.org>

Reviewed by Eric.
Expand Down
38 changes: 38 additions & 0 deletions WebCore/manual-tests/inline-input-marking.html
@@ -0,0 +1,38 @@
<html>
<head>

<style>
.editing {
border: 2px solid red;
padding: 12px;
font-size: 24px;
}
.inputtest {
font-family:'Hiragino Kaku Gothic Std';
border: 2px solid green;
}
</style>

<title>Inline Input Method Marking</title>
</head>
<body>
<p>This tests that the underlining of the inline input hole does not obscure the glyphs.</p>

<ol>
<li>Switch to Hirigana input method</li>
<li>Type characters into each of the green blocks below</li>
<li>As you do so, check that glyphs in the inline hole are clearly readable</li>
</ol>
<div contenteditable id="root" class="editing" style="width:400px;">
9px Hiragino Kaku Gothic Std<div class="inputtest" style="font-size: 9px;"><br></div>
<br>12px Hiragino Kaku Gothic Std<div class="inputtest" style="font-size: 12px;"><br></div>
<br>24px Hiragino Kaku Gothic Std<div class="inputtest" style="font-size: 24px;"><br></div>
</div>

<script>
runEditingTest();
</script>

</body>
</html>

7 changes: 5 additions & 2 deletions WebCore/rendering/InlineTextBox.cpp
Expand Up @@ -677,8 +677,11 @@ void InlineTextBox::paintMarkedTextUnderline(GraphicsContext* pt, int _tx, int _
width = static_cast<RenderText*>(m_object)->width(paintStart, paintEnd - paintStart, textPos() + start, m_firstLine);
}

int underlineOffset = m_height - 3;
pt->setPen(Pen(underline.color, underline.thick ? 2 : 0));
int lineThickness = 0;
if (underline.thick)
lineThickness = ((m_height - m_baseline) > 2) ? 2 : 1;
int underlineOffset = m_height - lineThickness;
pt->setPen(Pen(underline.color, lineThickness));
pt->drawLineForText(IntPoint(_tx + start, _ty), underlineOffset, width, textObject()->document()->printing());
}

Expand Down

0 comments on commit bd92f87

Please sign in to comment.