| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 , m_hasPendingLayout(false) | 109 , m_hasPendingLayout(false) |
| 110 , m_inSynchronousPostLayout(false) | 110 , m_inSynchronousPostLayout(false) |
| 111 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) | 111 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) |
| 112 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) | 112 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) |
| 113 , m_isTransparent(false) | 113 , m_isTransparent(false) |
| 114 , m_baseBackgroundColor(Color::white) | 114 , m_baseBackgroundColor(Color::white) |
| 115 , m_mediaType(MediaTypeNames::screen) | 115 , m_mediaType(MediaTypeNames::screen) |
| 116 , m_overflowStatusDirty(true) | 116 , m_overflowStatusDirty(true) |
| 117 , m_viewportLayoutObject(0) | 117 , m_viewportLayoutObject(0) |
| 118 , m_wasScrolledByUser(false) | 118 , m_wasScrolledByUser(false) |
| 119 , m_inProgrammaticScroll(false) | |
| 120 , m_safeToPropagateScrollToParent(true) | 119 , m_safeToPropagateScrollToParent(true) |
| 121 , m_isTrackingPaintInvalidations(false) | 120 , m_isTrackingPaintInvalidations(false) |
| 122 , m_scrollCorner(nullptr) | 121 , m_scrollCorner(nullptr) |
| 123 , m_visibleContentScaleFactor(1) | 122 , m_visibleContentScaleFactor(1) |
| 124 , m_inputEventsScaleFactorForEmulation(1) | 123 , m_inputEventsScaleFactorForEmulation(1) |
| 125 , m_layoutSizeFixedToFrameSize(true) | 124 , m_layoutSizeFixedToFrameSize(true) |
| 126 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) | 125 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) |
| 127 , m_topControlsViewportAdjustment(0) | 126 , m_topControlsViewportAdjustment(0) |
| 128 , m_needsUpdateWidgetPositions(false) | 127 , m_needsUpdateWidgetPositions(false) |
| 129 #if ENABLE(ASSERT) | 128 #if ENABLE(ASSERT) |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 | 908 |
| 910 if (isInPerformLayout() || !m_frame->document()->isActive()) | 909 if (isInPerformLayout() || !m_frame->document()->isActive()) |
| 911 return; | 910 return; |
| 912 | 911 |
| 913 TRACE_EVENT0("blink,benchmark", "FrameView::layout"); | 912 TRACE_EVENT0("blink,benchmark", "FrameView::layout"); |
| 914 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); | 913 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); |
| 915 | 914 |
| 916 // Protect the view from being deleted during layout (in recalcStyle) | 915 // Protect the view from being deleted during layout (in recalcStyle) |
| 917 RefPtrWillBeRawPtr<FrameView> protector(this); | 916 RefPtrWillBeRawPtr<FrameView> protector(this); |
| 918 | 917 |
| 919 // Every scroll that happens during layout is programmatic. | |
| 920 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); | |
| 921 | |
| 922 if (m_autoSizeInfo) | 918 if (m_autoSizeInfo) |
| 923 m_autoSizeInfo->autoSizeIfNeeded(); | 919 m_autoSizeInfo->autoSizeIfNeeded(); |
| 924 | 920 |
| 925 m_hasPendingLayout = false; | 921 m_hasPendingLayout = false; |
| 926 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); | 922 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); |
| 927 | 923 |
| 928 RELEASE_ASSERT(!isPainting()); | 924 RELEASE_ASSERT(!isPainting()); |
| 929 | 925 |
| 930 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout",
"beginData", InspectorLayoutEvent::beginData(this)); | 926 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout",
"beginData", InspectorLayoutEvent::beginData(this)); |
| 931 | 927 |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 | 1506 |
| 1511 // Update frame scroll offset to make target element visible. | 1507 // Update frame scroll offset to make target element visible. |
| 1512 setScrollPosition(targetOffset); | 1508 setScrollPosition(targetOffset); |
| 1513 | 1509 |
| 1514 return targetOffset - scrollPositionDouble(); | 1510 return targetOffset - scrollPositionDouble(); |
| 1515 } | 1511 } |
| 1516 | 1512 |
| 1517 void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollBehavior
scrollBehavior) | 1513 void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollBehavior
scrollBehavior) |
| 1518 { | 1514 { |
| 1519 cancelProgrammaticScrollAnimation(); | 1515 cancelProgrammaticScrollAnimation(); |
| 1520 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); | |
| 1521 m_maintainScrollPositionAnchor = nullptr; | 1516 m_maintainScrollPositionAnchor = nullptr; |
| 1522 | 1517 |
| 1523 DoublePoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint)
; | 1518 DoublePoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint)
; |
| 1524 if (newScrollPosition == scrollPositionDouble()) | 1519 if (newScrollPosition == scrollPositionDouble()) |
| 1525 return; | 1520 return; |
| 1526 | 1521 |
| 1527 if (scrollBehavior == ScrollBehaviorAuto) { | 1522 if (scrollBehavior == ScrollBehaviorAuto) { |
| 1528 Element* scrollElement = m_frame->document()->scrollingElement(); | 1523 Element* scrollElement = m_frame->document()->scrollingElement(); |
| 1529 LayoutObject* renderer = scrollElement ? scrollElement->layoutObject() :
nullptr; | 1524 LayoutObject* renderer = scrollElement ? scrollElement->layoutObject() :
nullptr; |
| 1530 if (renderer && renderer->style()->scrollBehavior() == ScrollBehaviorSmo
oth) | 1525 if (renderer && renderer->style()->scrollBehavior() == ScrollBehaviorSmo
oth) |
| 1531 scrollBehavior = ScrollBehaviorSmooth; | 1526 scrollBehavior = ScrollBehaviorSmooth; |
| 1532 else | 1527 else |
| 1533 scrollBehavior = ScrollBehaviorInstant; | 1528 scrollBehavior = ScrollBehaviorInstant; |
| 1534 } | 1529 } |
| 1535 | 1530 |
| 1536 if (scrollBehavior == ScrollBehaviorInstant) { | 1531 if (scrollBehavior == ScrollBehaviorInstant) { |
| 1537 DoubleSize newOffset(newScrollPosition.x(), newScrollPosition.y()); | 1532 DoubleSize newOffset(newScrollPosition.x(), newScrollPosition.y()); |
| 1538 updateScrollbars(newOffset); | 1533 updateScrollbars(newOffset); |
| 1539 } else { | 1534 } else { |
| 1540 programmaticallyScrollSmoothlyToOffset(toFloatPoint(newScrollPosition)); | 1535 programmaticallyScrollSmoothlyToOffset(toFloatPoint(newScrollPosition)); |
| 1541 } | 1536 } |
| 1542 } | 1537 } |
| 1543 | 1538 |
| 1544 void FrameView::setScrollPositionNonProgrammatically(const IntPoint& scrollPoint
) | |
| 1545 { | |
| 1546 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); | |
| 1547 | |
| 1548 if (newScrollPosition == scrollPosition()) | |
| 1549 return; | |
| 1550 | |
| 1551 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, fal
se); | |
| 1552 notifyScrollPositionChanged(newScrollPosition); | |
| 1553 } | |
| 1554 | |
| 1555 void FrameView::setElasticOverscroll(const FloatSize& elasticOverscroll) | 1539 void FrameView::setElasticOverscroll(const FloatSize& elasticOverscroll) |
| 1556 { | 1540 { |
| 1557 m_elasticOverscroll = elasticOverscroll; | 1541 m_elasticOverscroll = elasticOverscroll; |
| 1558 if (m_horizontalScrollbar) { | 1542 if (m_horizontalScrollbar) { |
| 1559 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic
Overscroll(); | 1543 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic
Overscroll(); |
| 1560 if (delta != 0) { | 1544 if (delta != 0) { |
| 1561 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width(
)); | 1545 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width(
)); |
| 1562 scrollAnimator()->notifyContentAreaScrolled(FloatSize(delta, 0)); | 1546 scrollAnimator()->notifyContentAreaScrolled(FloatSize(delta, 0)); |
| 1563 if (!m_scrollbarsSuppressed) | 1547 if (!m_scrollbarsSuppressed) |
| 1564 m_horizontalScrollbar->invalidate(); | 1548 m_horizontalScrollbar->invalidate(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1582 | 1566 |
| 1583 void FrameView::setLayoutSize(const IntSize& size) | 1567 void FrameView::setLayoutSize(const IntSize& size) |
| 1584 { | 1568 { |
| 1585 ASSERT(!layoutSizeFixedToFrameSize()); | 1569 ASSERT(!layoutSizeFixedToFrameSize()); |
| 1586 | 1570 |
| 1587 setLayoutSizeInternal(size); | 1571 setLayoutSizeInternal(size); |
| 1588 } | 1572 } |
| 1589 | 1573 |
| 1590 void FrameView::scrollPositionChanged() | 1574 void FrameView::scrollPositionChanged() |
| 1591 { | 1575 { |
| 1592 setWasScrolledByUser(true); | |
| 1593 | |
| 1594 Document* document = m_frame->document(); | 1576 Document* document = m_frame->document(); |
| 1595 document->enqueueScrollEventForNode(document); | 1577 document->enqueueScrollEventForNode(document); |
| 1596 | 1578 |
| 1597 m_frame->eventHandler().dispatchFakeMouseMoveEventSoon(); | 1579 m_frame->eventHandler().dispatchFakeMouseMoveEventSoon(); |
| 1598 | 1580 |
| 1599 if (LayoutView* layoutView = document->layoutView()) { | 1581 if (LayoutView* layoutView = document->layoutView()) { |
| 1600 if (layoutView->usesCompositing()) | 1582 if (layoutView->usesCompositing()) |
| 1601 layoutView->compositor()->frameViewDidScroll(); | 1583 layoutView->compositor()->frameViewDidScroll(); |
| 1602 } | 1584 } |
| 1603 | 1585 |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2490 return nullptr; | 2472 return nullptr; |
| 2491 } | 2473 } |
| 2492 | 2474 |
| 2493 bool FrameView::wasScrolledByUser() const | 2475 bool FrameView::wasScrolledByUser() const |
| 2494 { | 2476 { |
| 2495 return m_wasScrolledByUser; | 2477 return m_wasScrolledByUser; |
| 2496 } | 2478 } |
| 2497 | 2479 |
| 2498 void FrameView::setWasScrolledByUser(bool wasScrolledByUser) | 2480 void FrameView::setWasScrolledByUser(bool wasScrolledByUser) |
| 2499 { | 2481 { |
| 2500 if (m_inProgrammaticScroll) | |
| 2501 return; | |
| 2502 m_maintainScrollPositionAnchor = nullptr; | 2482 m_maintainScrollPositionAnchor = nullptr; |
| 2503 m_wasScrolledByUser = wasScrolledByUser; | 2483 m_wasScrolledByUser = wasScrolledByUser; |
| 2504 } | 2484 } |
| 2505 | 2485 |
| 2506 void FrameView::setPaintBehavior(PaintBehavior behavior) | 2486 void FrameView::setPaintBehavior(PaintBehavior behavior) |
| 2507 { | 2487 { |
| 2508 m_paintBehavior = behavior; | 2488 m_paintBehavior = behavior; |
| 2509 } | 2489 } |
| 2510 | 2490 |
| 2511 PaintBehavior FrameView::paintBehavior() const | 2491 PaintBehavior FrameView::paintBehavior() const |
| (...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3986 { | 3966 { |
| 3987 Settings* settings = frame().settings(); | 3967 Settings* settings = frame().settings(); |
| 3988 if (!settings || !settings->rootLayerScrolls()) | 3968 if (!settings || !settings->rootLayerScrolls()) |
| 3989 return this; | 3969 return this; |
| 3990 | 3970 |
| 3991 LayoutView* layoutView = this->layoutView(); | 3971 LayoutView* layoutView = this->layoutView(); |
| 3992 return layoutView ? layoutView->scrollableArea() : nullptr; | 3972 return layoutView ? layoutView->scrollableArea() : nullptr; |
| 3993 } | 3973 } |
| 3994 | 3974 |
| 3995 } // namespace blink | 3975 } // namespace blink |
| OLD | NEW |