OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. |
4 * All rights reserved. | 4 * All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "core/frame/Settings.h" | 30 #include "core/frame/Settings.h" |
31 #include "core/html/HTMLIFrameElement.h" | 31 #include "core/html/HTMLIFrameElement.h" |
32 #include "core/layout/HitTestResult.h" | 32 #include "core/layout/HitTestResult.h" |
33 #include "core/layout/LayoutGeometryMap.h" | 33 #include "core/layout/LayoutGeometryMap.h" |
34 #include "core/layout/LayoutPart.h" | 34 #include "core/layout/LayoutPart.h" |
35 #include "core/layout/ViewFragmentationContext.h" | 35 #include "core/layout/ViewFragmentationContext.h" |
36 #include "core/layout/api/LayoutAPIShim.h" | 36 #include "core/layout/api/LayoutAPIShim.h" |
37 #include "core/layout/api/LayoutPartItem.h" | 37 #include "core/layout/api/LayoutPartItem.h" |
38 #include "core/layout/api/LayoutViewItem.h" | 38 #include "core/layout/api/LayoutViewItem.h" |
39 #include "core/layout/compositing/PaintLayerCompositor.h" | 39 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 40 #include "core/layout/svg/LayoutSVGRoot.h" |
40 #include "core/page/ChromeClient.h" | 41 #include "core/page/ChromeClient.h" |
41 #include "core/page/Page.h" | 42 #include "core/page/Page.h" |
42 #include "core/paint/PaintLayer.h" | 43 #include "core/paint/PaintLayer.h" |
43 #include "core/paint/ViewPaintInvalidator.h" | 44 #include "core/paint/ViewPaintInvalidator.h" |
44 #include "core/paint/ViewPainter.h" | 45 #include "core/paint/ViewPainter.h" |
45 #include "core/svg/SVGDocumentExtensions.h" | 46 #include "core/svg/SVGDocumentExtensions.h" |
46 #include "platform/Histogram.h" | 47 #include "platform/Histogram.h" |
47 #include "platform/RuntimeEnabledFeatures.h" | 48 #include "platform/RuntimeEnabledFeatures.h" |
48 #include "platform/geometry/FloatQuad.h" | 49 #include "platform/geometry/FloatQuad.h" |
49 #include "platform/geometry/TransformState.h" | 50 #include "platform/geometry/TransformState.h" |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 return LayoutBox::OverflowClipRect(location, | 637 return LayoutBox::OverflowClipRect(location, |
637 overlay_scrollbar_clip_behavior); | 638 overlay_scrollbar_clip_behavior); |
638 | 639 |
639 rect.SetLocation(location); | 640 rect.SetLocation(location); |
640 if (HasOverflowClip()) | 641 if (HasOverflowClip()) |
641 ExcludeScrollbars(rect, overlay_scrollbar_clip_behavior); | 642 ExcludeScrollbars(rect, overlay_scrollbar_clip_behavior); |
642 | 643 |
643 return rect; | 644 return rect; |
644 } | 645 } |
645 | 646 |
| 647 void LayoutView::CalculateScrollbarModes(ScrollbarMode& h_mode, |
| 648 ScrollbarMode& v_mode) const { |
| 649 #define RETURN_SCROLLBAR_MODE(mode) \ |
| 650 { \ |
| 651 h_mode = v_mode = mode; \ |
| 652 return; \ |
| 653 } |
| 654 |
| 655 LocalFrame* frame = GetFrame(); |
| 656 if (!frame) |
| 657 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff); |
| 658 |
| 659 if (FrameOwner* owner = frame->Owner()) { |
| 660 // Setting scrolling="no" on an iframe element disables scrolling. |
| 661 if (owner->ScrollingMode() == kScrollbarAlwaysOff) |
| 662 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff); |
| 663 } |
| 664 |
| 665 Document& document = GetDocument(); |
| 666 if (Node* body = document.body()) { |
| 667 // Framesets can't scroll. |
| 668 if (isHTMLFrameSetElement(body) && body->GetLayoutObject()) |
| 669 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff); |
| 670 } |
| 671 |
| 672 if (FrameView* frameView = GetFrameView()) { |
| 673 // Scrollbars can be disabled by FrameView::setCanHaveScrollbars. |
| 674 if (!frameView->CanHaveScrollbars()) |
| 675 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff); |
| 676 } |
| 677 |
| 678 Element* viewportDefiningElement = document.ViewportDefiningElement(); |
| 679 if (!viewportDefiningElement) |
| 680 RETURN_SCROLLBAR_MODE(kScrollbarAuto); |
| 681 |
| 682 LayoutObject* viewport = viewportDefiningElement->GetLayoutObject(); |
| 683 if (!viewport) |
| 684 RETURN_SCROLLBAR_MODE(kScrollbarAuto); |
| 685 |
| 686 const ComputedStyle* style = viewport->Style(); |
| 687 if (!style) |
| 688 RETURN_SCROLLBAR_MODE(kScrollbarAuto); |
| 689 |
| 690 if (viewport->IsSVGRoot()) { |
| 691 // Don't allow overflow to affect <img> and css backgrounds |
| 692 if (ToLayoutSVGRoot(viewport)->IsEmbeddedThroughSVGImage()) |
| 693 RETURN_SCROLLBAR_MODE(kScrollbarAuto); |
| 694 |
| 695 // FIXME: evaluate if we can allow overflow for these cases too. |
| 696 // Overflow is always hidden when stand-alone SVG documents are embedded. |
| 697 if (ToLayoutSVGRoot(viewport) |
| 698 ->IsEmbeddedThroughFrameContainingSVGDocument()) |
| 699 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff); |
| 700 } |
| 701 |
| 702 h_mode = v_mode = kScrollbarAuto; |
| 703 |
| 704 EOverflow overflow_x = style->OverflowX(); |
| 705 EOverflow overflow_y = style->OverflowY(); |
| 706 |
| 707 bool shouldIgnoreOverflowHidden = false; |
| 708 if (Settings* settings = document.GetSettings()) { |
| 709 if (settings->GetIgnoreMainFrameOverflowHiddenQuirk() && |
| 710 frame->IsMainFrame()) |
| 711 shouldIgnoreOverflowHidden = true; |
| 712 } |
| 713 if (!shouldIgnoreOverflowHidden) { |
| 714 if (overflow_x == EOverflow::kHidden) |
| 715 h_mode = kScrollbarAlwaysOff; |
| 716 if (overflow_y == EOverflow::kHidden) |
| 717 v_mode = kScrollbarAlwaysOff; |
| 718 } |
| 719 |
| 720 if (overflow_x == EOverflow::kScroll) |
| 721 h_mode = kScrollbarAlwaysOn; |
| 722 if (overflow_y == EOverflow::kScroll) |
| 723 v_mode = kScrollbarAlwaysOn; |
| 724 |
| 725 #undef RETURN_SCROLLBAR_MODE |
| 726 } |
| 727 |
646 IntRect LayoutView::DocumentRect() const { | 728 IntRect LayoutView::DocumentRect() const { |
647 LayoutRect overflow_rect(LayoutOverflowRect()); | 729 LayoutRect overflow_rect(LayoutOverflowRect()); |
648 FlipForWritingMode(overflow_rect); | 730 FlipForWritingMode(overflow_rect); |
649 // TODO(crbug.com/650768): The pixel snapping looks incorrect. | 731 // TODO(crbug.com/650768): The pixel snapping looks incorrect. |
650 return PixelSnappedIntRect(overflow_rect); | 732 return PixelSnappedIntRect(overflow_rect); |
651 } | 733 } |
652 | 734 |
653 bool LayoutView::RootBackgroundIsEntirelyFixed() const { | 735 bool LayoutView::RootBackgroundIsEntirelyFixed() const { |
654 return Style()->HasEntirelyFixedBackground(); | 736 return Style()->HasEntirelyFixedBackground(); |
655 } | 737 } |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 // Frame scroll corner is painted using LayoutView as the display item client. | 907 // Frame scroll corner is painted using LayoutView as the display item client. |
826 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() && | 908 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() && |
827 (GetFrameView()->HorizontalScrollbar() || | 909 (GetFrameView()->HorizontalScrollbar() || |
828 GetFrameView()->VerticalScrollbar())) | 910 GetFrameView()->VerticalScrollbar())) |
829 return false; | 911 return false; |
830 | 912 |
831 return LayoutBlockFlow::PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); | 913 return LayoutBlockFlow::PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); |
832 } | 914 } |
833 | 915 |
834 } // namespace blink | 916 } // namespace blink |
OLD | NEW |