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

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

Issue 2390513002: Fix potential crashes in setHasHorizontal/VerticalScrollbar. (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 | no next file » | 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 3369 matching lines...) Expand 10 before | Expand all | Expand 10 after
3380 return maximumPosition.expandedTo(minimumScrollPosition()); 3380 return maximumPosition.expandedTo(minimumScrollPosition());
3381 } 3381 }
3382 3382
3383 void FrameView::addChild(Widget* child) { 3383 void FrameView::addChild(Widget* child) {
3384 ASSERT(child != this && !child->parent()); 3384 ASSERT(child != this && !child->parent());
3385 child->setParent(this); 3385 child->setParent(this);
3386 m_children.add(child); 3386 m_children.add(child);
3387 } 3387 }
3388 3388
3389 void FrameView::setHasHorizontalScrollbar(bool hasBar) { 3389 void FrameView::setHasHorizontalScrollbar(bool hasBar) {
3390 DCHECK(m_frame->settings()); 3390 if (m_frame->settings() && m_frame->settings()->hideScrollbars())
3391 if (m_frame->settings()->hideScrollbars())
3392 hasBar = false; 3391 hasBar = false;
3393 3392
3394 if (hasBar == !!m_horizontalScrollbar) 3393 if (hasBar == !!m_horizontalScrollbar)
3395 return; 3394 return;
3396 3395
3397 if (hasBar) { 3396 if (hasBar) {
3398 m_horizontalScrollbar = createScrollbar(HorizontalScrollbar); 3397 m_horizontalScrollbar = createScrollbar(HorizontalScrollbar);
3399 addChild(m_horizontalScrollbar.get()); 3398 addChild(m_horizontalScrollbar.get());
3400 didAddScrollbar(*m_horizontalScrollbar, HorizontalScrollbar); 3399 didAddScrollbar(*m_horizontalScrollbar, HorizontalScrollbar);
3401 m_horizontalScrollbar->styleChanged(); 3400 m_horizontalScrollbar->styleChanged();
3402 } else { 3401 } else {
3403 willRemoveScrollbar(*m_horizontalScrollbar, HorizontalScrollbar); 3402 willRemoveScrollbar(*m_horizontalScrollbar, HorizontalScrollbar);
3404 // If the scrollbar has been marked as overlapping the window resizer, 3403 // If the scrollbar has been marked as overlapping the window resizer,
3405 // then its removal should reduce the count. 3404 // then its removal should reduce the count.
3406 if (m_horizontalScrollbar->overlapsResizer()) 3405 if (m_horizontalScrollbar->overlapsResizer())
3407 adjustScrollbarsAvoidingResizerCount(-1); 3406 adjustScrollbarsAvoidingResizerCount(-1);
3408 removeChild(m_horizontalScrollbar.get()); 3407 removeChild(m_horizontalScrollbar.get());
3409 m_horizontalScrollbar->disconnectFromScrollableArea(); 3408 m_horizontalScrollbar->disconnectFromScrollableArea();
3410 m_horizontalScrollbar = nullptr; 3409 m_horizontalScrollbar = nullptr;
3411 } 3410 }
3412 3411
3413 setScrollCornerNeedsPaintInvalidation(); 3412 setScrollCornerNeedsPaintInvalidation();
3414 } 3413 }
3415 3414
3416 void FrameView::setHasVerticalScrollbar(bool hasBar) { 3415 void FrameView::setHasVerticalScrollbar(bool hasBar) {
3417 DCHECK(m_frame->settings()); 3416 if (m_frame->settings() && m_frame->settings()->hideScrollbars())
3418 if (m_frame->settings()->hideScrollbars())
3419 hasBar = false; 3417 hasBar = false;
3420 3418
3421 if (hasBar == !!m_verticalScrollbar) 3419 if (hasBar == !!m_verticalScrollbar)
3422 return; 3420 return;
3423 3421
3424 if (hasBar) { 3422 if (hasBar) {
3425 m_verticalScrollbar = createScrollbar(VerticalScrollbar); 3423 m_verticalScrollbar = createScrollbar(VerticalScrollbar);
3426 addChild(m_verticalScrollbar.get()); 3424 addChild(m_verticalScrollbar.get());
3427 didAddScrollbar(*m_verticalScrollbar, VerticalScrollbar); 3425 didAddScrollbar(*m_verticalScrollbar, VerticalScrollbar);
3428 m_verticalScrollbar->styleChanged(); 3426 m_verticalScrollbar->styleChanged();
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
4505 } 4503 }
4506 4504
4507 bool FrameView::canThrottleRendering() const { 4505 bool FrameView::canThrottleRendering() const {
4508 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4506 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4509 return false; 4507 return false;
4510 return m_subtreeThrottled || 4508 return m_subtreeThrottled ||
4511 (m_hiddenForThrottling && m_crossOriginForThrottling); 4509 (m_hiddenForThrottling && m_crossOriginForThrottling);
4512 } 4510 }
4513 4511
4514 } // namespace blink 4512 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698