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 26 matching lines...) Expand all Loading... | |
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/EventHandlerRegistry.h" | 43 #include "core/frame/EventHandlerRegistry.h" |
44 #include "core/frame/FrameConsole.h" | 44 #include "core/frame/FrameConsole.h" |
45 #include "core/frame/FrameDestructionObserver.h" | 45 #include "core/frame/FrameDestructionObserver.h" |
46 #include "core/frame/FrameHost.h" | 46 #include "core/frame/FrameHost.h" |
47 #include "core/frame/FrameProtector.h" | |
47 #include "core/frame/FrameView.h" | 48 #include "core/frame/FrameView.h" |
48 #include "core/frame/LocalDOMWindow.h" | 49 #include "core/frame/LocalDOMWindow.h" |
49 #include "core/frame/Settings.h" | 50 #include "core/frame/Settings.h" |
50 #include "core/html/HTMLFrameElementBase.h" | 51 #include "core/html/HTMLFrameElementBase.h" |
51 #include "core/inspector/ConsoleMessageStorage.h" | 52 #include "core/inspector/ConsoleMessageStorage.h" |
52 #include "core/inspector/InspectorInstrumentation.h" | 53 #include "core/inspector/InspectorInstrumentation.h" |
53 #include "core/loader/FrameLoaderClient.h" | 54 #include "core/loader/FrameLoaderClient.h" |
54 #include "core/page/Chrome.h" | 55 #include "core/page/Chrome.h" |
55 #include "core/page/EventHandler.h" | 56 #include "core/page/EventHandler.h" |
56 #include "core/page/FocusController.h" | 57 #include "core/page/FocusController.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 , m_selection(FrameSelection::create(this)) | 100 , m_selection(FrameSelection::create(this)) |
100 , m_eventHandler(adoptPtrWillBeNoop(new EventHandler(this))) | 101 , m_eventHandler(adoptPtrWillBeNoop(new EventHandler(this))) |
101 , m_console(FrameConsole::create(*this)) | 102 , m_console(FrameConsole::create(*this)) |
102 , m_inputMethodController(InputMethodController::create(*this)) | 103 , m_inputMethodController(InputMethodController::create(*this)) |
103 , m_pageZoomFactor(parentPageZoomFactor(this)) | 104 , m_pageZoomFactor(parentPageZoomFactor(this)) |
104 , m_textZoomFactor(parentTextZoomFactor(this)) | 105 , m_textZoomFactor(parentTextZoomFactor(this)) |
105 , m_inViewSourceMode(false) | 106 , m_inViewSourceMode(false) |
106 { | 107 { |
107 } | 108 } |
108 | 109 |
109 PassRefPtr<LocalFrame> LocalFrame::create(FrameLoaderClient* client, FrameHost* host, FrameOwner* owner) | 110 PassRefPtrWillBeRawPtr<LocalFrame> LocalFrame::create(FrameLoaderClient* client, FrameHost* host, FrameOwner* owner) |
110 { | 111 { |
111 RefPtr<LocalFrame> frame = adoptRef(new LocalFrame(client, host, owner)); | 112 RefPtrWillBeRawPtr<LocalFrame> frame = adoptRefWillBeNoop(new LocalFrame(cli ent, host, owner)); |
112 InspectorInstrumentation::frameAttachedToParent(frame.get()); | 113 InspectorInstrumentation::frameAttachedToParent(frame.get()); |
113 return frame.release(); | 114 return frame.release(); |
114 } | 115 } |
115 | 116 |
116 LocalFrame::~LocalFrame() | 117 LocalFrame::~LocalFrame() |
117 { | 118 { |
119 #if !ENABLE(OILPAN) | |
120 dispose(); | |
121 #endif | |
122 } | |
123 | |
124 void LocalFrame::trace(Visitor* visitor) | |
125 { | |
126 visitor->trace(m_loader); | |
127 visitor->trace(m_navigationScheduler); | |
128 visitor->trace(m_pagePopupOwner); | |
129 visitor->trace(m_editor); | |
130 visitor->trace(m_spellChecker); | |
131 visitor->trace(m_selection); | |
132 visitor->trace(m_eventHandler); | |
133 visitor->trace(m_console); | |
134 visitor->trace(m_inputMethodController); | |
135 Frame::trace(visitor); | |
136 WillBeHeapSupplementable<LocalFrame>::trace(visitor); | |
137 } | |
138 | |
139 void LocalFrame::dispose() | |
140 { | |
118 setView(nullptr); | 141 setView(nullptr); |
119 loader().clear(); | 142 loader().clear(); |
120 setDOMWindow(nullptr); | 143 setDOMWindow(nullptr); |
121 | 144 |
122 // FIXME: What to do here... some of this is redundant with ~Frame. | 145 // FIXME: What to do here... some of this is redundant with ~Frame. |
123 HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.e nd(); | 146 HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.e nd(); |
124 for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObserver s.begin(); it != stop; ++it) | 147 for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObserver s.begin(); it != stop; ++it) |
125 (*it)->frameDestroyed(); | 148 (*it)->frameDestroyed(); |
149 | |
150 #if ENABLE(OILPAN) | |
151 // For non-Oilpan, ~Frame arranges for same. | |
152 Frame::dispose(); | |
153 #endif | |
126 } | 154 } |
127 | 155 |
128 void LocalFrame::detach() | 156 void LocalFrame::detach() |
129 { | 157 { |
158 #if ENABLE(OILPAN) | |
159 if (hasBeenDisposed()) | |
Mads Ager (chromium)
2014/09/03 10:07:54
Could you explain when we get a detach of a local
| |
160 return; | |
161 #endif | |
130 // A lot of the following steps can result in the current frame being | 162 // A lot of the following steps can result in the current frame being |
131 // detached, so protect a reference to it. | 163 // detached, so protect a reference to it. |
132 RefPtr<LocalFrame> protect(this); | 164 FrameProtector protect(this); |
133 m_loader.stopAllLoaders(); | 165 m_loader.stopAllLoaders(); |
134 m_loader.closeURL(); | 166 m_loader.closeURL(); |
135 detachChildren(); | 167 detachChildren(); |
136 // stopAllLoaders() needs to be called after detachChildren(), because detac hChildren() | 168 // stopAllLoaders() needs to be called after detachChildren(), because detac hChildren() |
137 // will trigger the unload event handlers of any child frames, and those eve nt | 169 // will trigger the unload event handlers of any child frames, and those eve nt |
138 // handlers might start a new subresource load in this frame. | 170 // handlers might start a new subresource load in this frame. |
139 m_loader.stopAllLoaders(); | 171 m_loader.stopAllLoaders(); |
140 m_loader.detachFromParent(); | 172 m_loader.detachFromParent(); |
141 } | 173 } |
142 | 174 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 | 224 |
193 document()->styleResolverChanged(); | 225 document()->styleResolverChanged(); |
194 if (shouldUsePrintingLayout()) { | 226 if (shouldUsePrintingLayout()) { |
195 view()->forceLayoutForPagination(pageSize, originalPageSize, maximumShri nkRatio); | 227 view()->forceLayoutForPagination(pageSize, originalPageSize, maximumShri nkRatio); |
196 } else { | 228 } else { |
197 view()->forceLayout(); | 229 view()->forceLayout(); |
198 view()->adjustViewSize(); | 230 view()->adjustViewSize(); |
199 } | 231 } |
200 | 232 |
201 // Subframes of the one we're printing don't lay out to the page size. | 233 // Subframes of the one we're printing don't lay out to the page size. |
202 for (RefPtr<Frame> child = tree().firstChild(); child; child = child->tree() .nextSibling()) { | 234 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c hild->tree().nextSibling()) { |
203 if (child->isLocalFrame()) | 235 if (child->isLocalFrame()) |
204 toLocalFrame(child.get())->setPrinting(printing, FloatSize(), FloatS ize(), 0); | 236 toLocalFrame(child.get())->setPrinting(printing, FloatSize(), FloatS ize(), 0); |
205 } | 237 } |
206 } | 238 } |
207 | 239 |
208 bool LocalFrame::shouldUsePrintingLayout() const | 240 bool LocalFrame::shouldUsePrintingLayout() const |
209 { | 241 { |
210 // Only top frame being printed should be fit to page size. | 242 // Only top frame being printed should be fit to page size. |
211 // Subframes should be constrained by parents only. | 243 // Subframes should be constrained by parents only. |
212 return document()->printing() && (!tree().parent() || !tree().parent()->isLo calFrame() || !toLocalFrame(tree().parent())->document()->printing()); | 244 return document()->printing() && (!tree().parent() || !tree().parent()->isLo calFrame() || !toLocalFrame(tree().parent())->document()->printing()); |
(...skipping 28 matching lines...) Expand all Loading... | |
241 if (domWindow) | 273 if (domWindow) |
242 script().clearWindowProxy(); | 274 script().clearWindowProxy(); |
243 Frame::setDOMWindow(domWindow); | 275 Frame::setDOMWindow(domWindow); |
244 } | 276 } |
245 | 277 |
246 void LocalFrame::didChangeVisibilityState() | 278 void LocalFrame::didChangeVisibilityState() |
247 { | 279 { |
248 if (document()) | 280 if (document()) |
249 document()->didChangeVisibilityState(); | 281 document()->didChangeVisibilityState(); |
250 | 282 |
251 Vector<RefPtr<LocalFrame> > childFrames; | 283 WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > childFrames; |
252 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi bling()) { | 284 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi bling()) { |
253 if (child->isLocalFrame()) | 285 if (child->isLocalFrame()) |
254 childFrames.append(toLocalFrame(child)); | 286 childFrames.append(toLocalFrame(child)); |
255 } | 287 } |
256 | 288 |
257 for (size_t i = 0; i < childFrames.size(); ++i) | 289 for (size_t i = 0; i < childFrames.size(); ++i) |
258 childFrames[i]->didChangeVisibilityState(); | 290 childFrames[i]->didChangeVisibilityState(); |
259 } | 291 } |
260 | 292 |
261 void LocalFrame::addDestructionObserver(FrameDestructionObserver* observer) | 293 void LocalFrame::addDestructionObserver(FrameDestructionObserver* observer) |
(...skipping 25 matching lines...) Expand all Loading... | |
287 if (page() && page()->focusController().focusedFrame() == this) | 319 if (page() && page()->focusController().focusedFrame() == this) |
288 page()->focusController().setFocusedFrame(nullptr); | 320 page()->focusController().setFocusedFrame(nullptr); |
289 script().clearScriptObjects(); | 321 script().clearScriptObjects(); |
290 | 322 |
291 if (page() && page()->scrollingCoordinator() && m_view) | 323 if (page() && page()->scrollingCoordinator() && m_view) |
292 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); | 324 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); |
293 } | 325 } |
294 | 326 |
295 void LocalFrame::detachFromFrameHost() | 327 void LocalFrame::detachFromFrameHost() |
296 { | 328 { |
297 // We should never be detatching the page during a Layout. | 329 // We should never be detaching the page during a Layout. |
298 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); | 330 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); |
299 m_host = 0; | 331 m_host = 0; |
300 } | 332 } |
301 | 333 |
302 String LocalFrame::documentTypeString() const | 334 String LocalFrame::documentTypeString() const |
303 { | 335 { |
304 if (DocumentType* doctype = document()->doctype()) | 336 if (DocumentType* doctype = document()->doctype()) |
305 return createMarkup(doctype); | 337 return createMarkup(doctype); |
306 | 338 |
307 return String(); | 339 return String(); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
506 // Update the scroll position when doing a full page zoom, so the co ntent stays in relatively the same position. | 538 // Update the scroll position when doing a full page zoom, so the co ntent stays in relatively the same position. |
507 LayoutPoint scrollPosition = view->scrollPosition(); | 539 LayoutPoint scrollPosition = view->scrollPosition(); |
508 float percentDifference = (pageZoomFactor / m_pageZoomFactor); | 540 float percentDifference = (pageZoomFactor / m_pageZoomFactor); |
509 view->setScrollPosition(IntPoint(scrollPosition.x() * percentDiffere nce, scrollPosition.y() * percentDifference)); | 541 view->setScrollPosition(IntPoint(scrollPosition.x() * percentDiffere nce, scrollPosition.y() * percentDifference)); |
510 } | 542 } |
511 } | 543 } |
512 | 544 |
513 m_pageZoomFactor = pageZoomFactor; | 545 m_pageZoomFactor = pageZoomFactor; |
514 m_textZoomFactor = textZoomFactor; | 546 m_textZoomFactor = textZoomFactor; |
515 | 547 |
516 for (RefPtr<Frame> child = tree().firstChild(); child; child = child->tree() .nextSibling()) { | 548 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c hild->tree().nextSibling()) { |
517 if (child->isLocalFrame()) | 549 if (child->isLocalFrame()) |
518 toLocalFrame(child.get())->setPageAndTextZoomFactors(m_pageZoomFacto r, m_textZoomFactor); | 550 toLocalFrame(child.get())->setPageAndTextZoomFactors(m_pageZoomFacto r, m_textZoomFactor); |
519 } | 551 } |
520 | 552 |
521 document->setNeedsStyleRecalc(SubtreeStyleChange); | 553 document->setNeedsStyleRecalc(SubtreeStyleChange); |
522 document->updateLayoutIgnorePendingStylesheets(); | 554 document->updateLayoutIgnorePendingStylesheets(); |
523 } | 555 } |
524 | 556 |
525 void LocalFrame::deviceOrPageScaleFactorChanged() | 557 void LocalFrame::deviceOrPageScaleFactorChanged() |
526 { | 558 { |
527 document()->mediaQueryAffectingValueChanged(); | 559 document()->mediaQueryAffectingValueChanged(); |
528 for (RefPtr<Frame> child = tree().firstChild(); child; child = child->tree() .nextSibling()) { | 560 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c hild->tree().nextSibling()) { |
529 if (child->isLocalFrame()) | 561 if (child->isLocalFrame()) |
530 toLocalFrame(child.get())->deviceOrPageScaleFactorChanged(); | 562 toLocalFrame(child.get())->deviceOrPageScaleFactorChanged(); |
531 } | 563 } |
532 } | 564 } |
533 | 565 |
534 bool LocalFrame::isURLAllowed(const KURL& url) const | 566 bool LocalFrame::isURLAllowed(const KURL& url) const |
535 { | 567 { |
536 // We allow one level of self-reference because some sites depend on that, | 568 // We allow one level of self-reference because some sites depend on that, |
537 // but we don't allow more than one. | 569 // but we don't allow more than one. |
538 if (page()->subframeCount() >= Page::maxNumberOfFrames) | 570 if (page()->subframeCount() >= Page::maxNumberOfFrames) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 | 711 |
680 return curFrame; | 712 return curFrame; |
681 } | 713 } |
682 | 714 |
683 void LocalFrame::setPagePopupOwner(Element& owner) | 715 void LocalFrame::setPagePopupOwner(Element& owner) |
684 { | 716 { |
685 m_pagePopupOwner = &owner; | 717 m_pagePopupOwner = &owner; |
686 } | 718 } |
687 | 719 |
688 } // namespace blink | 720 } // namespace blink |
OLD | NEW |