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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalFrame.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 RespectImageOrientationEnum imageOrientation = DoNotRespectImageOrientat ion; 133 RespectImageOrientationEnum imageOrientation = DoNotRespectImageOrientat ion;
134 if (m_draggedNode && m_draggedNode->layoutObject()) 134 if (m_draggedNode && m_draggedNode->layoutObject())
135 imageOrientation = LayoutObject::shouldRespectImageOrientation(m_dra ggedNode->layoutObject()); 135 imageOrientation = LayoutObject::shouldRespectImageOrientation(m_dra ggedNode->layoutObject());
136 136
137 float screenDeviceScaleFactor = m_localFrame->page()->chromeClient().scr eenInfo().deviceScaleFactor; 137 float screenDeviceScaleFactor = m_localFrame->page()->chromeClient().scr eenInfo().deviceScaleFactor;
138 138
139 return DragImage::create(image.get(), imageOrientation, screenDeviceScal eFactor, InterpolationHigh, m_opacity); 139 return DragImage::create(image.get(), imageOrientation, screenDeviceScal eFactor, InterpolationHigh, m_opacity);
140 } 140 }
141 141
142 private: 142 private:
143 RawPtrWillBeMember<const LocalFrame> m_localFrame; 143 Member<const LocalFrame> m_localFrame;
144 RawPtrWillBeMember<Node> m_draggedNode; 144 Member<Node> m_draggedNode;
145 FloatRect m_bounds; 145 FloatRect m_bounds;
146 float m_opacity; 146 float m_opacity;
147 OwnPtr<SkPictureBuilder> m_pictureBuilder; 147 OwnPtr<SkPictureBuilder> m_pictureBuilder;
148 }; 148 };
149 149
150 inline float parentPageZoomFactor(LocalFrame* frame) 150 inline float parentPageZoomFactor(LocalFrame* frame)
151 { 151 {
152 Frame* parent = frame->tree().parent(); 152 Frame* parent = frame->tree().parent();
153 if (!parent || !parent->isLocalFrame()) 153 if (!parent || !parent->isLocalFrame())
154 return 1; 154 return 1;
155 return toLocalFrame(parent)->pageZoomFactor(); 155 return toLocalFrame(parent)->pageZoomFactor();
156 } 156 }
157 157
158 inline float parentTextZoomFactor(LocalFrame* frame) 158 inline float parentTextZoomFactor(LocalFrame* frame)
159 { 159 {
160 Frame* parent = frame->tree().parent(); 160 Frame* parent = frame->tree().parent();
161 if (!parent || !parent->isLocalFrame()) 161 if (!parent || !parent->isLocalFrame())
162 return 1; 162 return 1;
163 return toLocalFrame(parent)->textZoomFactor(); 163 return toLocalFrame(parent)->textZoomFactor();
164 } 164 }
165 165
166 } // namespace 166 } // namespace
167 167
168 PassRefPtrWillBeRawPtr<LocalFrame> LocalFrame::create(FrameLoaderClient* client, FrameHost* host, FrameOwner* owner) 168 RawPtr<LocalFrame> LocalFrame::create(FrameLoaderClient* client, FrameHost* host , FrameOwner* owner)
169 { 169 {
170 RefPtrWillBeRawPtr<LocalFrame> frame = adoptRefWillBeNoop(new LocalFrame(cli ent, host, owner)); 170 RawPtr<LocalFrame> frame = new LocalFrame(client, host, owner);
171 InspectorInstrumentation::frameAttachedToParent(frame.get()); 171 InspectorInstrumentation::frameAttachedToParent(frame.get());
172 return frame.release(); 172 return frame.release();
173 } 173 }
174 174
175 void LocalFrame::setView(PassRefPtrWillBeRawPtr<FrameView> view) 175 void LocalFrame::setView(RawPtr<FrameView> view)
176 { 176 {
177 ASSERT(!m_view || m_view != view); 177 ASSERT(!m_view || m_view != view);
178 ASSERT(!document() || !document()->isActive()); 178 ASSERT(!document() || !document()->isActive());
179 179
180 eventHandler().clear(); 180 eventHandler().clear();
181 181
182 m_view = view; 182 m_view = view;
183 } 183 }
184 184
185 void LocalFrame::createView(const IntSize& viewportSize, const Color& background Color, bool transparent, 185 void LocalFrame::createView(const IntSize& viewportSize, const Color& background Color, bool transparent,
186 ScrollbarMode horizontalScrollbarMode, bool horizontalLock, 186 ScrollbarMode horizontalScrollbarMode, bool horizontalLock,
187 ScrollbarMode verticalScrollbarMode, bool verticalLock) 187 ScrollbarMode verticalScrollbarMode, bool verticalLock)
188 { 188 {
189 ASSERT(this); 189 ASSERT(this);
190 ASSERT(page()); 190 ASSERT(page());
191 191
192 bool isLocalRoot = this->isLocalRoot(); 192 bool isLocalRoot = this->isLocalRoot();
193 193
194 if (isLocalRoot && view()) 194 if (isLocalRoot && view())
195 view()->setParentVisible(false); 195 view()->setParentVisible(false);
196 196
197 setView(nullptr); 197 setView(nullptr);
198 198
199 RefPtrWillBeRawPtr<FrameView> frameView = nullptr; 199 RawPtr<FrameView> frameView = nullptr;
200 if (isLocalRoot) { 200 if (isLocalRoot) {
201 frameView = FrameView::create(this, viewportSize); 201 frameView = FrameView::create(this, viewportSize);
202 202
203 // The layout size is set by WebViewImpl to support @viewport 203 // The layout size is set by WebViewImpl to support @viewport
204 frameView->setLayoutSizeFixedToFrameSize(false); 204 frameView->setLayoutSizeFixedToFrameSize(false);
205 } else { 205 } else {
206 frameView = FrameView::create(this); 206 frameView = FrameView::create(this);
207 } 207 }
208 208
209 frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode, horizontalLock, verticalLock); 209 frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode, horizontalLock, verticalLock);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } else { 313 } else {
314 m_navigationScheduler->scheduleReload(); 314 m_navigationScheduler->scheduleReload();
315 } 315 }
316 } 316 }
317 317
318 void LocalFrame::detach(FrameDetachType type) 318 void LocalFrame::detach(FrameDetachType type)
319 { 319 {
320 PluginScriptForbiddenScope forbidPluginDestructorScripting; 320 PluginScriptForbiddenScope forbidPluginDestructorScripting;
321 // A lot of the following steps can result in the current frame being 321 // A lot of the following steps can result in the current frame being
322 // detached, so protect a reference to it. 322 // detached, so protect a reference to it.
323 RefPtrWillBeRawPtr<LocalFrame> protect(this); 323 RawPtr<LocalFrame> protect(this);
324 m_loader.stopAllLoaders(); 324 m_loader.stopAllLoaders();
325 // Don't allow any new child frames to load in this frame: attaching a new 325 // Don't allow any new child frames to load in this frame: attaching a new
326 // child frame during or after detaching children results in an attached 326 // child frame during or after detaching children results in an attached
327 // frame on a detached DOM tree, which is bad. 327 // frame on a detached DOM tree, which is bad.
328 SubframeLoadingDisabler disabler(*document()); 328 SubframeLoadingDisabler disabler(*document());
329 m_loader.dispatchUnloadEvent(); 329 m_loader.dispatchUnloadEvent();
330 detachChildren(); 330 detachChildren();
331 m_frameScheduler.clear(); 331 m_frameScheduler.clear();
332 332
333 // All done if detaching the subframes brought about a detach of this frame also. 333 // All done if detaching the subframes brought about a detach of this frame also.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 // FIXME: It's unclear as to why this is called more than once, but it is, 404 // FIXME: It's unclear as to why this is called more than once, but it is,
405 // so page() could be null. 405 // so page() could be null.
406 if (page() && page()->focusController().focusedFrame() == this) 406 if (page() && page()->focusController().focusedFrame() == this)
407 page()->focusController().setFocusedFrame(nullptr); 407 page()->focusController().setFocusedFrame(nullptr);
408 script().clearScriptObjects(); 408 script().clearScriptObjects();
409 409
410 if (page() && page()->scrollingCoordinator() && m_view) 410 if (page() && page()->scrollingCoordinator() && m_view)
411 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); 411 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get());
412 } 412 }
413 413
414 void LocalFrame::setDOMWindow(PassRefPtrWillBeRawPtr<LocalDOMWindow> domWindow) 414 void LocalFrame::setDOMWindow(RawPtr<LocalDOMWindow> domWindow)
415 { 415 {
416 // Oilpan: setDOMWindow() cannot be used when finalizing. Which 416 // Oilpan: setDOMWindow() cannot be used when finalizing. Which
417 // is acceptable as its actions are either not needed or handled 417 // is acceptable as its actions are either not needed or handled
418 // by other means -- 418 // by other means --
419 // 419 //
420 // - LocalFrameLifecycleObserver::willDetachFrameHost() will have 420 // - LocalFrameLifecycleObserver::willDetachFrameHost() will have
421 // signalled the Inspector frameWindowDiscarded() notifications. 421 // signalled the Inspector frameWindowDiscarded() notifications.
422 // We assume that all LocalFrames are detached, where that notification 422 // We assume that all LocalFrames are detached, where that notification
423 // will have been done. 423 // will have been done.
424 // 424 //
(...skipping 30 matching lines...) Expand all
455 LayoutViewItem LocalFrame::contentLayoutItem() const 455 LayoutViewItem LocalFrame::contentLayoutItem() const
456 { 456 {
457 return LayoutViewItem(contentLayoutObject()); 457 return LayoutViewItem(contentLayoutObject());
458 } 458 }
459 459
460 void LocalFrame::didChangeVisibilityState() 460 void LocalFrame::didChangeVisibilityState()
461 { 461 {
462 if (document()) 462 if (document())
463 document()->didChangeVisibilityState(); 463 document()->didChangeVisibilityState();
464 464
465 WillBeHeapVector<RefPtrWillBeMember<LocalFrame>> childFrames; 465 HeapVector<Member<LocalFrame>> childFrames;
466 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi bling()) { 466 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi bling()) {
467 if (child->isLocalFrame()) 467 if (child->isLocalFrame())
468 childFrames.append(toLocalFrame(child)); 468 childFrames.append(toLocalFrame(child));
469 } 469 }
470 470
471 for (size_t i = 0; i < childFrames.size(); ++i) 471 for (size_t i = 0; i < childFrames.size(); ++i)
472 childFrames[i]->didChangeVisibilityState(); 472 childFrames[i]->didChangeVisibilityState();
473 } 473 }
474 474
475 LocalFrame* LocalFrame::localFrameRoot() 475 LocalFrame* LocalFrame::localFrameRoot()
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 if (LayoutView* layoutView = view()->layoutView()) { 517 if (LayoutView* layoutView = view()->layoutView()) {
518 layoutView->setPreferredLogicalWidthsDirty(); 518 layoutView->setPreferredLogicalWidthsDirty();
519 layoutView->setNeedsLayout(LayoutInvalidationReason::PrintingChanged ); 519 layoutView->setNeedsLayout(LayoutInvalidationReason::PrintingChanged );
520 layoutView->setShouldDoFullPaintInvalidationForViewAndAllDescendants (); 520 layoutView->setShouldDoFullPaintInvalidationForViewAndAllDescendants ();
521 } 521 }
522 view()->layout(); 522 view()->layout();
523 view()->adjustViewSize(); 523 view()->adjustViewSize();
524 } 524 }
525 525
526 // Subframes of the one we're printing don't lay out to the page size. 526 // Subframes of the one we're printing don't lay out to the page size.
527 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c hild->tree().nextSibling()) { 527 for (RawPtr<Frame> child = tree().firstChild(); child; child = child->tree() .nextSibling()) {
528 if (child->isLocalFrame()) 528 if (child->isLocalFrame())
529 toLocalFrame(child.get())->setPrinting(printing, FloatSize(), FloatS ize(), 0); 529 toLocalFrame(child.get())->setPrinting(printing, FloatSize(), FloatS ize(), 0);
530 } 530 }
531 } 531 }
532 532
533 bool LocalFrame::shouldUsePrintingLayout() const 533 bool LocalFrame::shouldUsePrintingLayout() const
534 { 534 {
535 // Only top frame being printed should be fit to page size. 535 // Only top frame being printed should be fit to page size.
536 // Subframes should be constrained by parents only. 536 // Subframes should be constrained by parents only.
537 return document()->printing() && (!tree().parent() || !tree().parent()->isLo calFrame() || !toLocalFrame(tree().parent())->document()->printing()); 537 return document()->printing() && (!tree().parent() || !tree().parent()->isLo calFrame() || !toLocalFrame(tree().parent())->document()->printing());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 float percentDifference = (pageZoomFactor / m_pageZoomFactor); 594 float percentDifference = (pageZoomFactor / m_pageZoomFactor);
595 view->setScrollPosition( 595 view->setScrollPosition(
596 DoublePoint(scrollPosition.x() * percentDifference, scrollPositi on.y() * percentDifference), 596 DoublePoint(scrollPosition.x() * percentDifference, scrollPositi on.y() * percentDifference),
597 ProgrammaticScroll); 597 ProgrammaticScroll);
598 } 598 }
599 } 599 }
600 600
601 m_pageZoomFactor = pageZoomFactor; 601 m_pageZoomFactor = pageZoomFactor;
602 m_textZoomFactor = textZoomFactor; 602 m_textZoomFactor = textZoomFactor;
603 603
604 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c hild->tree().nextSibling()) { 604 for (RawPtr<Frame> child = tree().firstChild(); child; child = child->tree() .nextSibling()) {
605 if (child->isLocalFrame()) 605 if (child->isLocalFrame())
606 toLocalFrame(child.get())->setPageAndTextZoomFactors(m_pageZoomFacto r, m_textZoomFactor); 606 toLocalFrame(child.get())->setPageAndTextZoomFactors(m_pageZoomFacto r, m_textZoomFactor);
607 } 607 }
608 608
609 document->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracin g::create(StyleChangeReason::Zoom)); 609 document->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracin g::create(StyleChangeReason::Zoom));
610 document->updateLayoutIgnorePendingStylesheets(); 610 document->updateLayoutIgnorePendingStylesheets();
611 } 611 }
612 612
613 void LocalFrame::deviceScaleFactorChanged() 613 void LocalFrame::deviceScaleFactorChanged()
614 { 614 {
615 document()->mediaQueryAffectingValueChanged(); 615 document()->mediaQueryAffectingValueChanged();
616 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c hild->tree().nextSibling()) { 616 for (RawPtr<Frame> child = tree().firstChild(); child; child = child->tree() .nextSibling()) {
617 if (child->isLocalFrame()) 617 if (child->isLocalFrame())
618 toLocalFrame(child.get())->deviceScaleFactorChanged(); 618 toLocalFrame(child.get())->deviceScaleFactorChanged();
619 } 619 }
620 } 620 }
621 621
622 double LocalFrame::devicePixelRatio() const 622 double LocalFrame::devicePixelRatio() const
623 { 623 {
624 if (!m_host) 624 if (!m_host)
625 return 0; 625 return 0;
626 626
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 } 825 }
826 826
827 inline LocalFrame::LocalFrame(FrameLoaderClient* client, FrameHost* host, FrameO wner* owner) 827 inline LocalFrame::LocalFrame(FrameLoaderClient* client, FrameHost* host, FrameO wner* owner)
828 : Frame(client, host, owner) 828 : Frame(client, host, owner)
829 , m_loader(this) 829 , m_loader(this)
830 , m_navigationScheduler(NavigationScheduler::create(this)) 830 , m_navigationScheduler(NavigationScheduler::create(this))
831 , m_script(ScriptController::create(this)) 831 , m_script(ScriptController::create(this))
832 , m_editor(Editor::create(*this)) 832 , m_editor(Editor::create(*this))
833 , m_spellChecker(SpellChecker::create(*this)) 833 , m_spellChecker(SpellChecker::create(*this))
834 , m_selection(FrameSelection::create(this)) 834 , m_selection(FrameSelection::create(this))
835 , m_eventHandler(adoptPtrWillBeNoop(new EventHandler(this))) 835 , m_eventHandler(new EventHandler(this))
836 , m_console(FrameConsole::create(*this)) 836 , m_console(FrameConsole::create(*this))
837 , m_inputMethodController(InputMethodController::create(*this)) 837 , m_inputMethodController(InputMethodController::create(*this))
838 , m_navigationDisableCount(0) 838 , m_navigationDisableCount(0)
839 , m_pageZoomFactor(parentPageZoomFactor(this)) 839 , m_pageZoomFactor(parentPageZoomFactor(this))
840 , m_textZoomFactor(parentTextZoomFactor(this)) 840 , m_textZoomFactor(parentTextZoomFactor(this))
841 , m_inViewSourceMode(false) 841 , m_inViewSourceMode(false)
842 { 842 {
843 if (isLocalRoot()) 843 if (isLocalRoot())
844 m_instrumentingAgents = InstrumentingAgents::create(); 844 m_instrumentingAgents = InstrumentingAgents::create();
845 else 845 else
(...skipping 29 matching lines...) Expand all
875 { 875 {
876 m_frame->disableNavigation(); 876 m_frame->disableNavigation();
877 } 877 }
878 878
879 FrameNavigationDisabler::~FrameNavigationDisabler() 879 FrameNavigationDisabler::~FrameNavigationDisabler()
880 { 880 {
881 m_frame->enableNavigation(); 881 m_frame->enableNavigation();
882 } 882 }
883 883
884 } // namespace blink 884 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.h ('k') | third_party/WebKit/Source/core/frame/Location.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698