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

Unified Diff: Source/core/page/FrameView.cpp

Issue 14874002: Allow frames with overflow:hidden scroll in slow scrolling path when scaled up (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove unnecessary changes Created 7 years, 8 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 | « Source/core/page/FrameView.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/FrameView.cpp
diff --git a/Source/core/page/FrameView.cpp b/Source/core/page/FrameView.cpp
index a369ca46cebbc67fa6798531fedb145f5e0c648e..f7d5d41b8d1afe413268633602238af08f70116d 100644
--- a/Source/core/page/FrameView.cpp
+++ b/Source/core/page/FrameView.cpp
@@ -222,6 +222,9 @@ PassRefPtr<FrameView> FrameView::create(Frame* frame, const IntSize& initialSize
FrameView::~FrameView()
{
+ // Avoid scrollbar updates during destruction.
+ setProhibitsScrolling(true);
+
if (m_postLayoutTasksTimer.isActive()) {
m_postLayoutTasksTimer.stop();
m_actionScheduler->clear();
@@ -502,17 +505,6 @@ void FrameView::setCanHaveScrollbars(bool canHaveScrollbars)
ScrollView::setCanHaveScrollbars(canHaveScrollbars);
}
-void FrameView::updateCanHaveScrollbars()
-{
- ScrollbarMode hMode;
- ScrollbarMode vMode;
- scrollbarModes(hMode, vMode);
- if (hMode == ScrollbarAlwaysOff && vMode == ScrollbarAlwaysOff)
- setCanHaveScrollbars(false);
- else
- setCanHaveScrollbars(true);
-}
-
PassRefPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientation)
{
if (Settings* settings = m_frame->settings()) {
@@ -575,9 +567,20 @@ void FrameView::adjustViewSize()
ASSERT(m_frame->view() == this);
const IntRect rect = renderView->documentRect();
- const IntSize& size = rect.size();
+ IntSize size = rect.size();
+
+ // For originally unscrollable content, may still allow scrolling in case that the page
+ // is scaled up, but only allow scrolling around the layout size, not the whole content size.
+ ScrollbarMode hMode;
+ ScrollbarMode vMode;
+ calculateScrollbarModesForLayout(hMode, vMode, RulesFromWebContent);
+ if (hMode == ScrollbarAlwaysOff)
+ size.setWidth(layoutWidth());
+ if (vMode == ScrollbarAlwaysOff)
+ size.setHeight(layoutHeight());
Xianzhu 2013/05/03 20:52:41 Change 1: let contentsSize() be the layout size if
+
ScrollView::setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !m_frame->document()->printing(), size == contentsSize());
-
+
setContentsSize(size);
}
@@ -673,7 +676,7 @@ void FrameView::calculateScrollbarModesForLayout(ScrollbarMode& hMode, Scrollbar
return;
}
- if (m_canHaveScrollbars || strategy == RulesFromWebContentOnly) {
+ if (m_canHaveScrollbars || !(strategy & RulesFromClient)) {
hMode = ScrollbarAuto;
// Seamless documents begin with heights of 0; we special case that here
// to correctly render documents that don't need scrollbars.
@@ -681,10 +684,11 @@ void FrameView::calculateScrollbarModesForLayout(ScrollbarMode& hMode, Scrollbar
bool isSeamlessDocument = frame() && frame()->document() && frame()->document()->shouldDisplaySeamlesslyWithParent();
vMode = (isSeamlessDocument && !fullVisibleSize.height()) ? ScrollbarAlwaysOff : ScrollbarAuto;
} else {
+ // The client disallows scrolling of this frame.
hMode = ScrollbarAlwaysOff;
vMode = ScrollbarAlwaysOff;
}
-
+
if (!m_layoutRoot) {
Document* document = m_frame->document();
Node* documentElement = document->documentElement();
@@ -702,7 +706,18 @@ void FrameView::calculateScrollbarModesForLayout(ScrollbarMode& hMode, Scrollbar
}
} else if (rootRenderer)
applyOverflowToViewport(rootRenderer, hMode, vMode);
- }
+ }
+
+ if (visibleContentScaleFactor() > 1 && (strategy & RulesFromVisibleContentScaleFactor)) {
+ // When the page is scaled up, for pages originally not allowed to scroll,
+ // the viewport may become smaller than its originally not-scrollable contents.
+ // Should allow scrolling to so that the user can pan around to see all the contents
+ // when the page is not scaled.
+ if (hMode == ScrollbarAlwaysOff)
+ hMode = ScrollbarAuto;
+ if (vMode == ScrollbarAlwaysOff)
+ vMode = ScrollbarAuto;
+ }
Xianzhu 2013/05/03 20:52:41 Change 2: Allow scrolling of originally not-scroll
}
void FrameView::updateCompositingLayersAfterStyleChange()
@@ -2610,6 +2625,7 @@ bool FrameView::isScrollable()
// 2) display:none or visibility:hidden set to self or inherited.
// 3) overflow{-x,-y}: hidden;
// 4) scrolling: no;
+ // 5) visibleContentScaleFactor
// Covers #1
IntSize contentsSize = this->contentsSize();
@@ -2622,10 +2638,11 @@ bool FrameView::isScrollable()
if (owner && (!owner->renderer() || !owner->renderer()->visibleToHitTesting()))
return false;
- // Cover #3 and #4.
+ // Cover #3, #4 and #5.
ScrollbarMode horizontalMode;
ScrollbarMode verticalMode;
- calculateScrollbarModesForLayout(horizontalMode, verticalMode, RulesFromWebContentOnly);
+ calculateScrollbarModesForLayout(horizontalMode, verticalMode,
+ static_cast<ScrollbarModesCalculationStrategy>(RulesFromWebContent | RulesFromVisibleContentScaleFactor));
Xianzhu 2013/05/03 20:52:41 This is not the key change, just to let isScrollab
if (horizontalMode == ScrollbarAlwaysOff && verticalMode == ScrollbarAlwaysOff)
return false;
« no previous file with comments | « Source/core/page/FrameView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698