Title: [138374] trunk
Revision
138374
Author
mih...@chromium.org
Date
2012-12-21 07:30:23 -0800 (Fri, 21 Dec 2012)

Log Message

Slow performance with <select> with many options and size >= 2
https://bugs.webkit.org/show_bug.cgi?id=105483

Source/WebCore:

Reviewed by Eric Seidel.

Avoids creating renderers for children of list <select>s that are not
<option> or <optgroup>. This is both more correct (no other browser
displays them) and provides a performance benefit (direct text children
of <select> would have O(N^2) behavior; this usually happened due to
whitespace between <option>...</option> tags).

Test: fast/forms/menulist-no-renderer-for-unexpected-children.html

* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::childShouldCreateRenderer):

LayoutTests:

Reviewed by Eric Seidel.

Test that checks that text and non-<option> and <optgroup> element
children of <select> do not get a renderer.

* fast/forms/menulist-no-renderer-for-unexpected-children-expected.txt: Added.
* fast/forms/menulist-no-renderer-for-unexpected-children.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (138373 => 138374)


--- trunk/LayoutTests/ChangeLog	2012-12-21 15:28:42 UTC (rev 138373)
+++ trunk/LayoutTests/ChangeLog	2012-12-21 15:30:23 UTC (rev 138374)
@@ -1,3 +1,16 @@
+2012-12-21  Mihai Parparita  <mih...@chromium.org>
+
+        Slow performance with <select> with many options and size >= 2
+        https://bugs.webkit.org/show_bug.cgi?id=105483
+
+        Reviewed by Eric Seidel.
+
+        Test that checks that text and non-<option> and <optgroup> element 
+        children of <select> do not get a renderer.
+
+        * fast/forms/menulist-no-renderer-for-unexpected-children-expected.txt: Added.
+        * fast/forms/menulist-no-renderer-for-unexpected-children.html: Added.
+
 2012-12-21  Sudarsana Nagineni  <sudarsana.nagin...@intel.com>
 
         Unreviewed EFL gardening.

Added: trunk/LayoutTests/fast/forms/menulist-no-renderer-for-unexpected-children-expected.txt (0 => 138374)


--- trunk/LayoutTests/fast/forms/menulist-no-renderer-for-unexpected-children-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/menulist-no-renderer-for-unexpected-children-expected.txt	2012-12-21 15:30:23 UTC (rev 138374)
@@ -0,0 +1,10 @@
+Check that a select control does not render children that are not <option> or <optgroup>.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS select.innerText is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/menulist-no-renderer-for-unexpected-children.html (0 => 138374)


--- trunk/LayoutTests/fast/forms/menulist-no-renderer-for-unexpected-children.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/menulist-no-renderer-for-unexpected-children.html	2012-12-21 15:30:23 UTC (rev 138374)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<script src=""
+<select size="2">
+  <option>PASS</option>FAIL
+</select>
+<script>
+description('Check that a select control does not render children that are not &lt;option&gt; or &lt;optgroup&gt;.');
+
+var select = document.querySelector('select');
+
+var div = select.appendChild(document.createElement('div'));
+div.innerText = 'FAIL';
+div.style.background = '';
+
+// innerText uses the render tree, and the "FAIL" text (from either the initial 
+// HTML or the dynamially inserted <div>) should not be in the render tree, thus 
+// not appear.
+shouldBeEqualToString('select.innerText', '');
+</script>
+<script src=""

Modified: trunk/Source/WebCore/ChangeLog (138373 => 138374)


--- trunk/Source/WebCore/ChangeLog	2012-12-21 15:28:42 UTC (rev 138373)
+++ trunk/Source/WebCore/ChangeLog	2012-12-21 15:30:23 UTC (rev 138374)
@@ -1,3 +1,21 @@
+2012-12-21  Mihai Parparita  <mih...@chromium.org>
+
+        Slow performance with <select> with many options and size >= 2
+        https://bugs.webkit.org/show_bug.cgi?id=105483
+
+        Reviewed by Eric Seidel.
+        
+        Avoids creating renderers for children of list <select>s that are not
+        <option> or <optgroup>. This is both more correct (no other browser
+        displays them) and provides a performance benefit (direct text children 
+        of <select> would have O(N^2) behavior; this usually happened due to
+        whitespace between <option>...</option> tags).
+
+        Test: fast/forms/menulist-no-renderer-for-unexpected-children.html
+
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::childShouldCreateRenderer):
+
 2012-12-21  Keishi Hattori  <kei...@webkit.org>
 
         Fix typing zero into multiple field input

Modified: trunk/Source/WebCore/html/HTMLSelectElement.cpp (138373 => 138374)


--- trunk/Source/WebCore/html/HTMLSelectElement.cpp	2012-12-21 15:28:42 UTC (rev 138373)
+++ trunk/Source/WebCore/html/HTMLSelectElement.cpp	2012-12-21 15:30:23 UTC (rev 138374)
@@ -348,7 +348,7 @@
     if (!HTMLFormControlElementWithState::childShouldCreateRenderer(childContext))
         return false;
     if (!usesMenuList())
-        return true;
+        return childContext.node()->hasTagName(HTMLNames::optionTag) || childContext.node()->hasTagName(HTMLNames::optgroupTag) || validationMessageShadowTreeContains(childContext.node());
     return validationMessageShadowTreeContains(childContext.node());
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to