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 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 } | 366 } |
367 | 367 |
368 bool FrameView::didFirstLayout() const | 368 bool FrameView::didFirstLayout() const |
369 { | 369 { |
370 return !m_firstLayout; | 370 return !m_firstLayout; |
371 } | 371 } |
372 | 372 |
373 void FrameView::invalidateRect(const IntRect& rect) | 373 void FrameView::invalidateRect(const IntRect& rect) |
374 { | 374 { |
375 if (!parent()) { | 375 if (!parent()) { |
376 if (HostWindow* window = hostWindow()) | 376 if (HostWindow* window = getHostWindow()) |
377 window->invalidateRect(rect); | 377 window->invalidateRect(rect); |
378 return; | 378 return; |
379 } | 379 } |
380 | 380 |
381 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); | 381 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); |
382 if (!layoutObject) | 382 if (!layoutObject) |
383 return; | 383 return; |
384 | 384 |
385 IntRect paintInvalidationRect = rect; | 385 IntRect paintInvalidationRect = rect; |
386 paintInvalidationRect.move(layoutObject->borderLeft() + layoutObject->paddin
gLeft(), | 386 paintInvalidationRect.move(layoutObject->borderLeft() + layoutObject->paddin
gLeft(), |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 LayoutRect rect(frameLayoutObject->borderLeft() + frameLayoutObject-
>paddingLeft(), | 1442 LayoutRect rect(frameLayoutObject->borderLeft() + frameLayoutObject-
>paddingLeft(), |
1443 frameLayoutObject->borderTop() + frameLayoutObject->paddingTop()
, | 1443 frameLayoutObject->borderTop() + frameLayoutObject->paddingTop()
, |
1444 LayoutUnit(visibleWidth()), LayoutUnit(visibleHeight())); | 1444 LayoutUnit(visibleWidth()), LayoutUnit(visibleHeight())); |
1445 // FIXME: We should not allow paint invalidation out of paint invali
dation state. crbug.com/457415 | 1445 // FIXME: We should not allow paint invalidation out of paint invali
dation state. crbug.com/457415 |
1446 DisablePaintInvalidationStateAsserts disabler; | 1446 DisablePaintInvalidationStateAsserts disabler; |
1447 frameLayoutObject->invalidatePaintRectangle(rect); | 1447 frameLayoutObject->invalidatePaintRectangle(rect); |
1448 return; | 1448 return; |
1449 } | 1449 } |
1450 } | 1450 } |
1451 | 1451 |
1452 hostWindow()->invalidateRect(updateRect); | 1452 getHostWindow()->invalidateRect(updateRect); |
1453 } | 1453 } |
1454 | 1454 |
1455 void FrameView::restoreScrollbar() | 1455 void FrameView::restoreScrollbar() |
1456 { | 1456 { |
1457 setScrollbarsSuppressed(false); | 1457 setScrollbarsSuppressed(false); |
1458 } | 1458 } |
1459 | 1459 |
1460 void FrameView::processUrlFragment(const KURL& url, UrlFragmentBehavior behavior
) | 1460 void FrameView::processUrlFragment(const KURL& url, UrlFragmentBehavior behavior
) |
1461 { | 1461 { |
1462 // If our URL has no ref, then we have no place we need to jump to. | 1462 // If our URL has no ref, then we have no place we need to jump to. |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 Frame* focusedFrame = page->focusController().focusedOrMainFrame(); | 1668 Frame* focusedFrame = page->focusController().focusedOrMainFrame(); |
1669 LocalFrame* localFrame = focusedFrame->isLocalFrame() ? toLocalFrame(focused
Frame) : nullptr; | 1669 LocalFrame* localFrame = focusedFrame->isLocalFrame() ? toLocalFrame(focused
Frame) : nullptr; |
1670 if (!localFrame || !computeCompositedSelection(*localFrame, selection)) { | 1670 if (!localFrame || !computeCompositedSelection(*localFrame, selection)) { |
1671 page->chromeClient().clearCompositedSelection(); | 1671 page->chromeClient().clearCompositedSelection(); |
1672 return; | 1672 return; |
1673 } | 1673 } |
1674 | 1674 |
1675 page->chromeClient().updateCompositedSelection(selection); | 1675 page->chromeClient().updateCompositedSelection(selection); |
1676 } | 1676 } |
1677 | 1677 |
1678 HostWindow* FrameView::hostWindow() const | 1678 HostWindow* FrameView::getHostWindow() const |
1679 { | 1679 { |
1680 Page* page = frame().page(); | 1680 Page* page = frame().page(); |
1681 if (!page) | 1681 if (!page) |
1682 return nullptr; | 1682 return nullptr; |
1683 return &page->chromeClient(); | 1683 return &page->chromeClient(); |
1684 } | 1684 } |
1685 | 1685 |
1686 void FrameView::contentsResized() | 1686 void FrameView::contentsResized() |
1687 { | 1687 { |
1688 if (m_frame->isMainFrame() && m_frame->document()) { | 1688 if (m_frame->isMainFrame() && m_frame->document()) { |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2544 ASSERT(view); | 2544 ASSERT(view); |
2545 | 2545 |
2546 // TODO(jbroman): Simplify the path to PaintController. | 2546 // TODO(jbroman): Simplify the path to PaintController. |
2547 PaintLayer* layer = view->layer(); | 2547 PaintLayer* layer = view->layer(); |
2548 ASSERT(layer); | 2548 ASSERT(layer); |
2549 if (!layer->hasCompositedLayerMapping()) | 2549 if (!layer->hasCompositedLayerMapping()) |
2550 return; | 2550 return; |
2551 GraphicsLayer* rootGraphicsLayer = layer->compositedLayerMapping()->mainGrap
hicsLayer(); | 2551 GraphicsLayer* rootGraphicsLayer = layer->compositedLayerMapping()->mainGrap
hicsLayer(); |
2552 if (!rootGraphicsLayer->drawsContent()) | 2552 if (!rootGraphicsLayer->drawsContent()) |
2553 return; | 2553 return; |
2554 const PaintArtifact& paintArtifact = rootGraphicsLayer->paintController().pa
intArtifact(); | 2554 const PaintArtifact& paintArtifact = rootGraphicsLayer->getPaintController()
.paintArtifact(); |
2555 | 2555 |
2556 Page* page = frame().page(); | 2556 Page* page = frame().page(); |
2557 if (!page) | 2557 if (!page) |
2558 return; | 2558 return; |
2559 page->chromeClient().didPaint(paintArtifact); | 2559 page->chromeClient().didPaint(paintArtifact); |
2560 } | 2560 } |
2561 | 2561 |
2562 void FrameView::updateFrameTimingRequestsIfNeeded() | 2562 void FrameView::updateFrameTimingRequestsIfNeeded() |
2563 { | 2563 { |
2564 GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests; | 2564 GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests; |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3513 if (m_pendingScrollDelta.isZero()) | 3513 if (m_pendingScrollDelta.isZero()) |
3514 return; | 3514 return; |
3515 DoubleSize scrollDelta = m_pendingScrollDelta; | 3515 DoubleSize scrollDelta = m_pendingScrollDelta; |
3516 m_pendingScrollDelta = DoubleSize(); | 3516 m_pendingScrollDelta = DoubleSize(); |
3517 // FIXME: Change scrollContents() to take DoubleSize. crbug.com/414283. | 3517 // FIXME: Change scrollContents() to take DoubleSize. crbug.com/414283. |
3518 scrollContents(flooredIntSize(scrollDelta)); | 3518 scrollContents(flooredIntSize(scrollDelta)); |
3519 } | 3519 } |
3520 | 3520 |
3521 void FrameView::scrollContents(const IntSize& scrollDelta) | 3521 void FrameView::scrollContents(const IntSize& scrollDelta) |
3522 { | 3522 { |
3523 HostWindow* window = hostWindow(); | 3523 HostWindow* window = getHostWindow(); |
3524 if (!window) | 3524 if (!window) |
3525 return; | 3525 return; |
3526 | 3526 |
3527 TRACE_EVENT0("blink", "FrameView::scrollContents"); | 3527 TRACE_EVENT0("blink", "FrameView::scrollContents"); |
3528 | 3528 |
3529 IntRect clipRect = windowClipRect(); | 3529 IntRect clipRect = windowClipRect(); |
3530 IntRect updateRect = clipRect; | 3530 IntRect updateRect = clipRect; |
3531 updateRect.intersect(rectToCopyOnScroll()); | 3531 updateRect.intersect(rectToCopyOnScroll()); |
3532 | 3532 |
3533 if (!scrollContentsFastPath(-scrollDelta)) | 3533 if (!scrollContentsFastPath(-scrollDelta)) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3614 | 3614 |
3615 IntPoint FrameView::contentsToViewport(const IntPoint& pointInContents) const | 3615 IntPoint FrameView::contentsToViewport(const IntPoint& pointInContents) const |
3616 { | 3616 { |
3617 IntPoint pointInFrame = contentsToFrame(pointInContents); | 3617 IntPoint pointInFrame = contentsToFrame(pointInContents); |
3618 IntPoint pointInRootFrame = convertToRootFrame(pointInFrame); | 3618 IntPoint pointInRootFrame = convertToRootFrame(pointInFrame); |
3619 return m_frame->host()->visualViewport().rootFrameToViewport(pointInRootFram
e); | 3619 return m_frame->host()->visualViewport().rootFrameToViewport(pointInRootFram
e); |
3620 } | 3620 } |
3621 | 3621 |
3622 IntRect FrameView::contentsToScreen(const IntRect& rect) const | 3622 IntRect FrameView::contentsToScreen(const IntRect& rect) const |
3623 { | 3623 { |
3624 HostWindow* window = hostWindow(); | 3624 HostWindow* window = getHostWindow(); |
3625 if (!window) | 3625 if (!window) |
3626 return IntRect(); | 3626 return IntRect(); |
3627 return window->viewportToScreen(contentsToViewport(rect)); | 3627 return window->viewportToScreen(contentsToViewport(rect)); |
3628 } | 3628 } |
3629 | 3629 |
3630 IntRect FrameView::soonToBeRemovedContentsToUnscaledViewport(const IntRect& rect
InContents) const | 3630 IntRect FrameView::soonToBeRemovedContentsToUnscaledViewport(const IntRect& rect
InContents) const |
3631 { | 3631 { |
3632 IntRect rectInFrame = contentsToFrame(rectInContents); | 3632 IntRect rectInFrame = contentsToFrame(rectInContents); |
3633 IntRect rectInRootFrame = convertToRootFrame(rectInFrame); | 3633 IntRect rectInRootFrame = convertToRootFrame(rectInFrame); |
3634 return enclosingIntRect(m_frame->host()->visualViewport().mainViewToViewport
CSSPixels(rectInRootFrame)); | 3634 return enclosingIntRect(m_frame->host()->visualViewport().mainViewToViewport
CSSPixels(rectInRootFrame)); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3725 m_horizontalScrollbarMode : m_verticalScrollbarMode; | 3725 m_horizontalScrollbarMode : m_verticalScrollbarMode; |
3726 | 3726 |
3727 return mode == ScrollbarAuto || mode == ScrollbarAlwaysOn; | 3727 return mode == ScrollbarAuto || mode == ScrollbarAlwaysOn; |
3728 } | 3728 } |
3729 | 3729 |
3730 bool FrameView::shouldPlaceVerticalScrollbarOnLeft() const | 3730 bool FrameView::shouldPlaceVerticalScrollbarOnLeft() const |
3731 { | 3731 { |
3732 return false; | 3732 return false; |
3733 } | 3733 } |
3734 | 3734 |
3735 Widget* FrameView::widget() | 3735 Widget* FrameView::getWidget() |
3736 { | 3736 { |
3737 return this; | 3737 return this; |
3738 } | 3738 } |
3739 | 3739 |
3740 LayoutRect FrameView::scrollIntoView(const LayoutRect& rectInContent, const Scro
llAlignment& alignX, const ScrollAlignment& alignY, ScrollType scrollType) | 3740 LayoutRect FrameView::scrollIntoView(const LayoutRect& rectInContent, const Scro
llAlignment& alignX, const ScrollAlignment& alignY, ScrollType scrollType) |
3741 { | 3741 { |
3742 LayoutRect viewRect(visibleContentRect()); | 3742 LayoutRect viewRect(visibleContentRect()); |
3743 LayoutRect exposeRect = ScrollAlignment::getRectToExpose(viewRect, rectInCon
tent, alignX, alignY); | 3743 LayoutRect exposeRect = ScrollAlignment::getRectToExpose(viewRect, rectInCon
tent, alignX, alignY); |
3744 if (exposeRect != viewRect) | 3744 if (exposeRect != viewRect) |
3745 setScrollPosition(DoublePoint(exposeRect.x(), exposeRect.y()), scrollTyp
e); | 3745 setScrollPosition(DoublePoint(exposeRect.x(), exposeRect.y()), scrollTyp
e); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3908 | 3908 |
3909 Widget::hide(); | 3909 Widget::hide(); |
3910 } | 3910 } |
3911 | 3911 |
3912 int FrameView::viewportWidth() const | 3912 int FrameView::viewportWidth() const |
3913 { | 3913 { |
3914 int viewportWidth = layoutSize(IncludeScrollbars).width(); | 3914 int viewportWidth = layoutSize(IncludeScrollbars).width(); |
3915 return adjustForAbsoluteZoom(viewportWidth, layoutView()); | 3915 return adjustForAbsoluteZoom(viewportWidth, layoutView()); |
3916 } | 3916 } |
3917 | 3917 |
3918 ScrollableArea* FrameView::scrollableArea() | 3918 ScrollableArea* FrameView::getScrollableArea() |
3919 { | 3919 { |
3920 if (m_viewportScrollableArea) | 3920 if (m_viewportScrollableArea) |
3921 return m_viewportScrollableArea.get(); | 3921 return m_viewportScrollableArea.get(); |
3922 | 3922 |
3923 return layoutViewportScrollableArea(); | 3923 return layoutViewportScrollableArea(); |
3924 } | 3924 } |
3925 | 3925 |
3926 ScrollableArea* FrameView::layoutViewportScrollableArea() | 3926 ScrollableArea* FrameView::layoutViewportScrollableArea() |
3927 { | 3927 { |
3928 Settings* settings = frame().settings(); | 3928 Settings* settings = frame().settings(); |
3929 if (!settings || !settings->rootLayerScrolls()) | 3929 if (!settings || !settings->rootLayerScrolls()) |
3930 return this; | 3930 return this; |
3931 | 3931 |
3932 LayoutView* layoutView = this->layoutView(); | 3932 LayoutView* layoutView = this->layoutView(); |
3933 return layoutView ? layoutView->scrollableArea() : nullptr; | 3933 return layoutView ? layoutView->getScrollableArea() : nullptr; |
3934 } | 3934 } |
3935 | 3935 |
3936 LayoutObject* FrameView::viewportLayoutObject() | 3936 LayoutObject* FrameView::viewportLayoutObject() |
3937 { | 3937 { |
3938 if (Document* document = frame().document()) { | 3938 if (Document* document = frame().document()) { |
3939 if (Element* element = document->viewportDefiningElement()) | 3939 if (Element* element = document->viewportDefiningElement()) |
3940 return element->layoutObject(); | 3940 return element->layoutObject(); |
3941 } | 3941 } |
3942 return nullptr; | 3942 return nullptr; |
3943 } | 3943 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4109 return m_hiddenForThrottling && m_crossOriginForThrottling; | 4109 return m_hiddenForThrottling && m_crossOriginForThrottling; |
4110 } | 4110 } |
4111 | 4111 |
4112 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4112 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
4113 { | 4113 { |
4114 ASSERT(layoutView()); | 4114 ASSERT(layoutView()); |
4115 return *layoutView(); | 4115 return *layoutView(); |
4116 } | 4116 } |
4117 | 4117 |
4118 } // namespace blink | 4118 } // namespace blink |
OLD | NEW |