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

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

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/WebIDBKeyRange.cpp ('k') | Source/web/tests/CustomEventTest.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 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 ASSERT(!m_selectPopup); 1409 ASSERT(!m_selectPopup);
1410 m_selectPopup = popupContainer; 1410 m_selectPopup = popupContainer;
1411 ASSERT(mainFrameImpl()->frame()->document()); 1411 ASSERT(mainFrameImpl()->frame()->document());
1412 Document& document = *mainFrameImpl()->frame()->document(); 1412 Document& document = *mainFrameImpl()->frame()->document();
1413 WheelController::from(document)->didAddWheelEventHandler(document); 1413 WheelController::from(document)->didAddWheelEventHandler(document);
1414 } 1414 }
1415 1415
1416 void WebViewImpl::popupClosed(PopupContainer* popupContainer) 1416 void WebViewImpl::popupClosed(PopupContainer* popupContainer)
1417 { 1417 {
1418 ASSERT(m_selectPopup); 1418 ASSERT(m_selectPopup);
1419 m_selectPopup = 0; 1419 m_selectPopup = nullptr;
1420 ASSERT(mainFrameImpl()->frame()->document()); 1420 ASSERT(mainFrameImpl()->frame()->document());
1421 Document& document = *mainFrameImpl()->frame()->document(); 1421 Document& document = *mainFrameImpl()->frame()->document();
1422 WheelController::from(document)->didRemoveWheelEventHandler(document); 1422 WheelController::from(document)->didRemoveWheelEventHandler(document);
1423 } 1423 }
1424 1424
1425 PagePopup* WebViewImpl::openPagePopup(PagePopupClient* client, const IntRect& or iginBoundsInRootView) 1425 PagePopup* WebViewImpl::openPagePopup(PagePopupClient* client, const IntRect& or iginBoundsInRootView)
1426 { 1426 {
1427 ASSERT(client); 1427 ASSERT(client);
1428 if (hasOpenedPopup()) 1428 if (hasOpenedPopup())
1429 hidePopups(); 1429 hidePopups();
1430 ASSERT(!m_pagePopup); 1430 ASSERT(!m_pagePopup);
1431 1431
1432 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypePage); 1432 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypePage);
1433 ASSERT(popupWidget); 1433 ASSERT(popupWidget);
1434 m_pagePopup = toWebPagePopupImpl(popupWidget); 1434 m_pagePopup = toWebPagePopupImpl(popupWidget);
1435 if (!m_pagePopup->initialize(this, client, originBoundsInRootView)) { 1435 if (!m_pagePopup->initialize(this, client, originBoundsInRootView)) {
1436 m_pagePopup->closePopup(); 1436 m_pagePopup->closePopup();
1437 m_pagePopup = 0; 1437 m_pagePopup = nullptr;
1438 } 1438 }
1439 return m_pagePopup.get(); 1439 return m_pagePopup.get();
1440 } 1440 }
1441 1441
1442 void WebViewImpl::closePagePopup(PagePopup* popup) 1442 void WebViewImpl::closePagePopup(PagePopup* popup)
1443 { 1443 {
1444 ASSERT(popup); 1444 ASSERT(popup);
1445 WebPagePopupImpl* popupImpl = toWebPagePopupImpl(popup); 1445 WebPagePopupImpl* popupImpl = toWebPagePopupImpl(popup);
1446 ASSERT(m_pagePopup.get() == popupImpl); 1446 ASSERT(m_pagePopup.get() == popupImpl);
1447 if (m_pagePopup.get() != popupImpl) 1447 if (m_pagePopup.get() != popupImpl)
1448 return; 1448 return;
1449 m_pagePopup->closePopup(); 1449 m_pagePopup->closePopup();
1450 m_pagePopup = 0; 1450 m_pagePopup = nullptr;
1451 } 1451 }
1452 1452
1453 WebHelperPlugin* WebViewImpl::createHelperPlugin(const WebString& pluginType, co nst WebDocument& hostDocument) 1453 WebHelperPlugin* WebViewImpl::createHelperPlugin(const WebString& pluginType, co nst WebDocument& hostDocument)
1454 { 1454 {
1455 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypeHelperPlugin) ; 1455 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypeHelperPlugin) ;
1456 ASSERT(popupWidget); 1456 ASSERT(popupWidget);
1457 WebHelperPluginImpl* helperPlugin = toWebHelperPluginImpl(popupWidget); 1457 WebHelperPluginImpl* helperPlugin = toWebHelperPluginImpl(popupWidget);
1458 1458
1459 if (!helperPlugin->initialize(pluginType, hostDocument, this)) { 1459 if (!helperPlugin->initialize(pluginType, hostDocument, this)) {
1460 closeAndDeleteHelperPluginSoon(helperPlugin); 1460 closeAndDeleteHelperPluginSoon(helperPlugin);
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 1857
1858 void WebViewImpl::setCursorVisibilityState(bool isVisible) 1858 void WebViewImpl::setCursorVisibilityState(bool isVisible)
1859 { 1859 {
1860 if (m_page) 1860 if (m_page)
1861 m_page->setIsCursorVisible(isVisible); 1861 m_page->setIsCursorVisible(isVisible);
1862 } 1862 }
1863 1863
1864 void WebViewImpl::mouseCaptureLost() 1864 void WebViewImpl::mouseCaptureLost()
1865 { 1865 {
1866 TRACE_EVENT_ASYNC_END0("input", "capturing mouse", this); 1866 TRACE_EVENT_ASYNC_END0("input", "capturing mouse", this);
1867 m_mouseCaptureNode = 0; 1867 m_mouseCaptureNode = nullptr;
1868 } 1868 }
1869 1869
1870 void WebViewImpl::setFocus(bool enable) 1870 void WebViewImpl::setFocus(bool enable)
1871 { 1871 {
1872 m_page->focusController().setFocused(enable); 1872 m_page->focusController().setFocused(enable);
1873 if (enable) { 1873 if (enable) {
1874 m_page->focusController().setActive(true); 1874 m_page->focusController().setActive(true);
1875 RefPtr<Frame> focusedFrame = m_page->focusController().focusedFrame(); 1875 RefPtr<Frame> focusedFrame = m_page->focusController().focusedFrame();
1876 if (focusedFrame) { 1876 if (focusedFrame) {
1877 Element* element = focusedFrame->document()->focusedElement(); 1877 Element* element = focusedFrame->document()->focusedElement();
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
2498 Frame* webcoreFrame = toWebFrameImpl(frame)->frame(); 2498 Frame* webcoreFrame = toWebFrameImpl(frame)->frame();
2499 webcoreFrame->page()->focusController().setFocusedFrame(webcoreFrame); 2499 webcoreFrame->page()->focusController().setFocusedFrame(webcoreFrame);
2500 } 2500 }
2501 2501
2502 void WebViewImpl::setInitialFocus(bool reverse) 2502 void WebViewImpl::setInitialFocus(bool reverse)
2503 { 2503 {
2504 if (!m_page) 2504 if (!m_page)
2505 return; 2505 return;
2506 Frame* frame = page()->focusController().focusedOrMainFrame(); 2506 Frame* frame = page()->focusController().focusedOrMainFrame();
2507 if (Document* document = frame->document()) 2507 if (Document* document = frame->document())
2508 document->setFocusedElement(0); 2508 document->setFocusedElement(nullptr);
2509 page()->focusController().setInitialFocus(reverse ? FocusTypeBackward : Focu sTypeForward); 2509 page()->focusController().setInitialFocus(reverse ? FocusTypeBackward : Focu sTypeForward);
2510 } 2510 }
2511 2511
2512 void WebViewImpl::clearFocusedNode() 2512 void WebViewImpl::clearFocusedNode()
2513 { 2513 {
2514 RefPtr<Frame> frame = focusedWebCoreFrame(); 2514 RefPtr<Frame> frame = focusedWebCoreFrame();
2515 if (!frame) 2515 if (!frame)
2516 return; 2516 return;
2517 2517
2518 RefPtr<Document> document = frame->document(); 2518 RefPtr<Document> document = frame->document();
2519 if (!document) 2519 if (!document)
2520 return; 2520 return;
2521 2521
2522 RefPtr<Element> oldFocusedElement = document->focusedElement(); 2522 RefPtr<Element> oldFocusedElement = document->focusedElement();
2523 2523
2524 // Clear the focused node. 2524 // Clear the focused node.
2525 document->setFocusedElement(0); 2525 document->setFocusedElement(nullptr);
2526 2526
2527 if (!oldFocusedElement) 2527 if (!oldFocusedElement)
2528 return; 2528 return;
2529 2529
2530 // If a text field has focus, we need to make sure the selection controller 2530 // If a text field has focus, we need to make sure the selection controller
2531 // knows to remove selection from it. Otherwise, the text field is still 2531 // knows to remove selection from it. Otherwise, the text field is still
2532 // processing keyboard events even though focus has been moved to the page a nd 2532 // processing keyboard events even though focus has been moved to the page a nd
2533 // keystrokes get eaten as a result. 2533 // keystrokes get eaten as a result.
2534 if (oldFocusedElement->isContentEditable() || oldFocusedElement->isTextFormC ontrol()) 2534 if (oldFocusedElement->isContentEditable() || oldFocusedElement->isTextFormC ontrol())
2535 frame->selection().clear(); 2535 frame->selection().clear();
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
3161 m_currentDragData.get(), 3161 m_currentDragData.get(),
3162 IntPoint(), 3162 IntPoint(),
3163 IntPoint(), 3163 IntPoint(),
3164 static_cast<DragOperation>(m_operationsAllowed)); 3164 static_cast<DragOperation>(m_operationsAllowed));
3165 3165
3166 m_page->dragController().dragExited(&dragData); 3166 m_page->dragController().dragExited(&dragData);
3167 3167
3168 // FIXME: why is the drag scroll timer not stopped here? 3168 // FIXME: why is the drag scroll timer not stopped here?
3169 3169
3170 m_dragOperation = WebDragOperationNone; 3170 m_dragOperation = WebDragOperationNone;
3171 m_currentDragData = 0; 3171 m_currentDragData = nullptr;
3172 } 3172 }
3173 3173
3174 void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, 3174 void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint,
3175 const WebPoint& screenPoint, 3175 const WebPoint& screenPoint,
3176 int keyModifiers) 3176 int keyModifiers)
3177 { 3177 {
3178 ASSERT(m_currentDragData); 3178 ASSERT(m_currentDragData);
3179 3179
3180 // If this webview transitions from the "drop accepting" state to the "not 3180 // If this webview transitions from the "drop accepting" state to the "not
3181 // accepting" state, then our IPC message reply indicating that may be in- 3181 // accepting" state, then our IPC message reply indicating that may be in-
(...skipping 10 matching lines...) Expand all
3192 m_currentDragData->setModifierKeyState(webInputEventKeyStateToPlatformEventK eyState(keyModifiers)); 3192 m_currentDragData->setModifierKeyState(webInputEventKeyStateToPlatformEventK eyState(keyModifiers));
3193 DragData dragData( 3193 DragData dragData(
3194 m_currentDragData.get(), 3194 m_currentDragData.get(),
3195 clientPoint, 3195 clientPoint,
3196 screenPoint, 3196 screenPoint,
3197 static_cast<DragOperation>(m_operationsAllowed)); 3197 static_cast<DragOperation>(m_operationsAllowed));
3198 3198
3199 m_page->dragController().performDrag(&dragData); 3199 m_page->dragController().performDrag(&dragData);
3200 3200
3201 m_dragOperation = WebDragOperationNone; 3201 m_dragOperation = WebDragOperationNone;
3202 m_currentDragData = 0; 3202 m_currentDragData = nullptr;
3203 } 3203 }
3204 3204
3205 void WebViewImpl::spellingMarkers(WebVector<uint32_t>* markers) 3205 void WebViewImpl::spellingMarkers(WebVector<uint32_t>* markers)
3206 { 3206 {
3207 Vector<uint32_t> result; 3207 Vector<uint32_t> result;
3208 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) { 3208 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) {
3209 const Vector<DocumentMarker*>& documentMarkers = frame->document()->mark ers()->markers(); 3209 const Vector<DocumentMarker*>& documentMarkers = frame->document()->mark ers()->markers();
3210 for (size_t i = 0; i < documentMarkers.size(); ++i) 3210 for (size_t i = 0; i < documentMarkers.size(); ++i)
3211 result.append(documentMarkers[i]->hash()); 3211 result.append(documentMarkers[i]->hash());
3212 } 3212 }
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
4005 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4005 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4006 4006
4007 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4007 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4008 return false; 4008 return false;
4009 4009
4010 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4010 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4011 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4011 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4012 } 4012 }
4013 4013
4014 } // namespace blink 4014 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebIDBKeyRange.cpp ('k') | Source/web/tests/CustomEventTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698