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 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 RELEASE_ASSERT_NOT_REACHED(); | 1748 RELEASE_ASSERT_NOT_REACHED(); |
1749 } | 1749 } |
1750 | 1750 |
1751 IntRect paintRect = rectInContent; | 1751 IntRect paintRect = rectInContent; |
1752 if (clipsPaintInvalidations()) | 1752 if (clipsPaintInvalidations()) |
1753 paintRect.intersect(visibleContentRect()); | 1753 paintRect.intersect(visibleContentRect()); |
1754 if (paintRect.isEmpty()) | 1754 if (paintRect.isEmpty()) |
1755 return; | 1755 return; |
1756 | 1756 |
1757 if (HostWindow* window = hostWindow()) | 1757 if (HostWindow* window = hostWindow()) |
1758 window->invalidateRect(contentsToWindow(paintRect)); | 1758 window->invalidateRect(contentsToRootFrame(paintRect)); |
1759 } | 1759 } |
1760 | 1760 |
1761 void FrameView::contentsResized() | 1761 void FrameView::contentsResized() |
1762 { | 1762 { |
1763 if (m_frame->isMainFrame() && m_frame->document()) { | 1763 if (m_frame->isMainFrame() && m_frame->document()) { |
1764 if (TextAutosizer* textAutosizer = m_frame->document()->textAutosizer()) | 1764 if (TextAutosizer* textAutosizer = m_frame->document()->textAutosizer()) |
1765 textAutosizer->updatePageInfoInAllFrames(); | 1765 textAutosizer->updatePageInfoInAllFrames(); |
1766 } | 1766 } |
1767 | 1767 |
1768 ScrollableArea::contentsResized(); | 1768 ScrollableArea::contentsResized(); |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2172 m_frame->document()->enqueueAnimationFrameEvent(event.release()); | 2172 m_frame->document()->enqueueAnimationFrameEvent(event.release()); |
2173 } | 2173 } |
2174 | 2174 |
2175 } | 2175 } |
2176 | 2176 |
2177 IntRect FrameView::windowClipRect(IncludeScrollbarsInRect scrollbarInclusion) co
nst | 2177 IntRect FrameView::windowClipRect(IncludeScrollbarsInRect scrollbarInclusion) co
nst |
2178 { | 2178 { |
2179 ASSERT(m_frame->view() == this); | 2179 ASSERT(m_frame->view() == this); |
2180 | 2180 |
2181 // Set our clip rect to be our contents. | 2181 // Set our clip rect to be our contents. |
2182 IntRect clipRect = contentsToWindow(visibleContentRect(scrollbarInclusion)); | 2182 IntRect clipRect = contentsToRootFrame(visibleContentRect(scrollbarInclusion
)); |
2183 if (!m_frame->deprecatedLocalOwner()) | 2183 if (!m_frame->deprecatedLocalOwner()) |
2184 return clipRect; | 2184 return clipRect; |
2185 | 2185 |
2186 // Take our owner element and get its clip rect. | 2186 // Take our owner element and get its clip rect. |
2187 // FIXME: Do we need to do this for remote frames? | 2187 // FIXME: Do we need to do this for remote frames? |
2188 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); | 2188 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); |
2189 FrameView* parentView = ownerElement->document().view(); | 2189 FrameView* parentView = ownerElement->document().view(); |
2190 if (parentView) | 2190 if (parentView) |
2191 clipRect.intersect(parentView->windowClipRectForFrameOwner(ownerElement)
); | 2191 clipRect.intersect(parentView->windowClipRectForFrameOwner(ownerElement)
); |
2192 return clipRect; | 2192 return clipRect; |
2193 } | 2193 } |
2194 | 2194 |
2195 IntRect FrameView::windowClipRectForFrameOwner(const HTMLFrameOwnerElement* owne
rElement) const | 2195 IntRect FrameView::windowClipRectForFrameOwner(const HTMLFrameOwnerElement* owne
rElement) const |
2196 { | 2196 { |
2197 // The renderer can sometimes be null when style="display:none" interacts | 2197 // The renderer can sometimes be null when style="display:none" interacts |
2198 // with external content and plugins. | 2198 // with external content and plugins. |
2199 if (!ownerElement->renderer()) | 2199 if (!ownerElement->renderer()) |
2200 return windowClipRect(); | 2200 return windowClipRect(); |
2201 | 2201 |
2202 // If we have no layer, just return our window clip rect. | 2202 // If we have no layer, just return our window clip rect. |
2203 const Layer* enclosingLayer = ownerElement->renderer()->enclosingLayer(); | 2203 const Layer* enclosingLayer = ownerElement->renderer()->enclosingLayer(); |
2204 if (!enclosingLayer) | 2204 if (!enclosingLayer) |
2205 return windowClipRect(); | 2205 return windowClipRect(); |
2206 | 2206 |
2207 // FIXME: childrenClipRect relies on compositingState, which is not necessar
ily up to date. | 2207 // FIXME: childrenClipRect relies on compositingState, which is not necessar
ily up to date. |
2208 // https://code.google.com/p/chromium/issues/detail?id=343769 | 2208 // https://code.google.com/p/chromium/issues/detail?id=343769 |
2209 DisableCompositingQueryAsserts disabler; | 2209 DisableCompositingQueryAsserts disabler; |
2210 | 2210 |
2211 // Apply the clip from the layer. | 2211 // Apply the clip from the layer. |
2212 IntRect clipRect = contentsToWindow(pixelSnappedIntRect(enclosingLayer->clip
per().childrenClipRect())); | 2212 IntRect clipRect = contentsToRootFrame(pixelSnappedIntRect(enclosingLayer->c
lipper().childrenClipRect())); |
2213 return intersection(clipRect, windowClipRect()); | 2213 return intersection(clipRect, windowClipRect()); |
2214 } | 2214 } |
2215 | 2215 |
2216 bool FrameView::shouldUseIntegerScrollOffset() const | 2216 bool FrameView::shouldUseIntegerScrollOffset() const |
2217 { | 2217 { |
2218 if (m_frame->settings() && !m_frame->settings()->preferCompositingToLCDTextE
nabled()) | 2218 if (m_frame->settings() && !m_frame->settings()->preferCompositingToLCDTextE
nabled()) |
2219 return true; | 2219 return true; |
2220 return false; | 2220 return false; |
2221 } | 2221 } |
2222 | 2222 |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3647 IntPoint framePoint = contentsToFrame(contentsPoint); | 3647 IntPoint framePoint = contentsToFrame(contentsPoint); |
3648 return convertToContainingWindow(framePoint); | 3648 return convertToContainingWindow(framePoint); |
3649 } | 3649 } |
3650 | 3650 |
3651 IntRect FrameView::contentsToRootFrame(const IntRect& contentsRect) const | 3651 IntRect FrameView::contentsToRootFrame(const IntRect& contentsRect) const |
3652 { | 3652 { |
3653 IntRect rectInFrame = contentsToFrame(contentsRect); | 3653 IntRect rectInFrame = contentsToFrame(contentsRect); |
3654 return convertToContainingWindow(rectInFrame); | 3654 return convertToContainingWindow(rectInFrame); |
3655 } | 3655 } |
3656 | 3656 |
3657 IntPoint FrameView::windowToContents(const IntPoint& windowPoint) const | 3657 FloatPoint FrameView::rootFrameToContents(const FloatPoint& windowPoint) const |
3658 { | |
3659 IntPoint framePoint = convertFromContainingWindow(windowPoint); | |
3660 return frameToContents(framePoint); | |
3661 } | |
3662 | |
3663 FloatPoint FrameView::windowToContents(const FloatPoint& windowPoint) const | |
3664 { | 3658 { |
3665 FloatPoint framePoint = convertFromContainingWindow(windowPoint); | 3659 FloatPoint framePoint = convertFromContainingWindow(windowPoint); |
3666 return frameToContents(framePoint); | 3660 return frameToContents(framePoint); |
3667 } | 3661 } |
3668 | 3662 |
3669 IntPoint FrameView::contentsToWindow(const IntPoint& contentsPoint) const | 3663 IntRect FrameView::viewportToContents(const IntRect& rectInViewport) const |
3670 { | 3664 { |
3671 IntPoint framePoint = contentsToFrame(contentsPoint); | 3665 IntRect rectInRootFrame = page()->frameHost().pinchViewport().viewportToRoot
Frame(rectInViewport); |
3672 return convertToContainingWindow(framePoint); | 3666 IntRect frameRect = convertFromContainingWindow(rectInRootFrame); |
| 3667 return frameToContents(frameRect); |
3673 } | 3668 } |
3674 | 3669 |
3675 IntRect FrameView::windowToContents(const IntRect& windowRect) const | 3670 IntPoint FrameView::viewportToContents(const IntPoint& pointInViewport) const |
3676 { | 3671 { |
3677 IntRect rectInFrame = convertFromContainingWindow(windowRect); | 3672 IntPoint pointInRootFrame = page()->frameHost().pinchViewport().viewportToRo
otFrame(pointInViewport); |
3678 return frameToContents(rectInFrame); | 3673 IntPoint pointInFrame = convertFromContainingWindow(pointInRootFrame); |
| 3674 return frameToContents(pointInFrame); |
3679 } | 3675 } |
3680 | 3676 |
3681 IntRect FrameView::contentsToWindow(const IntRect& contentsRect) const | 3677 IntRect FrameView::contentsToViewport(const IntRect& rectInContents) const |
3682 { | 3678 { |
3683 IntRect rectInFrame = contentsToFrame(contentsRect); | 3679 IntRect rectInFrame = contentsToFrame(rectInContents); |
3684 return convertToContainingWindow(rectInFrame); | 3680 IntRect rectInRootFrame = convertToContainingWindow(rectInFrame); |
| 3681 return page()->frameHost().pinchViewport().rootFrameToViewport(rectInRootFra
me); |
| 3682 } |
| 3683 |
| 3684 IntPoint FrameView::contentsToViewport(const IntPoint& pointInContents) const |
| 3685 { |
| 3686 IntPoint pointInFrame = contentsToFrame(pointInContents); |
| 3687 IntPoint pointInRootFrame = convertToContainingWindow(pointInFrame); |
| 3688 return page()->frameHost().pinchViewport().rootFrameToViewport(pointInRootFr
ame); |
3685 } | 3689 } |
3686 | 3690 |
3687 IntRect FrameView::contentsToScreen(const IntRect& rect) const | 3691 IntRect FrameView::contentsToScreen(const IntRect& rect) const |
3688 { | 3692 { |
3689 HostWindow* window = hostWindow(); | 3693 HostWindow* window = hostWindow(); |
3690 if (!window) | 3694 if (!window) |
3691 return IntRect(); | 3695 return IntRect(); |
3692 return window->viewportToScreen(contentsToWindow(rect)); | 3696 return window->viewportToScreen(contentsToViewport(rect)); |
| 3697 } |
| 3698 |
| 3699 IntRect FrameView::soonToBeRemovedContentsToUnscaledViewport(const IntRect& rect
InContents) const |
| 3700 { |
| 3701 IntRect rectInFrame = contentsToFrame(rectInContents); |
| 3702 IntRect rectInRootFrame = convertToContainingWindow(rectInFrame); |
| 3703 return enclosingIntRect(page()->frameHost().pinchViewport().mainViewToViewpo
rtCSSPixels(rectInRootFrame)); |
3693 } | 3704 } |
3694 | 3705 |
3695 bool FrameView::containsScrollbarsAvoidingResizer() const | 3706 bool FrameView::containsScrollbarsAvoidingResizer() const |
3696 { | 3707 { |
3697 return !m_scrollbarsAvoidingResizer; | 3708 return !m_scrollbarsAvoidingResizer; |
3698 } | 3709 } |
3699 | 3710 |
3700 void FrameView::adjustScrollbarsAvoidingResizerCount(int overlapDelta) | 3711 void FrameView::adjustScrollbarsAvoidingResizerCount(int overlapDelta) |
3701 { | 3712 { |
3702 int oldCount = m_scrollbarsAvoidingResizer; | 3713 int oldCount = m_scrollbarsAvoidingResizer; |
(...skipping 21 matching lines...) Expand all Loading... |
3724 if (m_horizontalScrollbar) | 3735 if (m_horizontalScrollbar) |
3725 m_horizontalScrollbar->invalidate(); | 3736 m_horizontalScrollbar->invalidate(); |
3726 if (m_verticalScrollbar) | 3737 if (m_verticalScrollbar) |
3727 m_verticalScrollbar->invalidate(); | 3738 m_verticalScrollbar->invalidate(); |
3728 | 3739 |
3729 // Invalidate the scroll corner too on unsuppress. | 3740 // Invalidate the scroll corner too on unsuppress. |
3730 invalidateRect(scrollCornerRect()); | 3741 invalidateRect(scrollCornerRect()); |
3731 } | 3742 } |
3732 } | 3743 } |
3733 | 3744 |
3734 Scrollbar* FrameView::scrollbarAtWindowPoint(const IntPoint& windowPoint) | 3745 Scrollbar* FrameView::scrollbarAtRootFramePoint(const IntPoint& pointInRootFrame
) |
3735 { | 3746 { |
3736 IntPoint pointInFrame = convertFromContainingWindow(windowPoint); | 3747 IntPoint pointInFrame = convertFromContainingWindow(pointInRootFrame); |
3737 return scrollbarAtFramePoint(pointInFrame); | 3748 return scrollbarAtFramePoint(pointInFrame); |
3738 } | 3749 } |
3739 | 3750 |
3740 Scrollbar* FrameView::scrollbarAtFramePoint(const IntPoint& pointInFrame) | 3751 Scrollbar* FrameView::scrollbarAtFramePoint(const IntPoint& pointInFrame) |
3741 { | 3752 { |
3742 if (m_horizontalScrollbar && m_horizontalScrollbar->shouldParticipateInHitTe
sting() && m_horizontalScrollbar->frameRect().contains(pointInFrame)) | 3753 if (m_horizontalScrollbar && m_horizontalScrollbar->shouldParticipateInHitTe
sting() && m_horizontalScrollbar->frameRect().contains(pointInFrame)) |
3743 return m_horizontalScrollbar.get(); | 3754 return m_horizontalScrollbar.get(); |
3744 if (m_verticalScrollbar && m_verticalScrollbar->shouldParticipateInHitTestin
g() && m_verticalScrollbar->frameRect().contains(pointInFrame)) | 3755 if (m_verticalScrollbar && m_verticalScrollbar->shouldParticipateInHitTestin
g() && m_verticalScrollbar->frameRect().contains(pointInFrame)) |
3745 return m_verticalScrollbar.get(); | 3756 return m_verticalScrollbar.get(); |
3746 return nullptr; | 3757 return nullptr; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3839 void FrameView::invalidateScrollCornerRect(const IntRect& rect) | 3850 void FrameView::invalidateScrollCornerRect(const IntRect& rect) |
3840 { | 3851 { |
3841 invalidateRect(rect); | 3852 invalidateRect(rect); |
3842 } | 3853 } |
3843 | 3854 |
3844 void FrameView::paintPanScrollIcon(GraphicsContext* context) | 3855 void FrameView::paintPanScrollIcon(GraphicsContext* context) |
3845 { | 3856 { |
3846 DEFINE_STATIC_REF(Image, panScrollIcon, (Image::loadPlatformResource("panIco
n"))); | 3857 DEFINE_STATIC_REF(Image, panScrollIcon, (Image::loadPlatformResource("panIco
n"))); |
3847 IntPoint iconGCPoint = m_panScrollIconPoint; | 3858 IntPoint iconGCPoint = m_panScrollIconPoint; |
3848 if (parent()) | 3859 if (parent()) |
3849 iconGCPoint = toFrameView(parent())->windowToContents(iconGCPoint); | 3860 iconGCPoint = toFrameView(parent())->rootFrameToContents(iconGCPoint); |
3850 context->drawImage(panScrollIcon, iconGCPoint); | 3861 context->drawImage(panScrollIcon, iconGCPoint); |
3851 } | 3862 } |
3852 | 3863 |
3853 void FrameView::paint(GraphicsContext* context, const IntRect& rect) | 3864 void FrameView::paint(GraphicsContext* context, const IntRect& rect) |
3854 { | 3865 { |
3855 FramePainter(*this).paint(context, rect); | 3866 FramePainter(*this).paint(context, rect); |
3856 } | 3867 } |
3857 | 3868 |
3858 void FrameView::paintContents(GraphicsContext* context, const IntRect& damageRec
t) | 3869 void FrameView::paintContents(GraphicsContext* context, const IntRect& damageRec
t) |
3859 { | 3870 { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4060 { | 4071 { |
4061 Settings* settings = frame().settings(); | 4072 Settings* settings = frame().settings(); |
4062 if (!settings || !settings->rootLayerScrolls()) | 4073 if (!settings || !settings->rootLayerScrolls()) |
4063 return this; | 4074 return this; |
4064 | 4075 |
4065 LayoutView* layoutView = this->layoutView(); | 4076 LayoutView* layoutView = this->layoutView(); |
4066 return layoutView ? layoutView->scrollableArea() : nullptr; | 4077 return layoutView ? layoutView->scrollableArea() : nullptr; |
4067 } | 4078 } |
4068 | 4079 |
4069 } // namespace blink | 4080 } // namespace blink |
OLD | NEW |