Commit cd6deb7d authored by mitz@apple.com's avatar mitz@apple.com

WebCore:

        Reviewed by Dave Hyatt.

        - fix https://bugs.webkit.org/show_bug.cgi?id=18809
          Forms with block level generated content and absolutely positioned labels break inline layout (fixed on reflow)

        Test: fast/block/basic/adding-near-anonymous-block.html

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::addChildToFlow): When adding a floating or
        positioned object, if it follows an anonymous block, put it
        inside the anonymous block. When adding an inline, check if it comes
        after an anonymous block and put it in the anonymous block.

LayoutTests:

        Reviewed by Dave Hyatt.

        - test, updated test and updated results for https://bugs.webkit.org/show_bug.cgi?id=18809
          Forms with block level generated content and absolutely positioned labels break inline layout (fixed on reflow)

        * fast/block/basic/adding-near-anonymous-block.html: Added.
        * media/video-controls-rendering.html: Changed to work around
        https://bugs.webkit.org/show_bug.cgi?id=18857 which now affects this
        test in its original form.
        * platform/mac/css1/box_properties/clear-expected.txt:
        * platform/mac/fast/block/basic/adding-near-anonymous-block-expected.checksum: Added.
        * platform/mac/fast/block/basic/adding-near-anonymous-block-expected.png: Added.
        * platform/mac/fast/block/basic/adding-near-anonymous-block-expected.txt: Added.
        * platform/mac/fast/forms/input-align-image-expected.txt:
        * platform/mac/media/audio-controls-rendering-expected.txt:
        * platform/mac/media/video-controls-rendering-expected.txt:
        * platform/mac/tables/mozilla/bugs/bug51140-expected.txt:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@32872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f0dc5ade
2008-05-05 Dan Bernstein <mitz@apple.com>
Reviewed by Dave Hyatt.
- test, updated test and updated results for https://bugs.webkit.org/show_bug.cgi?id=18809
Forms with block level generated content and absolutely positioned labels break inline layout (fixed on reflow)
* fast/block/basic/adding-near-anonymous-block.html: Added.
* media/video-controls-rendering.html: Changed to work around
https://bugs.webkit.org/show_bug.cgi?id=18857 which now affects this
test in its original form.
* platform/mac/css1/box_properties/clear-expected.txt:
* platform/mac/fast/block/basic/adding-near-anonymous-block-expected.checksum: Added.
* platform/mac/fast/block/basic/adding-near-anonymous-block-expected.png: Added.
* platform/mac/fast/block/basic/adding-near-anonymous-block-expected.txt: Added.
* platform/mac/fast/forms/input-align-image-expected.txt:
* platform/mac/media/audio-controls-rendering-expected.txt:
* platform/mac/media/video-controls-rendering-expected.txt:
* platform/mac/tables/mozilla/bugs/bug51140-expected.txt:
2008-05-02 Antti Koivisto <antti@apple.com>
Reviewed by Mitz.
<style>
div#withAfter::after {
content: "This should be the second line.";
display: block;
}
</style>
<p>
This is a test for <i><a href="https://bugs.webkit.org/show_bug.cgi?id=18809">https://bugs.webkit.org/show_bug.cgi?id=18809</a>
Forms with block level generated content and absolutely positioned labels break inline layout (fixed on reflow)</i>.
</p>
<div id="withAfter">
This should be
<span style="position: absolute;"></span>
a single line.
</div>
<div>
<div></div>
This should be
<span style="position: absolute;"></span>
a single line.
</div>
<div>
<div></div>
a single line.<span style="float: left;">This should be&nbsp;</span>
</div>
<p>Test controls placement. </p>
<video controls src="content/test.mp4"></video><br>
<video controls src="content/test.mp4" style="width: 320px;"></video><br>
<video controls src="content/test.mp4" style="position: absolute; width: 320px;"></video><br>
<div>
<video controls src="content/test.mp4"></video>
</div>
<div>
<video controls src="content/test.mp4" style="width: 320px;"></video>
</div>
<div>
<video controls src="content/test.mp4" style="position: absolute; width: 320px;"></video>
</div>
<script>
if (window.layoutTestController) {
layoutTestController.waitUntilDone();
......
......@@ -23,20 +23,20 @@ layer at (0,0) size 785x961
text run at (18,0) width 595: "This text should be flowing past a tall orange rectangle on the left side of the browser window."
RenderBlock (anonymous) at (0,159) size 769x18
RenderBR {BR} at (18,0) size 0x18
RenderImage {IMG} at (0,177) size 15x50
RenderImage {IMG} at (0,18) size 15x50
RenderBlock {P} at (0,227) size 769x18
RenderText {#text} at (0,0) size 649x18
text run at (0,0) width 649: "This paragraph should appear below the tall orange rectangle above and to the left, and not flow past it."
RenderBlock (anonymous) at (0,261) size 769x18
RenderBR {BR} at (0,0) size 0x18
RenderImage {IMG} at (754,279) size 15x50
RenderImage {IMG} at (754,18) size 15x50
RenderBlock {P} at (0,329) size 769x18
RenderText {#text} at (0,0) size 658x18
text run at (0,0) width 658: "This paragraph should appear below the tall orange rectangle above and to the right, and not flow past it."
RenderBlock (anonymous) at (0,363) size 769x18
RenderBR {BR} at (0,0) size 0x18
RenderImage {IMG} at (0,381) size 15x50
RenderImage {IMG} at (754,381) size 15x50
RenderImage {IMG} at (0,18) size 15x50
RenderImage {IMG} at (754,18) size 15x50
RenderBlock {P} at (0,431) size 769x18
RenderText {#text} at (0,0) size 602x18
text run at (0,0) width 602: "This paragraph should appear below the two tall orange rectangles, and not flow between them."
......@@ -65,20 +65,20 @@ layer at (0,0) size 785x961
text run at (18,0) width 595: "This text should be flowing past a tall orange rectangle on the left side of the browser window."
RenderBlock (anonymous) at (4,38) size 658x18
RenderBR {BR} at (18,0) size 0x18
RenderImage {IMG} at (4,56) size 15x50
RenderImage {IMG} at (0,18) size 15x50
RenderBlock {P} at (4,106) size 658x18
RenderText {#text} at (0,0) size 649x18
text run at (0,0) width 649: "This paragraph should appear below the tall orange rectangle above and to the left, and not flow past it."
RenderBlock (anonymous) at (4,140) size 658x18
RenderBR {BR} at (0,0) size 0x18
RenderImage {IMG} at (647,158) size 15x50
RenderImage {IMG} at (643,18) size 15x50
RenderBlock {P} at (4,208) size 658x18
RenderText {#text} at (0,0) size 658x18
text run at (0,0) width 658: "This paragraph should appear below the tall orange rectangle above and to the right, and not flow past it."
RenderBlock (anonymous) at (4,242) size 658x18
RenderBR {BR} at (0,0) size 0x18
RenderImage {IMG} at (4,260) size 15x50
RenderImage {IMG} at (647,260) size 15x50
RenderImage {IMG} at (0,18) size 15x50
RenderImage {IMG} at (643,18) size 15x50
RenderBlock {P} at (4,310) size 658x18
RenderText {#text} at (0,0) size 602x18
text run at (0,0) width 602: "This paragraph should appear below the two tall orange rectangles, and not flow between them."
......
343f332bc0d10bec0a84d754eb55d404
\ No newline at end of file
layer at (0,0) size 800x600
RenderView 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
RenderBlock {P} at (0,0) size 784x36
RenderText {#text} at (0,0) size 104x18
text run at (0,0) width 104: "This is a test for "
RenderInline {I} at (0,0) size 772x36
RenderInline {A} at (0,0) size 307x18 [color=#0000EE]
RenderText {#text} at (104,0) size 307x18
text run at (104,0) width 307: "https://bugs.webkit.org/show_bug.cgi?id=18809"
RenderText {#text} at (411,0) size 772x36
text run at (411,0) width 4: " "
text run at (415,0) width 357: "Forms with block level generated content and absolutely"
text run at (0,18) width 336: "positioned labels break inline layout (fixed on reflow)"
RenderText {#text} at (336,18) size 4x18
text run at (336,18) width 4: "."
RenderBlock {DIV} at (0,52) size 784x36
RenderBlock (anonymous) at (0,0) size 784x18
RenderText {#text} at (0,0) size 97x18
text run at (0,0) width 97: "This should be "
RenderText {#text} at (97,0) size 79x18
text run at (97,0) width 79: "a single line."
RenderBlock (generated) at (0,18) size 784x18
RenderText at (0,0) size 195x18
text run at (0,0) width 195: "This should be the second line."
RenderBlock {DIV} at (0,88) size 784x18
RenderBlock {DIV} at (0,0) size 784x0
RenderBlock (anonymous) at (0,0) size 784x18
RenderText {#text} at (0,0) size 97x18
text run at (0,0) width 97: "This should be "
RenderText {#text} at (97,0) size 79x18
text run at (97,0) width 79: "a single line."
RenderBlock {DIV} at (0,106) size 784x18
RenderBlock {DIV} at (0,0) size 784x0
RenderBlock (anonymous) at (0,0) size 784x18
RenderText {#text} at (97,0) size 79x18
text run at (97,0) width 79: "a single line."
RenderBlock (floating) {SPAN} at (0,0) size 97x18
RenderText {#text} at (0,0) size 97x18
text run at (0,0) width 97: "This should be "
......@@ -7,16 +7,15 @@ layer at (0,0) size 800x600
RenderText {#text} at (0,0) size 579x18
text run at (0,0) width 579: "The following 4 images should be all be rendered exactly the same, aligned to the right side."
RenderImage {INPUT} at (767,34) size 17x19
RenderBlock (anonymous) at (0,34) size 784x36
RenderBR {BR} at (0,0) size 0x18
RenderBR {BR} at (0,18) size 0x18
RenderImage {INPUT} at (767,70) size 17x19
RenderBlock (anonymous) at (0,70) size 784x72
RenderBlock (anonymous) at (0,34) size 784x108
RenderBR {BR} at (0,0) size 0x18
RenderBR {BR} at (0,18) size 0x18
RenderImage {INPUT} at (767,36) size 17x19
RenderText {#text} at (0,0) size 0x0
RenderBR {BR} at (0,36) size 0x18
RenderBR {BR} at (0,54) size 0x18
RenderImage {INPUT} at (767,72) size 17x19
RenderText {#text} at (0,0) size 0x0
RenderBR {BR} at (0,72) size 0x18
RenderBR {BR} at (0,90) size 0x18
RenderBlock {DIV} at (0,142) size 784x0
RenderImage {INPUT} at (767,0) size 17x19
......@@ -6,15 +6,14 @@ layer at (0,0) size 800x600
RenderBlock {P} at (0,0) size 784x18
RenderText {#text} at (0,0) size 153x18
text run at (0,0) width 153: "Test controls placement."
RenderBlock (anonymous) at (0,34) size 784x68
RenderBlock (anonymous) at (0,34) size 784x86
RenderMedia {AUDIO} at (0,0) size 200x16 [bgcolor=#0000FF]
RenderBR {BR} at (200,16) size 0x0
RenderBR {BR} at (0,16) size 0x18
RenderMedia {AUDIO} at (0,34) size 320x16 [bgcolor=#0000FF]
RenderBR {BR} at (320,50) size 0x0
RenderBR {BR} at (0,50) size 0x18
RenderBlock (anonymous) at (0,102) size 784x18
RenderBR {BR} at (0,0) size 0x18
RenderBR {BR} at (0,68) size 0x18
layer at (8,42) size 200x16
RenderBlock (relative positioned) {DIV} at (0,0) size 200x16
layer at (8,42) size 200x18
......
......@@ -6,13 +6,13 @@ layer at (0,0) size 785x600
RenderBlock {P} at (0,0) size 769x18
RenderText {#text} at (0,0) size 153x18
text run at (0,0) width 153: "Test controls placement."
RenderBlock (anonymous) at (0,34) size 769x480
RenderBlock {DIV} at (0,34) size 769x240
RenderVideo {VIDEO} at (0,0) size 320x240
RenderBR {BR} at (320,240) size 0x0
RenderVideo {VIDEO} at (0,240) size 320x240
RenderBR {BR} at (320,480) size 0x0
RenderBlock (anonymous) at (0,514) size 769x18
RenderBR {BR} at (0,0) size 0x18
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,274) size 769x240
RenderVideo {VIDEO} at (0,0) size 320x240
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,514) size 769x0
layer at (8,42) size 320x240
RenderBlock (relative positioned) {DIV} at (0,0) size 320x240
layer at (8,266) size 320x18
......
......@@ -12,7 +12,8 @@ layer at (0,0) size 800x600
RenderInline {A} at (0,0) size 72x18 [color=#0000EE]
RenderText {#text} at (31,0) size 72x18
text run at (31,0) width 72: "closepopup"
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (103,0) size 4x18
text run at (103,0) width 4: " "
RenderTable {TABLE} at (0,18) size 40x28 [border: (1px outset #808080)]
RenderTableSection {TBODY} at (1,1) size 38x26
RenderTableRow {TR} at (0,2) size 38x22
......
2008-05-05 Dan Bernstein <mitz@apple.com>
Reviewed by Dave Hyatt.
- fix https://bugs.webkit.org/show_bug.cgi?id=18809
Forms with block level generated content and absolutely positioned labels break inline layout (fixed on reflow)
Test: fast/block/basic/adding-near-anonymous-block.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addChildToFlow): When adding a floating or
positioned object, if it follows an anonymous block, put it
inside the anonymous block. When adding an inline, check if it comes
after an anonymous block and put it in the anonymous block.
2008-05-05 Antti Koivisto <antti@apple.com>
Reviewed by Darin.
......@@ -151,70 +151,58 @@ void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChi
// Make sure we don't append things after :after-generated content if we have it.
if (!beforeChild && isAfterContent(lastChild()))
beforeChild = lastChild();
bool madeBoxesNonInline = false;
// If the requested beforeChild is not one of our children, then this is most likely because
// there is an anonymous block box within this object that contains the beforeChild. So
// just insert the child into the anonymous block box instead of here.
if (beforeChild && beforeChild->parent() != this) {
ASSERT(beforeChild->parent());
ASSERT(beforeChild->parent()->isAnonymousBlock());
if (newChild->isInline()) {
beforeChild->parent()->addChild(newChild,beforeChild);
return;
}
else if (beforeChild->parent()->firstChild() != beforeChild)
return beforeChild->parent()->addChild(newChild, beforeChild);
if (newChild->isInline() || beforeChild->parent()->firstChild() != beforeChild)
beforeChild->parent()->addChild(newChild, beforeChild);
else
return addChildToFlow(newChild, beforeChild->parent());
addChildToFlow(newChild, beforeChild->parent());
return;
}
// A block has to either have all of its children inline, or all of its children as blocks.
// So, if our children are currently inline and a block child has to be inserted, we move all our
// inline children into anonymous block boxes
if ( m_childrenInline && !newChild->isInline() && !newChild->isFloatingOrPositioned() )
{
// inline children into anonymous block boxes.
if (m_childrenInline && !newChild->isInline() && !newChild->isFloatingOrPositioned()) {
// This is a block with inline content. Wrap the inline content in anonymous blocks.
makeChildrenNonInline(beforeChild);
madeBoxesNonInline = true;
if (beforeChild && beforeChild->parent() != this) {
beforeChild = beforeChild->parent();
ASSERT(beforeChild->isAnonymousBlock());
ASSERT(beforeChild->parent() == this);
}
}
else if (!m_childrenInline && !newChild->isFloatingOrPositioned())
{
} else if (!m_childrenInline && (newChild->isFloatingOrPositioned() || newChild->isInline())) {
// If we're inserting an inline child but all of our children are blocks, then we have to make sure
// it is put into an anomyous block box. We try to use an existing anonymous box if possible, otherwise
// a new one is created and inserted into our list of children in the appropriate position.
if (newChild->isInline()) {
if (beforeChild) {
if (beforeChild->previousSibling() && beforeChild->previousSibling()->isAnonymousBlock()) {
beforeChild->previousSibling()->addChild(newChild);
return;
}
}
else {
if (lastChild() && lastChild()->isAnonymousBlock()) {
lastChild()->addChild(newChild);
return;
}
}
RenderObject* afterChild = beforeChild ? beforeChild->previousSibling() : lastChild();
// no suitable existing anonymous box - create a new one
if (afterChild && afterChild->isAnonymousBlock()) {
afterChild->addChild(newChild);
return;
}
if (newChild->isInline()) {
// No suitable existing anonymous box - create a new one.
RenderBlock* newBox = createAnonymousBlock();
RenderContainer::addChild(newBox,beforeChild);
RenderContainer::addChild(newBox, beforeChild);
newBox->addChild(newChild);
return;
}
}
RenderContainer::addChild(newChild,beforeChild);
RenderContainer::addChild(newChild, beforeChild);
// ### care about aligned stuff
if (madeBoxesNonInline && parent() && isAnonymousBlock())
......
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