| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 // FIXME: Page should take care of updating focus/scrolling instead of Frame
. | 403 // FIXME: Page should take care of updating focus/scrolling instead of Frame
. |
| 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 | 408 |
| 409 if (page() && page()->scrollingCoordinator() && m_view) | 409 if (page() && page()->scrollingCoordinator() && m_view) |
| 410 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); | 410 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); |
| 411 } | 411 } |
| 412 | 412 |
| 413 void LocalFrame::setDOMWindow(PassRefPtrWillBeRawPtr<LocalDOMWindow> domWindow) | 413 void LocalFrame::setDOMWindow(RawPtr<LocalDOMWindow> domWindow) |
| 414 { | 414 { |
| 415 // Oilpan: setDOMWindow() cannot be used when finalizing. Which | 415 // Oilpan: setDOMWindow() cannot be used when finalizing. Which |
| 416 // is acceptable as its actions are either not needed or handled | 416 // is acceptable as its actions are either not needed or handled |
| 417 // by other means -- | 417 // by other means -- |
| 418 // | 418 // |
| 419 // - LocalFrameLifecycleObserver::willDetachFrameHost() will have | 419 // - LocalFrameLifecycleObserver::willDetachFrameHost() will have |
| 420 // signalled the Inspector frameWindowDiscarded() notifications. | 420 // signalled the Inspector frameWindowDiscarded() notifications. |
| 421 // We assume that all LocalFrames are detached, where that notification | 421 // We assume that all LocalFrames are detached, where that notification |
| 422 // will have been done. | 422 // will have been done. |
| 423 // | 423 // |
| (...skipping 30 matching lines...) Expand all Loading... |
| 454 LayoutViewItem LocalFrame::contentLayoutItem() const | 454 LayoutViewItem LocalFrame::contentLayoutItem() const |
| 455 { | 455 { |
| 456 return LayoutViewItem(contentLayoutObject()); | 456 return LayoutViewItem(contentLayoutObject()); |
| 457 } | 457 } |
| 458 | 458 |
| 459 void LocalFrame::didChangeVisibilityState() | 459 void LocalFrame::didChangeVisibilityState() |
| 460 { | 460 { |
| 461 if (document()) | 461 if (document()) |
| 462 document()->didChangeVisibilityState(); | 462 document()->didChangeVisibilityState(); |
| 463 | 463 |
| 464 WillBeHeapVector<RefPtrWillBeMember<LocalFrame>> childFrames; | 464 HeapVector<Member<LocalFrame>> childFrames; |
| 465 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi
bling()) { | 465 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi
bling()) { |
| 466 if (child->isLocalFrame()) | 466 if (child->isLocalFrame()) |
| 467 childFrames.append(toLocalFrame(child)); | 467 childFrames.append(toLocalFrame(child)); |
| 468 } | 468 } |
| 469 | 469 |
| 470 for (size_t i = 0; i < childFrames.size(); ++i) | 470 for (size_t i = 0; i < childFrames.size(); ++i) |
| 471 childFrames[i]->didChangeVisibilityState(); | 471 childFrames[i]->didChangeVisibilityState(); |
| 472 } | 472 } |
| 473 | 473 |
| 474 LocalFrame* LocalFrame::localFrameRoot() | 474 LocalFrame* LocalFrame::localFrameRoot() |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 if (LayoutView* layoutView = view()->layoutView()) { | 516 if (LayoutView* layoutView = view()->layoutView()) { |
| 517 layoutView->setPreferredLogicalWidthsDirty(); | 517 layoutView->setPreferredLogicalWidthsDirty(); |
| 518 layoutView->setNeedsLayout(LayoutInvalidationReason::PrintingChanged
); | 518 layoutView->setNeedsLayout(LayoutInvalidationReason::PrintingChanged
); |
| 519 layoutView->setShouldDoFullPaintInvalidationForViewAndAllDescendants
(); | 519 layoutView->setShouldDoFullPaintInvalidationForViewAndAllDescendants
(); |
| 520 } | 520 } |
| 521 view()->layout(); | 521 view()->layout(); |
| 522 view()->adjustViewSize(); | 522 view()->adjustViewSize(); |
| 523 } | 523 } |
| 524 | 524 |
| 525 // Subframes of the one we're printing don't lay out to the page size. | 525 // Subframes of the one we're printing don't lay out to the page size. |
| 526 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c
hild->tree().nextSibling()) { | 526 for (RawPtr<Frame> child = tree().firstChild(); child; child = child->tree()
.nextSibling()) { |
| 527 if (child->isLocalFrame()) | 527 if (child->isLocalFrame()) |
| 528 toLocalFrame(child.get())->setPrinting(printing, FloatSize(), FloatS
ize(), 0); | 528 toLocalFrame(child.get())->setPrinting(printing, FloatSize(), FloatS
ize(), 0); |
| 529 } | 529 } |
| 530 } | 530 } |
| 531 | 531 |
| 532 bool LocalFrame::shouldUsePrintingLayout() const | 532 bool LocalFrame::shouldUsePrintingLayout() const |
| 533 { | 533 { |
| 534 // Only top frame being printed should be fit to page size. | 534 // Only top frame being printed should be fit to page size. |
| 535 // Subframes should be constrained by parents only. | 535 // Subframes should be constrained by parents only. |
| 536 return document()->printing() && (!tree().parent() || !tree().parent()->isLo
calFrame() || !toLocalFrame(tree().parent())->document()->printing()); | 536 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... |
| 593 float percentDifference = (pageZoomFactor / m_pageZoomFactor); | 593 float percentDifference = (pageZoomFactor / m_pageZoomFactor); |
| 594 view->setScrollPosition( | 594 view->setScrollPosition( |
| 595 DoublePoint(scrollPosition.x() * percentDifference, scrollPositi
on.y() * percentDifference), | 595 DoublePoint(scrollPosition.x() * percentDifference, scrollPositi
on.y() * percentDifference), |
| 596 ProgrammaticScroll); | 596 ProgrammaticScroll); |
| 597 } | 597 } |
| 598 } | 598 } |
| 599 | 599 |
| 600 m_pageZoomFactor = pageZoomFactor; | 600 m_pageZoomFactor = pageZoomFactor; |
| 601 m_textZoomFactor = textZoomFactor; | 601 m_textZoomFactor = textZoomFactor; |
| 602 | 602 |
| 603 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c
hild->tree().nextSibling()) { | 603 for (RawPtr<Frame> child = tree().firstChild(); child; child = child->tree()
.nextSibling()) { |
| 604 if (child->isLocalFrame()) | 604 if (child->isLocalFrame()) |
| 605 toLocalFrame(child.get())->setPageAndTextZoomFactors(m_pageZoomFacto
r, m_textZoomFactor); | 605 toLocalFrame(child.get())->setPageAndTextZoomFactors(m_pageZoomFacto
r, m_textZoomFactor); |
| 606 } | 606 } |
| 607 | 607 |
| 608 document->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracin
g::create(StyleChangeReason::Zoom)); | 608 document->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracin
g::create(StyleChangeReason::Zoom)); |
| 609 document->updateLayoutIgnorePendingStylesheets(); | 609 document->updateLayoutIgnorePendingStylesheets(); |
| 610 } | 610 } |
| 611 | 611 |
| 612 void LocalFrame::deviceScaleFactorChanged() | 612 void LocalFrame::deviceScaleFactorChanged() |
| 613 { | 613 { |
| 614 document()->mediaQueryAffectingValueChanged(); | 614 document()->mediaQueryAffectingValueChanged(); |
| 615 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c
hild->tree().nextSibling()) { | 615 for (RawPtr<Frame> child = tree().firstChild(); child; child = child->tree()
.nextSibling()) { |
| 616 if (child->isLocalFrame()) | 616 if (child->isLocalFrame()) |
| 617 toLocalFrame(child.get())->deviceScaleFactorChanged(); | 617 toLocalFrame(child.get())->deviceScaleFactorChanged(); |
| 618 } | 618 } |
| 619 } | 619 } |
| 620 | 620 |
| 621 double LocalFrame::devicePixelRatio() const | 621 double LocalFrame::devicePixelRatio() const |
| 622 { | 622 { |
| 623 if (!m_host) | 623 if (!m_host) |
| 624 return 0; | 624 return 0; |
| 625 | 625 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 } | 824 } |
| 825 | 825 |
| 826 inline LocalFrame::LocalFrame(FrameLoaderClient* client, FrameHost* host, FrameO
wner* owner) | 826 inline LocalFrame::LocalFrame(FrameLoaderClient* client, FrameHost* host, FrameO
wner* owner) |
| 827 : Frame(client, host, owner) | 827 : Frame(client, host, owner) |
| 828 , m_loader(this) | 828 , m_loader(this) |
| 829 , m_navigationScheduler(NavigationScheduler::create(this)) | 829 , m_navigationScheduler(NavigationScheduler::create(this)) |
| 830 , m_script(ScriptController::create(this)) | 830 , m_script(ScriptController::create(this)) |
| 831 , m_editor(Editor::create(*this)) | 831 , m_editor(Editor::create(*this)) |
| 832 , m_spellChecker(SpellChecker::create(*this)) | 832 , m_spellChecker(SpellChecker::create(*this)) |
| 833 , m_selection(FrameSelection::create(this)) | 833 , m_selection(FrameSelection::create(this)) |
| 834 , m_eventHandler(adoptPtrWillBeNoop(new EventHandler(this))) | 834 , m_eventHandler(new EventHandler(this)) |
| 835 , m_console(FrameConsole::create(*this)) | 835 , m_console(FrameConsole::create(*this)) |
| 836 , m_inputMethodController(InputMethodController::create(*this)) | 836 , m_inputMethodController(InputMethodController::create(*this)) |
| 837 , m_navigationDisableCount(0) | 837 , m_navigationDisableCount(0) |
| 838 , m_pageZoomFactor(parentPageZoomFactor(this)) | 838 , m_pageZoomFactor(parentPageZoomFactor(this)) |
| 839 , m_textZoomFactor(parentTextZoomFactor(this)) | 839 , m_textZoomFactor(parentTextZoomFactor(this)) |
| 840 , m_inViewSourceMode(false) | 840 , m_inViewSourceMode(false) |
| 841 { | 841 { |
| 842 if (isLocalRoot()) | 842 if (isLocalRoot()) |
| 843 m_instrumentingAgents = InstrumentingAgents::create(); | 843 m_instrumentingAgents = InstrumentingAgents::create(); |
| 844 else | 844 else |
| (...skipping 28 matching lines...) Expand all Loading... |
| 873 { | 873 { |
| 874 m_frame->disableNavigation(); | 874 m_frame->disableNavigation(); |
| 875 } | 875 } |
| 876 | 876 |
| 877 FrameNavigationDisabler::~FrameNavigationDisabler() | 877 FrameNavigationDisabler::~FrameNavigationDisabler() |
| 878 { | 878 { |
| 879 m_frame->enableNavigation(); | 879 m_frame->enableNavigation(); |
| 880 } | 880 } |
| 881 | 881 |
| 882 } // namespace blink | 882 } // namespace blink |
| OLD | NEW |