| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. |
| 7 * All rights reserved. | 7 * All rights reserved. |
| 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 frameElementBase->scrollingMode() == ScrollbarAlwaysOff; | 640 frameElementBase->scrollingMode() == ScrollbarAlwaysOff; |
| 641 } | 641 } |
| 642 } | 642 } |
| 643 return false; | 643 return false; |
| 644 } | 644 } |
| 645 | 645 |
| 646 void LayoutBox::scrollRectToVisible(const LayoutRect& rect, | 646 void LayoutBox::scrollRectToVisible(const LayoutRect& rect, |
| 647 const ScrollAlignment& alignX, | 647 const ScrollAlignment& alignX, |
| 648 const ScrollAlignment& alignY, | 648 const ScrollAlignment& alignY, |
| 649 ScrollType scrollType, | 649 ScrollType scrollType, |
| 650 bool makeVisibleInVisualViewport) { | 650 bool makeVisibleInVisualViewport, |
| 651 ScrollBehavior scrollBehavior) { |
| 651 DCHECK(scrollType == ProgrammaticScroll || scrollType == UserScroll); | 652 DCHECK(scrollType == ProgrammaticScroll || scrollType == UserScroll); |
| 652 // Presumably the same issue as in setScrollTop. See crbug.com/343132. | 653 // Presumably the same issue as in setScrollTop. See crbug.com/343132. |
| 653 DisableCompositingQueryAsserts disabler; | 654 DisableCompositingQueryAsserts disabler; |
| 654 | 655 |
| 655 LayoutRect rectToScroll = rect; | 656 LayoutRect rectToScroll = rect; |
| 656 if (rectToScroll.width() <= 0) | 657 if (rectToScroll.width() <= 0) |
| 657 rectToScroll.setWidth(LayoutUnit(1)); | 658 rectToScroll.setWidth(LayoutUnit(1)); |
| 658 if (rectToScroll.height() <= 0) | 659 if (rectToScroll.height() <= 0) |
| 659 rectToScroll.setHeight(LayoutUnit(1)); | 660 rectToScroll.setHeight(LayoutUnit(1)); |
| 660 | 661 |
| 661 LayoutBox* parentBox = nullptr; | 662 LayoutBox* parentBox = nullptr; |
| 662 LayoutRect newRect = rectToScroll; | 663 LayoutRect newRect = rectToScroll; |
| 663 | 664 |
| 664 bool restrictedByLineClamp = false; | 665 bool restrictedByLineClamp = false; |
| 665 if (containingBlock()) { | 666 if (containingBlock()) { |
| 666 parentBox = containingBlock(); | 667 parentBox = containingBlock(); |
| 667 restrictedByLineClamp = !containingBlock()->style()->lineClamp().isNone(); | 668 restrictedByLineClamp = !containingBlock()->style()->lineClamp().isNone(); |
| 668 } | 669 } |
| 669 | 670 |
| 671 bool isSmooth = false; |
| 672 if (scrollBehavior == ScrollBehaviorSmooth || |
| 673 (scrollBehavior == ScrollBehaviorAuto && |
| 674 style()->getScrollBehavior() == ScrollBehaviorSmooth)) { |
| 675 isSmooth = true; |
| 676 } |
| 677 |
| 670 if (hasOverflowClip() && !restrictedByLineClamp) { | 678 if (hasOverflowClip() && !restrictedByLineClamp) { |
| 671 // Don't scroll to reveal an overflow layer that is restricted by the | 679 // Don't scroll to reveal an overflow layer that is restricted by the |
| 672 // -webkit-line-clamp property. This will prevent us from revealing text | 680 // -webkit-line-clamp property. This will prevent us from revealing text |
| 673 // hidden by the slider in Safari RSS. | 681 // hidden by the slider in Safari RSS. |
| 674 // TODO(eae): We probably don't need this any more as we don't share any | 682 // TODO(eae): We probably don't need this any more as we don't share any |
| 675 // code with the Safari RSS reeder. | 683 // code with the Safari RSS reeder. |
| 676 newRect = getScrollableArea()->scrollIntoView(rectToScroll, alignX, alignY, | 684 newRect = getScrollableArea()->scrollIntoView(rectToScroll, alignX, alignY, |
| 677 scrollType); | 685 scrollType, isSmooth); |
| 678 if (newRect.isEmpty()) | 686 if (newRect.isEmpty()) |
| 679 return; | 687 return; |
| 680 } else if (!parentBox && canBeProgramaticallyScrolled()) { | 688 } else if (!parentBox && canBeProgramaticallyScrolled()) { |
| 681 if (FrameView* frameView = this->frameView()) { | 689 if (FrameView* frameView = this->frameView()) { |
| 682 HTMLFrameOwnerElement* ownerElement = document().localOwner(); | 690 HTMLFrameOwnerElement* ownerElement = document().localOwner(); |
| 683 if (!isDisallowedAutoscroll(ownerElement, frameView)) { | 691 if (!isDisallowedAutoscroll(ownerElement, frameView)) { |
| 684 if (makeVisibleInVisualViewport) { | 692 if (makeVisibleInVisualViewport) { |
| 685 frameView->getScrollableArea()->scrollIntoView(rectToScroll, alignX, | 693 frameView->getScrollableArea()->scrollIntoView( |
| 686 alignY, scrollType); | 694 rectToScroll, alignX, alignY, scrollType, isSmooth); |
| 687 } else { | 695 } else { |
| 688 frameView->layoutViewportScrollableArea()->scrollIntoView( | 696 frameView->layoutViewportScrollableArea()->scrollIntoView( |
| 689 rectToScroll, alignX, alignY, scrollType); | 697 rectToScroll, alignX, alignY, scrollType, isSmooth); |
| 690 } | 698 } |
| 691 if (ownerElement && ownerElement->layoutObject()) { | 699 if (ownerElement && ownerElement->layoutObject()) { |
| 692 if (frameView->safeToPropagateScrollToParent()) { | 700 if (frameView->safeToPropagateScrollToParent()) { |
| 693 parentBox = ownerElement->layoutObject()->enclosingBox(); | 701 parentBox = ownerElement->layoutObject()->enclosingBox(); |
| 694 LayoutView* parentView = ownerElement->layoutObject()->view(); | 702 LayoutView* parentView = ownerElement->layoutObject()->view(); |
| 695 newRect = enclosingLayoutRect( | 703 newRect = enclosingLayoutRect( |
| 696 view() | 704 view() |
| 697 ->localToAncestorQuad( | 705 ->localToAncestorQuad( |
| 698 FloatRect(rectToScroll), parentView, | 706 FloatRect(rectToScroll), parentView, |
| 699 UseTransforms | TraverseDocumentBoundaries) | 707 UseTransforms | TraverseDocumentBoundaries) |
| 700 .boundingBox()); | 708 .boundingBox()); |
| 701 } else { | 709 } else { |
| 702 parentBox = nullptr; | 710 parentBox = nullptr; |
| 703 } | 711 } |
| 704 } | 712 } |
| 705 } | 713 } |
| 706 } | 714 } |
| 707 } | 715 } |
| 708 | 716 |
| 709 // If we are fixed-position and stick to the viewport, it is useless to | 717 // If we are fixed-position and stick to the viewport, it is useless to |
| 710 // scroll the parent. | 718 // scroll the parent. |
| 711 if (style()->position() == EPosition::kFixed && | 719 if (style()->position() == EPosition::kFixed && |
| 712 containerForFixedPosition() == view()) { | 720 containerForFixedPosition() == view()) { |
| 713 return; | 721 return; |
| 714 } | 722 } |
| 715 | 723 |
| 716 if (frame()->page()->autoscrollController().autoscrollInProgress()) | 724 if (frame()->page()->autoscrollController().autoscrollInProgress()) |
| 717 parentBox = enclosingScrollableBox(); | 725 parentBox = enclosingScrollableBox(); |
| 718 | 726 |
| 719 if (parentBox) | 727 if (parentBox) { |
| 720 parentBox->scrollRectToVisible(newRect, alignX, alignY, scrollType, | 728 parentBox->scrollRectToVisible(newRect, alignX, alignY, scrollType, |
| 721 makeVisibleInVisualViewport); | 729 makeVisibleInVisualViewport, scrollBehavior); |
| 730 } |
| 722 } | 731 } |
| 723 | 732 |
| 724 void LayoutBox::absoluteRects(Vector<IntRect>& rects, | 733 void LayoutBox::absoluteRects(Vector<IntRect>& rects, |
| 725 const LayoutPoint& accumulatedOffset) const { | 734 const LayoutPoint& accumulatedOffset) const { |
| 726 rects.push_back(pixelSnappedIntRect(accumulatedOffset, size())); | 735 rects.push_back(pixelSnappedIntRect(accumulatedOffset, size())); |
| 727 } | 736 } |
| 728 | 737 |
| 729 void LayoutBox::absoluteQuads(Vector<FloatQuad>& quads, | 738 void LayoutBox::absoluteQuads(Vector<FloatQuad>& quads, |
| 730 MapCoordinatesFlags mode) const { | 739 MapCoordinatesFlags mode) const { |
| 731 if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) { | 740 if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) { |
| (...skipping 5023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5755 | 5764 |
| 5756 void LayoutBox::MutableForPainting:: | 5765 void LayoutBox::MutableForPainting:: |
| 5757 savePreviousContentBoxSizeAndLayoutOverflowRect() { | 5766 savePreviousContentBoxSizeAndLayoutOverflowRect() { |
| 5758 auto& rareData = layoutBox().ensureRareData(); | 5767 auto& rareData = layoutBox().ensureRareData(); |
| 5759 rareData.m_hasPreviousContentBoxSizeAndLayoutOverflowRect = true; | 5768 rareData.m_hasPreviousContentBoxSizeAndLayoutOverflowRect = true; |
| 5760 rareData.m_previousContentBoxSize = layoutBox().contentBoxRect().size(); | 5769 rareData.m_previousContentBoxSize = layoutBox().contentBoxRect().size(); |
| 5761 rareData.m_previousLayoutOverflowRect = layoutBox().layoutOverflowRect(); | 5770 rareData.m_previousLayoutOverflowRect = layoutBox().layoutOverflowRect(); |
| 5762 } | 5771 } |
| 5763 | 5772 |
| 5764 } // namespace blink | 5773 } // namespace blink |
| OLD | NEW |