diff options
author | dbates@webkit.org <dbates@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-03-13 20:15:53 +0000 |
---|---|---|
committer | dbates@webkit.org <dbates@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-03-13 20:15:53 +0000 |
commit | 4f7f54e53c34b943c093cc2355fb020a3c61113a (patch) | |
tree | bef91cb2ea09ff17c8445f347f5b3df1e07f8b7c /third_party | |
parent | 05799bf3ce47a6ce70c3743de06c4397b3b2654f (diff) | |
download | chromium_src-4f7f54e53c34b943c093cc2355fb020a3c61113a.zip chromium_src-4f7f54e53c34b943c093cc2355fb020a3c61113a.tar.gz chromium_src-4f7f54e53c34b943c093cc2355fb020a3c61113a.tar.bz2 |
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.
git-svn-id: svn://svn.chromium.org/blink/trunk@110598 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party')
6 files changed, 77 insertions, 2 deletions
diff --git a/third_party/WebKit/LayoutTests/ChangeLog b/third_party/WebKit/LayoutTests/ChangeLog index b3268f1..d687c75 100644 --- a/third_party/WebKit/LayoutTests/ChangeLog +++ b/third_party/WebKit/LayoutTests/ChangeLog @@ -1,3 +1,16 @@ +2012-03-13 Daniel Bates <dbates@webkit.org> + + 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 <danakj@chromium.org> [chromium] Use CCOcclusionTracker for draw culling diff --git a/third_party/WebKit/LayoutTests/fast/forms/file/file-input-pressed-state-expected.txt b/third_party/WebKit/LayoutTests/fast/forms/file/file-input-pressed-state-expected.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/forms/file/file-input-pressed-state-expected.txt @@ -0,0 +1 @@ + diff --git a/third_party/WebKit/LayoutTests/fast/forms/file/file-input-pressed-state.html b/third_party/WebKit/LayoutTests/fast/forms/file/file-input-pressed-state.html new file mode 100644 index 0000000..25f69e7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/forms/file/file-input-pressed-state.html @@ -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> diff --git a/third_party/WebKit/Source/WebCore/ChangeLog b/third_party/WebKit/Source/WebCore/ChangeLog index 1ea0639..0d5c830 100644 --- a/third_party/WebKit/Source/WebCore/ChangeLog +++ b/third_party/WebKit/Source/WebCore/ChangeLog @@ -1,3 +1,27 @@ +2012-03-13 Daniel Bates <dbates@webkit.org> + + 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 <danakj@chromium.org> [chromium] Use CCOcclusionTracker for draw culling diff --git a/third_party/WebKit/Source/WebCore/rendering/RenderFileUploadControl.cpp b/third_party/WebKit/Source/WebCore/rendering/RenderFileUploadControl.cpp index af023a3..07dd77f 100644 --- a/third_party/WebKit/Source/WebCore/rendering/RenderFileUploadControl.cpp +++ b/third_party/WebKit/Source/WebCore/rendering/RenderFileUploadControl.cpp @@ -52,6 +52,7 @@ const int buttonShadowHeight = 2; RenderFileUploadControl::RenderFileUploadControl(HTMLInputElement* input) : RenderBlock(input) + , m_canReceiveDroppedFiles(input->canReceiveDroppedFiles()) { } @@ -72,8 +73,12 @@ void RenderFileUploadControl::updateFromElement() // 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 diff --git a/third_party/WebKit/Source/WebCore/rendering/RenderFileUploadControl.h b/third_party/WebKit/Source/WebCore/rendering/RenderFileUploadControl.h index 11d959d..11015eb 100644 --- a/third_party/WebKit/Source/WebCore/rendering/RenderFileUploadControl.h +++ b/third_party/WebKit/Source/WebCore/rendering/RenderFileUploadControl.h @@ -55,6 +55,8 @@ private: virtual VisiblePosition positionForPoint(const LayoutPoint&); HTMLInputElement* uploadButton() const; + + bool m_canReceiveDroppedFiles; }; inline RenderFileUploadControl* toRenderFileUploadControl(RenderObject* object) |