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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 399 |
400 updateScrollableAreaSet(); | 400 updateScrollableAreaSet(); |
401 | 401 |
402 if (LayoutView* layoutView = this->layoutView()) { | 402 if (LayoutView* layoutView = this->layoutView()) { |
403 if (layoutView->usesCompositing()) | 403 if (layoutView->usesCompositing()) |
404 layoutView->compositor()->frameViewDidChangeSize(); | 404 layoutView->compositor()->frameViewDidChangeSize(); |
405 } | 405 } |
406 | 406 |
407 viewportSizeChanged(newRect.width() != oldRect.width(), newRect.height() !=
oldRect.height()); | 407 viewportSizeChanged(newRect.width() != oldRect.width(), newRect.height() !=
oldRect.height()); |
408 | 408 |
409 if (oldRect.size() != newRect.size() && m_frame->isMainFrame()) | 409 if (oldRect.size() != newRect.size()) { |
410 page()->frameHost().visualViewport().mainFrameDidChangeSize(); | 410 if (m_frame->isMainFrame()) |
| 411 m_frame->host()->visualViewport().mainFrameDidChangeSize(); |
| 412 frame().loader().restoreScrollPositionAndViewState(); |
| 413 } |
411 } | 414 } |
412 | 415 |
413 Page* FrameView::page() const | 416 Page* FrameView::page() const |
414 { | 417 { |
415 return frame().page(); | 418 return frame().page(); |
416 } | 419 } |
417 | 420 |
418 LayoutView* FrameView::layoutView() const | 421 LayoutView* FrameView::layoutView() const |
419 { | 422 { |
420 return frame().contentLayoutObject(); | 423 return frame().contentLayoutObject(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 updateScrollbars(scrollOffsetDouble()); | 505 updateScrollbars(scrollOffsetDouble()); |
503 ScrollableArea::contentsResized(); | 506 ScrollableArea::contentsResized(); |
504 | 507 |
505 Page* page = frame().page(); | 508 Page* page = frame().page(); |
506 if (!page) | 509 if (!page) |
507 return; | 510 return; |
508 | 511 |
509 updateScrollableAreaSet(); | 512 updateScrollableAreaSet(); |
510 | 513 |
511 page->chromeClient().contentsSizeChanged(m_frame.get(), size); | 514 page->chromeClient().contentsSizeChanged(m_frame.get(), size); |
512 } | 515 frame().loader().restoreScrollPositionAndViewState(); |
513 | |
514 IntPoint FrameView::clampOffsetAtScale(const IntPoint& offset, float scale) cons
t | |
515 { | |
516 IntPoint maxScrollExtent(contentsSize().width() - scrollOrigin().x(), conten
tsSize().height() - scrollOrigin().y()); | |
517 FloatSize scaledSize = visibleContentSize(); | |
518 if (scale) | |
519 scaledSize.scale(1 / scale); | |
520 | |
521 IntPoint clampedOffset = offset; | |
522 clampedOffset = clampedOffset.shrunkTo(maxScrollExtent - expandedIntSize(sca
ledSize)); | |
523 clampedOffset = clampedOffset.expandedTo(-scrollOrigin()); | |
524 | |
525 return clampedOffset; | |
526 } | 516 } |
527 | 517 |
528 void FrameView::adjustViewSize() | 518 void FrameView::adjustViewSize() |
529 { | 519 { |
530 LayoutView* layoutView = this->layoutView(); | 520 LayoutView* layoutView = this->layoutView(); |
531 if (!layoutView) | 521 if (!layoutView) |
532 return; | 522 return; |
533 | 523 |
534 ASSERT(m_frame->view() == this); | 524 ASSERT(m_frame->view() == this); |
535 | 525 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 document->styleResolverChanged(); | 773 document->styleResolverChanged(); |
784 document->mediaQueryAffectingValueChanged(); | 774 document->mediaQueryAffectingValueChanged(); |
785 } else if (wasResized) { | 775 } else if (wasResized) { |
786 document->evaluateMediaQueryList(); | 776 document->evaluateMediaQueryList(); |
787 } | 777 } |
788 | 778 |
789 document->updateLayoutTreeIfNeeded(); | 779 document->updateLayoutTreeIfNeeded(); |
790 lifecycle().advanceTo(DocumentLifecycle::StyleClean); | 780 lifecycle().advanceTo(DocumentLifecycle::StyleClean); |
791 | 781 |
792 if (m_frame->isMainFrame() && !m_viewportScrollableArea) { | 782 if (m_frame->isMainFrame() && !m_viewportScrollableArea) { |
793 ScrollableArea& visualViewport = page()->frameHost().visualViewport(); | 783 ScrollableArea& visualViewport = m_frame->host()->visualViewport(); |
794 ScrollableArea* layoutViewport = layoutViewportScrollableArea(); | 784 ScrollableArea* layoutViewport = layoutViewportScrollableArea(); |
795 bool invertScrollOrder = m_frame->settings()->invertViewportScrollOrder(
); | 785 bool invertScrollOrder = m_frame->settings()->invertViewportScrollOrder(
); |
796 ASSERT(layoutViewport); | 786 ASSERT(layoutViewport); |
797 m_viewportScrollableArea = RootFrameViewport::create(visualViewport, *la
youtViewport, invertScrollOrder); | 787 m_viewportScrollableArea = RootFrameViewport::create(visualViewport, *la
youtViewport, invertScrollOrder); |
798 } | 788 } |
799 } | 789 } |
800 | 790 |
801 static inline void layoutFromRootObject(LayoutObject& root) | 791 static inline void layoutFromRootObject(LayoutObject& root) |
802 { | 792 { |
803 LayoutState layoutState(root); | 793 LayoutState layoutState(root); |
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2188 m_inputEventsScaleFactorForEmulation = contentScaleFactor; | 2178 m_inputEventsScaleFactorForEmulation = contentScaleFactor; |
2189 } | 2179 } |
2190 | 2180 |
2191 IntSize FrameView::inputEventsOffsetForEmulation() const | 2181 IntSize FrameView::inputEventsOffsetForEmulation() const |
2192 { | 2182 { |
2193 return m_inputEventsOffsetForEmulation; | 2183 return m_inputEventsOffsetForEmulation; |
2194 } | 2184 } |
2195 | 2185 |
2196 float FrameView::inputEventsScaleFactor() const | 2186 float FrameView::inputEventsScaleFactor() const |
2197 { | 2187 { |
2198 float pageScale = m_frame->page()->frameHost().visualViewport().scale(); | 2188 float pageScale = m_frame->host()->visualViewport().scale(); |
2199 return pageScale * m_inputEventsScaleFactorForEmulation; | 2189 return pageScale * m_inputEventsScaleFactorForEmulation; |
2200 } | 2190 } |
2201 | 2191 |
2202 bool FrameView::scrollbarsCanBeActive() const | 2192 bool FrameView::scrollbarsCanBeActive() const |
2203 { | 2193 { |
2204 if (m_frame->view() != this) | 2194 if (m_frame->view() != this) |
2205 return false; | 2195 return false; |
2206 | 2196 |
2207 return !!m_frame->document(); | 2197 return !!m_frame->document(); |
2208 } | 2198 } |
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3545 } | 3535 } |
3546 | 3536 |
3547 FloatPoint FrameView::rootFrameToContents(const FloatPoint& windowPoint) const | 3537 FloatPoint FrameView::rootFrameToContents(const FloatPoint& windowPoint) const |
3548 { | 3538 { |
3549 FloatPoint framePoint = convertFromContainingWindow(windowPoint); | 3539 FloatPoint framePoint = convertFromContainingWindow(windowPoint); |
3550 return frameToContents(framePoint); | 3540 return frameToContents(framePoint); |
3551 } | 3541 } |
3552 | 3542 |
3553 IntRect FrameView::viewportToContents(const IntRect& rectInViewport) const | 3543 IntRect FrameView::viewportToContents(const IntRect& rectInViewport) const |
3554 { | 3544 { |
3555 IntRect rectInRootFrame = page()->frameHost().visualViewport().viewportToRoo
tFrame(rectInViewport); | 3545 IntRect rectInRootFrame = m_frame->host()->visualViewport().viewportToRootFr
ame(rectInViewport); |
3556 IntRect frameRect = convertFromContainingWindow(rectInRootFrame); | 3546 IntRect frameRect = convertFromContainingWindow(rectInRootFrame); |
3557 return frameToContents(frameRect); | 3547 return frameToContents(frameRect); |
3558 } | 3548 } |
3559 | 3549 |
3560 IntPoint FrameView::viewportToContents(const IntPoint& pointInViewport) const | 3550 IntPoint FrameView::viewportToContents(const IntPoint& pointInViewport) const |
3561 { | 3551 { |
3562 IntPoint pointInRootFrame = page()->frameHost().visualViewport().viewportToR
ootFrame(pointInViewport); | 3552 IntPoint pointInRootFrame = m_frame->host()->visualViewport().viewportToRoot
Frame(pointInViewport); |
3563 IntPoint pointInFrame = convertFromContainingWindow(pointInRootFrame); | 3553 IntPoint pointInFrame = convertFromContainingWindow(pointInRootFrame); |
3564 return frameToContents(pointInFrame); | 3554 return frameToContents(pointInFrame); |
3565 } | 3555 } |
3566 | 3556 |
3567 IntRect FrameView::contentsToViewport(const IntRect& rectInContents) const | 3557 IntRect FrameView::contentsToViewport(const IntRect& rectInContents) const |
3568 { | 3558 { |
3569 IntRect rectInFrame = contentsToFrame(rectInContents); | 3559 IntRect rectInFrame = contentsToFrame(rectInContents); |
3570 IntRect rectInRootFrame = convertToContainingWindow(rectInFrame); | 3560 IntRect rectInRootFrame = convertToContainingWindow(rectInFrame); |
3571 return page()->frameHost().visualViewport().rootFrameToViewport(rectInRootFr
ame); | 3561 return m_frame->host()->visualViewport().rootFrameToViewport(rectInRootFrame
); |
3572 } | 3562 } |
3573 | 3563 |
3574 IntPoint FrameView::contentsToViewport(const IntPoint& pointInContents) const | 3564 IntPoint FrameView::contentsToViewport(const IntPoint& pointInContents) const |
3575 { | 3565 { |
3576 IntPoint pointInFrame = contentsToFrame(pointInContents); | 3566 IntPoint pointInFrame = contentsToFrame(pointInContents); |
3577 IntPoint pointInRootFrame = convertToContainingWindow(pointInFrame); | 3567 IntPoint pointInRootFrame = convertToContainingWindow(pointInFrame); |
3578 return page()->frameHost().visualViewport().rootFrameToViewport(pointInRootF
rame); | 3568 return m_frame->host()->visualViewport().rootFrameToViewport(pointInRootFram
e); |
3579 } | 3569 } |
3580 | 3570 |
3581 IntRect FrameView::contentsToScreen(const IntRect& rect) const | 3571 IntRect FrameView::contentsToScreen(const IntRect& rect) const |
3582 { | 3572 { |
3583 HostWindow* window = hostWindow(); | 3573 HostWindow* window = hostWindow(); |
3584 if (!window) | 3574 if (!window) |
3585 return IntRect(); | 3575 return IntRect(); |
3586 return window->viewportToScreen(contentsToViewport(rect)); | 3576 return window->viewportToScreen(contentsToViewport(rect)); |
3587 } | 3577 } |
3588 | 3578 |
3589 IntRect FrameView::soonToBeRemovedContentsToUnscaledViewport(const IntRect& rect
InContents) const | 3579 IntRect FrameView::soonToBeRemovedContentsToUnscaledViewport(const IntRect& rect
InContents) const |
3590 { | 3580 { |
3591 IntRect rectInFrame = contentsToFrame(rectInContents); | 3581 IntRect rectInFrame = contentsToFrame(rectInContents); |
3592 IntRect rectInRootFrame = convertToContainingWindow(rectInFrame); | 3582 IntRect rectInRootFrame = convertToContainingWindow(rectInFrame); |
3593 return enclosingIntRect(page()->frameHost().visualViewport().mainViewToViewp
ortCSSPixels(rectInRootFrame)); | 3583 return enclosingIntRect(m_frame->host()->visualViewport().mainViewToViewport
CSSPixels(rectInRootFrame)); |
3594 } | 3584 } |
3595 | 3585 |
3596 IntPoint FrameView::soonToBeRemovedUnscaledViewportToContents(const IntPoint& po
intInViewport) const | 3586 IntPoint FrameView::soonToBeRemovedUnscaledViewportToContents(const IntPoint& po
intInViewport) const |
3597 { | 3587 { |
3598 IntPoint pointInRootFrame = flooredIntPoint(page()->frameHost().visualViewpo
rt().viewportCSSPixelsToRootFrame(pointInViewport)); | 3588 IntPoint pointInRootFrame = flooredIntPoint(m_frame->host()->visualViewport(
).viewportCSSPixelsToRootFrame(pointInViewport)); |
3599 IntPoint pointInThisFrame = convertFromContainingWindow(pointInRootFrame); | 3589 IntPoint pointInThisFrame = convertFromContainingWindow(pointInRootFrame); |
3600 return frameToContents(pointInThisFrame); | 3590 return frameToContents(pointInThisFrame); |
3601 } | 3591 } |
3602 | 3592 |
3603 bool FrameView::containsScrollbarsAvoidingResizer() const | 3593 bool FrameView::containsScrollbarsAvoidingResizer() const |
3604 { | 3594 { |
3605 return !m_scrollbarsAvoidingResizer; | 3595 return !m_scrollbarsAvoidingResizer; |
3606 } | 3596 } |
3607 | 3597 |
3608 void FrameView::adjustScrollbarsAvoidingResizerCount(int overlapDelta) | 3598 void FrameView::adjustScrollbarsAvoidingResizerCount(int overlapDelta) |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3978 | 3968 |
3979 if (!graphicsLayer) | 3969 if (!graphicsLayer) |
3980 return; | 3970 return; |
3981 | 3971 |
3982 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL
ayoutObject(), paintInvalidationContainer, viewRect); | 3972 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL
ayoutObject(), paintInvalidationContainer, viewRect); |
3983 | 3973 |
3984 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web
Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing
IntRect(viewRect))); | 3974 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web
Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing
IntRect(viewRect))); |
3985 } | 3975 } |
3986 | 3976 |
3987 } // namespace blink | 3977 } // namespace blink |
OLD | NEW |