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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2394163002: Fix performance regression and bug with hide_scrollbars setting. (Closed)
Patch Set: Created 4 years, 2 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 | third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp » ('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) 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 3433 matching lines...) Expand 10 before | Expand all | Expand 10 after
3444 return maximumPosition.expandedTo(minimumScrollPosition()); 3444 return maximumPosition.expandedTo(minimumScrollPosition());
3445 } 3445 }
3446 3446
3447 void FrameView::addChild(Widget* child) { 3447 void FrameView::addChild(Widget* child) {
3448 ASSERT(child != this && !child->parent()); 3448 ASSERT(child != this && !child->parent());
3449 child->setParent(this); 3449 child->setParent(this);
3450 m_children.add(child); 3450 m_children.add(child);
3451 } 3451 }
3452 3452
3453 void FrameView::setHasHorizontalScrollbar(bool hasBar) { 3453 void FrameView::setHasHorizontalScrollbar(bool hasBar) {
3454 if (m_frame->settings() && m_frame->settings()->hideScrollbars())
3455 hasBar = false;
3456
3457 if (hasBar == !!m_horizontalScrollbar) 3454 if (hasBar == !!m_horizontalScrollbar)
3458 return; 3455 return;
3459 3456
3460 if (hasBar) { 3457 if (hasBar) {
3461 m_horizontalScrollbar = createScrollbar(HorizontalScrollbar); 3458 m_horizontalScrollbar = createScrollbar(HorizontalScrollbar);
3462 addChild(m_horizontalScrollbar.get()); 3459 addChild(m_horizontalScrollbar.get());
3463 didAddScrollbar(*m_horizontalScrollbar, HorizontalScrollbar); 3460 didAddScrollbar(*m_horizontalScrollbar, HorizontalScrollbar);
3464 m_horizontalScrollbar->styleChanged(); 3461 m_horizontalScrollbar->styleChanged();
3465 } else { 3462 } else {
3466 willRemoveScrollbar(*m_horizontalScrollbar, HorizontalScrollbar); 3463 willRemoveScrollbar(*m_horizontalScrollbar, HorizontalScrollbar);
3467 // If the scrollbar has been marked as overlapping the window resizer, 3464 // If the scrollbar has been marked as overlapping the window resizer,
3468 // then its removal should reduce the count. 3465 // then its removal should reduce the count.
3469 if (m_horizontalScrollbar->overlapsResizer()) 3466 if (m_horizontalScrollbar->overlapsResizer())
3470 adjustScrollbarsAvoidingResizerCount(-1); 3467 adjustScrollbarsAvoidingResizerCount(-1);
3471 removeChild(m_horizontalScrollbar.get()); 3468 removeChild(m_horizontalScrollbar.get());
3472 m_horizontalScrollbar->disconnectFromScrollableArea(); 3469 m_horizontalScrollbar->disconnectFromScrollableArea();
3473 m_horizontalScrollbar = nullptr; 3470 m_horizontalScrollbar = nullptr;
3474 } 3471 }
3475 3472
3476 setScrollCornerNeedsPaintInvalidation(); 3473 setScrollCornerNeedsPaintInvalidation();
3477 } 3474 }
3478 3475
3479 void FrameView::setHasVerticalScrollbar(bool hasBar) { 3476 void FrameView::setHasVerticalScrollbar(bool hasBar) {
3480 if (m_frame->settings() && m_frame->settings()->hideScrollbars())
3481 hasBar = false;
3482
3483 if (hasBar == !!m_verticalScrollbar) 3477 if (hasBar == !!m_verticalScrollbar)
3484 return; 3478 return;
3485 3479
3486 if (hasBar) { 3480 if (hasBar) {
3487 m_verticalScrollbar = createScrollbar(VerticalScrollbar); 3481 m_verticalScrollbar = createScrollbar(VerticalScrollbar);
3488 addChild(m_verticalScrollbar.get()); 3482 addChild(m_verticalScrollbar.get());
3489 didAddScrollbar(*m_verticalScrollbar, VerticalScrollbar); 3483 didAddScrollbar(*m_verticalScrollbar, VerticalScrollbar);
3490 m_verticalScrollbar->styleChanged(); 3484 m_verticalScrollbar->styleChanged();
3491 } else { 3485 } else {
3492 willRemoveScrollbar(*m_verticalScrollbar, VerticalScrollbar); 3486 willRemoveScrollbar(*m_verticalScrollbar, VerticalScrollbar);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
3684 return (m_horizontalScrollbar && 3678 return (m_horizontalScrollbar &&
3685 m_horizontalScrollbar->isOverlayScrollbar()) || 3679 m_horizontalScrollbar->isOverlayScrollbar()) ||
3686 (m_verticalScrollbar && m_verticalScrollbar->isOverlayScrollbar()); 3680 (m_verticalScrollbar && m_verticalScrollbar->isOverlayScrollbar());
3687 } 3681 }
3688 3682
3689 void FrameView::computeScrollbarExistence( 3683 void FrameView::computeScrollbarExistence(
3690 bool& newHasHorizontalScrollbar, 3684 bool& newHasHorizontalScrollbar,
3691 bool& newHasVerticalScrollbar, 3685 bool& newHasVerticalScrollbar,
3692 const IntSize& docSize, 3686 const IntSize& docSize,
3693 ComputeScrollbarExistenceOption option) const { 3687 ComputeScrollbarExistenceOption option) const {
3688 if (m_frame->settings() && m_frame->settings()->hideScrollbars()) {
3689 newHasHorizontalScrollbar = false;
3690 newHasVerticalScrollbar = false;
3691 return;
3692 }
3693
3694 bool hasHorizontalScrollbar = m_horizontalScrollbar; 3694 bool hasHorizontalScrollbar = m_horizontalScrollbar;
3695 bool hasVerticalScrollbar = m_verticalScrollbar; 3695 bool hasVerticalScrollbar = m_verticalScrollbar;
3696 3696
3697 newHasHorizontalScrollbar = hasHorizontalScrollbar; 3697 newHasHorizontalScrollbar = hasHorizontalScrollbar;
3698 newHasVerticalScrollbar = hasVerticalScrollbar; 3698 newHasVerticalScrollbar = hasVerticalScrollbar;
3699 3699
3700 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 3700 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
3701 return; 3701 return;
3702 3702
3703 ScrollbarMode hScroll = m_horizontalScrollbarMode; 3703 ScrollbarMode hScroll = m_horizontalScrollbarMode;
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
4570 } 4570 }
4571 4571
4572 bool FrameView::canThrottleRendering() const { 4572 bool FrameView::canThrottleRendering() const {
4573 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4573 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4574 return false; 4574 return false;
4575 return m_subtreeThrottled || 4575 return m_subtreeThrottled ||
4576 (m_hiddenForThrottling && m_crossOriginForThrottling); 4576 (m_hiddenForThrottling && m_crossOriginForThrottling);
4577 } 4577 }
4578 4578
4579 } // namespace blink 4579 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698