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

Side by Side Diff: Source/WebKit/chromium/src/PopupContainer.cpp

Issue 15877005: Popup menu is not aligned with the select element if inside a transformed webview. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added comment Created 7 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011, Google Inc. All rights reserved. 2 * Copyright (c) 2011, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 // displayed exactly the same width as the select box. 379 // displayed exactly the same width as the select box.
380 listBox()->setBaseWidth(max(controlSize.width() - borderSize * 2, 0)); 380 listBox()->setBaseWidth(max(controlSize.width() - borderSize * 2, 0));
381 381
382 listBox()->updateFromElement(); 382 listBox()->updateFromElement();
383 383
384 // We set the selected item in updateFromElement(), and disregard the 384 // We set the selected item in updateFromElement(), and disregard the
385 // index passed into this function (same as Webkit's PopupMenuWin.cpp) 385 // index passed into this function (same as Webkit's PopupMenuWin.cpp)
386 // FIXME: make sure this is correct, and add an assertion. 386 // FIXME: make sure this is correct, and add an assertion.
387 // ASSERT(popupWindow(popup)->listBox()->selectedIndex() == index); 387 // ASSERT(popupWindow(popup)->listBox()->selectedIndex() == index);
388 388
389 // Save and convert the controlPosition to main window coords. 389 // Save and convert the controlPosition to main window coords. Each point is converted separately
390 m_controlPosition = controlPosition; 390 // to window coordinates because the control could be in a transformed webvi ew and then each point
391 IntPoint delta = v->contentsToWindow(IntPoint()); 391 // would be transformed by a different delta.
392 m_controlPosition.move(delta.x(), delta.y()); 392 m_controlPosition.setP1(v->contentsToWindow(IntPoint(controlPosition.p1().x( ), controlPosition.p1().y())));
393 m_controlPosition.setP2(v->contentsToWindow(IntPoint(controlPosition.p2().x( ), controlPosition.p2().y())));
394 m_controlPosition.setP3(v->contentsToWindow(IntPoint(controlPosition.p3().x( ), controlPosition.p3().y())));
395 m_controlPosition.setP4(v->contentsToWindow(IntPoint(controlPosition.p4().x( ), controlPosition.p4().y())));
396
393 m_controlSize = controlSize; 397 m_controlSize = controlSize;
394 398
395 // Position at (0, 0) since the frameRect().location() is relative to the 399 // Position at (0, 0) since the frameRect().location() is relative to the
396 // parent WebWidget. 400 // parent WebWidget.
397 setFrameRect(IntRect(IntPoint(), controlSize)); 401 setFrameRect(IntRect(IntPoint(), controlSize));
398 showPopup(v); 402 showPopup(v);
399 } 403 }
400 404
401 IntRect PopupContainer::refresh(const IntRect& targetControlRect) 405 IntRect PopupContainer::refresh(const IntRect& targetControlRect)
402 { 406 {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 456
453 String PopupContainer::getSelectedItemToolTip() 457 String PopupContainer::getSelectedItemToolTip()
454 { 458 {
455 // We cannot use m_popupClient->selectedIndex() to choose tooltip message, 459 // We cannot use m_popupClient->selectedIndex() to choose tooltip message,
456 // because the selectedIndex() might return final selected index, not 460 // because the selectedIndex() might return final selected index, not
457 // hovering selection. 461 // hovering selection.
458 return listBox()->m_popupClient->itemToolTip(listBox()->m_selectedIndex); 462 return listBox()->m_popupClient->itemToolTip(listBox()->m_selectedIndex);
459 } 463 }
460 464
461 } // namespace WebCore 465 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698