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

Side by Side Diff: Source/web/PopupContainer.cpp

Issue 1013303004: Fix issue on <select> style change when popup is visible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed test expectation Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/ExternalPopupMenuTest.cpp ('k') | Source/web/PopupListBox.h » ('j') | 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 if (!m_listBox->parent()) 233 if (!m_listBox->parent())
234 m_listBox->setParent(this); 234 m_listBox->setParent(this);
235 235
236 m_listBox->scrollToRevealSelection(); 236 m_listBox->scrollToRevealSelection();
237 237
238 invalidate(); 238 invalidate();
239 } 239 }
240 240
241 void PopupContainer::hidePopup() 241 void PopupContainer::hidePopup()
242 { 242 {
243 m_listBox->abandon(); 243 m_listBox->cancel();
244 } 244 }
245 245
246 void PopupContainer::notifyPopupHidden() 246 void PopupContainer::notifyPopupHidden()
247 { 247 {
248 if (!m_popupOpen) 248 if (!m_popupOpen)
249 return; 249 return;
250 m_popupOpen = false; 250 m_popupOpen = false;
251 251
252 // With Oilpan, we cannot assume that the FrameView's LocalFrame's 252 // With Oilpan, we cannot assume that the FrameView's LocalFrame's
253 // page is still available, as the LocalFrame itself may have been 253 // page is still available, as the LocalFrame itself may have been
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 } 346 }
347 347
348 bool PopupContainer::handleKeyEvent(const PlatformKeyboardEvent& event) 348 bool PopupContainer::handleKeyEvent(const PlatformKeyboardEvent& event)
349 { 349 {
350 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); 350 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
351 return m_listBox->handleKeyEvent(event); 351 return m_listBox->handleKeyEvent(event);
352 } 352 }
353 353
354 void PopupContainer::hide() 354 void PopupContainer::hide()
355 { 355 {
356 m_listBox->abandon(); 356 m_listBox->cancel();
357 } 357 }
358 358
359 void PopupContainer::paint(GraphicsContext* gc, const IntRect& paintRect) 359 void PopupContainer::paint(GraphicsContext* gc, const IntRect& paintRect)
360 { 360 {
361 TransformRecorder transformRecorder(*gc, *this, AffineTransform::translation (x(), y())); 361 TransformRecorder transformRecorder(*gc, *this, AffineTransform::translation (x(), y()));
362 IntRect adjustedPaintRect = intersection(paintRect, frameRect()); 362 IntRect adjustedPaintRect = intersection(paintRect, frameRect());
363 adjustedPaintRect.moveBy(-location()); 363 adjustedPaintRect.moveBy(-location());
364 364
365 m_listBox->paint(gc, adjustedPaintRect); 365 m_listBox->paint(gc, adjustedPaintRect);
366 paintBorder(gc, adjustedPaintRect); 366 paintBorder(gc, adjustedPaintRect);
(...skipping 21 matching lines...) Expand all
388 { 388 {
389 return m_frameView->frame().page()->chrome().client(); 389 return m_frameView->frame().page()->chrome().client();
390 } 390 }
391 391
392 void PopupContainer::showInRect(const FloatQuad& controlPosition, const IntSize& controlSize, FrameView* v, int index) 392 void PopupContainer::showInRect(const FloatQuad& controlPosition, const IntSize& controlSize, FrameView* v, int index)
393 { 393 {
394 // The controlSize is the size of the select box. It's usually larger than 394 // The controlSize is the size of the select box. It's usually larger than
395 // we need. Subtract border size so that usually the container will be 395 // we need. Subtract border size so that usually the container will be
396 // displayed exactly the same width as the select box. 396 // displayed exactly the same width as the select box.
397 m_listBox->setBaseWidth(std::max(controlSize.width() - borderSize * 2, 0)); 397 m_listBox->setBaseWidth(std::max(controlSize.width() - borderSize * 2, 0));
398 m_listBox->setOriginalIndex(m_listBox->m_popupClient->selectedIndex()); 398 m_listBox->setSelectedIndex(m_listBox->m_popupClient->selectedIndex());
399 m_listBox->updateFromElement(); 399 m_listBox->updateFromElement();
400 400
401 // We set the selected item in updateFromElement(), and disregard the 401 // We set the selected item in updateFromElement(), and disregard the
402 // index passed into this function (same as Webkit's PopupMenuWin.cpp) 402 // index passed into this function (same as Webkit's PopupMenuWin.cpp)
403 // FIXME: make sure this is correct, and add an assertion. 403 // FIXME: make sure this is correct, and add an assertion.
404 // ASSERT(popupWindow(popup)->listBox()->selectedIndex() == index); 404 // ASSERT(popupWindow(popup)->listBox()->selectedIndex() == index);
405 405
406 // Save and convert the controlPosition to main window coords. Each point is converted separately 406 // Save and convert the controlPosition to main window coords. Each point is converted separately
407 // to window coordinates because the control could be in a transformed webvi ew and then each point 407 // to window coordinates because the control could be in a transformed webvi ew and then each point
408 // would be transformed by a different delta. 408 // would be transformed by a different delta.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 } 493 }
494 494
495 IntPoint PopupContainer::convertSelfToChild(const Widget* child, const IntPoint& point) const 495 IntPoint PopupContainer::convertSelfToChild(const Widget* child, const IntPoint& point) const
496 { 496 {
497 IntPoint newPoint = point; 497 IntPoint newPoint = point;
498 newPoint.moveBy(-child->location()); 498 newPoint.moveBy(-child->location());
499 return newPoint; 499 return newPoint;
500 } 500 }
501 501
502 } // namespace blink 502 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/ExternalPopupMenuTest.cpp ('k') | Source/web/PopupListBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698