Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Unified Diff: third_party/WebKit/WebCore/html/HTMLSelectElement.cpp

Issue 21184: WebKit merge 40722:40785 (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/WebCore/html/HTMLSelectElement.cpp
===================================================================
--- third_party/WebKit/WebCore/html/HTMLSelectElement.cpp (revision 9391)
+++ third_party/WebKit/WebCore/html/HTMLSelectElement.cpp (working copy)
@@ -711,9 +711,18 @@
{
if (evt->type() == eventNames().mousedownEvent && evt->isMouseEvent() && static_cast<MouseEvent*>(evt)->button() == LeftButton) {
focus();
-
- MouseEvent* mEvt = static_cast<MouseEvent*>(evt);
- int listIndex = static_cast<RenderListBox*>(renderer())->listIndexAtOffset(mEvt->offsetX(), mEvt->offsetY());
+
+ // Convert to coords relative to the list box if needed.
+ MouseEvent* mouseEvent = static_cast<MouseEvent*>(evt);
+ int offsetX = mouseEvent->offsetX();
+ int offsetY = mouseEvent->offsetY();
+ Node* target = evt->target()->toNode();
+ if (target != this) {
+ FloatPoint absPos = renderer()->absoluteToLocal(FloatPoint(offsetX, offsetY), false, true);
+ offsetX = absPos.x();
+ offsetY = absPos.y();
+ }
+ int listIndex = static_cast<RenderListBox*>(renderer())->listIndexAtOffset(offsetX, offsetY);
if (listIndex >= 0) {
// Save the selection so it can be compared to the new selection when we call onChange during mouseup, or after autoscroll finishes.
saveLastSelection();
@@ -722,13 +731,13 @@
bool multiSelectKeyPressed = false;
#if PLATFORM(MAC)
- multiSelectKeyPressed = mEvt->metaKey();
+ multiSelectKeyPressed = mouseEvent->metaKey();
#else
- multiSelectKeyPressed = mEvt->ctrlKey();
+ multiSelectKeyPressed = mouseEvent->ctrlKey();
#endif
- bool shiftSelect = multiple() && mEvt->shiftKey();
- bool multiSelect = multiple() && multiSelectKeyPressed && !mEvt->shiftKey();
+ bool shiftSelect = multiple() && mouseEvent->shiftKey();
+ bool multiSelect = multiple() && multiSelectKeyPressed && !mouseEvent->shiftKey();
HTMLElement* clickedElement = listItems()[listIndex];
HTMLOptionElement* option = 0;
« no previous file with comments | « third_party/WebKit/WebCore/html/HTMLParser.cpp ('k') | third_party/WebKit/WebCore/inspector/InspectorController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698