| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 void PaintLayerScrollableArea::computeScrollDimensions() | 631 void PaintLayerScrollableArea::computeScrollDimensions() |
| 632 { | 632 { |
| 633 m_overflowRect = box().layoutOverflowRect(); | 633 m_overflowRect = box().layoutOverflowRect(); |
| 634 box().flipForWritingMode(m_overflowRect); | 634 box().flipForWritingMode(m_overflowRect); |
| 635 | 635 |
| 636 int scrollableLeftOverflow = m_overflowRect.x() - box().borderLeft() - (box(
).style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? box().verticalScr
ollbarWidth() : 0); | 636 int scrollableLeftOverflow = m_overflowRect.x() - box().borderLeft() - (box(
).style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? box().verticalScr
ollbarWidth() : 0); |
| 637 int scrollableTopOverflow = m_overflowRect.y() - box().borderTop(); | 637 int scrollableTopOverflow = m_overflowRect.y() - box().borderTop(); |
| 638 setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow)); | 638 setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow)); |
| 639 } | 639 } |
| 640 | 640 |
| 641 void PaintLayerScrollableArea::scrollToPosition(const DoublePoint& scrollPositio
n, ScrollOffsetClamping clamp, ScrollBehavior scrollBehavior) | 641 void PaintLayerScrollableArea::scrollToPosition(const DoublePoint& scrollPositio
n, ScrollOffsetClamping clamp, ScrollBehavior scrollBehavior, ScrollType scrollT
ype) |
| 642 { | 642 { |
| 643 cancelProgrammaticScrollAnimation(); | 643 cancelProgrammaticScrollAnimation(); |
| 644 | 644 |
| 645 DoublePoint newScrollPosition = clamp == ScrollOffsetClamped ? clampScrollPo
sition(scrollPosition) : scrollPosition; | 645 DoublePoint newScrollPosition = clamp == ScrollOffsetClamped ? clampScrollPo
sition(scrollPosition) : scrollPosition; |
| 646 if (newScrollPosition != scrollPositionDouble()) | 646 if (newScrollPosition != scrollPositionDouble()) |
| 647 ScrollableArea::setScrollPosition(newScrollPosition, ProgrammaticScroll,
scrollBehavior); | 647 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollB
ehavior); |
| 648 } | 648 } |
| 649 | 649 |
| 650 void PaintLayerScrollableArea::updateScrollDimensions(DoubleSize& scrollOffset,
bool& autoHorizontalScrollBarChanged, bool& autoVerticalScrollBarChanged) | 650 void PaintLayerScrollableArea::updateScrollDimensions(DoubleSize& scrollOffset,
bool& autoHorizontalScrollBarChanged, bool& autoVerticalScrollBarChanged) |
| 651 { | 651 { |
| 652 ASSERT(box().hasOverflowClip()); | 652 ASSERT(box().hasOverflowClip()); |
| 653 | 653 |
| 654 if (needsScrollbarReconstruction()) { | 654 if (needsScrollbarReconstruction()) { |
| 655 m_scrollbarManager.setCanDetachScrollbars(false); | 655 m_scrollbarManager.setCanDetachScrollbars(false); |
| 656 setHasHorizontalScrollbar(false); | 656 setHasHorizontalScrollbar(false); |
| 657 setHasVerticalScrollbar(false); | 657 setHasVerticalScrollbar(false); |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 // If the <body> didn't have a custom style, then the root element m
ight. | 994 // If the <body> didn't have a custom style, then the root element m
ight. |
| 995 Element* docElement = doc.documentElement(); | 995 Element* docElement = doc.documentElement(); |
| 996 if (docElement && docElement->layoutObject() && docElement->layoutOb
ject()->style()->hasPseudoStyle(SCROLLBAR)) | 996 if (docElement && docElement->layoutObject() && docElement->layoutOb
ject()->style()->hasPseudoStyle(SCROLLBAR)) |
| 997 return *docElement->layoutObject(); | 997 return *docElement->layoutObject(); |
| 998 | 998 |
| 999 // If we have an owning ipage/LocalFrame element, then it can set th
e custom scrollbar also. | 999 // If we have an owning ipage/LocalFrame element, then it can set th
e custom scrollbar also. |
| 1000 LayoutPart* frameLayoutObject = node->document().frame()->ownerLayou
tObject(); | 1000 LayoutPart* frameLayoutObject = node->document().frame()->ownerLayou
tObject(); |
| 1001 if (frameLayoutObject && frameLayoutObject->style()->hasPseudoStyle(
SCROLLBAR)) | 1001 if (frameLayoutObject && frameLayoutObject->style()->hasPseudoStyle(
SCROLLBAR)) |
| 1002 return *frameLayoutObject; | 1002 return *frameLayoutObject; |
| 1003 } | 1003 } |
| 1004 |
| 1005 if (layoutObject.styleRef().hasPseudoStyle(SCROLLBAR)) |
| 1006 return layoutObject; |
| 1007 |
| 1004 if (ShadowRoot* shadowRoot = node->containingShadowRoot()) { | 1008 if (ShadowRoot* shadowRoot = node->containingShadowRoot()) { |
| 1005 if (shadowRoot->type() == ShadowRootType::UserAgent) | 1009 if (shadowRoot->type() == ShadowRootType::UserAgent) |
| 1006 return *shadowRoot->host()->layoutObject(); | 1010 return *shadowRoot->host()->layoutObject(); |
| 1007 } | 1011 } |
| 1008 } | 1012 } |
| 1009 | 1013 |
| 1010 return layoutObject; | 1014 return layoutObject; |
| 1011 } | 1015 } |
| 1012 | 1016 |
| 1013 bool PaintLayerScrollableArea::needsScrollbarReconstruction() const | 1017 bool PaintLayerScrollableArea::needsScrollbarReconstruction() const |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 LayoutUnit baseHeight = box().size().height() - (isBoxSizingBorder ? Lay
outUnit() : box().borderAndPaddingHeight()); | 1348 LayoutUnit baseHeight = box().size().height() - (isBoxSizingBorder ? Lay
outUnit() : box().borderAndPaddingHeight()); |
| 1345 baseHeight = baseHeight / zoomFactor; | 1349 baseHeight = baseHeight / zoomFactor; |
| 1346 element->setInlineStyleProperty(CSSPropertyHeight, roundToInt(baseHeight
+ difference.height()), CSSPrimitiveValue::UnitType::Pixels); | 1350 element->setInlineStyleProperty(CSSPropertyHeight, roundToInt(baseHeight
+ difference.height()), CSSPrimitiveValue::UnitType::Pixels); |
| 1347 } | 1351 } |
| 1348 | 1352 |
| 1349 document.updateLayout(); | 1353 document.updateLayout(); |
| 1350 | 1354 |
| 1351 // FIXME (Radar 4118564): We should also autoscroll the window as necessary
to keep the point under the cursor in view. | 1355 // FIXME (Radar 4118564): We should also autoscroll the window as necessary
to keep the point under the cursor in view. |
| 1352 } | 1356 } |
| 1353 | 1357 |
| 1354 LayoutRect PaintLayerScrollableArea::scrollIntoView(const LayoutRect& rect, cons
t ScrollAlignment& alignX, const ScrollAlignment& alignY) | 1358 LayoutRect PaintLayerScrollableArea::scrollIntoView(const LayoutRect& rect, cons
t ScrollAlignment& alignX, const ScrollAlignment& alignY, ScrollType scrollType) |
| 1355 { | 1359 { |
| 1356 LayoutRect localExposeRect(box().absoluteToLocalQuad(FloatQuad(FloatRect(rec
t)), UseTransforms).boundingBox()); | 1360 LayoutRect localExposeRect(box().absoluteToLocalQuad(FloatQuad(FloatRect(rec
t)), UseTransforms).boundingBox()); |
| 1357 localExposeRect.move(-box().borderLeft(), -box().borderTop()); | 1361 localExposeRect.move(-box().borderLeft(), -box().borderTop()); |
| 1358 LayoutRect layerBounds(0, 0, box().clientWidth(), box().clientHeight()); | 1362 LayoutRect layerBounds(0, 0, box().clientWidth(), box().clientHeight()); |
| 1359 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect
, alignX, alignY); | 1363 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect
, alignX, alignY); |
| 1360 | 1364 |
| 1361 DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble
() + roundedIntSize(r.location())); | 1365 DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble
() + roundedIntSize(r.location())); |
| 1362 if (clampedScrollPosition == scrollPositionDouble()) | 1366 if (clampedScrollPosition == scrollPositionDouble()) |
| 1363 return rect; | 1367 return rect; |
| 1364 | 1368 |
| 1365 DoubleSize oldScrollOffset = adjustedScrollOffset(); | 1369 DoubleSize oldScrollOffset = adjustedScrollOffset(); |
| 1366 scrollToPosition(clampedScrollPosition); | 1370 scrollToPosition(clampedScrollPosition, ScrollOffsetUnclamped, ScrollBehavio
rInstant, scrollType); |
| 1367 DoubleSize scrollOffsetDifference = adjustedScrollOffset() - oldScrollOffset
; | 1371 DoubleSize scrollOffsetDifference = adjustedScrollOffset() - oldScrollOffset
; |
| 1368 localExposeRect.move(-LayoutSize(scrollOffsetDifference)); | 1372 localExposeRect.move(-LayoutSize(scrollOffsetDifference)); |
| 1369 return LayoutRect(box().localToAbsoluteQuad(FloatQuad(FloatRect(localExposeR
ect)), UseTransforms).boundingBox()); | 1373 return LayoutRect(box().localToAbsoluteQuad(FloatQuad(FloatRect(localExposeR
ect)), UseTransforms).boundingBox()); |
| 1370 } | 1374 } |
| 1371 | 1375 |
| 1372 void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow) | 1376 void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow) |
| 1373 { | 1377 { |
| 1374 LocalFrame* frame = box().frame(); | 1378 LocalFrame* frame = box().frame(); |
| 1375 if (!frame) | 1379 if (!frame) |
| 1376 return; | 1380 return; |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 } | 1566 } |
| 1563 | 1567 |
| 1564 DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager) | 1568 DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager) |
| 1565 { | 1569 { |
| 1566 visitor->trace(m_scrollableArea); | 1570 visitor->trace(m_scrollableArea); |
| 1567 visitor->trace(m_hBar); | 1571 visitor->trace(m_hBar); |
| 1568 visitor->trace(m_vBar); | 1572 visitor->trace(m_vBar); |
| 1569 } | 1573 } |
| 1570 | 1574 |
| 1571 } // namespace blink | 1575 } // namespace blink |
| OLD | NEW |