| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 RespectImageOrientationEnum imageOrientation = DoNotRespectImageOrientat
ion; | 131 RespectImageOrientationEnum imageOrientation = DoNotRespectImageOrientat
ion; |
| 132 if (m_draggedNode && m_draggedNode->layoutObject()) | 132 if (m_draggedNode && m_draggedNode->layoutObject()) |
| 133 imageOrientation = LayoutObject::shouldRespectImageOrientation(m_dra
ggedNode->layoutObject()); | 133 imageOrientation = LayoutObject::shouldRespectImageOrientation(m_dra
ggedNode->layoutObject()); |
| 134 | 134 |
| 135 float screenDeviceScaleFactor = m_localFrame->page()->chromeClient().scr
eenInfo().deviceScaleFactor; | 135 float screenDeviceScaleFactor = m_localFrame->page()->chromeClient().scr
eenInfo().deviceScaleFactor; |
| 136 | 136 |
| 137 return DragImage::create(image.get(), imageOrientation, screenDeviceScal
eFactor, InterpolationHigh, m_opacity); | 137 return DragImage::create(image.get(), imageOrientation, screenDeviceScal
eFactor, InterpolationHigh, m_opacity); |
| 138 } | 138 } |
| 139 | 139 |
| 140 private: | 140 private: |
| 141 RawPtrWillBeMember<const LocalFrame> m_localFrame; | 141 Member<const LocalFrame> m_localFrame; |
| 142 RawPtrWillBeMember<Node> m_draggedNode; | 142 Member<Node> m_draggedNode; |
| 143 IntRect m_bounds; | 143 IntRect m_bounds; |
| 144 float m_opacity; | 144 float m_opacity; |
| 145 OwnPtr<SkPictureBuilder> m_pictureBuilder; | 145 OwnPtr<SkPictureBuilder> m_pictureBuilder; |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 inline float parentPageZoomFactor(LocalFrame* frame) | 148 inline float parentPageZoomFactor(LocalFrame* frame) |
| 149 { | 149 { |
| 150 Frame* parent = frame->tree().parent(); | 150 Frame* parent = frame->tree().parent(); |
| 151 if (!parent || !parent->isLocalFrame()) | 151 if (!parent || !parent->isLocalFrame()) |
| 152 return 1; | 152 return 1; |
| 153 return toLocalFrame(parent)->pageZoomFactor(); | 153 return toLocalFrame(parent)->pageZoomFactor(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 inline float parentTextZoomFactor(LocalFrame* frame) | 156 inline float parentTextZoomFactor(LocalFrame* frame) |
| 157 { | 157 { |
| 158 Frame* parent = frame->tree().parent(); | 158 Frame* parent = frame->tree().parent(); |
| 159 if (!parent || !parent->isLocalFrame()) | 159 if (!parent || !parent->isLocalFrame()) |
| 160 return 1; | 160 return 1; |
| 161 return toLocalFrame(parent)->textZoomFactor(); | 161 return toLocalFrame(parent)->textZoomFactor(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace | 164 } // namespace |
| 165 | 165 |
| 166 PassRefPtrWillBeRawPtr<LocalFrame> LocalFrame::create(FrameLoaderClient* client,
FrameHost* host, FrameOwner* owner) | 166 RawPtr<LocalFrame> LocalFrame::create(FrameLoaderClient* client, FrameHost* host
, FrameOwner* owner) |
| 167 { | 167 { |
| 168 RefPtrWillBeRawPtr<LocalFrame> frame = adoptRefWillBeNoop(new LocalFrame(cli
ent, host, owner)); | 168 RawPtr<LocalFrame> frame = (new LocalFrame(client, host, owner)); |
| 169 InspectorInstrumentation::frameAttachedToParent(frame.get()); | 169 InspectorInstrumentation::frameAttachedToParent(frame.get()); |
| 170 return frame.release(); | 170 return frame.release(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void LocalFrame::setView(PassRefPtrWillBeRawPtr<FrameView> view) | 173 void LocalFrame::setView(RawPtr<FrameView> view) |
| 174 { | 174 { |
| 175 ASSERT(!m_view || m_view != view); | 175 ASSERT(!m_view || m_view != view); |
| 176 ASSERT(!document() || !document()->isActive()); | 176 ASSERT(!document() || !document()->isActive()); |
| 177 | 177 |
| 178 eventHandler().clear(); | 178 eventHandler().clear(); |
| 179 | 179 |
| 180 m_view = view; | 180 m_view = view; |
| 181 } | 181 } |
| 182 | 182 |
| 183 void LocalFrame::createView(const IntSize& viewportSize, const Color& background
Color, bool transparent, | 183 void LocalFrame::createView(const IntSize& viewportSize, const Color& background
Color, bool transparent, |
| 184 ScrollbarMode horizontalScrollbarMode, bool horizontalLock, | 184 ScrollbarMode horizontalScrollbarMode, bool horizontalLock, |
| 185 ScrollbarMode verticalScrollbarMode, bool verticalLock) | 185 ScrollbarMode verticalScrollbarMode, bool verticalLock) |
| 186 { | 186 { |
| 187 ASSERT(this); | 187 ASSERT(this); |
| 188 ASSERT(page()); | 188 ASSERT(page()); |
| 189 | 189 |
| 190 bool isLocalRoot = this->isLocalRoot(); | 190 bool isLocalRoot = this->isLocalRoot(); |
| 191 | 191 |
| 192 if (isLocalRoot && view()) | 192 if (isLocalRoot && view()) |
| 193 view()->setParentVisible(false); | 193 view()->setParentVisible(false); |
| 194 | 194 |
| 195 setView(nullptr); | 195 setView(nullptr); |
| 196 | 196 |
| 197 RefPtrWillBeRawPtr<FrameView> frameView = nullptr; | 197 RawPtr<FrameView> frameView = nullptr; |
| 198 if (isLocalRoot) { | 198 if (isLocalRoot) { |
| 199 frameView = FrameView::create(this, viewportSize); | 199 frameView = FrameView::create(this, viewportSize); |
| 200 | 200 |
| 201 // The layout size is set by WebViewImpl to support @viewport | 201 // The layout size is set by WebViewImpl to support @viewport |
| 202 frameView->setLayoutSizeFixedToFrameSize(false); | 202 frameView->setLayoutSizeFixedToFrameSize(false); |
| 203 } else { | 203 } else { |
| 204 frameView = FrameView::create(this); | 204 frameView = FrameView::create(this); |
| 205 } | 205 } |
| 206 | 206 |
| 207 frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode,
horizontalLock, verticalLock); | 207 frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode,
horizontalLock, verticalLock); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 } else { | 311 } else { |
| 312 m_navigationScheduler->scheduleReload(); | 312 m_navigationScheduler->scheduleReload(); |
| 313 } | 313 } |
| 314 } | 314 } |
| 315 | 315 |
| 316 void LocalFrame::detach(FrameDetachType type) | 316 void LocalFrame::detach(FrameDetachType type) |
| 317 { | 317 { |
| 318 PluginScriptForbiddenScope forbidPluginDestructorScripting; | 318 PluginScriptForbiddenScope forbidPluginDestructorScripting; |
| 319 // A lot of the following steps can result in the current frame being | 319 // A lot of the following steps can result in the current frame being |
| 320 // detached, so protect a reference to it. | 320 // detached, so protect a reference to it. |
| 321 RefPtrWillBeRawPtr<LocalFrame> protect(this); | 321 RawPtr<LocalFrame> protect(this); |
| 322 m_loader.stopAllLoaders(); | 322 m_loader.stopAllLoaders(); |
| 323 // Don't allow any new child frames to load in this frame: attaching a new | 323 // Don't allow any new child frames to load in this frame: attaching a new |
| 324 // child frame during or after detaching children results in an attached | 324 // child frame during or after detaching children results in an attached |
| 325 // frame on a detached DOM tree, which is bad. | 325 // frame on a detached DOM tree, which is bad. |
| 326 SubframeLoadingDisabler disabler(*document()); | 326 SubframeLoadingDisabler disabler(*document()); |
| 327 m_loader.dispatchUnloadEvent(); | 327 m_loader.dispatchUnloadEvent(); |
| 328 detachChildren(); | 328 detachChildren(); |
| 329 m_frameScheduler.clear(); | 329 m_frameScheduler.clear(); |
| 330 | 330 |
| 331 // All done if detaching the subframes brought about a detach of this frame
also. | 331 // All done if detaching the subframes brought about a detach of this frame
also. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 // FIXME: It's unclear as to why this is called more than once, but it is, | 411 // FIXME: It's unclear as to why this is called more than once, but it is, |
| 412 // so page() could be null. | 412 // so page() could be null. |
| 413 if (page() && page()->focusController().focusedFrame() == this) | 413 if (page() && page()->focusController().focusedFrame() == this) |
| 414 page()->focusController().setFocusedFrame(nullptr); | 414 page()->focusController().setFocusedFrame(nullptr); |
| 415 script().clearScriptObjects(); | 415 script().clearScriptObjects(); |
| 416 | 416 |
| 417 if (page() && page()->scrollingCoordinator() && m_view) | 417 if (page() && page()->scrollingCoordinator() && m_view) |
| 418 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); | 418 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); |
| 419 } | 419 } |
| 420 | 420 |
| 421 void LocalFrame::setDOMWindow(PassRefPtrWillBeRawPtr<LocalDOMWindow> domWindow) | 421 void LocalFrame::setDOMWindow(RawPtr<LocalDOMWindow> domWindow) |
| 422 { | 422 { |
| 423 // Oilpan: setDOMWindow() cannot be used when finalizing. Which | 423 // Oilpan: setDOMWindow() cannot be used when finalizing. Which |
| 424 // is acceptable as its actions are either not needed or handled | 424 // is acceptable as its actions are either not needed or handled |
| 425 // by other means -- | 425 // by other means -- |
| 426 // | 426 // |
| 427 // - LocalFrameLifecycleObserver::willDetachFrameHost() will have | 427 // - LocalFrameLifecycleObserver::willDetachFrameHost() will have |
| 428 // signalled the Inspector frameWindowDiscarded() notifications. | 428 // signalled the Inspector frameWindowDiscarded() notifications. |
| 429 // We assume that all LocalFrames are detached, where that notification | 429 // We assume that all LocalFrames are detached, where that notification |
| 430 // will have been done. | 430 // will have been done. |
| 431 // | 431 // |
| (...skipping 25 matching lines...) Expand all Loading... |
| 457 LayoutView* LocalFrame::contentLayoutObject() const | 457 LayoutView* LocalFrame::contentLayoutObject() const |
| 458 { | 458 { |
| 459 return document() ? document()->layoutView() : nullptr; | 459 return document() ? document()->layoutView() : nullptr; |
| 460 } | 460 } |
| 461 | 461 |
| 462 void LocalFrame::didChangeVisibilityState() | 462 void LocalFrame::didChangeVisibilityState() |
| 463 { | 463 { |
| 464 if (document()) | 464 if (document()) |
| 465 document()->didChangeVisibilityState(); | 465 document()->didChangeVisibilityState(); |
| 466 | 466 |
| 467 WillBeHeapVector<RefPtrWillBeMember<LocalFrame>> childFrames; | 467 HeapVector<Member<LocalFrame>> childFrames; |
| 468 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi
bling()) { | 468 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi
bling()) { |
| 469 if (child->isLocalFrame()) | 469 if (child->isLocalFrame()) |
| 470 childFrames.append(toLocalFrame(child)); | 470 childFrames.append(toLocalFrame(child)); |
| 471 } | 471 } |
| 472 | 472 |
| 473 for (size_t i = 0; i < childFrames.size(); ++i) | 473 for (size_t i = 0; i < childFrames.size(); ++i) |
| 474 childFrames[i]->didChangeVisibilityState(); | 474 childFrames[i]->didChangeVisibilityState(); |
| 475 } | 475 } |
| 476 | 476 |
| 477 LocalFrame* LocalFrame::localFrameRoot() | 477 LocalFrame* LocalFrame::localFrameRoot() |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 if (LayoutView* layoutView = view()->layoutView()) { | 519 if (LayoutView* layoutView = view()->layoutView()) { |
| 520 layoutView->setPreferredLogicalWidthsDirty(); | 520 layoutView->setPreferredLogicalWidthsDirty(); |
| 521 layoutView->setNeedsLayout(LayoutInvalidationReason::PrintingChanged
); | 521 layoutView->setNeedsLayout(LayoutInvalidationReason::PrintingChanged
); |
| 522 layoutView->setShouldDoFullPaintInvalidationForViewAndAllDescendants
(); | 522 layoutView->setShouldDoFullPaintInvalidationForViewAndAllDescendants
(); |
| 523 } | 523 } |
| 524 view()->layout(); | 524 view()->layout(); |
| 525 view()->adjustViewSize(); | 525 view()->adjustViewSize(); |
| 526 } | 526 } |
| 527 | 527 |
| 528 // Subframes of the one we're printing don't lay out to the page size. | 528 // Subframes of the one we're printing don't lay out to the page size. |
| 529 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c
hild->tree().nextSibling()) { | 529 for (RawPtr<Frame> child = tree().firstChild(); child; child = child->tree()
.nextSibling()) { |
| 530 if (child->isLocalFrame()) | 530 if (child->isLocalFrame()) |
| 531 toLocalFrame(child.get())->setPrinting(printing, FloatSize(), FloatS
ize(), 0); | 531 toLocalFrame(child.get())->setPrinting(printing, FloatSize(), FloatS
ize(), 0); |
| 532 } | 532 } |
| 533 } | 533 } |
| 534 | 534 |
| 535 bool LocalFrame::shouldUsePrintingLayout() const | 535 bool LocalFrame::shouldUsePrintingLayout() const |
| 536 { | 536 { |
| 537 // Only top frame being printed should be fit to page size. | 537 // Only top frame being printed should be fit to page size. |
| 538 // Subframes should be constrained by parents only. | 538 // Subframes should be constrained by parents only. |
| 539 return document()->printing() && (!tree().parent() || !tree().parent()->isLo
calFrame() || !toLocalFrame(tree().parent())->document()->printing()); | 539 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 Loading... |
| 596 float percentDifference = (pageZoomFactor / m_pageZoomFactor); | 596 float percentDifference = (pageZoomFactor / m_pageZoomFactor); |
| 597 view->setScrollPosition( | 597 view->setScrollPosition( |
| 598 DoublePoint(scrollPosition.x() * percentDifference, scrollPositi
on.y() * percentDifference), | 598 DoublePoint(scrollPosition.x() * percentDifference, scrollPositi
on.y() * percentDifference), |
| 599 ProgrammaticScroll); | 599 ProgrammaticScroll); |
| 600 } | 600 } |
| 601 } | 601 } |
| 602 | 602 |
| 603 m_pageZoomFactor = pageZoomFactor; | 603 m_pageZoomFactor = pageZoomFactor; |
| 604 m_textZoomFactor = textZoomFactor; | 604 m_textZoomFactor = textZoomFactor; |
| 605 | 605 |
| 606 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c
hild->tree().nextSibling()) { | 606 for (RawPtr<Frame> child = tree().firstChild(); child; child = child->tree()
.nextSibling()) { |
| 607 if (child->isLocalFrame()) | 607 if (child->isLocalFrame()) |
| 608 toLocalFrame(child.get())->setPageAndTextZoomFactors(m_pageZoomFacto
r, m_textZoomFactor); | 608 toLocalFrame(child.get())->setPageAndTextZoomFactors(m_pageZoomFacto
r, m_textZoomFactor); |
| 609 } | 609 } |
| 610 | 610 |
| 611 document->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracin
g::create(StyleChangeReason::Zoom)); | 611 document->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracin
g::create(StyleChangeReason::Zoom)); |
| 612 document->updateLayoutIgnorePendingStylesheets(); | 612 document->updateLayoutIgnorePendingStylesheets(); |
| 613 } | 613 } |
| 614 | 614 |
| 615 void LocalFrame::deviceScaleFactorChanged() | 615 void LocalFrame::deviceScaleFactorChanged() |
| 616 { | 616 { |
| 617 document()->mediaQueryAffectingValueChanged(); | 617 document()->mediaQueryAffectingValueChanged(); |
| 618 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c
hild->tree().nextSibling()) { | 618 for (RawPtr<Frame> child = tree().firstChild(); child; child = child->tree()
.nextSibling()) { |
| 619 if (child->isLocalFrame()) | 619 if (child->isLocalFrame()) |
| 620 toLocalFrame(child.get())->deviceScaleFactorChanged(); | 620 toLocalFrame(child.get())->deviceScaleFactorChanged(); |
| 621 } | 621 } |
| 622 } | 622 } |
| 623 | 623 |
| 624 double LocalFrame::devicePixelRatio() const | 624 double LocalFrame::devicePixelRatio() const |
| 625 { | 625 { |
| 626 if (!m_host) | 626 if (!m_host) |
| 627 return 0; | 627 return 0; |
| 628 | 628 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 } | 839 } |
| 840 | 840 |
| 841 inline LocalFrame::LocalFrame(FrameLoaderClient* client, FrameHost* host, FrameO
wner* owner) | 841 inline LocalFrame::LocalFrame(FrameLoaderClient* client, FrameHost* host, FrameO
wner* owner) |
| 842 : Frame(client, host, owner) | 842 : Frame(client, host, owner) |
| 843 , m_loader(this) | 843 , m_loader(this) |
| 844 , m_navigationScheduler(NavigationScheduler::create(this)) | 844 , m_navigationScheduler(NavigationScheduler::create(this)) |
| 845 , m_script(ScriptController::create(this)) | 845 , m_script(ScriptController::create(this)) |
| 846 , m_editor(Editor::create(*this)) | 846 , m_editor(Editor::create(*this)) |
| 847 , m_spellChecker(SpellChecker::create(*this)) | 847 , m_spellChecker(SpellChecker::create(*this)) |
| 848 , m_selection(FrameSelection::create(this)) | 848 , m_selection(FrameSelection::create(this)) |
| 849 , m_eventHandler(adoptPtrWillBeNoop(new EventHandler(this))) | 849 , m_eventHandler((new EventHandler(this))) |
| 850 , m_console(FrameConsole::create(*this)) | 850 , m_console(FrameConsole::create(*this)) |
| 851 , m_inputMethodController(InputMethodController::create(*this)) | 851 , m_inputMethodController(InputMethodController::create(*this)) |
| 852 , m_navigationDisableCount(0) | 852 , m_navigationDisableCount(0) |
| 853 , m_pageZoomFactor(parentPageZoomFactor(this)) | 853 , m_pageZoomFactor(parentPageZoomFactor(this)) |
| 854 , m_textZoomFactor(parentTextZoomFactor(this)) | 854 , m_textZoomFactor(parentTextZoomFactor(this)) |
| 855 , m_inViewSourceMode(false) | 855 , m_inViewSourceMode(false) |
| 856 { | 856 { |
| 857 if (isLocalRoot()) | 857 if (isLocalRoot()) |
| 858 m_instrumentingAgents = InstrumentingAgents::create(); | 858 m_instrumentingAgents = InstrumentingAgents::create(); |
| 859 else | 859 else |
| (...skipping 29 matching lines...) Expand all Loading... |
| 889 { | 889 { |
| 890 m_frame->disableNavigation(); | 890 m_frame->disableNavigation(); |
| 891 } | 891 } |
| 892 | 892 |
| 893 FrameNavigationDisabler::~FrameNavigationDisabler() | 893 FrameNavigationDisabler::~FrameNavigationDisabler() |
| 894 { | 894 { |
| 895 m_frame->enableNavigation(); | 895 m_frame->enableNavigation(); |
| 896 } | 896 } |
| 897 | 897 |
| 898 } // namespace blink | 898 } // namespace blink |
| OLD | NEW |