OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Simon Hausmann <hausmann@kde.org> | 5 * 2000 Simon Hausmann <hausmann@kde.org> |
6 * 2000 Stefan Schimanski <1Stein@gmx.de> | 6 * 2000 Stefan Schimanski <1Stein@gmx.de> |
7 * 2001 George Staikos <staikos@kde.org> | 7 * 2001 George Staikos <staikos@kde.org> |
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> | 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> |
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "bindings/core/v8/ScriptController.h" | 33 #include "bindings/core/v8/ScriptController.h" |
34 #include "core/dom/DocumentType.h" | 34 #include "core/dom/DocumentType.h" |
35 #include "core/editing/Editor.h" | 35 #include "core/editing/Editor.h" |
36 #include "core/editing/FrameSelection.h" | 36 #include "core/editing/FrameSelection.h" |
37 #include "core/editing/InputMethodController.h" | 37 #include "core/editing/InputMethodController.h" |
38 #include "core/editing/SpellChecker.h" | 38 #include "core/editing/SpellChecker.h" |
39 #include "core/editing/htmlediting.h" | 39 #include "core/editing/htmlediting.h" |
40 #include "core/editing/markup.h" | 40 #include "core/editing/markup.h" |
41 #include "core/events/Event.h" | 41 #include "core/events/Event.h" |
42 #include "core/fetch/ResourceFetcher.h" | 42 #include "core/fetch/ResourceFetcher.h" |
43 #include "core/frame/LocalDOMWindow.h" | |
44 #include "core/frame/EventHandlerRegistry.h" | 43 #include "core/frame/EventHandlerRegistry.h" |
45 #include "core/frame/FrameConsole.h" | 44 #include "core/frame/FrameConsole.h" |
| 45 #include "core/frame/FrameDestructionObserver.h" |
46 #include "core/frame/FrameHost.h" | 46 #include "core/frame/FrameHost.h" |
47 #include "core/frame/FrameView.h" | 47 #include "core/frame/FrameView.h" |
| 48 #include "core/frame/LocalDOMWindow.h" |
48 #include "core/frame/Settings.h" | 49 #include "core/frame/Settings.h" |
49 #include "core/html/HTMLFrameElementBase.h" | 50 #include "core/html/HTMLFrameElementBase.h" |
50 #include "core/inspector/InspectorInstrumentation.h" | 51 #include "core/inspector/InspectorInstrumentation.h" |
51 #include "core/loader/FrameLoaderClient.h" | 52 #include "core/loader/FrameLoaderClient.h" |
52 #include "core/page/Chrome.h" | 53 #include "core/page/Chrome.h" |
53 #include "core/page/EventHandler.h" | 54 #include "core/page/EventHandler.h" |
54 #include "core/page/FocusController.h" | 55 #include "core/page/FocusController.h" |
55 #include "core/page/Page.h" | 56 #include "core/page/Page.h" |
56 #include "core/page/scrolling/ScrollingCoordinator.h" | 57 #include "core/page/scrolling/ScrollingCoordinator.h" |
57 #include "core/rendering/HitTestResult.h" | 58 #include "core/rendering/HitTestResult.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 RefPtr<LocalFrame> frame = adoptRef(new LocalFrame(client, host, owner)); | 110 RefPtr<LocalFrame> frame = adoptRef(new LocalFrame(client, host, owner)); |
110 InspectorInstrumentation::frameAttachedToParent(frame.get()); | 111 InspectorInstrumentation::frameAttachedToParent(frame.get()); |
111 return frame.release(); | 112 return frame.release(); |
112 } | 113 } |
113 | 114 |
114 LocalFrame::~LocalFrame() | 115 LocalFrame::~LocalFrame() |
115 { | 116 { |
116 setView(nullptr); | 117 setView(nullptr); |
117 loader().clear(); | 118 loader().clear(); |
118 setDOMWindow(nullptr); | 119 setDOMWindow(nullptr); |
| 120 |
| 121 // FIXME: What to do here... some of this is redundant with ~Frame. |
| 122 HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.e
nd(); |
| 123 for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObserver
s.begin(); it != stop; ++it) |
| 124 (*it)->frameDestroyed(); |
119 } | 125 } |
120 | 126 |
121 bool LocalFrame::inScope(TreeScope* scope) const | 127 bool LocalFrame::inScope(TreeScope* scope) const |
122 { | 128 { |
123 ASSERT(scope); | 129 ASSERT(scope); |
124 Document* doc = document(); | 130 Document* doc = document(); |
125 if (!doc) | 131 if (!doc) |
126 return false; | 132 return false; |
127 // FIXME: This check is broken in for OOPI. | 133 // FIXME: This check is broken in for OOPI. |
128 HTMLFrameOwnerElement* owner = doc->ownerElement(); | 134 HTMLFrameOwnerElement* owner = doc->ownerElement(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 Vector<RefPtr<LocalFrame> > childFrames; | 232 Vector<RefPtr<LocalFrame> > childFrames; |
227 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi
bling()) { | 233 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi
bling()) { |
228 if (child->isLocalFrame()) | 234 if (child->isLocalFrame()) |
229 childFrames.append(toLocalFrame(child)); | 235 childFrames.append(toLocalFrame(child)); |
230 } | 236 } |
231 | 237 |
232 for (size_t i = 0; i < childFrames.size(); ++i) | 238 for (size_t i = 0; i < childFrames.size(); ++i) |
233 childFrames[i]->didChangeVisibilityState(); | 239 childFrames[i]->didChangeVisibilityState(); |
234 } | 240 } |
235 | 241 |
| 242 void LocalFrame::addDestructionObserver(FrameDestructionObserver* observer) |
| 243 { |
| 244 m_destructionObservers.add(observer); |
| 245 } |
| 246 |
| 247 void LocalFrame::removeDestructionObserver(FrameDestructionObserver* observer) |
| 248 { |
| 249 m_destructionObservers.remove(observer); |
| 250 } |
| 251 |
236 void LocalFrame::willDetachFrameHost() | 252 void LocalFrame::willDetachFrameHost() |
237 { | 253 { |
238 // We should never be detatching the page during a Layout. | 254 // We should never be detatching the page during a Layout. |
239 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); | 255 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); |
240 | 256 |
241 Frame* parent = tree().parent(); | 257 Frame* parent = tree().parent(); |
242 if (parent && parent->isLocalFrame()) | 258 if (parent && parent->isLocalFrame()) |
243 toLocalFrame(parent)->loader().checkLoadComplete(); | 259 toLocalFrame(parent)->loader().checkLoadComplete(); |
244 | 260 |
245 Frame::willDetachFrameHost(); | 261 HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.e
nd(); |
| 262 for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObserver
s.begin(); it != stop; ++it) |
| 263 (*it)->willDetachFrameHost(); |
| 264 |
| 265 // FIXME: Page should take care of updating focus/scrolling instead of Frame
. |
| 266 // FIXME: It's unclear as to why this is called more than once, but it is, |
| 267 // so page() could be null. |
| 268 if (page() && page()->focusController().focusedFrame() == this) |
| 269 page()->focusController().setFocusedFrame(nullptr); |
246 script().clearScriptObjects(); | 270 script().clearScriptObjects(); |
247 | 271 |
248 if (page() && page()->scrollingCoordinator() && m_view) | 272 if (page() && page()->scrollingCoordinator() && m_view) |
249 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); | 273 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); |
250 } | 274 } |
251 | 275 |
252 void LocalFrame::detachFromFrameHost() | 276 void LocalFrame::detachFromFrameHost() |
253 { | 277 { |
254 // We should never be detatching the page during a Layout. | 278 // We should never be detatching the page during a Layout. |
255 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); | 279 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); |
256 Frame::detachFromFrameHost(); | 280 m_host = 0; |
257 } | 281 } |
258 | 282 |
259 String LocalFrame::documentTypeString() const | 283 String LocalFrame::documentTypeString() const |
260 { | 284 { |
261 if (DocumentType* doctype = document()->doctype()) | 285 if (DocumentType* doctype = document()->doctype()) |
262 return createMarkup(doctype); | 286 return createMarkup(doctype); |
263 | 287 |
264 return String(); | 288 return String(); |
265 } | 289 } |
266 | 290 |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 LocalFrame* LocalFrame::localFrameRoot() | 645 LocalFrame* LocalFrame::localFrameRoot() |
622 { | 646 { |
623 LocalFrame* curFrame = this; | 647 LocalFrame* curFrame = this; |
624 while (curFrame && curFrame->tree().parent() && curFrame->tree().parent()->i
sLocalFrame()) | 648 while (curFrame && curFrame->tree().parent() && curFrame->tree().parent()->i
sLocalFrame()) |
625 curFrame = toLocalFrame(curFrame->tree().parent()); | 649 curFrame = toLocalFrame(curFrame->tree().parent()); |
626 | 650 |
627 return curFrame; | 651 return curFrame; |
628 } | 652 } |
629 | 653 |
630 } // namespace blink | 654 } // namespace blink |
OLD | NEW |