[webkit-changes] cvs commit: WebCore/layout-tests/fast/selectors
064-expected.txt
David
hyatt at opensource.apple.com
Tue Aug 9 13:58:29 PDT 2005
hyatt 05/08/09 13:58:29
Modified: . ChangeLog
khtml/rendering render_block.cpp render_block.h
render_object.h
layout-tests/css1/box_properties acid_test-expected.txt
layout-tests/fast/css MarqueeLayoutTest-expected.txt
layout-tests/fast/forms 007-expected.txt
layout-tests/fast/inline-block 001-expected.txt 001.html
layout-tests/fast/selectors 064-expected.txt
Added: layout-tests/fast/inline-block 006-expected.txt 006.html
Log:
Implement baseline alignment support for inline blocks. Inline blocks are supposed to use
the baseline of the last line in the block as their baseline. For marquees we still
bottom align, since marquees really have no discernible baseline in many cases (and this
retains compatibility with WinIE).
Reviewed by cblu
Test cases added: 006.html in fast/inline-block
* khtml/rendering/render_block.cpp:
(khtml::RenderBlock::baselinePosition):
(khtml::RenderBlock::getBaselineOfLastLineBox):
* khtml/rendering/render_block.h:
* khtml/rendering/render_object.h:
(khtml::RenderObject::getBaselineOfLastLineBox):
* layout-tests/css1/box_properties/acid_test-expected.txt:
* layout-tests/fast/css/MarqueeLayoutTest-expected.txt:
* layout-tests/fast/forms/007-expected.txt:
* layout-tests/fast/inline-block/001-expected.txt:
* layout-tests/fast/inline-block/001.html:
* layout-tests/fast/inline-block/006-expected.txt: Added.
* layout-tests/fast/inline-block/006.html: Added.
* layout-tests/fast/selectors/064-expected.txt:
Revision Changes Path
1.4547 +26 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4546
retrieving revision 1.4547
diff -u -r1.4546 -r1.4547
--- ChangeLog 9 Aug 2005 19:15:46 -0000 1.4546
+++ ChangeLog 9 Aug 2005 20:58:23 -0000 1.4547
@@ -1,3 +1,29 @@
+2005-08-09 David Hyatt <hyatt at apple.com>
+
+ Implement baseline alignment support for inline blocks. Inline blocks are supposed to use
+ the baseline of the last line in the block as their baseline. For marquees we still
+ bottom align, since marquees really have no discernible baseline in many cases (and this
+ retains compatibility with WinIE).
+
+ Reviewed by cblu
+
+ Test cases added: 006.html in fast/inline-block
+
+ * khtml/rendering/render_block.cpp:
+ (khtml::RenderBlock::baselinePosition):
+ (khtml::RenderBlock::getBaselineOfLastLineBox):
+ * khtml/rendering/render_block.h:
+ * khtml/rendering/render_object.h:
+ (khtml::RenderObject::getBaselineOfLastLineBox):
+ * layout-tests/css1/box_properties/acid_test-expected.txt:
+ * layout-tests/fast/css/MarqueeLayoutTest-expected.txt:
+ * layout-tests/fast/forms/007-expected.txt:
+ * layout-tests/fast/inline-block/001-expected.txt:
+ * layout-tests/fast/inline-block/001.html:
+ * layout-tests/fast/inline-block/006-expected.txt: Added.
+ * layout-tests/fast/inline-block/006.html: Added.
+ * layout-tests/fast/selectors/064-expected.txt:
+
2005-08-09 Vicki Murley <vicki at apple.com>
Fixed by Anders Carlsson, Reviewed by Maciej.
1.196 +34 -0 WebCore/khtml/rendering/render_block.cpp
Index: render_block.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_block.cpp,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -r1.195 -r1.196
--- render_block.cpp 30 Jul 2005 02:33:22 -0000 1.195
+++ render_block.cpp 9 Aug 2005 20:58:27 -0000 1.196
@@ -3188,8 +3188,18 @@
// box, then the fact that we're an inline-block is irrelevant, and we behave
// just like a block.
if (isReplaced() && !isRootLineBox) {
+ // For "leaf" theme objects, let the theme decide what the baseline position is.
+ // FIXME: Might be better to have a custom CSS property instead, so that if the theme
+ // is turned off, checkboxes/radios will still have decent baselines.
if (style()->hasAppearance() && !theme()->isControlContainer(style()->appearance()))
return theme()->baselinePosition(this);
+
+ // CSS2.1 states that the baseline of an inline block is the baseline of the last line box in
+ // the normal flow. We make an exception for marquees, since their baselines are meaningless
+ // (the content inside them moves). This matches WinIE as well, which just bottom-aligns them.
+ int baselinePos = (m_layer && m_layer->marquee()) ? -1 : getBaselineOfLastLineBox();
+ if (baselinePos != -1)
+ return marginTop() + baselinePos;
return height() + marginTop() + marginBottom();
}
return RenderFlow::baselinePosition(b, isRootLineBox);
@@ -3219,6 +3229,30 @@
return -1;
}
+int RenderBlock::getBaselineOfLastLineBox() const
+{
+ if (!isBlockFlow())
+ return RenderFlow::getBaselineOfLastLineBox();
+
+ if (childrenInline()) {
+ if (m_lastLineBox)
+ return m_lastLineBox->yPos() + m_lastLineBox->baseline();
+ else
+ return -1;
+ }
+ else {
+ for (RenderObject* curr = lastChild(); curr; curr = curr->previousSibling()) {
+ if (!curr->isFloatingOrPositioned()) {
+ int result = curr->getBaselineOfLastLineBox();
+ if (result != -1)
+ return curr->yPos() + result; // Translate to our coordinate space.
+ }
+ }
+ }
+
+ return -1;
+}
+
RenderBlock* RenderBlock::firstLineBlock() const
{
const RenderObject* firstLineBlock = this;
1.69 +1 -0 WebCore/khtml/rendering/render_block.h
Index: render_block.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_block.h,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- render_block.h 29 Jul 2005 23:42:49 -0000 1.68
+++ render_block.h 9 Aug 2005 20:58:27 -0000 1.69
@@ -197,6 +197,7 @@
void calcBlockMinMaxWidth();
virtual int getBaselineOfFirstLineBox() const;
+ virtual int getBaselineOfLastLineBox() const;
RootInlineBox* firstRootBox() const { return static_cast<RootInlineBox*>(m_firstLineBox); }
RootInlineBox* lastRootBox() const { return static_cast<RootInlineBox*>(m_lastLineBox); }
1.154 +1 -0 WebCore/khtml/rendering/render_object.h
Index: render_object.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_object.h,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -r1.153 -r1.154
--- render_object.h 29 Jul 2005 23:42:51 -0000 1.153
+++ render_object.h 9 Aug 2005 20:58:27 -0000 1.154
@@ -174,6 +174,7 @@
bool hasClip() { return isPositioned() && style()->hasClip(); }
virtual int getBaselineOfFirstLineBox() const { return -1; }
+ virtual int getBaselineOfLastLineBox() const { return -1; }
// Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline
// children.
1.11 +2 -2 WebCore/layout-tests/css1/box_properties/acid_test-expected.txt
Index: acid_test-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/css1/box_properties/acid_test-expected.txt,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- acid_test-expected.txt 15 Apr 2005 21:45:53 -0000 1.10
+++ acid_test-expected.txt 9 Aug 2005 20:58:28 -0000 1.11
@@ -23,12 +23,12 @@
RenderBlock {P} at (0,0) size 139x19
RenderText {TEXT} at (0,4) size 28x18
text run at (0,4) width 28: "bang "
- RenderRadioButton {INPUT} at (31,3) size 12x13 [color=#000000]
+ RenderBlock {INPUT} at (31,3) size 12x13 [color=#000000]
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {P} at (0,19) size 139x19
RenderText {TEXT} at (0,4) size 47x18
text run at (0,4) width 47: "whimper "
- RenderRadioButton {INPUT} at (50,3) size 12x13 [color=#000000]
+ RenderBlock {INPUT} at (50,3) size 12x13 [color=#000000]
RenderText {TEXT} at (0,0) size 0x0
RenderBlock (anonymous) at (10,58) size 139x0
RenderInline {FORM} at (0,0) size 0x0
1.4 +7 -7 WebCore/layout-tests/fast/css/MarqueeLayoutTest-expected.txt
Index: MarqueeLayoutTest-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/fast/css/MarqueeLayoutTest-expected.txt,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MarqueeLayoutTest-expected.txt 19 Jul 2005 21:18:19 -0000 1.3
+++ MarqueeLayoutTest-expected.txt 9 Aug 2005 20:58:28 -0000 1.4
@@ -1,8 +1,8 @@
-layer at (0,0) size 800x708
+layer at (0,0) size 800x890
RenderCanvas at (0,0) size 800x600
-layer at (0,0) size 800x708
- RenderBlock {HTML} at (0,0) size 800x708
- RenderBody {BODY} at (8,8) size 784x692
+layer at (0,0) size 800x890
+ RenderBlock {HTML} at (0,0) size 800x890
+ RenderBody {BODY} at (8,8) size 784x874
RenderBlock {P} at (0,0) size 784x18
RenderText {TEXT} at (0,0) size 284x18
text run at (0,0) width 284: "Tests: the height attribute for the marquee tag"
@@ -22,7 +22,7 @@
text run at (0,18) width 50: "the text "
text run at (50,18) width 678: "should be cut off. In the vertical group, the aqua marquee should be 200px, and the others should be 100px."
RenderBlock {HR} at (0,174) size 784x2 [border: (1px inset #000000)]
- RenderBlock (anonymous) at (0,184) size 784x508
+ RenderBlock (anonymous) at (0,184) size 784x690
RenderText {TEXT} at (0,0) size 0x0
RenderBR {BR} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
@@ -34,7 +34,7 @@
RenderBR {BR} at (0,0) size 0x0
RenderBR {BR} at (0,168) size 0x18
RenderBR {BR} at (0,186) size 0x18
- RenderBlock {DIV} at (0,204) size 113x200 [bgcolor=#008000]
+ RenderBlock {DIV} at (0,390) size 113x200 [bgcolor=#008000]
RenderText {TEXT} at (0,0) size 113x18
text run at (0,0) width 113: "This is 200px tall."
RenderText {TEXT} at (113,390) size 4x18
@@ -44,7 +44,7 @@
RenderText {TEXT} at (521,390) size 4x18
text run at (521,390) width 4: " "
RenderText {TEXT} at (0,0) size 0x0
- RenderBlock {DIV} at (0,408) size 113x100 [bgcolor=#008000]
+ RenderBlock {DIV} at (0,590) size 113x100 [bgcolor=#008000]
RenderText {TEXT} at (0,0) size 113x18
text run at (0,0) width 113: "This is 100px tall."
RenderText {TEXT} at (0,0) size 0x0
1.5 +2 -2 WebCore/layout-tests/fast/forms/007-expected.txt
Index: 007-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/fast/forms/007-expected.txt,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- 007-expected.txt 26 Apr 2004 21:19:01 -0000 1.4
+++ 007-expected.txt 9 Aug 2005 20:58:28 -0000 1.5
@@ -13,8 +13,8 @@
RenderBR {BR} at (0,0) size 0x0
RenderText {TEXT} at (0,18) size 80x18
text run at (0,18) width 80: "Hello world."
- RenderText {TEXT} at (115,66) size 4x18
- text run at (115,66) width 4: " "
+ RenderText {TEXT} at (115,48) size 4x18
+ text run at (115,48) width 4: " "
RenderFieldSet {FIELDSET} at (121,18) size 114x62 [border: (2px groove #C0C0C0)]
RenderLegend {LEGEND} at (12,0) size 90x18
RenderText {TEXT} at (2,0) size 86x18
1.7 +14 -10 WebCore/layout-tests/fast/inline-block/001-expected.txt
Index: 001-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/fast/inline-block/001-expected.txt,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- 001-expected.txt 14 Jun 2005 22:37:09 -0000 1.6
+++ 001-expected.txt 9 Aug 2005 20:58:28 -0000 1.7
@@ -3,15 +3,19 @@
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
- RenderBlock {P} at (0,0) size 59x40 [border: (2px solid #0000FF)]
+ RenderText {TEXT} at (0,0) size 743x36
+ text run at (0,0) width 743: "THIS TEST'S RESULTS ARE NOT CORRECT, SINCE INLINE TABLES ARE NOT BASELINE-ALIGNING"
+ text run at (0,18) width 511: "PROPERLY, AND WHEN THEY DO, THE FIRST ROW WILL BE USED. "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderBlock {P} at (0,42) size 59x40 [border: (2px solid #0000FF)]
RenderText {TEXT} at (2,2) size 55x18
text run at (2,2) width 55: "This text"
RenderBR {BR} at (0,0) size 0x0
RenderText {TEXT} at (2,20) size 55x18
text run at (2,20) width 55: "This text"
- RenderText {TEXT} at (59,26) size 4x18
- text run at (59,26) width 4: " "
- RenderBlock {P} at (63,0) size 113x40 [border: (2px solid #0000FF)]
+ RenderText {TEXT} at (59,62) size 4x18
+ text run at (59,62) width 4: " "
+ RenderBlock {P} at (63,42) size 113x40 [border: (2px solid #0000FF)]
RenderBlock (anonymous) at (2,2) size 109x0
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {SPAN} at (2,2) size 109x36
@@ -20,9 +24,9 @@
RenderBR {BR} at (0,0) size 0x0
RenderText {TEXT} at (0,18) size 109x18
text run at (0,18) width 109: "should also all be"
- RenderText {TEXT} at (176,26) size 4x18
- text run at (176,26) width 4: " "
- RenderTable {TABLE} at (180,0) size 43x40 [border: (2px solid #0000FF)]
+ RenderText {TEXT} at (176,62) size 4x18
+ text run at (176,62) width 4: " "
+ RenderTable {TABLE} at (180,36) size 43x40 [border: (2px solid #0000FF)]
RenderTableSection {TBODY} at (2,2) size 0x36
RenderTableRow {TR} at (0,0) size 0x0
RenderTableCell {TD} at (0,0) size 39x18 [r=0 c=0 rs=1 cs=1]
@@ -32,9 +36,9 @@
RenderTableCell {TD} at (0,18) size 39x18 [r=1 c=0 rs=1 cs=1]
RenderText {TEXT} at (0,0) size 39x18
text run at (0,0) width 39: "on the"
- RenderText {TEXT} at (223,26) size 4x18
- text run at (223,26) width 4: " "
- RenderTable {TABLE} at (227,0) size 71x40 [border: (2px solid #0000FF)]
+ RenderText {TEXT} at (223,62) size 4x18
+ text run at (223,62) width 4: " "
+ RenderTable {TABLE} at (227,36) size 71x40 [border: (2px solid #0000FF)]
RenderTableSection {TBODY} at (2,2) size 0x36
RenderTableRow {TR} at (0,0) size 0x0
RenderTableCell {TD} at (0,0) size 67x18 [r=0 c=0 rs=1 cs=1]
1.2 +6 -1 WebCore/layout-tests/fast/inline-block/001.html
Index: 001.html
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/fast/inline-block/001.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 001.html 31 Jul 2003 00:18:01 -0000 1.1
+++ 001.html 9 Aug 2005 20:58:28 -0000 1.2
@@ -1,5 +1,10 @@
<html>
-<body><p style="margin:0;display:inline-block;border:2px solid blue;">This text<br>This text</p>
+<body>
+THIS TEST'S RESULTS ARE NOT CORRECT, SINCE INLINE TABLES ARE NOT
+BASELINE-ALIGNING PROPERLY, AND WHEN THEY DO, THE FIRST ROW WILL BE
+USED.
+<br>
+<p style="margin:0;display:inline-block;border:2px solid blue;">This text<br>This text</p>
<p style="margin: 0; border: 2px solid blue; display:inline-block">
<span style="display:block">should all be<br>should also all be</span></p>
<table style="margin: 0; display: inline-table; border:2px solid blue" cellpadding=0 cellspacing=0>
1.1 WebCore/layout-tests/fast/inline-block/006-expected.txt
Index: 006-expected.txt
===================================================================
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 784x584
RenderText {TEXT} at (0,0) size 772x36
text run at (0,0) width 313: "This is a baseline alignment test for inline blocks. "
text run at (313,0) width 459: "The last lines of the two red-bordered inline blocks should line up and be"
text run at (0,18) width 102: "on the baseline. "
RenderBR {BR} at (0,0) size 0x0
RenderBlock {DIV} at (0,64) size 255x60 [border: (2px solid #FF0000)]
RenderText {TEXT} at (12,12) size 81x18
text run at (12,12) width 81: "This is block"
RenderBR {BR} at (0,0) size 0x0
RenderText {TEXT} at (12,30) size 231x18
text run at (12,30) width 83: "number one. "
text run at (95,30) width 148: "This line is the last one."
RenderText {TEXT} at (255,94) size 4x18
text run at (255,94) width 4: " "
RenderBlock {DIV} at (259,36) size 192x128 [border: (2px solid #FF0000)]
RenderBlock (anonymous) at (12,12) size 168x36
RenderText {TEXT} at (0,0) size 42x18
text run at (0,0) width 42: "This is"
RenderBR {BR} at (0,0) size 0x0
RenderText {TEXT} at (0,18) size 80x18
text run at (0,18) width 80: "number two."
RenderBlock {DIV} at (12,48) size 168x38
RenderText {TEXT} at (10,10) size 148x18
text run at (10,10) width 148: "This line is the last one."
RenderText {TEXT} at (451,94) size 139x18
text run at (451,94) width 139: " More text on the line."
RenderBR {BR} at (0,0) size 0x0
RenderText {TEXT} at (0,164) size 87x18
text run at (0,164) width 87: "The next line."
1.1 WebCore/layout-tests/fast/inline-block/006.html
Index: 006.html
===================================================================
<head>
<style>
div { display: inline-block; border:2px solid red; padding:10px; }
</style>
</head>
<body>
This is a baseline alignment test for inline blocks. The last lines of the two red-bordered
inline blocks should line up and be on the baseline.
<br>
<div>This is block<br>number one. This line is the last one.</div>
<div style="padding-bottom:40px">This is<br>number two.
<div style="border:0px; display:block">This line is the last one.</div>
</div>
More text on the line.<br>
The next line.
</body>
1.6 +5 -5 WebCore/layout-tests/fast/selectors/064-expected.txt
Index: 064-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/fast/selectors/064-expected.txt,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- 064-expected.txt 17 Nov 2003 21:15:40 -0000 1.5
+++ 064-expected.txt 9 Aug 2005 20:58:29 -0000 1.6
@@ -1,15 +1,15 @@
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
-layer at (0,0) size 800x91
- RenderBlock {HTML} at (0,0) size 800x91
- RenderBody {BODY} at (8,16) size 784x59
- RenderBlock {DIV} at (0,0) size 784x59
+layer at (0,0) size 800x87
+ RenderBlock {HTML} at (0,0) size 800x87
+ RenderBody {BODY} at (8,16) size 784x55
+ RenderBlock {DIV} at (0,0) size 784x55
RenderBlock {P} at (0,0) size 784x18 [color=#00FF00]
RenderInline {A} at (0,0) size 279x18 [color=#000000]
RenderText {TEXT} at (0,0) size 279x18
text run at (0,0) width 279: "This text should turn green while it is active."
RenderText {TEXT} at (0,0) size 0x0
- RenderBlock {P} at (0,34) size 784x25 [color=#00FF00]
+ RenderBlock {P} at (0,34) size 784x21 [color=#00FF00]
RenderBlock {BUTTON} at (0,0) size 248x21 [color=#000000] [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
RenderText {TEXT} at (4,4) size 240x13
text run at (4,4) width 240: "This text should turn green while it is active."
More information about the webkit-changes
mailing list