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

Side by Side Diff: Source/core/frame/DOMWindow.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/core/frame/ConsoleBase.cpp ('k') | Source/core/frame/Frame.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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // always detaches the previous Document first. Only XSLTProcessor 351 // always detaches the previous Document first. Only XSLTProcessor
352 // depends on this detach() call, so it seems like there's some room 352 // depends on this detach() call, so it seems like there's some room
353 // for cleanup. 353 // for cleanup.
354 m_document->detach(); 354 m_document->detach();
355 } 355 }
356 356
357 // FIXME: This should be part of ActiveDOM Object shutdown 357 // FIXME: This should be part of ActiveDOM Object shutdown
358 clearEventQueue(); 358 clearEventQueue();
359 359
360 m_document->clearDOMWindow(); 360 m_document->clearDOMWindow();
361 m_document = 0; 361 m_document = nullptr;
362 } 362 }
363 363
364 void DOMWindow::clearEventQueue() 364 void DOMWindow::clearEventQueue()
365 { 365 {
366 if (!m_eventQueue) 366 if (!m_eventQueue)
367 return; 367 return;
368 m_eventQueue->close(); 368 m_eventQueue->close();
369 m_eventQueue.clear(); 369 m_eventQueue.clear();
370 } 370 }
371 371
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 return m_document.get(); 524 return m_document.get();
525 } 525 }
526 526
527 DOMWindow* DOMWindow::toDOMWindow() 527 DOMWindow* DOMWindow::toDOMWindow()
528 { 528 {
529 return this; 529 return this;
530 } 530 }
531 531
532 PassRefPtr<MediaQueryList> DOMWindow::matchMedia(const String& media) 532 PassRefPtr<MediaQueryList> DOMWindow::matchMedia(const String& media)
533 { 533 {
534 return document() ? document()->mediaQueryMatcher().matchMedia(media) : 0; 534 return document() ? document()->mediaQueryMatcher().matchMedia(media) : null ptr;
535 } 535 }
536 536
537 Page* DOMWindow::page() 537 Page* DOMWindow::page()
538 { 538 {
539 return frame() ? frame()->page() : 0; 539 return frame() ? frame()->page() : 0;
540 } 540 }
541 541
542 void DOMWindow::frameDestroyed() 542 void DOMWindow::frameDestroyed()
543 { 543 {
544 FrameDestructionObserver::frameDestroyed(); 544 FrameDestructionObserver::frameDestroyed();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 void DOMWindow::reset() 583 void DOMWindow::reset()
584 { 584 {
585 willDestroyDocumentInFrame(); 585 willDestroyDocumentInFrame();
586 resetDOMWindowProperties(); 586 resetDOMWindowProperties();
587 } 587 }
588 588
589 void DOMWindow::resetDOMWindowProperties() 589 void DOMWindow::resetDOMWindowProperties()
590 { 590 {
591 m_properties.clear(); 591 m_properties.clear();
592 592
593 m_screen = 0; 593 m_screen = nullptr;
594 m_history = 0; 594 m_history = nullptr;
595 m_locationbar = 0; 595 m_locationbar = nullptr;
596 m_menubar = 0; 596 m_menubar = nullptr;
597 m_personalbar = 0; 597 m_personalbar = nullptr;
598 m_scrollbars = 0; 598 m_scrollbars = nullptr;
599 m_statusbar = 0; 599 m_statusbar = nullptr;
600 m_toolbar = 0; 600 m_toolbar = nullptr;
601 m_console = 0; 601 m_console = nullptr;
602 m_navigator = 0; 602 m_navigator = nullptr;
603 m_performance = 0; 603 m_performance = nullptr;
604 m_location = 0; 604 m_location = nullptr;
605 m_media = 0; 605 m_media = nullptr;
606 m_sessionStorage = 0; 606 m_sessionStorage = nullptr;
607 m_localStorage = 0; 607 m_localStorage = nullptr;
608 m_applicationCache = 0; 608 m_applicationCache = nullptr;
609 } 609 }
610 610
611 bool DOMWindow::isCurrentlyDisplayedInFrame() const 611 bool DOMWindow::isCurrentlyDisplayedInFrame() const
612 { 612 {
613 return m_frame && m_frame->domWindow() == this; 613 return m_frame && m_frame->domWindow() == this;
614 } 614 }
615 615
616 int DOMWindow::orientation() const 616 int DOMWindow::orientation() const
617 { 617 {
618 ASSERT(RuntimeEnabledFeatures::orientationEventEnabled()); 618 ASSERT(RuntimeEnabledFeatures::orientationEventEnabled());
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 } 1307 }
1308 1308
1309 Document* DOMWindow::document() const 1309 Document* DOMWindow::document() const
1310 { 1310 {
1311 return m_document.get(); 1311 return m_document.get();
1312 } 1312 }
1313 1313
1314 PassRefPtr<StyleMedia> DOMWindow::styleMedia() const 1314 PassRefPtr<StyleMedia> DOMWindow::styleMedia() const
1315 { 1315 {
1316 if (!isCurrentlyDisplayedInFrame()) 1316 if (!isCurrentlyDisplayedInFrame())
1317 return 0; 1317 return nullptr;
1318 if (!m_media) 1318 if (!m_media)
1319 m_media = StyleMedia::create(m_frame); 1319 m_media = StyleMedia::create(m_frame);
1320 return m_media.get(); 1320 return m_media.get();
1321 } 1321 }
1322 1322
1323 PassRefPtr<CSSStyleDeclaration> DOMWindow::getComputedStyle(Element* elt, const String& pseudoElt) const 1323 PassRefPtr<CSSStyleDeclaration> DOMWindow::getComputedStyle(Element* elt, const String& pseudoElt) const
1324 { 1324 {
1325 if (!elt) 1325 if (!elt)
1326 return 0; 1326 return nullptr;
1327 1327
1328 return CSSComputedStyleDeclaration::create(elt, false, pseudoElt); 1328 return CSSComputedStyleDeclaration::create(elt, false, pseudoElt);
1329 } 1329 }
1330 1330
1331 PassRefPtr<CSSRuleList> DOMWindow::getMatchedCSSRules(Element* element, const St ring& pseudoElement) const 1331 PassRefPtr<CSSRuleList> DOMWindow::getMatchedCSSRules(Element* element, const St ring& pseudoElement) const
1332 { 1332 {
1333 UseCounter::count(document(), UseCounter::GetMatchedCSSRules); 1333 UseCounter::count(document(), UseCounter::GetMatchedCSSRules);
1334 if (!element) 1334 if (!element)
1335 return 0; 1335 return nullptr;
1336 1336
1337 if (!isCurrentlyDisplayedInFrame()) 1337 if (!isCurrentlyDisplayedInFrame())
1338 return 0; 1338 return nullptr;
1339 1339
1340 unsigned colonStart = pseudoElement[0] == ':' ? (pseudoElement[1] == ':' ? 2 : 1) : 0; 1340 unsigned colonStart = pseudoElement[0] == ':' ? (pseudoElement[1] == ':' ? 2 : 1) : 0;
1341 CSSSelector::PseudoType pseudoType = CSSSelector::parsePseudoType(AtomicStri ng(pseudoElement.substring(colonStart))); 1341 CSSSelector::PseudoType pseudoType = CSSSelector::parsePseudoType(AtomicStri ng(pseudoElement.substring(colonStart)));
1342 if (pseudoType == CSSSelector::PseudoUnknown && !pseudoElement.isEmpty()) 1342 if (pseudoType == CSSSelector::PseudoUnknown && !pseudoElement.isEmpty())
1343 return 0; 1343 return nullptr;
1344 1344
1345 unsigned rulesToInclude = StyleResolver::AuthorCSSRules; 1345 unsigned rulesToInclude = StyleResolver::AuthorCSSRules;
1346 PseudoId pseudoId = CSSSelector::pseudoId(pseudoType); 1346 PseudoId pseudoId = CSSSelector::pseudoId(pseudoType);
1347 return m_frame->document()->ensureStyleResolver().pseudoCSSRulesForElement(e lement, pseudoId, rulesToInclude); 1347 return m_frame->document()->ensureStyleResolver().pseudoCSSRulesForElement(e lement, pseudoId, rulesToInclude);
1348 } 1348 }
1349 1349
1350 PassRefPtr<DOMPoint> DOMWindow::webkitConvertPointFromNodeToPage(Node* node, con st DOMPoint* p) const 1350 PassRefPtr<DOMPoint> DOMWindow::webkitConvertPointFromNodeToPage(Node* node, con st DOMPoint* p) const
1351 { 1351 {
1352 if (!node || !p) 1352 if (!node || !p)
1353 return 0; 1353 return nullptr;
1354 1354
1355 if (!document()) 1355 if (!document())
1356 return 0; 1356 return nullptr;
1357 1357
1358 document()->updateLayoutIgnorePendingStylesheets(); 1358 document()->updateLayoutIgnorePendingStylesheets();
1359 1359
1360 FloatPoint pagePoint(p->x(), p->y()); 1360 FloatPoint pagePoint(p->x(), p->y());
1361 pagePoint = node->convertToPage(pagePoint); 1361 pagePoint = node->convertToPage(pagePoint);
1362 return DOMPoint::create(pagePoint.x(), pagePoint.y()); 1362 return DOMPoint::create(pagePoint.x(), pagePoint.y());
1363 } 1363 }
1364 1364
1365 PassRefPtr<DOMPoint> DOMWindow::webkitConvertPointFromPageToNode(Node* node, con st DOMPoint* p) const 1365 PassRefPtr<DOMPoint> DOMWindow::webkitConvertPointFromPageToNode(Node* node, con st DOMPoint* p) const
1366 { 1366 {
1367 if (!node || !p) 1367 if (!node || !p)
1368 return 0; 1368 return nullptr;
1369 1369
1370 if (!document()) 1370 if (!document())
1371 return 0; 1371 return nullptr;
1372 1372
1373 document()->updateLayoutIgnorePendingStylesheets(); 1373 document()->updateLayoutIgnorePendingStylesheets();
1374 1374
1375 FloatPoint nodePoint(p->x(), p->y()); 1375 FloatPoint nodePoint(p->x(), p->y());
1376 nodePoint = node->convertFromPage(nodePoint); 1376 nodePoint = node->convertFromPage(nodePoint);
1377 return DOMPoint::create(nodePoint.x(), nodePoint.y()); 1377 return DOMPoint::create(nodePoint.x(), nodePoint.y());
1378 } 1378 }
1379 1379
1380 double DOMWindow::devicePixelRatio() const 1380 double DOMWindow::devicePixelRatio() const
1381 { 1381 {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 } 1786 }
1787 1787
1788 printErrorMessage(crossDomainAccessErrorMessage(callingWindow)); 1788 printErrorMessage(crossDomainAccessErrorMessage(callingWindow));
1789 return true; 1789 return true;
1790 } 1790 }
1791 1791
1792 PassRefPtr<DOMWindow> DOMWindow::open(const String& urlString, const AtomicStrin g& frameName, const String& windowFeaturesString, 1792 PassRefPtr<DOMWindow> DOMWindow::open(const String& urlString, const AtomicStrin g& frameName, const String& windowFeaturesString,
1793 DOMWindow* callingWindow, DOMWindow* enteredWindow) 1793 DOMWindow* callingWindow, DOMWindow* enteredWindow)
1794 { 1794 {
1795 if (!isCurrentlyDisplayedInFrame()) 1795 if (!isCurrentlyDisplayedInFrame())
1796 return 0; 1796 return nullptr;
1797 Document* activeDocument = callingWindow->document(); 1797 Document* activeDocument = callingWindow->document();
1798 if (!activeDocument) 1798 if (!activeDocument)
1799 return 0; 1799 return nullptr;
1800 Frame* firstFrame = enteredWindow->frame(); 1800 Frame* firstFrame = enteredWindow->frame();
1801 if (!firstFrame) 1801 if (!firstFrame)
1802 return 0; 1802 return nullptr;
1803 1803
1804 if (!enteredWindow->allowPopUp()) { 1804 if (!enteredWindow->allowPopUp()) {
1805 // Because FrameTree::find() returns true for empty strings, we must che ck for empty frame names. 1805 // Because FrameTree::find() returns true for empty strings, we must che ck for empty frame names.
1806 // Otherwise, illegitimate window.open() calls with no name will pass ri ght through the popup blocker. 1806 // Otherwise, illegitimate window.open() calls with no name will pass ri ght through the popup blocker.
1807 if (frameName.isEmpty() || !m_frame->tree().find(frameName)) 1807 if (frameName.isEmpty() || !m_frame->tree().find(frameName))
1808 return 0; 1808 return nullptr;
1809 } 1809 }
1810 1810
1811 // Get the target frame for the special cases of _top and _parent. 1811 // Get the target frame for the special cases of _top and _parent.
1812 // In those cases, we schedule a location change right now and return early. 1812 // In those cases, we schedule a location change right now and return early.
1813 Frame* targetFrame = 0; 1813 Frame* targetFrame = 0;
1814 if (frameName == "_top") 1814 if (frameName == "_top")
1815 targetFrame = m_frame->tree().top(); 1815 targetFrame = m_frame->tree().top();
1816 else if (frameName == "_parent") { 1816 else if (frameName == "_parent") {
1817 if (Frame* parent = m_frame->tree().parent()) 1817 if (Frame* parent = m_frame->tree().parent())
1818 targetFrame = parent; 1818 targetFrame = parent;
1819 else 1819 else
1820 targetFrame = m_frame; 1820 targetFrame = m_frame;
1821 } 1821 }
1822 if (targetFrame) { 1822 if (targetFrame) {
1823 if (!activeDocument->canNavigate(targetFrame)) 1823 if (!activeDocument->canNavigate(targetFrame))
1824 return 0; 1824 return nullptr;
1825 1825
1826 KURL completedURL = firstFrame->document()->completeURL(urlString); 1826 KURL completedURL = firstFrame->document()->completeURL(urlString);
1827 1827
1828 if (targetFrame->domWindow()->isInsecureScriptAccess(callingWindow, comp letedURL)) 1828 if (targetFrame->domWindow()->isInsecureScriptAccess(callingWindow, comp letedURL))
1829 return targetFrame->domWindow(); 1829 return targetFrame->domWindow();
1830 1830
1831 if (urlString.isEmpty()) 1831 if (urlString.isEmpty())
1832 return targetFrame->domWindow(); 1832 return targetFrame->domWindow();
1833 1833
1834 // For whatever reason, Firefox uses the first window rather than the ac tive window to 1834 // For whatever reason, Firefox uses the first window rather than the ac tive window to
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<DOMWindow>: :lifecycleNotifier()); 1890 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<DOMWindow>: :lifecycleNotifier());
1891 } 1891 }
1892 1892
1893 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier() 1893 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier()
1894 { 1894 {
1895 return DOMWindowLifecycleNotifier::create(this); 1895 return DOMWindowLifecycleNotifier::create(this);
1896 } 1896 }
1897 1897
1898 1898
1899 } // namespace WebCore 1899 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/ConsoleBase.cpp ('k') | Source/core/frame/Frame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698