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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 // Autosized font sizes depend on the width of the viewing area. | 342 // Autosized font sizes depend on the width of the viewing area. |
343 bool autosizerNeedsUpdating = false; | 343 bool autosizerNeedsUpdating = false; |
344 if (newRect.width() != oldRect.width() && m_frame->isMainFrame() && m_frame-
>settings()->textAutosizingEnabled()) | 344 if (newRect.width() != oldRect.width() && m_frame->isMainFrame() && m_frame-
>settings()->textAutosizingEnabled()) |
345 autosizerNeedsUpdating = true; | 345 autosizerNeedsUpdating = true; |
346 | 346 |
347 setFrameRectInternal(newRect); | 347 setFrameRectInternal(newRect); |
348 | 348 |
349 updateScrollableAreaSet(); | 349 updateScrollableAreaSet(); |
350 | 350 |
351 if (autosizerNeedsUpdating) { | 351 if (autosizerNeedsUpdating) { |
352 // This needs to be after the call to ScrollView::setFrameRect, because
it reads the new width. | 352 // This needs to be after the call to setFrameRectInternal, because it r
eads the new width. |
353 if (TextAutosizer* textAutosizer = m_frame->document()->textAutosizer()) | 353 if (TextAutosizer* textAutosizer = m_frame->document()->textAutosizer()) |
354 textAutosizer->updatePageInfoInAllFrames(); | 354 textAutosizer->updatePageInfoInAllFrames(); |
355 } | 355 } |
356 | 356 |
357 if (RenderView* renderView = this->renderView()) { | 357 if (RenderView* renderView = this->renderView()) { |
358 if (renderView->usesCompositing()) | 358 if (renderView->usesCompositing()) |
359 renderView->compositor()->frameViewDidChangeSize(); | 359 renderView->compositor()->frameViewDidChangeSize(); |
360 } | 360 } |
361 | 361 |
362 viewportConstrainedVisibleContentSizeChanged(newRect.width() != oldRect.widt
h(), newRect.height() != oldRect.height()); | 362 viewportConstrainedVisibleContentSizeChanged(newRect.width() != oldRect.widt
h(), newRect.height() != oldRect.height()); |
(...skipping 2392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2755 IntPoint point = viewPoint; | 2755 IntPoint point = viewPoint; |
2756 | 2756 |
2757 // Convert from FrameView coords into page ("absolute") coordinates. | 2757 // Convert from FrameView coords into page ("absolute") coordinates. |
2758 point += IntSize(scrollX(), scrollY()); | 2758 point += IntSize(scrollX(), scrollY()); |
2759 | 2759 |
2760 return roundedIntPoint(renderer.absoluteToLocal(point, UseTransforms)); | 2760 return roundedIntPoint(renderer.absoluteToLocal(point, UseTransforms)); |
2761 } | 2761 } |
2762 | 2762 |
2763 IntRect FrameView::convertToContainingView(const IntRect& localRect) const | 2763 IntRect FrameView::convertToContainingView(const IntRect& localRect) const |
2764 { | 2764 { |
2765 if (const FrameView* parentScrollView = toFrameView(parent())) { | 2765 if (const FrameView* parentView = toFrameView(parent())) { |
2766 if (parentScrollView->isFrameView()) { | 2766 // Get our renderer in the parent view |
2767 const FrameView* parentView = parentScrollView; | 2767 RenderPart* renderer = m_frame->ownerRenderer(); |
2768 // Get our renderer in the parent view | 2768 if (!renderer) |
2769 RenderPart* renderer = m_frame->ownerRenderer(); | 2769 return localRect; |
2770 if (!renderer) | |
2771 return localRect; | |
2772 | 2770 |
2773 IntRect rect(localRect); | 2771 IntRect rect(localRect); |
2774 // Add borders and padding?? | 2772 // Add borders and padding?? |
2775 rect.move(renderer->borderLeft() + renderer->paddingLeft(), | 2773 rect.move(renderer->borderLeft() + renderer->paddingLeft(), |
2776 renderer->borderTop() + renderer->paddingTop()); | 2774 renderer->borderTop() + renderer->paddingTop()); |
2777 return parentView->convertFromRenderer(*renderer, rect); | 2775 return parentView->convertFromRenderer(*renderer, rect); |
2778 } | |
2779 | |
2780 return Widget::convertToContainingView(localRect); | |
2781 } | 2776 } |
2782 | 2777 |
2783 return localRect; | 2778 return localRect; |
2784 } | 2779 } |
2785 | 2780 |
2786 IntRect FrameView::convertFromContainingView(const IntRect& parentRect) const | 2781 IntRect FrameView::convertFromContainingView(const IntRect& parentRect) const |
2787 { | 2782 { |
2788 if (const FrameView* parentScrollView = toFrameView(parent())) { | 2783 if (const FrameView* parentView = toFrameView(parent())) { |
2789 if (parentScrollView->isFrameView()) { | 2784 // Get our renderer in the parent view |
2790 const FrameView* parentView = parentScrollView; | 2785 RenderPart* renderer = m_frame->ownerRenderer(); |
| 2786 if (!renderer) |
| 2787 return parentRect; |
2791 | 2788 |
2792 // Get our renderer in the parent view | 2789 IntRect rect = parentView->convertToRenderer(*renderer, parentRect); |
2793 RenderPart* renderer = m_frame->ownerRenderer(); | 2790 // Subtract borders and padding |
2794 if (!renderer) | 2791 rect.move(-renderer->borderLeft() - renderer->paddingLeft(), |
2795 return parentRect; | 2792 -renderer->borderTop() - renderer->paddingTop()); |
2796 | 2793 return rect; |
2797 IntRect rect = parentView->convertToRenderer(*renderer, parentRect); | |
2798 // Subtract borders and padding | |
2799 rect.move(-renderer->borderLeft() - renderer->paddingLeft(), | |
2800 -renderer->borderTop() - renderer->paddingTop()); | |
2801 return rect; | |
2802 } | |
2803 | |
2804 return Widget::convertFromContainingView(parentRect); | |
2805 } | 2794 } |
2806 | 2795 |
2807 return parentRect; | 2796 return parentRect; |
2808 } | 2797 } |
2809 | 2798 |
2810 IntPoint FrameView::convertToContainingView(const IntPoint& localPoint) const | 2799 IntPoint FrameView::convertToContainingView(const IntPoint& localPoint) const |
2811 { | 2800 { |
2812 if (const FrameView* parentScrollView = toFrameView(parent())) { | 2801 if (const FrameView* parentView = toFrameView(parent())) { |
2813 if (parentScrollView->isFrameView()) { | 2802 // Get our renderer in the parent view |
2814 const FrameView* parentView = parentScrollView; | 2803 RenderPart* renderer = m_frame->ownerRenderer(); |
| 2804 if (!renderer) |
| 2805 return localPoint; |
2815 | 2806 |
2816 // Get our renderer in the parent view | 2807 IntPoint point(localPoint); |
2817 RenderPart* renderer = m_frame->ownerRenderer(); | |
2818 if (!renderer) | |
2819 return localPoint; | |
2820 | 2808 |
2821 IntPoint point(localPoint); | 2809 // Add borders and padding |
2822 | 2810 point.move(renderer->borderLeft() + renderer->paddingLeft(), |
2823 // Add borders and padding | 2811 renderer->borderTop() + renderer->paddingTop()); |
2824 point.move(renderer->borderLeft() + renderer->paddingLeft(), | 2812 return parentView->convertFromRenderer(*renderer, point); |
2825 renderer->borderTop() + renderer->paddingTop()); | |
2826 return parentView->convertFromRenderer(*renderer, point); | |
2827 } | |
2828 | |
2829 return Widget::convertToContainingView(localPoint); | |
2830 } | 2813 } |
2831 | 2814 |
2832 return localPoint; | 2815 return localPoint; |
2833 } | 2816 } |
2834 | 2817 |
2835 IntPoint FrameView::convertFromContainingView(const IntPoint& parentPoint) const | 2818 IntPoint FrameView::convertFromContainingView(const IntPoint& parentPoint) const |
2836 { | 2819 { |
2837 if (const FrameView* parentScrollView = toFrameView(parent())) { | 2820 if (const FrameView* parentView = toFrameView(parent())) { |
2838 if (parentScrollView->isFrameView()) { | 2821 // Get our renderer in the parent view |
2839 const FrameView* parentView = parentScrollView; | 2822 RenderPart* renderer = m_frame->ownerRenderer(); |
| 2823 if (!renderer) |
| 2824 return parentPoint; |
2840 | 2825 |
2841 // Get our renderer in the parent view | 2826 IntPoint point = parentView->convertToRenderer(*renderer, parentPoint); |
2842 RenderPart* renderer = m_frame->ownerRenderer(); | 2827 // Subtract borders and padding |
2843 if (!renderer) | 2828 point.move(-renderer->borderLeft() - renderer->paddingLeft(), |
2844 return parentPoint; | 2829 -renderer->borderTop() - renderer->paddingTop()); |
2845 | 2830 return point; |
2846 IntPoint point = parentView->convertToRenderer(*renderer, parentPoin
t); | |
2847 // Subtract borders and padding | |
2848 point.move(-renderer->borderLeft() - renderer->paddingLeft(), | |
2849 -renderer->borderTop() - renderer->paddingTop()); | |
2850 return point; | |
2851 } | |
2852 | |
2853 return Widget::convertFromContainingView(parentPoint); | |
2854 } | 2831 } |
2855 | 2832 |
2856 return parentPoint; | 2833 return parentPoint; |
2857 } | 2834 } |
2858 | 2835 |
2859 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) | 2836 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) |
2860 { | 2837 { |
2861 if (trackPaintInvalidations == m_isTrackingPaintInvalidations) | 2838 if (trackPaintInvalidations == m_isTrackingPaintInvalidations) |
2862 return; | 2839 return; |
2863 | 2840 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3048 visibleContentSizeF.scale(1 / visibleContentScaleFactor()); | 3025 visibleContentSizeF.scale(1 / visibleContentScaleFactor()); |
3049 IntSize visibleSize = expandedIntSize(visibleContentSizeF); | 3026 IntSize visibleSize = expandedIntSize(visibleContentSizeF); |
3050 | 3027 |
3051 IntPoint maximumOffset( | 3028 IntPoint maximumOffset( |
3052 contentsWidth() - visibleSize.width() - scrollOrigin().x(), | 3029 contentsWidth() - visibleSize.width() - scrollOrigin().x(), |
3053 contentsHeight() - visibleSize.height() - scrollOrigin().y()); | 3030 contentsHeight() - visibleSize.height() - scrollOrigin().y()); |
3054 maximumOffset.clampNegativeToZero(); | 3031 maximumOffset.clampNegativeToZero(); |
3055 return maximumOffset; | 3032 return maximumOffset; |
3056 } | 3033 } |
3057 | 3034 |
3058 // --- ScrollView --- | |
3059 | |
3060 void FrameView::addChild(PassRefPtr<Widget> prpChild) | 3035 void FrameView::addChild(PassRefPtr<Widget> prpChild) |
3061 { | 3036 { |
3062 Widget* child = prpChild.get(); | 3037 Widget* child = prpChild.get(); |
3063 ASSERT(child != this && !child->parent()); | 3038 ASSERT(child != this && !child->parent()); |
3064 child->setParent(this); | 3039 child->setParent(this); |
3065 m_children.add(prpChild); | 3040 m_children.add(prpChild); |
3066 } | 3041 } |
3067 | 3042 |
3068 void FrameView::removeChildInternal(Widget* child) | 3043 void FrameView::removeChildInternal(Widget* child) |
3069 { | 3044 { |
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4173 return; | 4148 return; |
4174 | 4149 |
4175 ScrollableArea::setScrollOrigin(origin); | 4150 ScrollableArea::setScrollOrigin(origin); |
4176 | 4151 |
4177 // Update if the scroll origin changes, since our position will be different
if the content size did not change. | 4152 // Update if the scroll origin changes, since our position will be different
if the content size did not change. |
4178 if (updatePositionAtAll && updatePositionSynchronously) | 4153 if (updatePositionAtAll && updatePositionSynchronously) |
4179 updateScrollbars(scrollOffsetDouble()); | 4154 updateScrollbars(scrollOffsetDouble()); |
4180 } | 4155 } |
4181 | 4156 |
4182 } // namespace blink | 4157 } // namespace blink |
OLD | NEW |