| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 { | 336 { |
| 337 if (scrollOffset() == toDoubleSize(newScrollOffset)) | 337 if (scrollOffset() == toDoubleSize(newScrollOffset)) |
| 338 return; | 338 return; |
| 339 | 339 |
| 340 DoubleSize scrollDelta = scrollOffset() - toDoubleSize(newScrollOffset); | 340 DoubleSize scrollDelta = scrollOffset() - toDoubleSize(newScrollOffset); |
| 341 m_scrollOffset = toDoubleSize(newScrollOffset); | 341 m_scrollOffset = toDoubleSize(newScrollOffset); |
| 342 | 342 |
| 343 LocalFrame* frame = box().frame(); | 343 LocalFrame* frame = box().frame(); |
| 344 ASSERT(frame); | 344 ASSERT(frame); |
| 345 | 345 |
| 346 RefPtrWillBeRawPtr<FrameView> frameView = box().frameView(); | 346 RawPtr<FrameView> frameView = box().frameView(); |
| 347 | 347 |
| 348 TRACE_EVENT1("devtools.timeline", "ScrollLayer", "data", InspectorScrollLaye
rEvent::data(&box())); | 348 TRACE_EVENT1("devtools.timeline", "ScrollLayer", "data", InspectorScrollLaye
rEvent::data(&box())); |
| 349 | 349 |
| 350 // FIXME(420741): Resolve circular dependency between scroll offset and | 350 // FIXME(420741): Resolve circular dependency between scroll offset and |
| 351 // compositing state, and remove this disabler. | 351 // compositing state, and remove this disabler. |
| 352 DisableCompositingQueryAsserts disabler; | 352 DisableCompositingQueryAsserts disabler; |
| 353 | 353 |
| 354 // Update the positions of our child layers (if needed as only fixed layers
should be impacted by a scroll). | 354 // Update the positions of our child layers (if needed as only fixed layers
should be impacted by a scroll). |
| 355 // We don't update compositing layers, because we need to do a deep update f
rom the compositing ancestor. | 355 // We don't update compositing layers, because we need to do a deep update f
rom the compositing ancestor. |
| 356 if (!frameView->isInPerformLayout()) { | 356 if (!frameView->isInPerformLayout()) { |
| (...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 if (!m_vBar) | 1507 if (!m_vBar) |
| 1508 m_vBar = createScrollbar(VerticalScrollbar); | 1508 m_vBar = createScrollbar(VerticalScrollbar); |
| 1509 m_vBarIsAttached = 1; | 1509 m_vBarIsAttached = 1; |
| 1510 } else { | 1510 } else { |
| 1511 m_vBarIsAttached = 0; | 1511 m_vBarIsAttached = 0; |
| 1512 if (!m_canDetachScrollbars) | 1512 if (!m_canDetachScrollbars) |
| 1513 destroyScrollbar(VerticalScrollbar); | 1513 destroyScrollbar(VerticalScrollbar); |
| 1514 } | 1514 } |
| 1515 } | 1515 } |
| 1516 | 1516 |
| 1517 PassRefPtrWillBeRawPtr<Scrollbar> PaintLayerScrollableArea::ScrollbarManager::cr
eateScrollbar(ScrollbarOrientation orientation) | 1517 RawPtr<Scrollbar> PaintLayerScrollableArea::ScrollbarManager::createScrollbar(Sc
rollbarOrientation orientation) |
| 1518 { | 1518 { |
| 1519 ASSERT(orientation == HorizontalScrollbar ? !m_hBarIsAttached : !m_vBarIsAtt
ached); | 1519 ASSERT(orientation == HorizontalScrollbar ? !m_hBarIsAttached : !m_vBarIsAtt
ached); |
| 1520 RefPtrWillBeRawPtr<Scrollbar> scrollbar = nullptr; | 1520 RawPtr<Scrollbar> scrollbar = nullptr; |
| 1521 const LayoutObject& actualLayoutObject = layoutObjectForScrollbar(m_scrollab
leArea->box()); | 1521 const LayoutObject& actualLayoutObject = layoutObjectForScrollbar(m_scrollab
leArea->box()); |
| 1522 bool hasCustomScrollbarStyle = actualLayoutObject.isBox() && actualLayoutObj
ect.styleRef().hasPseudoStyle(SCROLLBAR); | 1522 bool hasCustomScrollbarStyle = actualLayoutObject.isBox() && actualLayoutObj
ect.styleRef().hasPseudoStyle(SCROLLBAR); |
| 1523 if (hasCustomScrollbarStyle) { | 1523 if (hasCustomScrollbarStyle) { |
| 1524 scrollbar = LayoutScrollbar::createCustomScrollbar(m_scrollableArea.get(
), orientation, actualLayoutObject.node()); | 1524 scrollbar = LayoutScrollbar::createCustomScrollbar(m_scrollableArea.get(
), orientation, actualLayoutObject.node()); |
| 1525 } else { | 1525 } else { |
| 1526 ScrollbarControlSize scrollbarSize = RegularScrollbar; | 1526 ScrollbarControlSize scrollbarSize = RegularScrollbar; |
| 1527 if (actualLayoutObject.styleRef().hasAppearance()) | 1527 if (actualLayoutObject.styleRef().hasAppearance()) |
| 1528 scrollbarSize = LayoutTheme::theme().scrollbarControlSizeForPart(act
ualLayoutObject.styleRef().appearance()); | 1528 scrollbarSize = LayoutTheme::theme().scrollbarControlSizeForPart(act
ualLayoutObject.styleRef().appearance()); |
| 1529 scrollbar = Scrollbar::create(m_scrollableArea.get(), orientation, scrol
lbarSize, &m_scrollableArea->box().frame()->page()->chromeClient()); | 1529 scrollbar = Scrollbar::create(m_scrollableArea.get(), orientation, scrol
lbarSize, &m_scrollableArea->box().frame()->page()->chromeClient()); |
| 1530 if (orientation == HorizontalScrollbar) | 1530 if (orientation == HorizontalScrollbar) |
| 1531 m_scrollableArea->didAddScrollbar(*scrollbar, HorizontalScrollbar); | 1531 m_scrollableArea->didAddScrollbar(*scrollbar, HorizontalScrollbar); |
| 1532 else | 1532 else |
| 1533 m_scrollableArea->didAddScrollbar(*scrollbar, VerticalScrollbar); | 1533 m_scrollableArea->didAddScrollbar(*scrollbar, VerticalScrollbar); |
| 1534 } | 1534 } |
| 1535 m_scrollableArea->box().document().view()->addChild(scrollbar.get()); | 1535 m_scrollableArea->box().document().view()->addChild(scrollbar.get()); |
| 1536 return scrollbar.release(); | 1536 return scrollbar.release(); |
| 1537 } | 1537 } |
| 1538 | 1538 |
| 1539 void PaintLayerScrollableArea::ScrollbarManager::destroyScrollbar(ScrollbarOrien
tation orientation) | 1539 void PaintLayerScrollableArea::ScrollbarManager::destroyScrollbar(ScrollbarOrien
tation orientation) |
| 1540 { | 1540 { |
| 1541 RefPtrWillBeMember<Scrollbar>& scrollbar = orientation == HorizontalScrollba
r ? m_hBar : m_vBar; | 1541 Member<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_hBar :
m_vBar; |
| 1542 ASSERT(orientation == HorizontalScrollbar ? !m_hBarIsAttached: !m_vBarIsAtta
ched); | 1542 ASSERT(orientation == HorizontalScrollbar ? !m_hBarIsAttached: !m_vBarIsAtta
ched); |
| 1543 if (!scrollbar) | 1543 if (!scrollbar) |
| 1544 return; | 1544 return; |
| 1545 | 1545 |
| 1546 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation); | 1546 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation); |
| 1547 | 1547 |
| 1548 if (!scrollbar->isCustomScrollbar()) | 1548 if (!scrollbar->isCustomScrollbar()) |
| 1549 m_scrollableArea->willRemoveScrollbar(*scrollbar, orientation); | 1549 m_scrollableArea->willRemoveScrollbar(*scrollbar, orientation); |
| 1550 | 1550 |
| 1551 toFrameView(scrollbar->parent())->removeChild(scrollbar.get()); | 1551 toFrameView(scrollbar->parent())->removeChild(scrollbar.get()); |
| 1552 scrollbar->disconnectFromScrollableArea(); | 1552 scrollbar->disconnectFromScrollableArea(); |
| 1553 scrollbar = nullptr; | 1553 scrollbar = nullptr; |
| 1554 } | 1554 } |
| 1555 | 1555 |
| 1556 DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager) | 1556 DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager) |
| 1557 { | 1557 { |
| 1558 visitor->trace(m_scrollableArea); | 1558 visitor->trace(m_scrollableArea); |
| 1559 visitor->trace(m_hBar); | 1559 visitor->trace(m_hBar); |
| 1560 visitor->trace(m_vBar); | 1560 visitor->trace(m_vBar); |
| 1561 } | 1561 } |
| 1562 | 1562 |
| 1563 } // namespace blink | 1563 } // namespace blink |
| OLD | NEW |