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..4064135dcbfcb9846039c506bbd8dbe70ac366a4 100644 |
| --- a/Source/core/rendering/RenderView.cpp |
| +++ b/Source/core/rendering/RenderView.cpp |
| @@ -1235,6 +1235,69 @@ LayoutUnit RenderView::viewportPercentageMax(float percentage) const |
| * percentage / 100.f; |
| } |
| +void RenderView::viewResized() |
| +{ |
| + if (logicalWidth() != viewLogicalWidth() || needsLayoutOnLogicalHeightChange()) { |
| + setNeedsLayout(); |
| + } else if (!needsLayout()) { |
| + setLogicalHeight(viewLogicalHeight()); |
| + if (m_overflow) |
| + m_overflow->setVisualOverflow(borderBoxRect()); |
| + layer()->updateLayerPositionsAfterLayout(layer(), RenderLayer::defaultFlags); |
| + } |
| +} |
| + |
| +bool RenderView::needsLayoutOnLogicalHeightChange() const |
| +{ |
| + // FIXME: Move logics that are generic to RenderBox or RenderBlock into these classes |
| + // so that this function can be also used to optimize layout of them. |
| + |
| + if (document().inQuirksMode() || document().paginated() || shouldUsePrintingLayout()) |
| + return true; |
| + |
| + // Optimize layout in horizontal writing mode only to simplify the logic. |
| + if (!style()->isHorizontalWritingMode()) |
| + return true; |
| + |
| + if (hasPercentHeightDescendants()) |
| + return true; |
| + |
| + if (document().ensureStyleResolver().affectedByViewportChange()) |
| + return true; |
| + |
| + // FIXME: Waiting for document().hasViewportUnits(). |
| + // if (document().hasViewportUnits()) |
|
ojan
2014/01/03 02:04:26
We generally don't commit commented out code. In t
Xianzhu
2014/01/03 20:46:24
I meant this patch depends on https://codereview.c
|
| + // return true; |
| + |
| + // Needs layout if there is no body element (e.g. there is frameset). |
| + Element* body = document().body(); |
| + if (!body || !body->hasTagName(HTMLNames::bodyTag)) |
| + return true; |
| + |
| + // Root background image may be stretched related to the viewport size. |
| + Element* documentElement = document().documentElement(); |
| + if (!documentElement || !documentElement->renderer() |
| + || documentElement->renderer()->rendererForRootBackground()->style()->hasBackgroundImage()) |
| + return true; |
| + |
| + if (TrackedRendererListHashSet* positionedObjects = this->positionedObjects()) { |
| + TrackedRendererListHashSet::iterator end = positionedObjects->end(); |
| + for (TrackedRendererListHashSet::iterator it = positionedObjects->begin(); it != end; ++it) { |
| + if ((*it)->node() && (*it)->node()->hasTagName(HTMLNames::dialogTag)) |
| + return true; |
| + |
| + RenderStyle* childStyle = (*it)->style(); |
| + // Fixed position element may change compositing state when viewport height changes. |
| + if (childStyle->position() == FixedPosition) |
| + return true; |
| + if (childStyle->top().isPercent() || childStyle->height().isPercent() || childStyle->minHeight().isPercent() || childStyle->maxHeight().isPercent() || !childStyle->bottom().isAuto()) |
| + return true; |
| + } |
| + } |
| + |
| + return false; |
| +} |
| + |
| FragmentationDisabler::FragmentationDisabler(RenderObject* root) |
| { |
| RenderView* renderView = root->view(); |