Title: [112973] trunk
Revision
112973
Author
[email protected]
Date
2012-04-02 18:41:49 -0700 (Mon, 02 Apr 2012)

Log Message

<select> shouldn't intrude as a run-in.
https://bugs.webkit.org/show_bug.cgi?id=82829

Reviewed by Tony Chang.

Source/WebCore:

Matches Opera's behavior which also does not allow <select>
to intrude as a run-in into the neighbouring block.
IE and Firefox doesn't support run-ins, so can't compare behavior
with them.

Test: fast/runin/select-runin.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::handleRunInChild):

LayoutTests:

* fast/runin/select-runin-expected.txt: Added.
* fast/runin/select-runin.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (112972 => 112973)


--- trunk/LayoutTests/ChangeLog	2012-04-03 01:39:35 UTC (rev 112972)
+++ trunk/LayoutTests/ChangeLog	2012-04-03 01:41:49 UTC (rev 112973)
@@ -1,3 +1,13 @@
+2012-04-02  Abhishek Arya  <[email protected]>
+
+        <select> shouldn't intrude as a run-in.
+        https://bugs.webkit.org/show_bug.cgi?id=82829
+
+        Reviewed by Tony Chang.
+
+        * fast/runin/select-runin-expected.txt: Added.
+        * fast/runin/select-runin.html: Added.
+
 2012-04-02  Daniel Cheng  <[email protected]>
 
         fast/events/drop-handler-should-not-stop-navigate.html fails on Lion

Added: trunk/LayoutTests/fast/runin/select-runin-expected.txt (0 => 112973)


--- trunk/LayoutTests/fast/runin/select-runin-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/runin/select-runin-expected.txt	2012-04-03 01:41:49 UTC (rev 112973)
@@ -0,0 +1,2 @@
+Test passes if it does not crash. 
+

Added: trunk/LayoutTests/fast/runin/select-runin.html (0 => 112973)


--- trunk/LayoutTests/fast/runin/select-runin.html	                        (rev 0)
+++ trunk/LayoutTests/fast/runin/select-runin.html	2012-04-03 01:41:49 UTC (rev 112973)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+Test passes if it does not crash.
+<select multiple="multiple" id="select" style="-webkit-appearance: none; display: run-in;">
+<option></option>
+</select>
+<div></div>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+document.body.offsetTop;
+document.execCommand("SelectAll");
+var select = document.getElementById("select");
+select.removeChild(select.firstChild);
+</script>
+</html>
Property changes on: trunk/LayoutTests/fast/runin/select-runin.html
___________________________________________________________________

Added: svn:executable

Modified: trunk/Source/WebCore/ChangeLog (112972 => 112973)


--- trunk/Source/WebCore/ChangeLog	2012-04-03 01:39:35 UTC (rev 112972)
+++ trunk/Source/WebCore/ChangeLog	2012-04-03 01:41:49 UTC (rev 112973)
@@ -1,3 +1,20 @@
+2012-04-02  Abhishek Arya  <[email protected]>
+
+        <select> shouldn't intrude as a run-in.
+        https://bugs.webkit.org/show_bug.cgi?id=82829
+
+        Reviewed by Tony Chang.
+
+        Matches Opera's behavior which also does not allow <select>
+        to intrude as a run-in into the neighbouring block.
+        IE and Firefox doesn't support run-ins, so can't compare behavior
+        with them.
+
+        Test: fast/runin/select-runin.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::handleRunInChild):
+
 2012-04-02  Mark Pilgrim  <[email protected]>
 
         Call decrementStatsCounter directly

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (112972 => 112973)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-04-03 01:39:35 UTC (rev 112972)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-04-03 01:41:49 UTC (rev 112973)
@@ -1876,14 +1876,22 @@
     // block.
     if (!child->isRunIn() || !child->childrenInline())
         return false;
+
     // FIXME: We don't handle non-block elements with run-in for now.
     if (!child->isRenderBlock())
-        return false;  
+        return false;
+
     // Run-in child shouldn't intrude into the sibling block if it is part of a
     // continuation chain. In that case, treat it as a normal block.
     if (child->isElementContinuation() || child->virtualContinuation())
         return false;
 
+    // Check if this node is allowed to run-in. E.g. <select> expects its renderer to
+    // be a RenderListBox or RenderMenuList, and hence cannot be a RenderInline run-in.
+    Node* runInNode = child->node();
+    if (runInNode && runInNode->hasTagName(selectTag))
+        return false;
+
     RenderBlock* blockRunIn = toRenderBlock(child);
     RenderObject* curr = blockRunIn->nextSibling();
     if (!curr || !curr->isRenderBlock() || !curr->childrenInline() || curr->isRunIn() || curr->isAnonymous() || curr->isFloatingOrPositioned())
@@ -1905,7 +1913,6 @@
     children()->removeChildNode(this, blockRunIn);
 
     // Create an inline.
-    Node* runInNode = blockRunIn->node();
     RenderInline* inlineRunIn = new (renderArena()) RenderInline(runInNode ? runInNode : document());
     inlineRunIn->setStyle(blockRunIn->style());
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to