Implement run-in remove child cases.
https://bugs.webkit.org/show_bug.cgi?id=86520
Move runin to original position when sibling element is destroyed.
Reviewed by David Hyatt.
Source/WebCore:
Tests: fast/runin/runin-remove-child-simple.html
fast/runin/runin-sibling-inline.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::willBeDestroyed):
(WebCore::RenderBlock::moveRunInUnderSiblingBlockIfNeeded):
If moveRunInUnderSiblingBlockIfNeeded is called when the sibling run-in block
is being destroyed, it means that the run-in is moving to original position and
we do not need to do nothing.
LayoutTests:
* fast/runin/runin-remove-child-simple-expected.txt: Added.
* fast/runin/runin-remove-child-simple.html: Added.
* fast/runin/runin-sibling-inline-expected.txt: Added.
* fast/runin/runin-sibling-inline.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150155 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 4e2c16f..6fb7a10 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2013-05-15 Igor Oliveira <igor.o@sisa.samsung.com>
+
+ Implement run-in remove child cases.
+ https://bugs.webkit.org/show_bug.cgi?id=86520
+
+ Move runin to original position when sibling element is destroyed.
+
+ Reviewed by David Hyatt.
+
+ * fast/runin/runin-remove-child-simple-expected.txt: Added.
+ * fast/runin/runin-remove-child-simple.html: Added.
+ * fast/runin/runin-sibling-inline-expected.txt: Added.
+ * fast/runin/runin-sibling-inline.html: Added.
+
2013-05-15 Dongseong Hwang <dongseong.hwang@intel.com>
Remove an overloaded strokeRect in <canvas>
diff --git a/LayoutTests/fast/runin/runin-remove-child-simple-expected.txt b/LayoutTests/fast/runin/runin-remove-child-simple-expected.txt
new file mode 100644
index 0000000..1d48412
--- /dev/null
+++ b/LayoutTests/fast/runin/runin-remove-child-simple-expected.txt
@@ -0,0 +1 @@
+This should
diff --git a/LayoutTests/fast/runin/runin-remove-child-simple.html b/LayoutTests/fast/runin/runin-remove-child-simple.html
new file mode 100644
index 0000000..2f26196
--- /dev/null
+++ b/LayoutTests/fast/runin/runin-remove-child-simple.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<style>
+.runin { display: run-in }
+</style>
+</head>
+<body>
+<div>
+ <div class="runin">This should </div>
+ <div id="t1">run in.</div>
+</div>
+</body>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+document.body.offsetTop;
+document.getElementById('t1').style.display = 'none';
+</script>
+</html>
diff --git a/LayoutTests/fast/runin/runin-sibling-inline-expected.txt b/LayoutTests/fast/runin/runin-sibling-inline-expected.txt
new file mode 100644
index 0000000..f0e0ad6
--- /dev/null
+++ b/LayoutTests/fast/runin/runin-sibling-inline-expected.txt
@@ -0,0 +1,2 @@
+This should
+run in.
diff --git a/LayoutTests/fast/runin/runin-sibling-inline.html b/LayoutTests/fast/runin/runin-sibling-inline.html
new file mode 100644
index 0000000..c31f1a3
--- /dev/null
+++ b/LayoutTests/fast/runin/runin-sibling-inline.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<style>
+.runin { display: run-in }
+</style>
+</head>
+<body>
+<div>
+ <div class="runin">This should </div>
+ <div id="t1">run in.</div>
+</div>
+</body>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+document.body.offsetTop;
+document.getElementById('t1').style.display = 'inline';
+</script>
+</html>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 5067358..c594e35 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2013-05-15 Igor Oliveira <igor.o@sisa.samsung.com>
+
+ Implement run-in remove child cases.
+ https://bugs.webkit.org/show_bug.cgi?id=86520
+
+ Move runin to original position when sibling element is destroyed.
+
+ Reviewed by David Hyatt.
+
+ Tests: fast/runin/runin-remove-child-simple.html
+ fast/runin/runin-sibling-inline.html
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::willBeDestroyed):
+ (WebCore::RenderBlock::moveRunInUnderSiblingBlockIfNeeded):
+ If moveRunInUnderSiblingBlockIfNeeded is called when the sibling run-in block
+ is being destroyed, it means that the run-in is moving to original position and
+ we do not need to do nothing.
+
2013-05-15 Anders Carlsson <andersca@apple.com>
Remove WebSocketHandshakeResponse class
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index d709616..03542fc 100644
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -256,6 +256,11 @@
// Mark as being destroyed to avoid trouble with merges in removeChild().
m_beingDestroyed = true;
+ if (!documentBeingDestroyed()) {
+ if (firstChild() && firstChild()->isRunIn())
+ moveRunInToOriginalPosition(firstChild());
+ }
+
// Make sure to destroy anonymous children first while they are still connected to the rest of the tree, so that they will
// properly dirty line boxes that they are removed from. Effects that do :before/:after only on hover could crash otherwise.
children()->destroyLeftoverChildren();
@@ -1982,6 +1987,9 @@
if (!curr || !curr->isRenderBlock() || !curr->childrenInline())
return;
+ if (toRenderBlock(curr)->beingDestroyed())
+ return;
+
// Per CSS3, "A run-in cannot run in to a block that already starts with a
// run-in or that itself is a run-in".
if (curr->isRunIn() || (curr->firstChild() && curr->firstChild()->isRunIn()))