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

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

Issue 2657743004: Handle stale m_owner in FrameView::needsScrollbarReconstruction. (Closed)
Patch Set: rebase Created 3 years, 10 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 | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 632
633 bool FrameView::shouldUseCustomScrollbars( 633 bool FrameView::shouldUseCustomScrollbars(
634 Element*& customScrollbarElement) const { 634 Element*& customScrollbarElement) const {
635 customScrollbarElement = nullptr; 635 customScrollbarElement = nullptr;
636 636
637 if (Settings* settings = m_frame->settings()) { 637 if (Settings* settings = m_frame->settings()) {
638 if (!settings->getAllowCustomScrollbarInMainFrame() && 638 if (!settings->getAllowCustomScrollbarInMainFrame() &&
639 m_frame->isMainFrame()) 639 m_frame->isMainFrame())
640 return false; 640 return false;
641 } 641 }
642
643 // FIXME: We need to update the scrollbar dynamically as documents change (or
644 // as doc elements and bodies get discovered that have custom styles).
645 Document* doc = m_frame->document(); 642 Document* doc = m_frame->document();
646 643
647 // Try the <body> element first as a scrollbar source. 644 // Try the <body> element first as a scrollbar source.
648 Element* body = doc ? doc->body() : 0; 645 Element* body = doc ? doc->body() : 0;
649 if (body && body->layoutObject() && 646 if (body && body->layoutObject() &&
650 body->layoutObject()->style()->hasPseudoStyle(PseudoIdScrollbar)) { 647 body->layoutObject()->style()->hasPseudoStyle(PseudoIdScrollbar)) {
651 customScrollbarElement = body; 648 customScrollbarElement = body;
652 return true; 649 return true;
653 } 650 }
654 651
(...skipping 3427 matching lines...) Expand 10 before | Expand all | Expand 10 after
4082 if (m_scrollbarsSuppressed) 4079 if (m_scrollbarsSuppressed)
4083 return true; 4080 return true;
4084 4081
4085 if (!hasOverlayScrollbars()) 4082 if (!hasOverlayScrollbars())
4086 contentsResized(); 4083 contentsResized();
4087 scrollbarExistenceDidChange(); 4084 scrollbarExistenceDidChange();
4088 return true; 4085 return true;
4089 } 4086 }
4090 4087
4091 bool FrameView::needsScrollbarReconstruction() const { 4088 bool FrameView::needsScrollbarReconstruction() const {
4092 Element* customScrollbarElement = nullptr; 4089 Scrollbar* scrollbar = horizontalScrollbar();
4093 bool shouldUseCustom = shouldUseCustomScrollbars(customScrollbarElement); 4090 if (!scrollbar)
4094 4091 scrollbar = verticalScrollbar();
4095 bool hasAnyScrollbar = horizontalScrollbar() || verticalScrollbar(); 4092 if (!scrollbar) {
4096 bool hasCustom = 4093 // We have no scrollbar to reconstruct.
4097 (horizontalScrollbar() && horizontalScrollbar()->isCustomScrollbar()) || 4094 return false;
4098 (verticalScrollbar() && verticalScrollbar()->isCustomScrollbar()); 4095 }
4099 4096 Element* styleSource = nullptr;
4100 return hasAnyScrollbar && (shouldUseCustom != hasCustom); 4097 bool needsCustom = shouldUseCustomScrollbars(styleSource);
4098 bool isCustom = scrollbar->isCustomScrollbar();
4099 if (needsCustom != isCustom) {
4100 // We have a native scrollbar that should be custom, or vice versa.
4101 return true;
4102 }
4103 if (!needsCustom) {
4104 // We have a native scrollbar that should remain native.
4105 return false;
4106 }
4107 DCHECK(needsCustom && isCustom);
4108 DCHECK(styleSource);
4109 if (toLayoutScrollbar(scrollbar)->owningLayoutObject() !=
4110 styleSource->layoutObject()) {
4111 // We have a custom scrollbar with a stale m_owner.
4112 return true;
4113 }
4114 return false;
4101 } 4115 }
4102 4116
4103 bool FrameView::shouldIgnoreOverflowHidden() const { 4117 bool FrameView::shouldIgnoreOverflowHidden() const {
4104 return m_frame->settings()->getIgnoreMainFrameOverflowHiddenQuirk() && 4118 return m_frame->settings()->getIgnoreMainFrameOverflowHiddenQuirk() &&
4105 m_frame->isMainFrame(); 4119 m_frame->isMainFrame();
4106 } 4120 }
4107 4121
4108 void FrameView::updateScrollbarsIfNeeded() { 4122 void FrameView::updateScrollbarsIfNeeded() {
4109 if (m_needsScrollbarsUpdate || needsScrollbarReconstruction() || 4123 if (m_needsScrollbarsUpdate || needsScrollbarReconstruction() ||
4110 scrollOriginChanged()) 4124 scrollOriginChanged())
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
5061 std::unique_ptr<CompositorAnimationTimeline> timeline) { 5075 std::unique_ptr<CompositorAnimationTimeline> timeline) {
5062 m_animationTimeline = std::move(timeline); 5076 m_animationTimeline = std::move(timeline);
5063 } 5077 }
5064 5078
5065 void FrameView::setAnimationHost( 5079 void FrameView::setAnimationHost(
5066 std::unique_ptr<CompositorAnimationHost> host) { 5080 std::unique_ptr<CompositorAnimationHost> host) {
5067 m_animationHost = std::move(host); 5081 m_animationHost = std::move(host);
5068 } 5082 }
5069 5083
5070 } // namespace blink 5084 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698