| 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@gmail.com> | 9 * Christian Biesinger <cbiesinger@gmail.com> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 { | 337 { |
| 338 if (scrollOffset() == toDoubleSize(newScrollOffset)) | 338 if (scrollOffset() == toDoubleSize(newScrollOffset)) |
| 339 return; | 339 return; |
| 340 | 340 |
| 341 DoubleSize scrollDelta = scrollOffset() - toDoubleSize(newScrollOffset); | 341 DoubleSize scrollDelta = scrollOffset() - toDoubleSize(newScrollOffset); |
| 342 m_scrollOffset = toDoubleSize(newScrollOffset); | 342 m_scrollOffset = toDoubleSize(newScrollOffset); |
| 343 | 343 |
| 344 LocalFrame* frame = box().frame(); | 344 LocalFrame* frame = box().frame(); |
| 345 ASSERT(frame); | 345 ASSERT(frame); |
| 346 | 346 |
| 347 RefPtrWillBeRawPtr<FrameView> frameView = box().frameView(); | 347 RawPtr<FrameView> frameView = box().frameView(); |
| 348 | 348 |
| 349 TRACE_EVENT1("devtools.timeline", "ScrollLayer", "data", InspectorScrollLaye
rEvent::data(&box())); | 349 TRACE_EVENT1("devtools.timeline", "ScrollLayer", "data", InspectorScrollLaye
rEvent::data(&box())); |
| 350 | 350 |
| 351 // FIXME(420741): Resolve circular dependency between scroll offset and | 351 // FIXME(420741): Resolve circular dependency between scroll offset and |
| 352 // compositing state, and remove this disabler. | 352 // compositing state, and remove this disabler. |
| 353 DisableCompositingQueryAsserts disabler; | 353 DisableCompositingQueryAsserts disabler; |
| 354 | 354 |
| 355 // Update the positions of our child layers (if needed as only fixed layers
should be impacted by a scroll). | 355 // Update the positions of our child layers (if needed as only fixed layers
should be impacted by a scroll). |
| 356 // We don't update compositing layers, because we need to do a deep update f
rom the compositing ancestor. | 356 // We don't update compositing layers, because we need to do a deep update f
rom the compositing ancestor. |
| 357 if (!frameView->isInPerformLayout()) { | 357 if (!frameView->isInPerformLayout()) { |
| (...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 m_vBarIsAttached = 1; | 1538 m_vBarIsAttached = 1; |
| 1539 } | 1539 } |
| 1540 | 1540 |
| 1541 } else { | 1541 } else { |
| 1542 m_vBarIsAttached = 0; | 1542 m_vBarIsAttached = 0; |
| 1543 if (!m_canDetachScrollbars) | 1543 if (!m_canDetachScrollbars) |
| 1544 destroyScrollbar(VerticalScrollbar); | 1544 destroyScrollbar(VerticalScrollbar); |
| 1545 } | 1545 } |
| 1546 } | 1546 } |
| 1547 | 1547 |
| 1548 PassRefPtrWillBeRawPtr<Scrollbar> PaintLayerScrollableArea::ScrollbarManager::cr
eateScrollbar(ScrollbarOrientation orientation) | 1548 RawPtr<Scrollbar> PaintLayerScrollableArea::ScrollbarManager::createScrollbar(Sc
rollbarOrientation orientation) |
| 1549 { | 1549 { |
| 1550 ASSERT(orientation == HorizontalScrollbar ? !m_hBarIsAttached : !m_vBarIsAtt
ached); | 1550 ASSERT(orientation == HorizontalScrollbar ? !m_hBarIsAttached : !m_vBarIsAtt
ached); |
| 1551 RefPtrWillBeRawPtr<Scrollbar> scrollbar = nullptr; | 1551 RawPtr<Scrollbar> scrollbar = nullptr; |
| 1552 const LayoutObject& actualLayoutObject = layoutObjectForScrollbar(m_scrollab
leArea->box()); | 1552 const LayoutObject& actualLayoutObject = layoutObjectForScrollbar(m_scrollab
leArea->box()); |
| 1553 bool hasCustomScrollbarStyle = actualLayoutObject.isBox() && actualLayoutObj
ect.styleRef().hasPseudoStyle(PseudoIdScrollbar); | 1553 bool hasCustomScrollbarStyle = actualLayoutObject.isBox() && actualLayoutObj
ect.styleRef().hasPseudoStyle(PseudoIdScrollbar); |
| 1554 if (hasCustomScrollbarStyle) { | 1554 if (hasCustomScrollbarStyle) { |
| 1555 scrollbar = LayoutScrollbar::createCustomScrollbar(m_scrollableArea.get(
), orientation, actualLayoutObject.node()); | 1555 scrollbar = LayoutScrollbar::createCustomScrollbar(m_scrollableArea.get(
), orientation, actualLayoutObject.node()); |
| 1556 } else { | 1556 } else { |
| 1557 ScrollbarControlSize scrollbarSize = RegularScrollbar; | 1557 ScrollbarControlSize scrollbarSize = RegularScrollbar; |
| 1558 if (actualLayoutObject.styleRef().hasAppearance()) | 1558 if (actualLayoutObject.styleRef().hasAppearance()) |
| 1559 scrollbarSize = LayoutTheme::theme().scrollbarControlSizeForPart(act
ualLayoutObject.styleRef().appearance()); | 1559 scrollbarSize = LayoutTheme::theme().scrollbarControlSizeForPart(act
ualLayoutObject.styleRef().appearance()); |
| 1560 scrollbar = Scrollbar::create(m_scrollableArea.get(), orientation, scrol
lbarSize, &m_scrollableArea->box().frame()->page()->chromeClient()); | 1560 scrollbar = Scrollbar::create(m_scrollableArea.get(), orientation, scrol
lbarSize, &m_scrollableArea->box().frame()->page()->chromeClient()); |
| 1561 } | 1561 } |
| 1562 m_scrollableArea->box().document().view()->addChild(scrollbar.get()); | 1562 m_scrollableArea->box().document().view()->addChild(scrollbar.get()); |
| 1563 return scrollbar.release(); | 1563 return scrollbar.release(); |
| 1564 } | 1564 } |
| 1565 | 1565 |
| 1566 void PaintLayerScrollableArea::ScrollbarManager::destroyScrollbar(ScrollbarOrien
tation orientation) | 1566 void PaintLayerScrollableArea::ScrollbarManager::destroyScrollbar(ScrollbarOrien
tation orientation) |
| 1567 { | 1567 { |
| 1568 RefPtrWillBeMember<Scrollbar>& scrollbar = orientation == HorizontalScrollba
r ? m_hBar : m_vBar; | 1568 Member<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_hBar :
m_vBar; |
| 1569 ASSERT(orientation == HorizontalScrollbar ? !m_hBarIsAttached: !m_vBarIsAtta
ched); | 1569 ASSERT(orientation == HorizontalScrollbar ? !m_hBarIsAttached: !m_vBarIsAtta
ched); |
| 1570 if (!scrollbar) | 1570 if (!scrollbar) |
| 1571 return; | 1571 return; |
| 1572 | 1572 |
| 1573 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation); | 1573 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation); |
| 1574 if (orientation == HorizontalScrollbar) | 1574 if (orientation == HorizontalScrollbar) |
| 1575 m_scrollableArea->m_rebuildHorizontalScrollbarLayer = true; | 1575 m_scrollableArea->m_rebuildHorizontalScrollbarLayer = true; |
| 1576 else | 1576 else |
| 1577 m_scrollableArea->m_rebuildVerticalScrollbarLayer = true; | 1577 m_scrollableArea->m_rebuildVerticalScrollbarLayer = true; |
| 1578 | 1578 |
| 1579 if (!scrollbar->isCustomScrollbar()) | 1579 if (!scrollbar->isCustomScrollbar()) |
| 1580 m_scrollableArea->willRemoveScrollbar(*scrollbar, orientation); | 1580 m_scrollableArea->willRemoveScrollbar(*scrollbar, orientation); |
| 1581 | 1581 |
| 1582 toFrameView(scrollbar->parent())->removeChild(scrollbar.get()); | 1582 toFrameView(scrollbar->parent())->removeChild(scrollbar.get()); |
| 1583 scrollbar->disconnectFromScrollableArea(); | 1583 scrollbar->disconnectFromScrollableArea(); |
| 1584 scrollbar = nullptr; | 1584 scrollbar = nullptr; |
| 1585 } | 1585 } |
| 1586 | 1586 |
| 1587 DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager) | 1587 DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager) |
| 1588 { | 1588 { |
| 1589 visitor->trace(m_scrollableArea); | 1589 visitor->trace(m_scrollableArea); |
| 1590 visitor->trace(m_hBar); | 1590 visitor->trace(m_hBar); |
| 1591 visitor->trace(m_vBar); | 1591 visitor->trace(m_vBar); |
| 1592 } | 1592 } |
| 1593 | 1593 |
| 1594 } // namespace blink | 1594 } // namespace blink |
| OLD | NEW |