| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 : m_layer(layer) | 85 : m_layer(layer) |
| 86 , m_inResizeMode(false) | 86 , m_inResizeMode(false) |
| 87 , m_scrollsOverflow(false) | 87 , m_scrollsOverflow(false) |
| 88 , m_inOverflowRelayout(false) | 88 , m_inOverflowRelayout(false) |
| 89 , m_nextTopmostScrollChild(0) | 89 , m_nextTopmostScrollChild(0) |
| 90 , m_topmostScrollChild(0) | 90 , m_topmostScrollChild(0) |
| 91 , m_needsCompositedScrolling(false) | 91 , m_needsCompositedScrolling(false) |
| 92 , m_scrollbarManager(*this) | 92 , m_scrollbarManager(*this) |
| 93 , m_scrollCorner(nullptr) | 93 , m_scrollCorner(nullptr) |
| 94 , m_resizer(nullptr) | 94 , m_resizer(nullptr) |
| 95 , m_scrollAnchor(this) |
| 95 #if ENABLE(ASSERT) | 96 #if ENABLE(ASSERT) |
| 96 , m_hasBeenDisposed(false) | 97 , m_hasBeenDisposed(false) |
| 97 #endif | 98 #endif |
| 98 { | 99 { |
| 99 Node* node = box().node(); | 100 Node* node = box().node(); |
| 100 if (node && node->isElementNode()) { | 101 if (node && node->isElementNode()) { |
| 101 // We save and restore only the scrollOffset as the other scroll values
are recalculated. | 102 // We save and restore only the scrollOffset as the other scroll values
are recalculated. |
| 102 Element* element = toElement(node); | 103 Element* element = toElement(node); |
| 103 m_scrollOffset = element->savedLayerScrollOffset(); | 104 m_scrollOffset = element->savedLayerScrollOffset(); |
| 104 if (!m_scrollOffset.isZero()) | 105 if (!m_scrollOffset.isZero()) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 clearScrollAnimators(); | 155 clearScrollAnimators(); |
| 155 | 156 |
| 156 #if ENABLE(ASSERT) | 157 #if ENABLE(ASSERT) |
| 157 m_hasBeenDisposed = true; | 158 m_hasBeenDisposed = true; |
| 158 #endif | 159 #endif |
| 159 } | 160 } |
| 160 | 161 |
| 161 DEFINE_TRACE(PaintLayerScrollableArea) | 162 DEFINE_TRACE(PaintLayerScrollableArea) |
| 162 { | 163 { |
| 163 visitor->trace(m_scrollbarManager); | 164 visitor->trace(m_scrollbarManager); |
| 165 visitor->trace(m_scrollAnchor); |
| 164 ScrollableArea::trace(visitor); | 166 ScrollableArea::trace(visitor); |
| 165 } | 167 } |
| 166 | 168 |
| 167 HostWindow* PaintLayerScrollableArea::hostWindow() const | 169 HostWindow* PaintLayerScrollableArea::hostWindow() const |
| 168 { | 170 { |
| 169 if (Page* page = box().frame()->page()) | 171 if (Page* page = box().frame()->page()) |
| 170 return &page->chromeClient(); | 172 return &page->chromeClient(); |
| 171 return nullptr; | 173 return nullptr; |
| 172 } | 174 } |
| 173 | 175 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 { | 322 { |
| 321 IntSize scrollDimensions = maximumScrollPosition() - minimumScrollPosition()
; | 323 IntSize scrollDimensions = maximumScrollPosition() - minimumScrollPosition()
; |
| 322 return (orientation == HorizontalScrollbar) ? scrollDimensions.width() : scr
ollDimensions.height(); | 324 return (orientation == HorizontalScrollbar) ? scrollDimensions.width() : scr
ollDimensions.height(); |
| 323 } | 325 } |
| 324 | 326 |
| 325 void PaintLayerScrollableArea::setScrollOffset(const IntPoint& newScrollOffset,
ScrollType scrollType) | 327 void PaintLayerScrollableArea::setScrollOffset(const IntPoint& newScrollOffset,
ScrollType scrollType) |
| 326 { | 328 { |
| 327 setScrollOffset(DoublePoint(newScrollOffset), scrollType); | 329 setScrollOffset(DoublePoint(newScrollOffset), scrollType); |
| 328 } | 330 } |
| 329 | 331 |
| 330 void PaintLayerScrollableArea::setScrollOffset(const DoublePoint& newScrollOffse
t, ScrollType) | 332 void PaintLayerScrollableArea::setScrollOffset(const DoublePoint& newScrollOffse
t, ScrollType scrollType) |
| 331 { | 333 { |
| 332 if (scrollOffset() == toDoubleSize(newScrollOffset)) | 334 if (scrollOffset() == toDoubleSize(newScrollOffset)) |
| 333 return; | 335 return; |
| 334 | 336 |
| 335 DoubleSize scrollDelta = scrollOffset() - toDoubleSize(newScrollOffset); | 337 DoubleSize scrollDelta = scrollOffset() - toDoubleSize(newScrollOffset); |
| 336 m_scrollOffset = toDoubleSize(newScrollOffset); | 338 m_scrollOffset = toDoubleSize(newScrollOffset); |
| 337 | 339 |
| 338 LocalFrame* frame = box().frame(); | 340 LocalFrame* frame = box().frame(); |
| 339 ASSERT(frame); | 341 ASSERT(frame); |
| 340 | 342 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 box().view()->clearHitTestCache(); | 402 box().view()->clearHitTestCache(); |
| 401 | 403 |
| 402 // Inform the FrameLoader of the new scroll position, so it can be restored
when navigating back. | 404 // Inform the FrameLoader of the new scroll position, so it can be restored
when navigating back. |
| 403 if (layer()->isRootLayer()) { | 405 if (layer()->isRootLayer()) { |
| 404 frameView->frame().loader().saveScrollState(); | 406 frameView->frame().loader().saveScrollState(); |
| 405 frame->loader().client()->didChangeScrollOffset(); | 407 frame->loader().client()->didChangeScrollOffset(); |
| 406 } | 408 } |
| 407 | 409 |
| 408 // All scrolls clear the fragment anchor. | 410 // All scrolls clear the fragment anchor. |
| 409 frameView->clearFragmentAnchor(); | 411 frameView->clearFragmentAnchor(); |
| 412 |
| 413 // Clear the scroll anchor, unless it is the reason for this scroll. |
| 414 if (scrollAnchoringEnabled() && scrollType != AnchoringScroll) |
| 415 scrollAnchor().clear(); |
| 410 } | 416 } |
| 411 | 417 |
| 412 IntPoint PaintLayerScrollableArea::scrollPosition() const | 418 IntPoint PaintLayerScrollableArea::scrollPosition() const |
| 413 { | 419 { |
| 414 return IntPoint(flooredIntSize(m_scrollOffset)); | 420 return IntPoint(flooredIntSize(m_scrollOffset)); |
| 415 } | 421 } |
| 416 | 422 |
| 417 DoublePoint PaintLayerScrollableArea::scrollPositionDouble() const | 423 DoublePoint PaintLayerScrollableArea::scrollPositionDouble() const |
| 418 { | 424 { |
| 419 return DoublePoint(m_scrollOffset); | 425 return DoublePoint(m_scrollOffset); |
| (...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1440 return false; | 1446 return false; |
| 1441 | 1447 |
| 1442 return frame->settings()->viewportMetaEnabled(); | 1448 return frame->settings()->viewportMetaEnabled(); |
| 1443 } | 1449 } |
| 1444 | 1450 |
| 1445 Widget* PaintLayerScrollableArea::widget() | 1451 Widget* PaintLayerScrollableArea::widget() |
| 1446 { | 1452 { |
| 1447 return box().frame()->view(); | 1453 return box().frame()->view(); |
| 1448 } | 1454 } |
| 1449 | 1455 |
| 1456 bool PaintLayerScrollableArea::scrollAnchoringEnabled() const |
| 1457 { |
| 1458 if (Frame* frame = box().frame()) { |
| 1459 if (Settings* settings = frame->settings()) |
| 1460 return settings->scrollAnchoringEnabled(); |
| 1461 } |
| 1462 return false; |
| 1463 } |
| 1464 |
| 1450 PaintLayerScrollableArea::ScrollbarManager::ScrollbarManager(PaintLayerScrollabl
eArea& scrollableArea) | 1465 PaintLayerScrollableArea::ScrollbarManager::ScrollbarManager(PaintLayerScrollabl
eArea& scrollableArea) |
| 1451 : m_scrollableArea(&scrollableArea) | 1466 : m_scrollableArea(&scrollableArea) |
| 1452 , m_canDetachScrollbars(0) | 1467 , m_canDetachScrollbars(0) |
| 1453 , m_hBarIsAttached(0) | 1468 , m_hBarIsAttached(0) |
| 1454 , m_vBarIsAttached(0) | 1469 , m_vBarIsAttached(0) |
| 1455 { | 1470 { |
| 1456 } | 1471 } |
| 1457 | 1472 |
| 1458 void PaintLayerScrollableArea::ScrollbarManager::dispose() | 1473 void PaintLayerScrollableArea::ScrollbarManager::dispose() |
| 1459 { | 1474 { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 } | 1560 } |
| 1546 | 1561 |
| 1547 DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager) | 1562 DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager) |
| 1548 { | 1563 { |
| 1549 visitor->trace(m_scrollableArea); | 1564 visitor->trace(m_scrollableArea); |
| 1550 visitor->trace(m_hBar); | 1565 visitor->trace(m_hBar); |
| 1551 visitor->trace(m_vBar); | 1566 visitor->trace(m_vBar); |
| 1552 } | 1567 } |
| 1553 | 1568 |
| 1554 } // namespace blink | 1569 } // namespace blink |
| OLD | NEW |