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

Side by Side Diff: third_party/WebKit/Source/web/WebPagePopupImpl.cpp

Issue 1833843002: Popup loosing focus through keyboard events should update HTMLSelectElement display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added check Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/WebViewImpl.cpp » ('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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 return; 484 return;
485 m_page->focusController().setFocused(enable); 485 m_page->focusController().setFocused(enable);
486 if (enable) 486 if (enable)
487 m_page->focusController().setActive(true); 487 m_page->focusController().setActive(true);
488 } 488 }
489 489
490 void WebPagePopupImpl::close() 490 void WebPagePopupImpl::close()
491 { 491 {
492 m_closing = true; 492 m_closing = true;
493 // In case closePopup() was not called. 493 // In case closePopup() was not called.
494 if (m_page) { 494 if (m_page)
495 destroyPage(); 495 cancel();
496 m_popupClient->didClosePopup(); 496 m_widgetClient = nullptr;
497 m_webView->cleanupPagePopup();
498 }
499 m_widgetClient = 0;
500 deref(); 497 deref();
501 } 498 }
502 499
503 void WebPagePopupImpl::closePopup() 500 void WebPagePopupImpl::closePopup()
504 { 501 {
505 // This function can be called in EventDispatchForbiddenScope for the main 502 // This function can be called in EventDispatchForbiddenScope for the main
506 // document, and the following operations dispatch some events. It's safe 503 // document, and the following operations dispatch some events. It's safe
507 // because web authors can't listen the events. 504 // because web authors can't listen the events.
508 EventDispatchForbiddenScope::AllowUserAgentEvents allowEvents; 505 EventDispatchForbiddenScope::AllowUserAgentEvents allowEvents;
509 506
510 if (m_page) { 507 if (m_page) {
511 toLocalFrame(m_page->mainFrame())->loader().stopAllLoaders(); 508 toLocalFrame(m_page->mainFrame())->loader().stopAllLoaders();
512 PagePopupSupplement::uninstall(*toLocalFrame(m_page->mainFrame())); 509 PagePopupSupplement::uninstall(*toLocalFrame(m_page->mainFrame()));
513 } 510 }
511 bool closeAlreadyCalled = m_closing;
514 m_closing = true; 512 m_closing = true;
515 513
516 destroyPage(); 514 destroyPage();
517 515
518 // m_widgetClient might be 0 because this widget might be already closed. 516 // m_widgetClient might be 0 because this widget might be already closed.
519 if (m_widgetClient) { 517 if (m_widgetClient && !closeAlreadyCalled) {
520 // closeWidgetSoon() will call this->close() later. 518 // closeWidgetSoon() will call this->close() later.
521 m_widgetClient->closeWidgetSoon(); 519 m_widgetClient->closeWidgetSoon();
522 } 520 }
523 521
524 m_popupClient->didClosePopup(); 522 m_popupClient->didClosePopup();
523 m_webView->cleanupPagePopup();
525 } 524 }
526 525
527 LocalDOMWindow* WebPagePopupImpl::window() 526 LocalDOMWindow* WebPagePopupImpl::window()
528 { 527 {
529 return m_page->deprecatedLocalMainFrame()->localDOMWindow(); 528 return m_page->deprecatedLocalMainFrame()->localDOMWindow();
530 } 529 }
531 530
532 void WebPagePopupImpl::layoutAndPaintAsync(WebLayoutAndPaintAsyncCallback* callb ack) 531 void WebPagePopupImpl::layoutAndPaintAsync(WebLayoutAndPaintAsyncCallback* callb ack)
533 { 532 {
534 m_layerTreeView->layoutAndPaintAsync(callback); 533 m_layerTreeView->layoutAndPaintAsync(callback);
(...skipping 26 matching lines...) Expand all
561 // A WebPagePopupImpl instance usually has two references. 560 // A WebPagePopupImpl instance usually has two references.
562 // - One owned by the instance itself. It represents the visible widget. 561 // - One owned by the instance itself. It represents the visible widget.
563 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the 562 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the
564 // WebPagePopupImpl to close. 563 // WebPagePopupImpl to close.
565 // We need them because the closing operation is asynchronous and the widget 564 // We need them because the closing operation is asynchronous and the widget
566 // can be closed while the WebViewImpl is unaware of it. 565 // can be closed while the WebViewImpl is unaware of it.
567 return adoptRef(new WebPagePopupImpl(client)).leakRef(); 566 return adoptRef(new WebPagePopupImpl(client)).leakRef();
568 } 567 }
569 568
570 } // namespace blink 569 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698