Chromium Code Reviews| Index: Source/core/rendering/RenderView.cpp |
| diff --git a/Source/core/rendering/RenderView.cpp b/Source/core/rendering/RenderView.cpp |
| index 05955691af573fc99f2d0102d0b46c6a62b72e2f..8ffd652405448c4ee3b09a4286fdd5016152e979 100644 |
| --- a/Source/core/rendering/RenderView.cpp |
| +++ b/Source/core/rendering/RenderView.cpp |
| @@ -1235,6 +1235,56 @@ LayoutUnit RenderView::viewportPercentageMax(float percentage) const |
| * percentage / 100.f; |
| } |
| +void RenderView::viewResized() |
| +{ |
| + if (!RuntimeEnabledFeatures::optimizedLayoutOnViewHeightChangeEnabled() || width() != viewWidth() || needsLayoutOnHeightChange()) { |
|
ojan
2013/12/18 00:48:20
I don't think we need to add a RuntimeEnabledFeatu
Xianzhu
2013/12/18 20:22:45
Yes. I added the flag because I was afraid of the
|
| + setNeedsLayout(); |
| + } else { |
| + setHeight(viewHeight()); |
| + if (m_overflow) |
| + m_overflow->setVisualOverflow(borderBoxRect()); |
| + layer()->updateLayerPositionsAfterLayout(layer(), RenderLayer::defaultFlags); |
| + } |
| +} |
| + |
| +bool RenderView::needsLayoutOnHeightChange() const |
|
ojan
2013/12/18 00:48:20
This misses a number of cases. For example, if the
Xianzhu
2013/12/18 20:22:45
Thanks for the case. Will add them.
|
| +{ |
| + if (!style()->isHorizontalWritingMode() || hasPercentHeightDescendants() || document().paginated()) |
| + return true; |
| + |
| + if (!document().styleResolver() || document().styleResolver()->affectedByViewportChange()) |
|
ojan
2013/12/18 00:48:20
It's not uncommon that we destroy the styleResolve
|
| + return true; |
| + |
| + // Needs layout if there is no body element (e.g. there is frameset). |
| + Element* body = document().body(); |
| + if (!body || !body->renderer() || !body->renderer()->isBody()) |
|
ojan
2013/12/18 00:48:20
I don't think you need this case. We'll do a layou
Xianzhu
2013/12/18 20:22:45
My intention was to exclude the frameset case whic
|
| + return true; |
| + |
| + Element* documentElement = document().documentElement(); |
| + if (RenderObject* rootRenderer = documentElement ? documentElement->renderer() : 0) { |
| + // Background image may be stretched related to the viewport size. |
| + if (rootRenderer->rendererForRootBackground()->style()->hasBackgroundImage()) |
| + return true; |
| + } else { |
| + return true; |
| + } |
| + |
| + TrackedRendererListHashSet* positionedDescendants = positionedObjects(); |
| + if (positionedDescendants) { |
| + TrackedRendererListHashSet::iterator end = positionedDescendants->end(); |
| + for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(); it != end; ++it) { |
| + RenderStyle* style = (*it)->style(); |
| + // Fixed position element may change compositing state when viewport height changes. |
| + if (style->position() == FixedPosition) |
| + return true; |
| + if (style->top().isPercent() || style->height().isPercent() || style->maxHeight().isPercent() || !style->bottom().isAuto()) |
| + return true; |
| + } |
| + } |
| + |
| + return false; |
| +} |
| + |
| FragmentationDisabler::FragmentationDisabler(RenderObject* root) |
| { |
| RenderView* renderView = root->view(); |