| 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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 | 775 |
| 776 void FrameView::AdjustViewSizeAndLayout() { | 776 void FrameView::AdjustViewSizeAndLayout() { |
| 777 AdjustViewSize(); | 777 AdjustViewSize(); |
| 778 if (NeedsLayout()) { | 778 if (NeedsLayout()) { |
| 779 AutoReset<bool> suppress_adjust_view_size(&suppress_adjust_view_size_, | 779 AutoReset<bool> suppress_adjust_view_size(&suppress_adjust_view_size_, |
| 780 true); | 780 true); |
| 781 UpdateLayout(); | 781 UpdateLayout(); |
| 782 } | 782 } |
| 783 } | 783 } |
| 784 | 784 |
| 785 void FrameView::CalculateScrollbarModesFromOverflowStyle( | |
| 786 const ComputedStyle* style, | |
| 787 ScrollbarMode& h_mode, | |
| 788 ScrollbarMode& v_mode) const { | |
| 789 h_mode = v_mode = kScrollbarAuto; | |
| 790 | |
| 791 EOverflow overflow_x = style->OverflowX(); | |
| 792 EOverflow overflow_y = style->OverflowY(); | |
| 793 | |
| 794 if (!ShouldIgnoreOverflowHidden()) { | |
| 795 if (overflow_x == EOverflow::kHidden) | |
| 796 h_mode = kScrollbarAlwaysOff; | |
| 797 if (overflow_y == EOverflow::kHidden) | |
| 798 v_mode = kScrollbarAlwaysOff; | |
| 799 } | |
| 800 | |
| 801 if (overflow_x == EOverflow::kScroll) | |
| 802 h_mode = kScrollbarAlwaysOn; | |
| 803 if (overflow_y == EOverflow::kScroll) | |
| 804 v_mode = kScrollbarAlwaysOn; | |
| 805 } | |
| 806 | |
| 807 void FrameView::CalculateScrollbarModes(ScrollbarMode& h_mode, | |
| 808 ScrollbarMode& v_mode) const { | |
| 809 #define RETURN_SCROLLBAR_MODE(mode) \ | |
| 810 { \ | |
| 811 h_mode = v_mode = mode; \ | |
| 812 return; \ | |
| 813 } | |
| 814 | |
| 815 // Setting scrolling="no" on an iframe element disables scrolling. | |
| 816 if (frame_->Owner() && | |
| 817 frame_->Owner()->ScrollingMode() == kScrollbarAlwaysOff) | |
| 818 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff); | |
| 819 | |
| 820 // Framesets can't scroll. | |
| 821 Node* body = frame_->GetDocument()->body(); | |
| 822 if (isHTMLFrameSetElement(body) && body->GetLayoutObject()) | |
| 823 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff); | |
| 824 | |
| 825 // Scrollbars can be disabled by FrameView::setCanHaveScrollbars. | |
| 826 if (!can_have_scrollbars_) | |
| 827 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff); | |
| 828 | |
| 829 // This will be the LayoutObject for either the body element or the html | |
| 830 // element (see Document::viewportDefiningElement). | |
| 831 LayoutObject* viewport = ViewportLayoutObject(); | |
| 832 if (!viewport || !viewport->Style()) | |
| 833 RETURN_SCROLLBAR_MODE(kScrollbarAuto); | |
| 834 | |
| 835 if (viewport->IsSVGRoot()) { | |
| 836 // Don't allow overflow to affect <img> and css backgrounds | |
| 837 if (ToLayoutSVGRoot(viewport)->IsEmbeddedThroughSVGImage()) | |
| 838 RETURN_SCROLLBAR_MODE(kScrollbarAuto); | |
| 839 | |
| 840 // FIXME: evaluate if we can allow overflow for these cases too. | |
| 841 // Overflow is always hidden when stand-alone SVG documents are embedded. | |
| 842 if (ToLayoutSVGRoot(viewport) | |
| 843 ->IsEmbeddedThroughFrameContainingSVGDocument()) | |
| 844 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff); | |
| 845 } | |
| 846 | |
| 847 CalculateScrollbarModesFromOverflowStyle(viewport->Style(), h_mode, v_mode); | |
| 848 | |
| 849 #undef RETURN_SCROLLBAR_MODE | |
| 850 } | |
| 851 | |
| 852 void FrameView::UpdateAcceleratedCompositingSettings() { | 785 void FrameView::UpdateAcceleratedCompositingSettings() { |
| 853 if (LayoutViewItem layout_view_item = this->GetLayoutViewItem()) | 786 if (LayoutViewItem layout_view_item = this->GetLayoutViewItem()) |
| 854 layout_view_item.Compositor()->UpdateAcceleratedCompositingSettings(); | 787 layout_view_item.Compositor()->UpdateAcceleratedCompositingSettings(); |
| 855 } | 788 } |
| 856 | 789 |
| 857 void FrameView::RecalcOverflowAfterStyleChange() { | 790 void FrameView::RecalcOverflowAfterStyleChange() { |
| 858 LayoutViewItem layout_view_item = this->GetLayoutViewItem(); | 791 LayoutViewItem layout_view_item = this->GetLayoutViewItem(); |
| 859 CHECK(!layout_view_item.IsNull()); | 792 CHECK(!layout_view_item.IsNull()); |
| 860 if (!layout_view_item.NeedsOverflowRecalcAfterStyleChange()) | 793 if (!layout_view_item.NeedsOverflowRecalcAfterStyleChange()) |
| 861 return; | 794 return; |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 body->GetLayoutObject()->SetChildNeedsLayout(); | 1197 body->GetLayoutObject()->SetChildNeedsLayout(); |
| 1265 } else if (isHTMLBodyElement(*body)) { | 1198 } else if (isHTMLBodyElement(*body)) { |
| 1266 if (!first_layout_ && size_.Height() != GetLayoutSize().Height() && | 1199 if (!first_layout_ && size_.Height() != GetLayoutSize().Height() && |
| 1267 body->GetLayoutObject()->EnclosingBox()->StretchesToViewport()) | 1200 body->GetLayoutObject()->EnclosingBox()->StretchesToViewport()) |
| 1268 body->GetLayoutObject()->SetChildNeedsLayout(); | 1201 body->GetLayoutObject()->SetChildNeedsLayout(); |
| 1269 } | 1202 } |
| 1270 } | 1203 } |
| 1271 | 1204 |
| 1272 ScrollbarMode h_mode; | 1205 ScrollbarMode h_mode; |
| 1273 ScrollbarMode v_mode; | 1206 ScrollbarMode v_mode; |
| 1274 CalculateScrollbarModes(h_mode, v_mode); | 1207 GetLayoutView()->CalculateScrollbarModes(h_mode, v_mode); |
| 1275 | 1208 |
| 1276 // Now set our scrollbar state for the layout. | 1209 // Now set our scrollbar state for the layout. |
| 1277 ScrollbarMode current_h_mode = HorizontalScrollbarMode(); | 1210 ScrollbarMode current_h_mode = HorizontalScrollbarMode(); |
| 1278 ScrollbarMode current_v_mode = VerticalScrollbarMode(); | 1211 ScrollbarMode current_v_mode = VerticalScrollbarMode(); |
| 1279 | 1212 |
| 1280 if (first_layout_) { | 1213 if (first_layout_) { |
| 1281 SetScrollbarsSuppressed(true); | 1214 SetScrollbarsSuppressed(true); |
| 1282 | 1215 |
| 1283 first_layout_ = false; | 1216 first_layout_ = false; |
| 1284 last_viewport_size_ = GetLayoutSize(kIncludeScrollbars); | 1217 last_viewport_size_ = GetLayoutSize(kIncludeScrollbars); |
| (...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2770 // Covers #2. | 2703 // Covers #2. |
| 2771 // FIXME: Do we need to fix this for OOPI? | 2704 // FIXME: Do we need to fix this for OOPI? |
| 2772 HTMLFrameOwnerElement* owner = frame_->DeprecatedLocalOwner(); | 2705 HTMLFrameOwnerElement* owner = frame_->DeprecatedLocalOwner(); |
| 2773 if (owner && (!owner->GetLayoutObject() || | 2706 if (owner && (!owner->GetLayoutObject() || |
| 2774 !owner->GetLayoutObject()->VisibleToHitTesting())) | 2707 !owner->GetLayoutObject()->VisibleToHitTesting())) |
| 2775 return kNotScrollableNotVisible; | 2708 return kNotScrollableNotVisible; |
| 2776 | 2709 |
| 2777 // Cover #3 and #4. | 2710 // Cover #3 and #4. |
| 2778 ScrollbarMode horizontal_mode; | 2711 ScrollbarMode horizontal_mode; |
| 2779 ScrollbarMode vertical_mode; | 2712 ScrollbarMode vertical_mode; |
| 2780 CalculateScrollbarModes(horizontal_mode, vertical_mode); | 2713 GetLayoutView()->CalculateScrollbarModes(horizontal_mode, vertical_mode); |
| 2781 if (horizontal_mode == kScrollbarAlwaysOff && | 2714 if (horizontal_mode == kScrollbarAlwaysOff && |
| 2782 vertical_mode == kScrollbarAlwaysOff) | 2715 vertical_mode == kScrollbarAlwaysOff) |
| 2783 return kNotScrollableExplicitlyDisabled; | 2716 return kNotScrollableExplicitlyDisabled; |
| 2784 | 2717 |
| 2785 return kScrollable; | 2718 return kScrollable; |
| 2786 } | 2719 } |
| 2787 | 2720 |
| 2788 void FrameView::UpdateParentScrollableAreaSet() { | 2721 void FrameView::UpdateParentScrollableAreaSet() { |
| 2789 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 2722 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 2790 return; | 2723 return; |
| (...skipping 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5434 void FrameView::SetAnimationHost( | 5367 void FrameView::SetAnimationHost( |
| 5435 std::unique_ptr<CompositorAnimationHost> host) { | 5368 std::unique_ptr<CompositorAnimationHost> host) { |
| 5436 animation_host_ = std::move(host); | 5369 animation_host_ = std::move(host); |
| 5437 } | 5370 } |
| 5438 | 5371 |
| 5439 LayoutUnit FrameView::CaretWidth() const { | 5372 LayoutUnit FrameView::CaretWidth() const { |
| 5440 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); | 5373 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); |
| 5441 } | 5374 } |
| 5442 | 5375 |
| 5443 } // namespace blink | 5376 } // namespace blink |
| OLD | NEW |