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. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 if (ownerElement && isHTMLFrameElementBase(*ownerElement)) { | 496 if (ownerElement && isHTMLFrameElementBase(*ownerElement)) { |
497 HTMLFrameElementBase* frameElementBase = toHTMLFrameElementBase(ownerEle
ment); | 497 HTMLFrameElementBase* frameElementBase = toHTMLFrameElementBase(ownerEle
ment); |
498 if (Page* page = frameView->frame().page()) { | 498 if (Page* page = frameView->frame().page()) { |
499 return page->autoscrollController().autoscrollInProgress() | 499 return page->autoscrollController().autoscrollInProgress() |
500 && frameElementBase->scrollingMode() == ScrollbarAlwaysOff; | 500 && frameElementBase->scrollingMode() == ScrollbarAlwaysOff; |
501 } | 501 } |
502 } | 502 } |
503 return false; | 503 return false; |
504 } | 504 } |
505 | 505 |
506 void LayoutBox::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignmen
t& alignX, const ScrollAlignment& alignY) | 506 void LayoutBox::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignmen
t& alignX, const ScrollAlignment& alignY, ScrollType scrollType) |
507 { | 507 { |
| 508 ASSERT(scrollType == ProgrammaticScroll || scrollType == UserScroll); |
508 // Presumably the same issue as in setScrollTop. See crbug.com/343132. | 509 // Presumably the same issue as in setScrollTop. See crbug.com/343132. |
509 DisableCompositingQueryAsserts disabler; | 510 DisableCompositingQueryAsserts disabler; |
510 | 511 |
511 LayoutBox* parentBox = nullptr; | 512 LayoutBox* parentBox = nullptr; |
512 LayoutRect newRect = rect; | 513 LayoutRect newRect = rect; |
513 | 514 |
514 bool restrictedByLineClamp = false; | 515 bool restrictedByLineClamp = false; |
515 if (parent()) { | 516 if (parent()) { |
516 parentBox = parent()->enclosingBox(); | 517 parentBox = parent()->enclosingBox(); |
517 restrictedByLineClamp = !parent()->style()->lineClamp().isNone(); | 518 restrictedByLineClamp = !parent()->style()->lineClamp().isNone(); |
518 } | 519 } |
519 | 520 |
520 if (hasOverflowClip() && !restrictedByLineClamp) { | 521 if (hasOverflowClip() && !restrictedByLineClamp) { |
521 // Don't scroll to reveal an overflow layer that is restricted by the -w
ebkit-line-clamp property. | 522 // Don't scroll to reveal an overflow layer that is restricted by the -w
ebkit-line-clamp property. |
522 // This will prevent us from revealing text hidden by the slider in Safa
ri RSS. | 523 // This will prevent us from revealing text hidden by the slider in Safa
ri RSS. |
523 newRect = layer()->scrollableArea()->scrollIntoView(rect, alignX, alignY
); | 524 newRect = layer()->scrollableArea()->scrollIntoView(rect, alignX, alignY
, scrollType); |
524 } else if (!parentBox && canBeProgramaticallyScrolled()) { | 525 } else if (!parentBox && canBeProgramaticallyScrolled()) { |
525 if (FrameView* frameView = this->frameView()) { | 526 if (FrameView* frameView = this->frameView()) { |
526 HTMLFrameOwnerElement* ownerElement = document().ownerElement(); | 527 HTMLFrameOwnerElement* ownerElement = document().ownerElement(); |
527 if (!isDisallowedAutoscroll(ownerElement, frameView)) { | 528 if (!isDisallowedAutoscroll(ownerElement, frameView)) { |
528 frameView->scrollableArea()->scrollIntoView(rect, alignX, alignY
); | 529 frameView->scrollableArea()->scrollIntoView(rect, alignX, alignY
, scrollType); |
529 | 530 |
530 if (ownerElement && ownerElement->layoutObject()) { | 531 if (ownerElement && ownerElement->layoutObject()) { |
531 if (frameView->safeToPropagateScrollToParent()) { | 532 if (frameView->safeToPropagateScrollToParent()) { |
532 parentBox = ownerElement->layoutObject()->enclosingBox()
; | 533 parentBox = ownerElement->layoutObject()->enclosingBox()
; |
533 // FIXME: This doesn't correctly convert the rect to | 534 // FIXME: This doesn't correctly convert the rect to |
534 // absolute coordinates in the parent. | 535 // absolute coordinates in the parent. |
535 newRect.setX(rect.x() - frameView->scrollX() + frameView
->x()); | 536 newRect.setX(rect.x() - frameView->scrollX() + frameView
->x()); |
536 newRect.setY(rect.y() - frameView->scrollY() + frameView
->y()); | 537 newRect.setY(rect.y() - frameView->scrollY() + frameView
->y()); |
537 } else { | 538 } else { |
538 parentBox = nullptr; | 539 parentBox = nullptr; |
539 } | 540 } |
540 } | 541 } |
541 } | 542 } |
542 } | 543 } |
543 } | 544 } |
544 | 545 |
545 // If we are fixed-position, it is useless to scroll the parent. | 546 // If we are fixed-position, it is useless to scroll the parent. |
546 if (hasLayer() && layer()->scrollsWithViewport()) | 547 if (hasLayer() && layer()->scrollsWithViewport()) |
547 return; | 548 return; |
548 | 549 |
549 if (frame()->page()->autoscrollController().autoscrollInProgress()) | 550 if (frame()->page()->autoscrollController().autoscrollInProgress()) |
550 parentBox = enclosingScrollableBox(); | 551 parentBox = enclosingScrollableBox(); |
551 | 552 |
552 if (parentBox) | 553 if (parentBox) |
553 parentBox->scrollRectToVisible(newRect, alignX, alignY); | 554 parentBox->scrollRectToVisible(newRect, alignX, alignY, scrollType); |
554 } | 555 } |
555 | 556 |
556 void LayoutBox::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumul
atedOffset) const | 557 void LayoutBox::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumul
atedOffset) const |
557 { | 558 { |
558 rects.append(pixelSnappedIntRect(accumulatedOffset, size())); | 559 rects.append(pixelSnappedIntRect(accumulatedOffset, size())); |
559 } | 560 } |
560 | 561 |
561 void LayoutBox::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const | 562 void LayoutBox::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const |
562 { | 563 { |
563 quads.append(localToAbsoluteQuad(FloatRect(0, 0, m_frameRect.width().toFloat
(), m_frameRect.height().toFloat()), 0 /* mode */, wasFixed)); | 564 quads.append(localToAbsoluteQuad(FloatRect(0, 0, m_frameRect.width().toFloat
(), m_frameRect.height().toFloat()), 0 /* mode */, wasFixed)); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 { | 767 { |
767 LocalFrame* frame = this->frame(); | 768 LocalFrame* frame = this->frame(); |
768 if (!frame) | 769 if (!frame) |
769 return; | 770 return; |
770 | 771 |
771 FrameView* frameView = frame->view(); | 772 FrameView* frameView = frame->view(); |
772 if (!frameView) | 773 if (!frameView) |
773 return; | 774 return; |
774 | 775 |
775 IntPoint positionInContent = frameView->rootFrameToContents(positionInRootFr
ame); | 776 IntPoint positionInContent = frameView->rootFrameToContents(positionInRootFr
ame); |
776 scrollRectToVisible(LayoutRect(positionInContent, LayoutSize(1, 1)), ScrollA
lignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded); | 777 scrollRectToVisible(LayoutRect(positionInContent, LayoutSize(1, 1)), ScrollA
lignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, UserScroll)
; |
777 } | 778 } |
778 | 779 |
779 // There are two kinds of layoutObject that can autoscroll. | 780 // There are two kinds of layoutObject that can autoscroll. |
780 bool LayoutBox::canAutoscroll() const | 781 bool LayoutBox::canAutoscroll() const |
781 { | 782 { |
782 if (node() && node()->isDocumentNode()) | 783 if (node() && node()->isDocumentNode()) |
783 return view()->frameView()->isScrollable(); | 784 return view()->frameView()->isScrollable(); |
784 | 785 |
785 // Check for a box that can be scrolled in its own right. | 786 // Check for a box that can be scrolled in its own right. |
786 return canBeScrolledAndHasScrollableArea(); | 787 return canBeScrolledAndHasScrollableArea(); |
(...skipping 3961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4748 StyleImage* borderImage = style()->borderImage().image(); | 4749 StyleImage* borderImage = style()->borderImage().image(); |
4749 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); | 4750 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); |
4750 } | 4751 } |
4751 | 4752 |
4752 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const | 4753 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const |
4753 { | 4754 { |
4754 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this)
: nullptr; | 4755 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this)
: nullptr; |
4755 } | 4756 } |
4756 | 4757 |
4757 } // namespace blink | 4758 } // namespace blink |
OLD | NEW |