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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 530e1224f1a96424eb13c66f5798ccacf1afc45d..fed6ff08048b1a3f237d8d0ebe3c76239672192d 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -639,9 +639,6 @@ bool FrameView::shouldUseCustomScrollbars(
m_frame->isMainFrame())
return false;
}
-
- // FIXME: We need to update the scrollbar dynamically as documents change (or
- // as doc elements and bodies get discovered that have custom styles).
Document* doc = m_frame->document();
// Try the <body> element first as a scrollbar source.
@@ -4089,15 +4086,32 @@ bool FrameView::adjustScrollbarExistence(
}
bool FrameView::needsScrollbarReconstruction() const {
- Element* customScrollbarElement = nullptr;
- bool shouldUseCustom = shouldUseCustomScrollbars(customScrollbarElement);
-
- bool hasAnyScrollbar = horizontalScrollbar() || verticalScrollbar();
- bool hasCustom =
- (horizontalScrollbar() && horizontalScrollbar()->isCustomScrollbar()) ||
- (verticalScrollbar() && verticalScrollbar()->isCustomScrollbar());
-
- return hasAnyScrollbar && (shouldUseCustom != hasCustom);
+ Scrollbar* scrollbar = horizontalScrollbar();
+ if (!scrollbar)
+ scrollbar = verticalScrollbar();
+ if (!scrollbar) {
+ // We have no scrollbar to reconstruct.
+ return false;
+ }
+ Element* styleSource = nullptr;
+ bool needsCustom = shouldUseCustomScrollbars(styleSource);
+ bool isCustom = scrollbar->isCustomScrollbar();
+ if (needsCustom != isCustom) {
+ // We have a native scrollbar that should be custom, or vice versa.
+ return true;
+ }
+ if (!needsCustom) {
+ // We have a native scrollbar that should remain native.
+ return false;
+ }
+ DCHECK(needsCustom && isCustom);
+ DCHECK(styleSource);
+ if (toLayoutScrollbar(scrollbar)->owningLayoutObject() !=
+ styleSource->layoutObject()) {
+ // We have a custom scrollbar with a stale m_owner.
+ return true;
+ }
+ return false;
}
bool FrameView::shouldIgnoreOverflowHidden() const {
« 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