Title: [94045] trunk
Revision
94045
Author
[email protected]
Date
2011-08-29 22:22:37 -0700 (Mon, 29 Aug 2011)

Log Message

REGRESSION(r88115): Disabling a file upload control causes an endless busyloop.
https://bugs.webkit.org/show_bug.cgi?id=66659

Reviewed by Darin Adler.

Source/WebCore:

Test: fast/forms/file/disabling-file-busy-loop.html

* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::updateFromElement):
Don't call setDisabled() if the disabled status is not changed.
setDisabled() causes styleRecalc(), and
HTMLFormControlElement::styleRecalc() causes
updateFromElement(). updateFromElement() should not call
setDisabled() again.

LayoutTests:

* fast/forms/file/disabling-file-busy-loop-expected.txt: Added.
* fast/forms/file/disabling-file-busy-loop.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (94044 => 94045)


--- trunk/LayoutTests/ChangeLog	2011-08-30 05:01:47 UTC (rev 94044)
+++ trunk/LayoutTests/ChangeLog	2011-08-30 05:22:37 UTC (rev 94045)
@@ -1,3 +1,13 @@
+2011-08-25  Kent Tamura  <[email protected]>
+
+        REGRESSION(r88115): Disabling a file upload control causes an endless busyloop.
+        https://bugs.webkit.org/show_bug.cgi?id=66659
+
+        Reviewed by Darin Adler.
+
+        * fast/forms/file/disabling-file-busy-loop-expected.txt: Added.
+        * fast/forms/file/disabling-file-busy-loop.html: Added.
+
 2011-08-29  David Levin  <[email protected]>
 
         [chromium] Minor update for test that is timing out.

Added: trunk/LayoutTests/fast/forms/file/disabling-file-busy-loop-expected.txt (0 => 94045)


--- trunk/LayoutTests/fast/forms/file/disabling-file-busy-loop-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/file/disabling-file-busy-loop-expected.txt	2011-08-30 05:22:37 UTC (rev 94045)
@@ -0,0 +1,2 @@
+
+PASS if this text is visible.
Property changes on: trunk/LayoutTests/fast/forms/file/disabling-file-busy-loop-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/forms/file/disabling-file-busy-loop.html (0 => 94045)


--- trunk/LayoutTests/fast/forms/file/disabling-file-busy-loop.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/file/disabling-file-busy-loop.html	2011-08-30 05:22:37 UTC (rev 94045)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.foo[disabled] {}
+</style>
+</head>
+<body>
+<input type="file" id="fileUpload">
+<div id=console></div>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+document.getElementById('fileUpload').disabled = true;
+document.getElementById('console').innerText = 'PASS if this text is visible.';
+</script>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/forms/file/disabling-file-busy-loop.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (94044 => 94045)


--- trunk/Source/WebCore/ChangeLog	2011-08-30 05:01:47 UTC (rev 94044)
+++ trunk/Source/WebCore/ChangeLog	2011-08-30 05:22:37 UTC (rev 94045)
@@ -1,3 +1,20 @@
+2011-08-25  Kent Tamura  <[email protected]>
+
+        REGRESSION(r88115): Disabling a file upload control causes an endless busyloop.
+        https://bugs.webkit.org/show_bug.cgi?id=66659
+
+        Reviewed by Darin Adler.
+
+        Test: fast/forms/file/disabling-file-busy-loop.html
+
+        * rendering/RenderFileUploadControl.cpp:
+        (WebCore::RenderFileUploadControl::updateFromElement):
+        Don't call setDisabled() if the disabled status is not changed.
+        setDisabled() causes styleRecalc(), and
+        HTMLFormControlElement::styleRecalc() causes
+        updateFromElement(). updateFromElement() should not call
+        setDisabled() again.
+
 2011-08-29  Daniel Bates  <[email protected]>
 
         Add HAVE(VASPRINTF) macro to test for vasprintf() support

Modified: trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp (94044 => 94045)


--- trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp	2011-08-30 05:01:47 UTC (rev 94044)
+++ trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp	2011-08-30 05:22:37 UTC (rev 94045)
@@ -63,8 +63,15 @@
     HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
     ASSERT(input->isFileUpload());
 
-    if (HTMLInputElement* button = uploadButton())
-        button->setDisabled(!theme()->isEnabled(this));
+    if (HTMLInputElement* button = uploadButton()) {
+        bool newDisabled = !theme()->isEnabled(this);
+        // We should avoid to call HTMLFormControlElement::setDisabled() as
+        // possible because setAttribute() in setDisabled() can cause style
+        // recalculation, and HTMLFormControlElement::recalcStyle() calls
+        // updateFromElement() eventually.
+        if (button->disabled() != newDisabled)
+            button->setDisabled(newDisabled);
+    }
 
     // This only supports clearing out the files, but that's OK because for
     // security reasons that's the only change the DOM is allowed to make.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to