Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(584)

Side by Side Diff: sky/engine/core/rendering/RenderLayerScrollableArea.cpp

Issue 856443005: Delete some noop and dead scrollbar code. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sky/engine/platform/Widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 IntSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset()); 369 IntSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset());
370 if (clampedScrollOffset != adjustedScrollOffset()) 370 if (clampedScrollOffset != adjustedScrollOffset())
371 scrollToOffset(clampedScrollOffset); 371 scrollToOffset(clampedScrollOffset);
372 372
373 if (originalScrollOffset != adjustedScrollOffset()) 373 if (originalScrollOffset != adjustedScrollOffset())
374 scrollToOffsetWithoutAnimation(-scrollOrigin() + adjustedScrollOffset()) ; 374 scrollToOffsetWithoutAnimation(-scrollOrigin() + adjustedScrollOffset()) ;
375 375
376 bool hasHorizontalOverflow = this->hasHorizontalOverflow(); 376 bool hasHorizontalOverflow = this->hasHorizontalOverflow();
377 bool hasVerticalOverflow = this->hasVerticalOverflow(); 377 bool hasVerticalOverflow = this->hasVerticalOverflow();
378 378
379 // overflow:scroll should just enable/disable.
380 if (box().style()->overflowX() == OSCROLL)
381 horizontalScrollbar()->setEnabled(hasHorizontalOverflow);
382 if (box().style()->overflowY() == OSCROLL)
383 verticalScrollbar()->setEnabled(hasVerticalOverflow);
384
385 // overflow:auto may need to lay out again if scrollbars got added/removed. 379 // overflow:auto may need to lay out again if scrollbars got added/removed.
386 if (box().hasAutoHorizontalScrollbar()) 380 if (box().hasAutoHorizontalScrollbar())
387 setHasHorizontalScrollbar(hasHorizontalOverflow); 381 setHasHorizontalScrollbar(hasHorizontalOverflow);
388 if (box().hasAutoVerticalScrollbar()) 382 if (box().hasAutoVerticalScrollbar())
389 setHasVerticalScrollbar(hasVerticalOverflow); 383 setHasVerticalScrollbar(hasVerticalOverflow);
390 384
391 // Set up the range (and page step/line step). 385 // Set up the range (and page step/line step).
392 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { 386 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
393 int clientWidth = box().pixelSnappedClientWidth(); 387 int clientWidth = box().pixelSnappedClientWidth();
394 horizontalScrollbar->setProportion(clientWidth, overflowRect().width()); 388 horizontalScrollbar->setProportion(clientWidth, overflowRect().width());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 if (!canHaveOverflowScrollbars(box())) 449 if (!canHaveOverflowScrollbars(box()))
456 return; 450 return;
457 451
458 if (!m_scrollDimensionsDirty) 452 if (!m_scrollDimensionsDirty)
459 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab leVerticalOverflow()); 453 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab leVerticalOverflow());
460 454
461 EOverflow overflowX = box().style()->overflowX(); 455 EOverflow overflowX = box().style()->overflowX();
462 EOverflow overflowY = box().style()->overflowY(); 456 EOverflow overflowY = box().style()->overflowY();
463 457
464 // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep any automatic scrollbar that was already present. 458 // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep any automatic scrollbar that was already present.
459 // FIXME(sky): We only have overlay scrollbars, so we never do a relayout
460 // due to scrollbars. We probably don't need to do this at all. Also,
461 // updateScrollbarsAfterLayout not longer exists.
465 bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefines AutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX); 462 bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefines AutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX);
466 bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAuto maticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY); 463 bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAuto maticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY);
467 setHasHorizontalScrollbar(needsHorizontalScrollbar); 464 setHasHorizontalScrollbar(needsHorizontalScrollbar);
468 setHasVerticalScrollbar(needsVerticalScrollbar); 465 setHasVerticalScrollbar(needsVerticalScrollbar);
469
470 // With overflow: scroll, scrollbars are always visible but may be disabled.
471 // When switching to another value, we need to re-enable them (see bug 11985 ).
472 if (needsHorizontalScrollbar && oldStyle && oldStyle->overflowX() == OSCROLL && overflowX != OSCROLL) {
473 ASSERT(hasHorizontalScrollbar());
474 m_hBar->setEnabled(true);
475 }
476
477 if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL & & overflowY != OSCROLL) {
478 ASSERT(hasVerticalScrollbar());
479 m_vBar->setEnabled(true);
480 }
481 } 466 }
482 467
483 bool RenderLayerScrollableArea::updateAfterCompositingChange() 468 bool RenderLayerScrollableArea::updateAfterCompositingChange()
484 { 469 {
485 const bool layersChanged = m_topmostScrollChild != m_nextTopmostScrollChild; 470 const bool layersChanged = m_topmostScrollChild != m_nextTopmostScrollChild;
486 m_topmostScrollChild = m_nextTopmostScrollChild; 471 m_topmostScrollChild = m_nextTopmostScrollChild;
487 m_nextTopmostScrollChild = nullptr; 472 m_nextTopmostScrollChild = nullptr;
488 return layersChanged; 473 return layersChanged;
489 } 474 }
490 475
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) 718 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild)
734 { 719 {
735 // We only want to track the topmost scroll child for scrollable areas with 720 // We only want to track the topmost scroll child for scrollable areas with
736 // overlay scrollbars. 721 // overlay scrollbars.
737 if (!hasOverlayScrollbars()) 722 if (!hasOverlayScrollbars())
738 return; 723 return;
739 m_nextTopmostScrollChild = scrollChild; 724 m_nextTopmostScrollChild = scrollChild;
740 } 725 }
741 726
742 } // namespace blink 727 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | sky/engine/platform/Widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698