Title: [110598] trunk
- Revision
- 110598
- Author
- [email protected]
- Date
- 2012-03-13 13:15:53 -0700 (Tue, 13 Mar 2012)
Log Message
REGRESSION(r99369): File input button doesn't highlight when pressed
https://bugs.webkit.org/show_bug.cgi?id=79385
Reviewed by Kent Tamura.
Source/WebCore:
Fixes an issue where the file input button doesn't highlight on mouse press.
Currently we always override the active state of the button with whether
a dragged file is being hovered over the file input control (i.e. can the control
receive a dropped file; HTMLInputElement::canReceiveDroppedFiles()).
Instead, we should only override the active state of the button when the state
changes for whether we can receive dropped files (e.g. during a drag) so that
we honor the active state of the button when it is pressed.
Test: fast/forms/file/file-input-pressed-state.html
* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::RenderFileUploadControl):
(WebCore::RenderFileUploadControl::updateFromElement):
* rendering/RenderFileUploadControl.h:
(RenderFileUploadControl):
LayoutTests:
Add test to ensure that the file input button visually changes when pressed.
* fast/forms/file/file-input-pressed-state-expected.txt: Added.
* fast/forms/file/file-input-pressed-state.html: Added.
* platform/mac/fast/forms/file/file-input-pressed-state-expected.png: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (110597 => 110598)
--- trunk/LayoutTests/ChangeLog 2012-03-13 20:15:39 UTC (rev 110597)
+++ trunk/LayoutTests/ChangeLog 2012-03-13 20:15:53 UTC (rev 110598)
@@ -1,3 +1,16 @@
+2012-03-13 Daniel Bates <[email protected]>
+
+ REGRESSION(r99369): File input button doesn't highlight when pressed
+ https://bugs.webkit.org/show_bug.cgi?id=79385
+
+ Reviewed by Kent Tamura.
+
+ Add test to ensure that the file input button visually changes when pressed.
+
+ * fast/forms/file/file-input-pressed-state-expected.txt: Added.
+ * fast/forms/file/file-input-pressed-state.html: Added.
+ * platform/mac/fast/forms/file/file-input-pressed-state-expected.png: Added.
+
2012-03-13 Dana Jansens <[email protected]>
[chromium] Use CCOcclusionTracker for draw culling
Added: trunk/LayoutTests/fast/forms/file/file-input-pressed-state-expected.txt (0 => 110598)
--- trunk/LayoutTests/fast/forms/file/file-input-pressed-state-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/file/file-input-pressed-state-expected.txt 2012-03-13 20:15:53 UTC (rev 110598)
@@ -0,0 +1 @@
+
Added: trunk/LayoutTests/fast/forms/file/file-input-pressed-state.html (0 => 110598)
--- trunk/LayoutTests/fast/forms/file/file-input-pressed-state.html (rev 0)
+++ trunk/LayoutTests/fast/forms/file/file-input-pressed-state.html 2012-03-13 20:15:53 UTC (rev 110598)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText(true); // Dump pixel test result.
+</script>
+</head>
+<body>
+<!-- The output of this test is only meaningful as a pixel test result because form controls have a platform-specific look-and-feel. -->
+<!-- You can run this test either in DRT as a pixel test or by hand. -->
+<div id="description">
+<p>This tests that pressing on the file input button visually changes its appearance. For instance, when pressed, the button will have an Aqua background color when using the Blue appearance (System Preferences > General) on OS X.</p>
+<p>To run this test manually, click and hold on the input file button (below). This test PASSED if the button visually highlights when pressed. Otherwise, it FAILED.</p>
+</div>
+<input type="file" id="file">
+<script>
+if (window.eventSender) {
+ // Remove the descriptive text so as minimize pixel differences due to discrepancies in font rendering.
+ document.body.removeChild(document.getElementById("description"));
+
+ var file = document.getElementById("file");
+ var x = file.offsetLeft + 10;
+ var y = file.offsetTop + 10;
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+}
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/platform/mac/fast/forms/file/file-input-pressed-state-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/forms/file/file-input-pressed-state-expected.png
___________________________________________________________________
Added: svn:mime-type
Modified: trunk/Source/WebCore/ChangeLog (110597 => 110598)
--- trunk/Source/WebCore/ChangeLog 2012-03-13 20:15:39 UTC (rev 110597)
+++ trunk/Source/WebCore/ChangeLog 2012-03-13 20:15:53 UTC (rev 110598)
@@ -1,3 +1,27 @@
+2012-03-13 Daniel Bates <[email protected]>
+
+ REGRESSION(r99369): File input button doesn't highlight when pressed
+ https://bugs.webkit.org/show_bug.cgi?id=79385
+
+ Reviewed by Kent Tamura.
+
+ Fixes an issue where the file input button doesn't highlight on mouse press.
+
+ Currently we always override the active state of the button with whether
+ a dragged file is being hovered over the file input control (i.e. can the control
+ receive a dropped file; HTMLInputElement::canReceiveDroppedFiles()).
+ Instead, we should only override the active state of the button when the state
+ changes for whether we can receive dropped files (e.g. during a drag) so that
+ we honor the active state of the button when it is pressed.
+
+ Test: fast/forms/file/file-input-pressed-state.html
+
+ * rendering/RenderFileUploadControl.cpp:
+ (WebCore::RenderFileUploadControl::RenderFileUploadControl):
+ (WebCore::RenderFileUploadControl::updateFromElement):
+ * rendering/RenderFileUploadControl.h:
+ (RenderFileUploadControl):
+
2012-03-13 Dana Jansens <[email protected]>
[chromium] Use CCOcclusionTracker for draw culling
Modified: trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp (110597 => 110598)
--- trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp 2012-03-13 20:15:39 UTC (rev 110597)
+++ trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp 2012-03-13 20:15:53 UTC (rev 110598)
@@ -52,6 +52,7 @@
RenderFileUploadControl::RenderFileUploadControl(HTMLInputElement* input)
: RenderBlock(input)
+ , m_canReceiveDroppedFiles(input->canReceiveDroppedFiles())
{
}
@@ -72,8 +73,12 @@
// updateFromElement() eventually.
if (button->disabled() != newDisabled)
button->setDisabled(newDisabled);
-
- button->setActive(input->canReceiveDroppedFiles());
+
+ bool newCanReceiveDroppedFilesState = input->canReceiveDroppedFiles();
+ if (m_canReceiveDroppedFiles != newCanReceiveDroppedFilesState) {
+ m_canReceiveDroppedFiles = newCanReceiveDroppedFilesState;
+ button->setActive(newCanReceiveDroppedFilesState);
+ }
}
// This only supports clearing out the files, but that's OK because for
Modified: trunk/Source/WebCore/rendering/RenderFileUploadControl.h (110597 => 110598)
--- trunk/Source/WebCore/rendering/RenderFileUploadControl.h 2012-03-13 20:15:39 UTC (rev 110597)
+++ trunk/Source/WebCore/rendering/RenderFileUploadControl.h 2012-03-13 20:15:53 UTC (rev 110598)
@@ -55,6 +55,8 @@
virtual VisiblePosition positionForPoint(const LayoutPoint&);
HTMLInputElement* uploadButton() const;
+
+ bool m_canReceiveDroppedFiles;
};
inline RenderFileUploadControl* toRenderFileUploadControl(RenderObject* object)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes