mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Remove relayout due to scrollbars taking up width
We only have overlay scrollbars, so we never need to relayout due to the lack or presence of scrollbars. Also remove a few stracking has*Scrollbar methods. R=eseidel@chromium.org Review URL: https://codereview.chromium.org/783393006
This commit is contained in:
parent
c6f3d36fe2
commit
3ffd336ad5
@ -70,7 +70,6 @@ RenderLayerScrollableArea::RenderLayerScrollableArea(RenderLayer& layer)
|
||||
: m_layer(layer)
|
||||
, m_scrollsOverflow(false)
|
||||
, m_scrollDimensionsDirty(true)
|
||||
, m_inOverflowRelayout(false)
|
||||
, m_nextTopmostScrollChild(0)
|
||||
, m_topmostScrollChild(0)
|
||||
, m_needsCompositedScrolling(false)
|
||||
@ -408,67 +407,32 @@ void RenderLayerScrollableArea::updateAfterLayout()
|
||||
bool hasHorizontalOverflow = this->hasHorizontalOverflow();
|
||||
bool hasVerticalOverflow = this->hasVerticalOverflow();
|
||||
|
||||
{
|
||||
// Hits in compositing/overflow/automatically-opt-into-composited-scrolling-after-style-change.html.
|
||||
DisableCompositingQueryAsserts disabler;
|
||||
|
||||
// overflow:scroll should just enable/disable.
|
||||
if (box().style()->overflowX() == OSCROLL)
|
||||
horizontalScrollbar()->setEnabled(hasHorizontalOverflow);
|
||||
if (box().style()->overflowY() == OSCROLL)
|
||||
verticalScrollbar()->setEnabled(hasVerticalOverflow);
|
||||
}
|
||||
// overflow:scroll should just enable/disable.
|
||||
if (box().style()->overflowX() == OSCROLL)
|
||||
horizontalScrollbar()->setEnabled(hasHorizontalOverflow);
|
||||
if (box().style()->overflowY() == OSCROLL)
|
||||
verticalScrollbar()->setEnabled(hasVerticalOverflow);
|
||||
|
||||
// overflow:auto may need to lay out again if scrollbars got added/removed.
|
||||
bool autoHorizontalScrollBarChanged = box().hasAutoHorizontalScrollbar() && (hasHorizontalScrollbar() != hasHorizontalOverflow);
|
||||
bool autoVerticalScrollBarChanged = box().hasAutoVerticalScrollbar() && (hasVerticalScrollbar() != hasVerticalOverflow);
|
||||
if (box().hasAutoHorizontalScrollbar())
|
||||
setHasHorizontalScrollbar(hasHorizontalOverflow);
|
||||
if (box().hasAutoVerticalScrollbar())
|
||||
setHasVerticalScrollbar(hasVerticalOverflow);
|
||||
|
||||
if (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged) {
|
||||
if (box().hasAutoHorizontalScrollbar())
|
||||
setHasHorizontalScrollbar(hasHorizontalOverflow);
|
||||
if (box().hasAutoVerticalScrollbar())
|
||||
setHasVerticalScrollbar(hasVerticalOverflow);
|
||||
|
||||
layer()->updateSelfPaintingLayer();
|
||||
|
||||
if (box().style()->overflowX() == OAUTO || box().style()->overflowY() == OAUTO) {
|
||||
if (!m_inOverflowRelayout) {
|
||||
// Our proprietary overflow: overlay value doesn't trigger a layout.
|
||||
m_inOverflowRelayout = true;
|
||||
SubtreeLayoutScope layoutScope(box());
|
||||
layoutScope.setNeedsLayout(&box());
|
||||
if (box().isRenderBlock()) {
|
||||
RenderBlock& block = toRenderBlock(box());
|
||||
block.scrollbarsChanged(autoHorizontalScrollBarChanged, autoVerticalScrollBarChanged);
|
||||
block.layoutBlock(true);
|
||||
} else {
|
||||
box().layout();
|
||||
}
|
||||
m_inOverflowRelayout = false;
|
||||
}
|
||||
}
|
||||
// Set up the range (and page step/line step).
|
||||
if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
|
||||
int clientWidth = box().pixelSnappedClientWidth();
|
||||
horizontalScrollbar->setProportion(clientWidth, overflowRect().width());
|
||||
}
|
||||
|
||||
{
|
||||
// Hits in compositing/overflow/automatically-opt-into-composited-scrolling-after-style-change.html.
|
||||
DisableCompositingQueryAsserts disabler;
|
||||
|
||||
// Set up the range (and page step/line step).
|
||||
if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
|
||||
int clientWidth = box().pixelSnappedClientWidth();
|
||||
horizontalScrollbar->setProportion(clientWidth, overflowRect().width());
|
||||
}
|
||||
if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) {
|
||||
int clientHeight = box().pixelSnappedClientHeight();
|
||||
verticalScrollbar->setProportion(clientHeight, overflowRect().height());
|
||||
}
|
||||
if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) {
|
||||
int clientHeight = box().pixelSnappedClientHeight();
|
||||
verticalScrollbar->setProportion(clientHeight, overflowRect().height());
|
||||
}
|
||||
|
||||
bool hasOverflow = hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow();
|
||||
updateScrollableAreaSet(hasOverflow);
|
||||
|
||||
if (hasOverflow) {
|
||||
DisableCompositingQueryAsserts disabler;
|
||||
positionOverflowControls(IntSize());
|
||||
}
|
||||
}
|
||||
@ -663,9 +627,6 @@ void RenderLayerScrollableArea::setHasHorizontalScrollbar(bool hasScrollbar)
|
||||
return;
|
||||
|
||||
if (hasScrollbar) {
|
||||
// This doesn't hit in any tests, but since the equivalent code in setHasVerticalScrollbar
|
||||
// does, presumably this code does as well.
|
||||
DisableCompositingQueryAsserts disabler;
|
||||
m_hBar = createScrollbar(HorizontalScrollbar);
|
||||
} else {
|
||||
destroyScrollbar(HorizontalScrollbar);
|
||||
@ -678,8 +639,6 @@ void RenderLayerScrollableArea::setHasVerticalScrollbar(bool hasScrollbar)
|
||||
return;
|
||||
|
||||
if (hasScrollbar) {
|
||||
// Hits in compositing/overflow/automatically-opt-into-composited-scrolling-after-style-change.html
|
||||
DisableCompositingQueryAsserts disabler;
|
||||
m_vBar = createScrollbar(VerticalScrollbar);
|
||||
} else {
|
||||
destroyScrollbar(VerticalScrollbar);
|
||||
|
||||
@ -171,7 +171,6 @@ private:
|
||||
unsigned m_scrollsOverflow : 1;
|
||||
|
||||
unsigned m_scrollDimensionsDirty : 1;
|
||||
unsigned m_inOverflowRelayout : 1;
|
||||
|
||||
RenderLayer* m_nextTopmostScrollChild;
|
||||
RenderLayer* m_topmostScrollChild;
|
||||
|
||||
@ -110,9 +110,6 @@ public:
|
||||
// Returns the visible content rect (minus scrollbars, in absolute coordinate)
|
||||
virtual WebRect visibleContentRect() const = 0;
|
||||
|
||||
virtual bool hasHorizontalScrollbar() const = 0;
|
||||
virtual bool hasVerticalScrollbar() const = 0;
|
||||
|
||||
// Hierarchy ----------------------------------------------------------
|
||||
|
||||
// Returns the containing view.
|
||||
|
||||
@ -233,18 +233,6 @@ WebRect WebLocalFrameImpl::visibleContentRect() const
|
||||
return frame()->view()->frameRect();
|
||||
}
|
||||
|
||||
bool WebLocalFrameImpl::hasHorizontalScrollbar() const
|
||||
{
|
||||
// FIXME(sky): Remove
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WebLocalFrameImpl::hasVerticalScrollbar() const
|
||||
{
|
||||
// FIXME(sky): Remove
|
||||
return false;
|
||||
}
|
||||
|
||||
WebView* WebLocalFrameImpl::view() const
|
||||
{
|
||||
return viewImpl();
|
||||
|
||||
@ -65,8 +65,6 @@ public:
|
||||
virtual WebSize contentsSize() const override;
|
||||
virtual bool hasVisibleContent() const override;
|
||||
virtual WebRect visibleContentRect() const override;
|
||||
virtual bool hasHorizontalScrollbar() const override;
|
||||
virtual bool hasVerticalScrollbar() const override;
|
||||
virtual WebView* view() const override;
|
||||
virtual WebDocument document() const override;
|
||||
virtual void executeScript(const WebScriptSource&) override;
|
||||
|
||||
@ -697,18 +697,6 @@ bool WebViewImpl::isTrackingRepaints() const
|
||||
return view->isTrackingPaintInvalidations();
|
||||
}
|
||||
|
||||
bool WebViewImpl::hasHorizontalScrollbar()
|
||||
{
|
||||
// FIXME(sky): Remove
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WebViewImpl::hasVerticalScrollbar()
|
||||
{
|
||||
// FIXME(sky): Remove
|
||||
return false;
|
||||
}
|
||||
|
||||
const WebInputEvent* WebViewImpl::m_currentInputEvent = 0;
|
||||
|
||||
// FIXME: autogenerate this kind of code, and use it throughout Blink rather than
|
||||
|
||||
@ -225,10 +225,6 @@ public:
|
||||
// Exposed for the purpose of overriding device metrics.
|
||||
void sendResizeEventAndRepaint();
|
||||
|
||||
// Exposed for testing purposes.
|
||||
bool hasHorizontalScrollbar();
|
||||
bool hasVerticalScrollbar();
|
||||
|
||||
WebSettingsImpl* settingsImpl();
|
||||
|
||||
IntPoint clampOffsetAtScale(const IntPoint& offset, float scale);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user