| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 static bool overflowRequiresScrollbar(EOverflow overflow) | 433 static bool overflowRequiresScrollbar(EOverflow overflow) |
| 434 { | 434 { |
| 435 return overflow == OSCROLL; | 435 return overflow == OSCROLL; |
| 436 } | 436 } |
| 437 | 437 |
| 438 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) | 438 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) |
| 439 { | 439 { |
| 440 return overflow == OAUTO || overflow == OOVERLAY; | 440 return overflow == OAUTO || overflow == OOVERLAY; |
| 441 } | 441 } |
| 442 | 442 |
| 443 // This function returns true if the given box requires overflow scrollbars (as | |
| 444 // opposed to the 'viewport' scrollbars managed by the RenderLayerCompositor). | |
| 445 // FIXME: we should use the same scrolling machinery for both the viewport and | |
| 446 // overflow. Currently, we need to avoid producing scrollbars here if they'll be | |
| 447 // handled externally in the RLC. | |
| 448 static bool canHaveOverflowScrollbars(const RenderBox& box) | |
| 449 { | |
| 450 return !box.isRenderView() && box.document().viewportDefiningElement() != bo
x.node(); | |
| 451 } | |
| 452 | |
| 453 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty
le) | 443 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty
le) |
| 454 { | 444 { |
| 455 if (!canHaveOverflowScrollbars(box())) | |
| 456 return; | |
| 457 | |
| 458 if (!m_scrollDimensionsDirty) | 445 if (!m_scrollDimensionsDirty) |
| 459 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab
leVerticalOverflow()); | 446 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab
leVerticalOverflow()); |
| 460 | 447 |
| 461 EOverflow overflowX = box().style()->overflowX(); | 448 EOverflow overflowX = box().style()->overflowX(); |
| 462 EOverflow overflowY = box().style()->overflowY(); | 449 EOverflow overflowY = box().style()->overflowY(); |
| 463 | 450 |
| 464 // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep
any automatic scrollbar that was already present. | 451 // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep
any automatic scrollbar that was already present. |
| 465 bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefines
AutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX); | 452 bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefines
AutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX); |
| 466 bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAuto
maticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY); | 453 bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAuto
maticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY); |
| 467 setHasHorizontalScrollbar(needsHorizontalScrollbar); | 454 setHasHorizontalScrollbar(needsHorizontalScrollbar); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) | 720 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) |
| 734 { | 721 { |
| 735 // We only want to track the topmost scroll child for scrollable areas with | 722 // We only want to track the topmost scroll child for scrollable areas with |
| 736 // overlay scrollbars. | 723 // overlay scrollbars. |
| 737 if (!hasOverlayScrollbars()) | 724 if (!hasOverlayScrollbars()) |
| 738 return; | 725 return; |
| 739 m_nextTopmostScrollChild = scrollChild; | 726 m_nextTopmostScrollChild = scrollChild; |
| 740 } | 727 } |
| 741 | 728 |
| 742 } // namespace blink | 729 } // namespace blink |
| OLD | NEW |