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

Side by Side Diff: Source/core/page/DOMWindow.cpp

Issue 24773003: Rename Node::attached() to confusingAndOftenMisusedAttached() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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/loader/ImageLoader.cpp ('k') | Source/core/page/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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 , m_shouldPrintWhenFinishedLoading(false) 320 , m_shouldPrintWhenFinishedLoading(false)
321 { 321 {
322 ASSERT(frame); 322 ASSERT(frame);
323 ScriptWrappable::init(this); 323 ScriptWrappable::init(this);
324 } 324 }
325 325
326 void DOMWindow::setDocument(PassRefPtr<Document> document) 326 void DOMWindow::setDocument(PassRefPtr<Document> document)
327 { 327 {
328 ASSERT(!document || document->frame() == m_frame); 328 ASSERT(!document || document->frame() == m_frame);
329 if (m_document) { 329 if (m_document) {
330 if (m_document->attached()) { 330 if (m_document->confusingAndOftenMisusedAttached()) {
331 // FIXME: We don't call willRemove here. Why is that OK? 331 // FIXME: We don't call willRemove here. Why is that OK?
332 // This detach() call is also mostly redundant. Most of the calls to 332 // This detach() call is also mostly redundant. Most of the calls to
333 // this function come via DocumentLoader::createWriterFor, which 333 // this function come via DocumentLoader::createWriterFor, which
334 // always detaches the previous Document first. Only XSLTProcessor 334 // always detaches the previous Document first. Only XSLTProcessor
335 // depends on this detach() call, so it seems like there's some room 335 // depends on this detach() call, so it seems like there's some room
336 // for cleanup. 336 // for cleanup.
337 m_document->detach(); 337 m_document->detach();
338 } 338 }
339 m_document->setDOMWindow(0); 339 m_document->setDOMWindow(0);
340 } 340 }
341 341
342 m_document = document; 342 m_document = document;
343 343
344 if (!m_document) 344 if (!m_document)
345 return; 345 return;
346 346
347 m_document->setDOMWindow(this); 347 m_document->setDOMWindow(this);
348 if (!m_document->attached()) 348 if (!m_document->confusingAndOftenMisusedAttached())
349 m_document->attach(); 349 m_document->attach();
350 350
351 if (!m_frame) 351 if (!m_frame)
352 return; 352 return;
353 353
354 m_frame->script()->updateDocument(); 354 m_frame->script()->updateDocument();
355 m_document->updateViewportArguments(); 355 m_document->updateViewportArguments();
356 356
357 if (m_frame->page() && m_frame->view()) { 357 if (m_frame->page() && m_frame->view()) {
358 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) { 358 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) {
(...skipping 28 matching lines...) Expand all
387 ASSERT(!m_location); 387 ASSERT(!m_location);
388 ASSERT(!m_media); 388 ASSERT(!m_media);
389 ASSERT(!m_sessionStorage); 389 ASSERT(!m_sessionStorage);
390 ASSERT(!m_localStorage); 390 ASSERT(!m_localStorage);
391 ASSERT(!m_applicationCache); 391 ASSERT(!m_applicationCache);
392 392
393 reset(); 393 reset();
394 394
395 removeAllEventListeners(); 395 removeAllEventListeners();
396 396
397 ASSERT(!m_document->attached()); 397 ASSERT(!m_document->confusingAndOftenMisusedAttached());
398 setDocument(0); 398 setDocument(0);
399 } 399 }
400 400
401 const AtomicString& DOMWindow::interfaceName() const 401 const AtomicString& DOMWindow::interfaceName() const
402 { 402 {
403 return eventNames().interfaceForDOMWindow; 403 return eventNames().interfaceForDOMWindow;
404 } 404 }
405 405
406 ScriptExecutionContext* DOMWindow::scriptExecutionContext() const 406 ScriptExecutionContext* DOMWindow::scriptExecutionContext() const
407 { 407 {
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleN otifier()); 1761 return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleN otifier());
1762 } 1762 }
1763 1763
1764 PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier() 1764 PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier()
1765 { 1765 {
1766 return DOMWindowLifecycleNotifier::create(this); 1766 return DOMWindowLifecycleNotifier::create(this);
1767 } 1767 }
1768 1768
1769 1769
1770 } // namespace WebCore 1770 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/ImageLoader.cpp ('k') | Source/core/page/Frame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698