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

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

Issue 14735003: Remove compile time flag ENABLE_PAGE_POPUP . This is part of an overall effort to remove unneeded c… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 7 years, 7 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 | « Source/WebKit/chromium/src/WebViewImpl.h ('k') | Source/core/dom/ContextFeatures.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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 m_client->setMouseOverURL(WebURL()); 528 m_client->setMouseOverURL(WebURL());
529 PageWidgetEventHandler::handleMouseLeave(mainFrame, event); 529 PageWidgetEventHandler::handleMouseLeave(mainFrame, event);
530 } 530 }
531 531
532 void WebViewImpl::handleMouseDown(Frame& mainFrame, const WebMouseEvent& event) 532 void WebViewImpl::handleMouseDown(Frame& mainFrame, const WebMouseEvent& event)
533 { 533 {
534 // If there is a popup open, close it as the user is clicking on the page (o utside of the 534 // If there is a popup open, close it as the user is clicking on the page (o utside of the
535 // popup). We also save it so we can prevent a click on an element from imme diately 535 // popup). We also save it so we can prevent a click on an element from imme diately
536 // reopening the same popup. 536 // reopening the same popup.
537 RefPtr<WebCore::PopupContainer> selectPopup; 537 RefPtr<WebCore::PopupContainer> selectPopup;
538 #if ENABLE(PAGE_POPUP)
539 RefPtr<WebPagePopupImpl> pagePopup; 538 RefPtr<WebPagePopupImpl> pagePopup;
540 #endif
541 if (event.button == WebMouseEvent::ButtonLeft) { 539 if (event.button == WebMouseEvent::ButtonLeft) {
542 selectPopup = m_selectPopup; 540 selectPopup = m_selectPopup;
543 #if ENABLE(PAGE_POPUP)
544 pagePopup = m_pagePopup; 541 pagePopup = m_pagePopup;
545 #endif
546 hidePopups(); 542 hidePopups();
547 ASSERT(!m_selectPopup); 543 ASSERT(!m_selectPopup);
548 #if ENABLE(PAGE_POPUP)
549 ASSERT(!m_pagePopup); 544 ASSERT(!m_pagePopup);
550 #endif
551 } 545 }
552 546
553 m_lastMouseDownPoint = WebPoint(event.x, event.y); 547 m_lastMouseDownPoint = WebPoint(event.x, event.y);
554 548
555 if (event.button == WebMouseEvent::ButtonLeft) { 549 if (event.button == WebMouseEvent::ButtonLeft) {
556 IntPoint point(event.x, event.y); 550 IntPoint point(event.x, event.y);
557 point = m_page->mainFrame()->view()->windowToContents(point); 551 point = m_page->mainFrame()->view()->windowToContents(point);
558 HitTestResult result(m_page->mainFrame()->eventHandler()->hitTestResultA tPoint(point)); 552 HitTestResult result(m_page->mainFrame()->eventHandler()->hitTestResultA tPoint(point));
559 Node* hitNode = result.innerNonSharedNode(); 553 Node* hitNode = result.innerNonSharedNode();
560 554
561 // Take capture on a mouse down on a plugin so we can send it mouse even ts. 555 // Take capture on a mouse down on a plugin so we can send it mouse even ts.
562 if (hitNode && hitNode->renderer() && hitNode->renderer()->isEmbeddedObj ect()) { 556 if (hitNode && hitNode->renderer() && hitNode->renderer()->isEmbeddedObj ect()) {
563 m_mouseCaptureNode = hitNode; 557 m_mouseCaptureNode = hitNode;
564 TRACE_EVENT_ASYNC_BEGIN0("webkit", "capturing mouse", this); 558 TRACE_EVENT_ASYNC_BEGIN0("webkit", "capturing mouse", this);
565 } 559 }
566 } 560 }
567 561
568 PageWidgetEventHandler::handleMouseDown(mainFrame, event); 562 PageWidgetEventHandler::handleMouseDown(mainFrame, event);
569 563
570 if (m_selectPopup && m_selectPopup == selectPopup) { 564 if (m_selectPopup && m_selectPopup == selectPopup) {
571 // That click triggered a select popup which is the same as the one that 565 // That click triggered a select popup which is the same as the one that
572 // was showing before the click. It means the user clicked the select 566 // was showing before the click. It means the user clicked the select
573 // while the popup was showing, and as a result we first closed then 567 // while the popup was showing, and as a result we first closed then
574 // immediately reopened the select popup. It needs to be closed. 568 // immediately reopened the select popup. It needs to be closed.
575 hideSelectPopup(); 569 hideSelectPopup();
576 } 570 }
577 571
578 #if ENABLE(PAGE_POPUP)
579 if (m_pagePopup && pagePopup && m_pagePopup->hasSamePopupClient(pagePopup.ge t())) { 572 if (m_pagePopup && pagePopup && m_pagePopup->hasSamePopupClient(pagePopup.ge t())) {
580 // That click triggered a page popup that is the same as the one we just closed. 573 // That click triggered a page popup that is the same as the one we just closed.
581 // It needs to be closed. 574 // It needs to be closed.
582 closePagePopup(m_pagePopup.get()); 575 closePagePopup(m_pagePopup.get());
583 } 576 }
584 #endif
585 577
586 // Dispatch the contextmenu event regardless of if the click was swallowed. 578 // Dispatch the contextmenu event regardless of if the click was swallowed.
587 // On Windows, we handle it on mouse up, not down. 579 // On Windows, we handle it on mouse up, not down.
588 #if OS(DARWIN) 580 #if OS(DARWIN)
589 if (event.button == WebMouseEvent::ButtonRight 581 if (event.button == WebMouseEvent::ButtonRight
590 || (event.button == WebMouseEvent::ButtonLeft 582 || (event.button == WebMouseEvent::ButtonLeft
591 && event.modifiers & WebMouseEvent::ControlKey)) 583 && event.modifiers & WebMouseEvent::ControlKey))
592 mouseContextMenu(event); 584 mouseContextMenu(event);
593 #elif OS(UNIX) 585 #elif OS(UNIX)
594 if (event.button == WebMouseEvent::ButtonRight) 586 if (event.button == WebMouseEvent::ButtonRight)
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 // The m_suppressNextKeypressEvent is set if the KeyDown is handled by 927 // The m_suppressNextKeypressEvent is set if the KeyDown is handled by
936 // Webkit. A keyDown event is typically associated with a keyPress(char) 928 // Webkit. A keyDown event is typically associated with a keyPress(char)
937 // event and a keyUp event. We reset this flag here as this is a new keyDown 929 // event and a keyUp event. We reset this flag here as this is a new keyDown
938 // event. 930 // event.
939 m_suppressNextKeypressEvent = false; 931 m_suppressNextKeypressEvent = false;
940 932
941 // If there is a select popup, it should be the one processing the event, 933 // If there is a select popup, it should be the one processing the event,
942 // not the page. 934 // not the page.
943 if (m_selectPopup) 935 if (m_selectPopup)
944 return m_selectPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event) ); 936 return m_selectPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event) );
945 #if ENABLE(PAGE_POPUP)
946 if (m_pagePopup) { 937 if (m_pagePopup) {
947 m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event)); 938 m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event));
948 // We need to ignore the next Char event after this otherwise pressing 939 // We need to ignore the next Char event after this otherwise pressing
949 // enter when selecting an item in the popup will go to the page. 940 // enter when selecting an item in the popup will go to the page.
950 if (WebInputEvent::RawKeyDown == event.type) 941 if (WebInputEvent::RawKeyDown == event.type)
951 m_suppressNextKeypressEvent = true; 942 m_suppressNextKeypressEvent = true;
952 return true; 943 return true;
953 } 944 }
954 #endif
955 945
956 // Give Autocomplete a chance to consume the key events it is interested in. 946 // Give Autocomplete a chance to consume the key events it is interested in.
957 if (autocompleteHandleKeyEvent(event)) 947 if (autocompleteHandleKeyEvent(event))
958 return true; 948 return true;
959 949
960 RefPtr<Frame> frame = focusedWebCoreFrame(); 950 RefPtr<Frame> frame = focusedWebCoreFrame();
961 if (!frame) 951 if (!frame)
962 return false; 952 return false;
963 953
964 EventHandler* handler = frame->eventHandler(); 954 EventHandler* handler = frame->eventHandler();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 // handled by Webkit. A keyDown event is typically associated with a 1047 // handled by Webkit. A keyDown event is typically associated with a
1058 // keyPress(char) event and a keyUp event. We reset this flag here as it 1048 // keyPress(char) event and a keyUp event. We reset this flag here as it
1059 // only applies to the current keyPress event. 1049 // only applies to the current keyPress event.
1060 bool suppress = m_suppressNextKeypressEvent; 1050 bool suppress = m_suppressNextKeypressEvent;
1061 m_suppressNextKeypressEvent = false; 1051 m_suppressNextKeypressEvent = false;
1062 1052
1063 // If there is a select popup, it should be the one processing the event, 1053 // If there is a select popup, it should be the one processing the event,
1064 // not the page. 1054 // not the page.
1065 if (m_selectPopup) 1055 if (m_selectPopup)
1066 return m_selectPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event) ); 1056 return m_selectPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event) );
1067 #if ENABLE(PAGE_POPUP)
1068 if (m_pagePopup) 1057 if (m_pagePopup)
1069 return m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event)); 1058 return m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event));
1070 #endif
1071 1059
1072 Frame* frame = focusedWebCoreFrame(); 1060 Frame* frame = focusedWebCoreFrame();
1073 if (!frame) 1061 if (!frame)
1074 return suppress; 1062 return suppress;
1075 1063
1076 EventHandler* handler = frame->eventHandler(); 1064 EventHandler* handler = frame->eventHandler();
1077 if (!handler) 1065 if (!handler)
1078 return suppress || keyEventDefault(event); 1066 return suppress || keyEventDefault(event);
1079 1067
1080 PlatformKeyboardEventBuilder evt(event); 1068 PlatformKeyboardEventBuilder evt(event);
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 } 1497 }
1510 1498
1511 void WebViewImpl::popupClosed(WebCore::PopupContainer* popupContainer) 1499 void WebViewImpl::popupClosed(WebCore::PopupContainer* popupContainer)
1512 { 1500 {
1513 if (popupContainer->popupType() == WebCore::PopupContainer::Select) { 1501 if (popupContainer->popupType() == WebCore::PopupContainer::Select) {
1514 ASSERT(m_selectPopup); 1502 ASSERT(m_selectPopup);
1515 m_selectPopup = 0; 1503 m_selectPopup = 0;
1516 } 1504 }
1517 } 1505 }
1518 1506
1519 #if ENABLE(PAGE_POPUP)
1520 PagePopup* WebViewImpl::openPagePopup(PagePopupClient* client, const IntRect& or iginBoundsInRootView) 1507 PagePopup* WebViewImpl::openPagePopup(PagePopupClient* client, const IntRect& or iginBoundsInRootView)
1521 { 1508 {
1522 ASSERT(client); 1509 ASSERT(client);
1523 if (hasOpenedPopup()) 1510 if (hasOpenedPopup())
1524 hidePopups(); 1511 hidePopups();
1525 ASSERT(!m_pagePopup); 1512 ASSERT(!m_pagePopup);
1526 1513
1527 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypePage); 1514 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypePage);
1528 ASSERT(popupWidget); 1515 ASSERT(popupWidget);
1529 m_pagePopup = static_cast<WebPagePopupImpl*>(popupWidget); 1516 m_pagePopup = static_cast<WebPagePopupImpl*>(popupWidget);
1530 if (!m_pagePopup->initialize(this, client, originBoundsInRootView)) { 1517 if (!m_pagePopup->initialize(this, client, originBoundsInRootView)) {
1531 m_pagePopup->closePopup(); 1518 m_pagePopup->closePopup();
1532 m_pagePopup = 0; 1519 m_pagePopup = 0;
1533 } 1520 }
1534 return m_pagePopup.get(); 1521 return m_pagePopup.get();
1535 } 1522 }
1536 1523
1537 void WebViewImpl::closePagePopup(PagePopup* popup) 1524 void WebViewImpl::closePagePopup(PagePopup* popup)
1538 { 1525 {
1539 ASSERT(popup); 1526 ASSERT(popup);
1540 WebPagePopupImpl* popupImpl = static_cast<WebPagePopupImpl*>(popup); 1527 WebPagePopupImpl* popupImpl = static_cast<WebPagePopupImpl*>(popup);
1541 ASSERT(m_pagePopup.get() == popupImpl); 1528 ASSERT(m_pagePopup.get() == popupImpl);
1542 if (m_pagePopup.get() != popupImpl) 1529 if (m_pagePopup.get() != popupImpl)
1543 return; 1530 return;
1544 m_pagePopup->closePopup(); 1531 m_pagePopup->closePopup();
1545 m_pagePopup = 0; 1532 m_pagePopup = 0;
1546 } 1533 }
1547 #endif
1548 1534
1549 void WebViewImpl::hideAutofillPopup() 1535 void WebViewImpl::hideAutofillPopup()
1550 { 1536 {
1551 if (m_autofillPopupShowing) { 1537 if (m_autofillPopupShowing) {
1552 m_autofillPopup->hidePopup(); 1538 m_autofillPopup->hidePopup();
1553 m_autofillPopupShowing = false; 1539 m_autofillPopupShowing = false;
1554 } 1540 }
1555 } 1541 }
1556 1542
1557 WebHelperPluginImpl* WebViewImpl::createHelperPlugin(const String& pluginType, c onst WebDocument& hostDocument) 1543 WebHelperPluginImpl* WebViewImpl::createHelperPlugin(const String& pluginType, c onst WebDocument& hostDocument)
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after
3513 m_autofillPopupShowing = true; 3499 m_autofillPopupShowing = true;
3514 IntRect rect = focusedNode->pixelSnappedBoundingBox(); 3500 IntRect rect = focusedNode->pixelSnappedBoundingBox();
3515 m_autofillPopup->showInRect(FloatQuad(rect), rect.size(), focusedNode->o wnerDocument()->view(), 0); 3501 m_autofillPopup->showInRect(FloatQuad(rect), rect.size(), focusedNode->o wnerDocument()->view(), 0);
3516 } 3502 }
3517 } 3503 }
3518 3504
3519 void WebViewImpl::hidePopups() 3505 void WebViewImpl::hidePopups()
3520 { 3506 {
3521 hideSelectPopup(); 3507 hideSelectPopup();
3522 hideAutofillPopup(); 3508 hideAutofillPopup();
3523 #if ENABLE(PAGE_POPUP)
3524 if (m_pagePopup) 3509 if (m_pagePopup)
3525 closePagePopup(m_pagePopup.get()); 3510 closePagePopup(m_pagePopup.get());
3526 #endif
3527 } 3511 }
3528 3512
3529 void WebViewImpl::performCustomContextMenuAction(unsigned action) 3513 void WebViewImpl::performCustomContextMenuAction(unsigned action)
3530 { 3514 {
3531 if (!m_page) 3515 if (!m_page)
3532 return; 3516 return;
3533 ContextMenu* menu = m_page->contextMenuController()->contextMenu(); 3517 ContextMenu* menu = m_page->contextMenuController()->contextMenu();
3534 if (!menu) 3518 if (!menu)
3535 return; 3519 return;
3536 const ContextMenuItem* item = menu->itemWithAction(static_cast<ContextMenuAc tion>(ContextMenuItemBaseCustomTag + action)); 3520 const ContextMenuItem* item = menu->itemWithAction(static_cast<ContextMenuAc tion>(ContextMenuItemBaseCustomTag + action));
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
4211 } 4195 }
4212 4196
4213 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4197 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4214 { 4198 {
4215 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4199 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4216 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4200 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4217 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4201 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4218 } 4202 }
4219 4203
4220 } // namespace WebKit 4204 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/WebViewImpl.h ('k') | Source/core/dom/ContextFeatures.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698