| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| (...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 } | 1335 } |
| 1336 | 1336 |
| 1337 void Document::removeAllEventListeners() | 1337 void Document::removeAllEventListeners() |
| 1338 { | 1338 { |
| 1339 ContainerNode::removeAllEventListeners(); | 1339 ContainerNode::removeAllEventListeners(); |
| 1340 | 1340 |
| 1341 if (LocalDOMWindow* domWindow = this->domWindow()) | 1341 if (LocalDOMWindow* domWindow = this->domWindow()) |
| 1342 domWindow->removeAllEventListeners(); | 1342 domWindow->removeAllEventListeners(); |
| 1343 } | 1343 } |
| 1344 | 1344 |
| 1345 HTMLDocumentParser* Document::scriptableDocumentParser() const | |
| 1346 { | |
| 1347 return m_parser ? m_parser->asHTMLDocumentParser() : 0; | |
| 1348 } | |
| 1349 | |
| 1350 void Document::detachParser() | 1345 void Document::detachParser() |
| 1351 { | 1346 { |
| 1352 if (!m_parser) | 1347 if (!m_parser) |
| 1353 return; | 1348 return; |
| 1354 m_parser->detach(); | 1349 m_parser->detach(); |
| 1355 m_parser.clear(); | 1350 m_parser.clear(); |
| 1356 } | 1351 } |
| 1357 | 1352 |
| 1358 void Document::cancelParsing() | 1353 void Document::cancelParsing() |
| 1359 { | 1354 { |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1628 m_executeScriptsWaitingForResourcesTimer.startOneShot(0, FROM_HERE); | 1623 m_executeScriptsWaitingForResourcesTimer.startOneShot(0, FROM_HERE); |
| 1629 | 1624 |
| 1630 if (frame()) | 1625 if (frame()) |
| 1631 frame()->loaderClient()->didRemoveAllPendingStylesheet(); | 1626 frame()->loaderClient()->didRemoveAllPendingStylesheet(); |
| 1632 } | 1627 } |
| 1633 | 1628 |
| 1634 void Document::executeScriptsWaitingForResourcesTimerFired(Timer<Document>*) | 1629 void Document::executeScriptsWaitingForResourcesTimerFired(Timer<Document>*) |
| 1635 { | 1630 { |
| 1636 if (!isRenderingReady()) | 1631 if (!isRenderingReady()) |
| 1637 return; | 1632 return; |
| 1638 if (HTMLDocumentParser* parser = scriptableDocumentParser()) | 1633 if (m_parser) |
| 1639 parser->executeScriptsWaitingForResources(); | 1634 m_parser->executeScriptsWaitingForResources(); |
| 1640 } | 1635 } |
| 1641 | 1636 |
| 1642 TextPosition Document::textPosition() const | 1637 TextPosition Document::textPosition() const |
| 1643 { | 1638 { |
| 1644 if (HTMLDocumentParser* parser = scriptableDocumentParser()) | 1639 if (m_parser) |
| 1645 return parser->textPosition(); | 1640 m_parser->textPosition(); |
| 1646 return TextPosition::belowRangePosition(); | 1641 return TextPosition::belowRangePosition(); |
| 1647 } | 1642 } |
| 1648 | 1643 |
| 1649 CSSStyleSheet& Document::elementSheet() | 1644 CSSStyleSheet& Document::elementSheet() |
| 1650 { | 1645 { |
| 1651 if (!m_elemSheet) | 1646 if (!m_elemSheet) |
| 1652 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); | 1647 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); |
| 1653 return *m_elemSheet; | 1648 return *m_elemSheet; |
| 1654 } | 1649 } |
| 1655 | 1650 |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2375 return this; | 2370 return this; |
| 2376 #else | 2371 #else |
| 2377 return m_weakFactory.createWeakPtr(); | 2372 return m_weakFactory.createWeakPtr(); |
| 2378 #endif | 2373 #endif |
| 2379 } | 2374 } |
| 2380 return WeakPtr<Document>(nullptr); | 2375 return WeakPtr<Document>(nullptr); |
| 2381 } | 2376 } |
| 2382 | 2377 |
| 2383 void Document::finishedParsing() | 2378 void Document::finishedParsing() |
| 2384 { | 2379 { |
| 2385 ASSERT(!scriptableDocumentParser() || !m_parser->isParsing()); | 2380 ASSERT(!m_parser || !m_parser->isParsing()); |
| 2386 ASSERT(!scriptableDocumentParser() || m_readyState != Loading); | 2381 ASSERT(!m_parser || m_readyState != Loading); |
| 2387 setParsing(false); | 2382 setParsing(false); |
| 2388 dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded)); | 2383 dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded)); |
| 2389 | 2384 |
| 2390 // The loader's finishedParsing() method may invoke script that causes this
object to | 2385 // The loader's finishedParsing() method may invoke script that causes this
object to |
| 2391 // be dereferenced (when this document is in an iframe and the onload causes
the iframe's src to change). | 2386 // be dereferenced (when this document is in an iframe and the onload causes
the iframe's src to change). |
| 2392 // Keep it alive until we are done. | 2387 // Keep it alive until we are done. |
| 2393 RefPtr<Document> protect(this); | 2388 RefPtr<Document> protect(this); |
| 2394 | 2389 |
| 2395 if (RefPtr<LocalFrame> f = frame()) { | 2390 if (RefPtr<LocalFrame> f = frame()) { |
| 2396 checkCompleted(); | 2391 checkCompleted(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2472 { | 2467 { |
| 2473 } | 2468 } |
| 2474 | 2469 |
| 2475 void Document::addMessage(PassRefPtr<ConsoleMessage> consoleMessage) | 2470 void Document::addMessage(PassRefPtr<ConsoleMessage> consoleMessage) |
| 2476 { | 2471 { |
| 2477 if (!m_frame) | 2472 if (!m_frame) |
| 2478 return; | 2473 return; |
| 2479 | 2474 |
| 2480 if (!consoleMessage->scriptState() && consoleMessage->url().isNull() && !con
soleMessage->lineNumber()) { | 2475 if (!consoleMessage->scriptState() && consoleMessage->url().isNull() && !con
soleMessage->lineNumber()) { |
| 2481 consoleMessage->setURL(url().string()); | 2476 consoleMessage->setURL(url().string()); |
| 2482 if (parsing() && scriptableDocumentParser()) { | 2477 if (parsing() && m_parser) { |
| 2483 HTMLDocumentParser* parser = scriptableDocumentParser(); | 2478 if (!m_parser->isWaitingForScripts() && !m_parser->isExecutingScript
()) |
| 2484 if (!parser->isWaitingForScripts() && !parser->isExecutingScript()) | 2479 consoleMessage->setLineNumber(m_parser->textPosition().m_line.on
eBasedInt()); |
| 2485 consoleMessage->setLineNumber(parser->lineNumber().oneBasedInt()
); | |
| 2486 } | 2480 } |
| 2487 } | 2481 } |
| 2488 m_frame->console().addMessage(consoleMessage); | 2482 m_frame->console().addMessage(consoleMessage); |
| 2489 } | 2483 } |
| 2490 | 2484 |
| 2491 void Document::decrementLoadEventDelayCount() | 2485 void Document::decrementLoadEventDelayCount() |
| 2492 { | 2486 { |
| 2493 ASSERT(m_loadEventDelayCount); | 2487 ASSERT(m_loadEventDelayCount); |
| 2494 --m_loadEventDelayCount; | 2488 --m_loadEventDelayCount; |
| 2495 | 2489 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2615 | 2609 |
| 2616 void Document::adjustFloatRectForScroll(FloatRect& rect) | 2610 void Document::adjustFloatRectForScroll(FloatRect& rect) |
| 2617 { | 2611 { |
| 2618 if (!view()) | 2612 if (!view()) |
| 2619 return; | 2613 return; |
| 2620 | 2614 |
| 2621 LayoutRect visibleContentRect = view()->visibleContentRect(); | 2615 LayoutRect visibleContentRect = view()->visibleContentRect(); |
| 2622 rect.move(-FloatSize(visibleContentRect.x().toFloat(), visibleContentRect.y(
).toFloat())); | 2616 rect.move(-FloatSize(visibleContentRect.x().toFloat(), visibleContentRect.y(
).toFloat())); |
| 2623 } | 2617 } |
| 2624 | 2618 |
| 2625 bool Document::hasActiveParser() | |
| 2626 { | |
| 2627 return m_activeParserCount || (m_parser && m_parser->processingData()); | |
| 2628 } | |
| 2629 | |
| 2630 void Document::decrementActiveParserCount() | 2619 void Document::decrementActiveParserCount() |
| 2631 { | 2620 { |
| 2632 --m_activeParserCount; | 2621 --m_activeParserCount; |
| 2633 } | 2622 } |
| 2634 | 2623 |
| 2635 static RenderObject* nearestCommonHoverAncestor(RenderObject* obj1, RenderObject
* obj2) | 2624 static RenderObject* nearestCommonHoverAncestor(RenderObject* obj1, RenderObject
* obj2) |
| 2636 { | 2625 { |
| 2637 if (!obj1 || !obj2) | 2626 if (!obj1 || !obj2) |
| 2638 return 0; | 2627 return 0; |
| 2639 | 2628 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2916 using namespace blink; | 2905 using namespace blink; |
| 2917 void showLiveDocumentInstances() | 2906 void showLiveDocumentInstances() |
| 2918 { | 2907 { |
| 2919 WeakDocumentSet& set = liveDocumentSet(); | 2908 WeakDocumentSet& set = liveDocumentSet(); |
| 2920 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 2909 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 2921 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { | 2910 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { |
| 2922 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); | 2911 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); |
| 2923 } | 2912 } |
| 2924 } | 2913 } |
| 2925 #endif | 2914 #endif |
| OLD | NEW |