| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 #include "sky/engine/core/dom/custom/custom_element_registry.h" | 68 #include "sky/engine/core/dom/custom/custom_element_registry.h" |
| 69 #include "sky/engine/core/dom/shadow/ElementShadow.h" | 69 #include "sky/engine/core/dom/shadow/ElementShadow.h" |
| 70 #include "sky/engine/core/dom/shadow/ShadowRoot.h" | 70 #include "sky/engine/core/dom/shadow/ShadowRoot.h" |
| 71 #include "sky/engine/core/editing/FrameSelection.h" | 71 #include "sky/engine/core/editing/FrameSelection.h" |
| 72 #include "sky/engine/core/editing/SpellChecker.h" | 72 #include "sky/engine/core/editing/SpellChecker.h" |
| 73 #include "sky/engine/core/events/Event.h" | 73 #include "sky/engine/core/events/Event.h" |
| 74 #include "sky/engine/core/events/EventListener.h" | 74 #include "sky/engine/core/events/EventListener.h" |
| 75 #include "sky/engine/core/events/HashChangeEvent.h" | 75 #include "sky/engine/core/events/HashChangeEvent.h" |
| 76 #include "sky/engine/core/events/PageTransitionEvent.h" | 76 #include "sky/engine/core/events/PageTransitionEvent.h" |
| 77 #include "sky/engine/core/events/ScopedEventQueue.h" | 77 #include "sky/engine/core/events/ScopedEventQueue.h" |
| 78 #include "sky/engine/core/fetch/ResourceFetcher.h" | |
| 79 #include "sky/engine/core/frame/FrameConsole.h" | 78 #include "sky/engine/core/frame/FrameConsole.h" |
| 80 #include "sky/engine/core/frame/FrameHost.h" | 79 #include "sky/engine/core/frame/FrameHost.h" |
| 81 #include "sky/engine/core/frame/FrameView.h" | 80 #include "sky/engine/core/frame/FrameView.h" |
| 82 #include "sky/engine/core/frame/LocalDOMWindow.h" | 81 #include "sky/engine/core/frame/LocalDOMWindow.h" |
| 83 #include "sky/engine/core/frame/LocalFrame.h" | 82 #include "sky/engine/core/frame/LocalFrame.h" |
| 84 #include "sky/engine/core/frame/Settings.h" | 83 #include "sky/engine/core/frame/Settings.h" |
| 85 #include "sky/engine/core/inspector/ConsoleMessage.h" | 84 #include "sky/engine/core/inspector/ConsoleMessage.h" |
| 86 #include "sky/engine/core/inspector/InspectorCounters.h" | 85 #include "sky/engine/core/inspector/InspectorCounters.h" |
| 87 #include "sky/engine/core/loader/FrameLoaderClient.h" | 86 #include "sky/engine/core/loader/FrameLoaderClient.h" |
| 88 #include "sky/engine/core/loader/ImageLoader.h" | |
| 89 #include "sky/engine/core/page/ChromeClient.h" | 87 #include "sky/engine/core/page/ChromeClient.h" |
| 90 #include "sky/engine/core/page/EventHandler.h" | 88 #include "sky/engine/core/page/EventHandler.h" |
| 91 #include "sky/engine/core/page/FocusController.h" | 89 #include "sky/engine/core/page/FocusController.h" |
| 92 #include "sky/engine/core/page/Page.h" | 90 #include "sky/engine/core/page/Page.h" |
| 93 #include "sky/engine/core/painting/PaintingTasks.h" | 91 #include "sky/engine/core/painting/PaintingTasks.h" |
| 94 #include "sky/engine/core/painting/Picture.h" | 92 #include "sky/engine/core/painting/Picture.h" |
| 95 #include "sky/engine/core/rendering/HitTestResult.h" | 93 #include "sky/engine/core/rendering/HitTestResult.h" |
| 96 #include "sky/engine/core/rendering/RenderView.h" | 94 #include "sky/engine/core/rendering/RenderView.h" |
| 97 #include "sky/engine/platform/DateComponents.h" | 95 #include "sky/engine/platform/DateComponents.h" |
| 98 #include "sky/engine/platform/EventDispatchForbiddenScope.h" | 96 #include "sky/engine/platform/EventDispatchForbiddenScope.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 , m_templateDocumentHost(nullptr) | 236 , m_templateDocumentHost(nullptr) |
| 239 , m_hasViewportUnits(false) | 237 , m_hasViewportUnits(false) |
| 240 , m_styleRecalcElementCounter(0) | 238 , m_styleRecalcElementCounter(0) |
| 241 , m_frameView(nullptr) | 239 , m_frameView(nullptr) |
| 242 { | 240 { |
| 243 setClient(this); | 241 setClient(this); |
| 244 | 242 |
| 245 if (!m_elementRegistry) | 243 if (!m_elementRegistry) |
| 246 m_elementRegistry = CustomElementRegistry::Create(); | 244 m_elementRegistry = CustomElementRegistry::Create(); |
| 247 | 245 |
| 248 m_fetcher = ResourceFetcher::create(this); | |
| 249 | |
| 250 // We depend on the url getting immediately set in subframes, but we | 246 // We depend on the url getting immediately set in subframes, but we |
| 251 // also depend on the url NOT getting immediately set in opened windows. | 247 // also depend on the url NOT getting immediately set in opened windows. |
| 252 // See fast/dom/early-frame-url.html | 248 // See fast/dom/early-frame-url.html |
| 253 // and fast/dom/location-new-window-no-crash.html, respectively. | 249 // and fast/dom/location-new-window-no-crash.html, respectively. |
| 254 // FIXME: Can/should we unify this behavior? | 250 // FIXME: Can/should we unify this behavior? |
| 255 if (initializer.shouldSetURL()) | 251 if (initializer.shouldSetURL()) |
| 256 setURL(initializer.url()); | 252 setURL(initializer.url()); |
| 257 | 253 |
| 258 InspectorCounters::incrementCounter(InspectorCounters::DocumentCounter); | 254 InspectorCounters::incrementCounter(InspectorCounters::DocumentCounter); |
| 259 | 255 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 282 removeAllEventListenersRecursively(); | 278 removeAllEventListenersRecursively(); |
| 283 #endif | 279 #endif |
| 284 | 280 |
| 285 #if !ENABLE(OILPAN) | 281 #if !ENABLE(OILPAN) |
| 286 | 282 |
| 287 m_timeline->detachFromDocument(); | 283 m_timeline->detachFromDocument(); |
| 288 | 284 |
| 289 if (m_elemSheet) | 285 if (m_elemSheet) |
| 290 m_elemSheet->clearOwnerNode(); | 286 m_elemSheet->clearOwnerNode(); |
| 291 | 287 |
| 292 m_fetcher.clear(); | |
| 293 | |
| 294 // We must call clearRareData() here since a Document class inherits TreeSco
pe | 288 // We must call clearRareData() here since a Document class inherits TreeSco
pe |
| 295 // as well as Node. See a comment on TreeScope.h for the reason. | 289 // as well as Node. See a comment on TreeScope.h for the reason. |
| 296 if (hasRareData()) | 290 if (hasRareData()) |
| 297 clearRareData(); | 291 clearRareData(); |
| 298 | 292 |
| 299 #ifndef NDEBUG | 293 #ifndef NDEBUG |
| 300 liveDocumentSet().remove(this); | 294 liveDocumentSet().remove(this); |
| 301 #endif | 295 #endif |
| 302 #endif | 296 #endif |
| 303 | 297 |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 // The call to dispatchWindowLoadEvent can detach the LocalDOMWindow and cau
se it (and its | 1087 // The call to dispatchWindowLoadEvent can detach the LocalDOMWindow and cau
se it (and its |
| 1094 // attached Document) to be destroyed. | 1088 // attached Document) to be destroyed. |
| 1095 RefPtr<LocalDOMWindow> protectedWindow(this->domWindow()); | 1089 RefPtr<LocalDOMWindow> protectedWindow(this->domWindow()); |
| 1096 | 1090 |
| 1097 m_loadEventProgress = LoadEventInProgress; | 1091 m_loadEventProgress = LoadEventInProgress; |
| 1098 | 1092 |
| 1099 // We have to clear the parser, in case someone document.write()s from the | 1093 // We have to clear the parser, in case someone document.write()s from the |
| 1100 // onLoad event handler, as in Radar 3206524. | 1094 // onLoad event handler, as in Radar 3206524. |
| 1101 detachParser(); | 1095 detachParser(); |
| 1102 | 1096 |
| 1103 if (frame()) { | |
| 1104 ImageLoader::dispatchPendingLoadEvents(); | |
| 1105 ImageLoader::dispatchPendingErrorEvents(); | |
| 1106 } | |
| 1107 | |
| 1108 // JS running below could remove the frame or destroy the RenderView so we c
all | 1097 // JS running below could remove the frame or destroy the RenderView so we c
all |
| 1109 // those two functions repeatedly and don't save them on the stack. | 1098 // those two functions repeatedly and don't save them on the stack. |
| 1110 | 1099 |
| 1111 if (protectedWindow) | 1100 if (protectedWindow) |
| 1112 protectedWindow->documentWasClosed(); | 1101 protectedWindow->documentWasClosed(); |
| 1113 | 1102 |
| 1114 if (frame()) | 1103 if (frame()) |
| 1115 frame()->loaderClient()->dispatchDidHandleOnloadEvents(); | 1104 frame()->loaderClient()->dispatchDidHandleOnloadEvents(); |
| 1116 | 1105 |
| 1117 if (!frame()) { | 1106 if (!frame()) { |
| 1118 m_loadEventProgress = LoadEventCompleted; | 1107 m_loadEventProgress = LoadEventCompleted; |
| 1119 return; | 1108 return; |
| 1120 } | 1109 } |
| 1121 | 1110 |
| 1122 // FIXME(sky): Could start frame if they are still paused here. | 1111 // FIXME(sky): Could start frame if they are still paused here. |
| 1123 m_loadEventProgress = LoadEventCompleted; | 1112 m_loadEventProgress = LoadEventCompleted; |
| 1124 } | 1113 } |
| 1125 | 1114 |
| 1126 void Document::checkCompleted() | 1115 void Document::checkCompleted() |
| 1127 { | 1116 { |
| 1128 if (isLoadCompleted()) | 1117 if (isLoadCompleted()) |
| 1129 return; | 1118 return; |
| 1130 | 1119 |
| 1131 // Are we still parsing? | 1120 // Are we still parsing? |
| 1132 if (parsing()) | 1121 if (parsing()) |
| 1133 return; | 1122 return; |
| 1134 | 1123 |
| 1135 // Still waiting for images/scripts? | |
| 1136 if (fetcher()->requestCount()) | |
| 1137 return; | |
| 1138 | |
| 1139 // Still waiting for elements that don't go through a FrameLoader? | 1124 // Still waiting for elements that don't go through a FrameLoader? |
| 1140 if (isDelayingLoadEvent()) | 1125 if (isDelayingLoadEvent()) |
| 1141 return; | 1126 return; |
| 1142 | 1127 |
| 1143 // OK, completed. | 1128 // OK, completed. |
| 1144 setReadyState(Complete); | 1129 setReadyState(Complete); |
| 1145 if (loadEventStillNeeded()) | 1130 if (loadEventStillNeeded()) |
| 1146 implicitClose(); | 1131 implicitClose(); |
| 1147 } | 1132 } |
| 1148 | 1133 |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1991 using namespace blink; | 1976 using namespace blink; |
| 1992 void showLiveDocumentInstances() | 1977 void showLiveDocumentInstances() |
| 1993 { | 1978 { |
| 1994 WeakDocumentSet& set = liveDocumentSet(); | 1979 WeakDocumentSet& set = liveDocumentSet(); |
| 1995 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 1980 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 1996 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { | 1981 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { |
| 1997 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); | 1982 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); |
| 1998 } | 1983 } |
| 1999 } | 1984 } |
| 2000 #endif | 1985 #endif |
| OLD | NEW |