Title: [94059] branches/chromium/835/Source/WebCore/rendering/RenderFileUploadControl.cpp
Revision
94059
Author
[email protected]
Date
2011-08-30 01:07:08 -0700 (Tue, 30 Aug 2011)

Log Message

Merge 94045 - 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.

[email protected]
BUG=94710
Review URL: http://codereview.chromium.org/7792032

Modified Paths

Diff

Modified: branches/chromium/835/Source/WebCore/rendering/RenderFileUploadControl.cpp (94058 => 94059)


--- branches/chromium/835/Source/WebCore/rendering/RenderFileUploadControl.cpp	2011-08-30 08:04:34 UTC (rev 94058)
+++ branches/chromium/835/Source/WebCore/rendering/RenderFileUploadControl.cpp	2011-08-30 08:07:08 UTC (rev 94059)
@@ -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