Bug #:
Submitted by:
Reviewed by:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11584 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b87e3ec..1077f39 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2005-12-14 Beth Dakin <bdakin@apple.com>
+
+ Reviewed by Eric.
+
+ This layout test is sort of for <rdar://problem/4374783> 10.4.4
+ REGRESSION: caret disappears when typing at the bottom of a
+ scrollable textarea.
+
+ It does not address the fundamental problem with that bug,
+ but it does make sure we ignore negative line-height in
+ textareas.
+
+ * fast/forms/negativeLineHeight-expected.checksum: Added.
+ * fast/forms/negativeLineHeight-expected.png: Added.
+ * fast/forms/negativeLineHeight-expected.txt: Added.
+ * fast/forms/negativeLineHeight.html: Added.
+
2005-12-14 Mitz Pettel <opendarwin.org@mitzpettel.com>
Layout test for <http://bugzilla.opendarwin.org/show_bug.cgi?id=5921>
diff --git a/LayoutTests/fast/forms/negativeLineHeight-expected.checksum b/LayoutTests/fast/forms/negativeLineHeight-expected.checksum
new file mode 100644
index 0000000..263e88d
--- /dev/null
+++ b/LayoutTests/fast/forms/negativeLineHeight-expected.checksum
@@ -0,0 +1 @@
+d70363670409cd5fc445dd5ace99cac9
\ No newline at end of file
diff --git a/LayoutTests/fast/forms/negativeLineHeight-expected.png b/LayoutTests/fast/forms/negativeLineHeight-expected.png
new file mode 100644
index 0000000..0fd3cd6
--- /dev/null
+++ b/LayoutTests/fast/forms/negativeLineHeight-expected.png
Binary files differ
diff --git a/LayoutTests/fast/forms/negativeLineHeight-expected.txt b/LayoutTests/fast/forms/negativeLineHeight-expected.txt
new file mode 100644
index 0000000..e4adc7b
--- /dev/null
+++ b/LayoutTests/fast/forms/negativeLineHeight-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x576
+ RenderBlock (anonymous) at (0,0) size 784x18
+ RenderText {TEXT} at (0,0) size 666x18
+ text run at (0,0) width 666: "The textarea below should have standard line-height because textareas should ignore negative line-heights"
+ RenderBR {BR} at (0,0) size 0x0
+ RenderBlock {P} at (0,34) size 784x240
+ RenderText {TEXT} at (0,0) size 87x18
+ text run at (0,0) width 87: "TEXTAREA"
+ RenderBR {BR} at (0,0) size 0x0
+ RenderTextArea {TEXTAREA} at (0,18) size 400x200
+ RenderText {TEXT} at (400,204) size 4x18
+ text run at (400,204) width 4: " "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderBR {BR} at (0,222) size 0x18
diff --git a/LayoutTests/fast/forms/negativeLineHeight.html b/LayoutTests/fast/forms/negativeLineHeight.html
new file mode 100644
index 0000000..7187d22
--- /dev/null
+++ b/LayoutTests/fast/forms/negativeLineHeight.html
@@ -0,0 +1,23 @@
+<html lang="en">
+<head>
+ <style type="text/css">
+ .p {
+ border: dotted silver 1px;
+ font-style:italic;
+ font-family: Verdana, Arial, Helvetica;
+ font-size: 10pt;
+ line-height:-400%;
+ width:400px; height:200px;
+ }
+
+ </style>
+</head>
+<body>
+The textarea below should have standard line-height because textareas should ignore negative line-heights<br/>
+<p> TEXTAREA<br/>
+ <textarea id="myTA" class="p">Demo text here that wraps a bit and should demonstrate the goodness of line-height</textarea>
+ <br/><br/>
+
+</p>
+</body>
+</html>
\ No newline at end of file
diff --git a/WebCore/ChangeLog-2005-12-19 b/WebCore/ChangeLog-2005-12-19
index a80f873..2f3efc2 100644
--- a/WebCore/ChangeLog-2005-12-19
+++ b/WebCore/ChangeLog-2005-12-19
@@ -1,3 +1,20 @@
+2005-12-14 Beth Dakin <bdakin@apple.com>
+
+ Reviewed by Eric.
+
+ Fix for <rdar://problem/4374783> 10.4.4 REGRESSION: caret
+ disappears when typing at the bottom of a scrollable textarea.
+
+ This regression occurred because we were calculating the font
+ height incorrectly. Made changes that Doug suggested in the bug.
+
+ * kwq/KWQTextArea.mm:
+ (-[KWQTextAreaTextView setFont:]): Send the font itself to
+ _KWQ_updateTypingAttributes
+ (-[KWQTextAreaTextView setLineHeight:]): Same.
+ (-[NSTextView _KWQ_updateTypingAttributes:forLineHeight:font:]):
+ Calculate the font height using defaultLineHeightForFont.
+
2005-12-14 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by Darin & Geoff, committed by Adele.
diff --git a/WebCore/kwq/KWQTextArea.mm b/WebCore/kwq/KWQTextArea.mm
index 702e2f5..cba4e0a 100644
--- a/WebCore/kwq/KWQTextArea.mm
+++ b/WebCore/kwq/KWQTextArea.mm
@@ -68,7 +68,7 @@
@interface NSTextView (KWQTextArea)
- (NSParagraphStyle *)_KWQ_typingParagraphStyle;
- (void)_KWQ_setTypingParagraphStyle:(NSParagraphStyle *)style;
-- (void)_KWQ_updateTypingAttributes:(NSParagraphStyle *)style forLineHeight:(float)lineHeight fontHeight:(float)fontHeight;
+- (void)_KWQ_updateTypingAttributes:(NSParagraphStyle *)style forLineHeight:(float)lineHeight font:(NSFont *)font;
@end
@interface NSTextStorage (KWQTextArea)
@@ -547,7 +547,7 @@
NSParagraphStyle *style = [textView _KWQ_typingParagraphStyle];
if (_lineHeight) {
ASSERT(style);
- [textView _KWQ_updateTypingAttributes:style forLineHeight:_lineHeight fontHeight:([_font ascender] - [_font descender])];
+ [textView _KWQ_updateTypingAttributes:style forLineHeight:_lineHeight font:_font];
}
}
@@ -594,7 +594,7 @@
}
NSMutableParagraphStyle *newStyle = [paraStyle mutableCopy];
[newStyle setMinimumLineHeight:lineHeight];
- [textView _KWQ_updateTypingAttributes:newStyle forLineHeight:lineHeight fontHeight:([_font ascender] - [_font descender])];
+ [textView _KWQ_updateTypingAttributes:newStyle forLineHeight:lineHeight font:_font];
[newStyle release];
}
@@ -1287,11 +1287,13 @@
[attributes release];
}
-- (void)_KWQ_updateTypingAttributes:(NSParagraphStyle *)style forLineHeight:(float)lineHeight fontHeight:(float)fontHeight
+- (void)_KWQ_updateTypingAttributes:(NSParagraphStyle *)style forLineHeight:(float)lineHeight font:(NSFont *)font
{
NSDictionary *typingAttrs = [self typingAttributes];
NSMutableDictionary *dict;
+ float fontHeight = [[self layoutManager] defaultLineHeightForFont:font];
float h = (lineHeight / 2.0f) - (fontHeight / 2.0f);
+ h = (h >= 0.0) ? floor(h) : -floor(-h);
if (typingAttrs)
dict = [typingAttrs mutableCopy];