OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1228 return std::min(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars)) | 1228 return std::min(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars)) |
1229 * percentage / 100.f; | 1229 * percentage / 100.f; |
1230 } | 1230 } |
1231 | 1231 |
1232 LayoutUnit RenderView::viewportPercentageMax(float percentage) const | 1232 LayoutUnit RenderView::viewportPercentageMax(float percentage) const |
1233 { | 1233 { |
1234 return std::max(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars)) | 1234 return std::max(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars)) |
1235 * percentage / 100.f; | 1235 * percentage / 100.f; |
1236 } | 1236 } |
1237 | 1237 |
1238 void RenderView::viewResized() | |
1239 { | |
1240 if (logicalWidth() != viewLogicalWidth() || needsLayoutOnLogicalHeightChange ()) { | |
1241 setNeedsLayout(); | |
1242 } else if (!needsLayout()) { | |
1243 setLogicalHeight(viewLogicalHeight()); | |
1244 if (m_overflow) | |
1245 m_overflow->setVisualOverflow(borderBoxRect()); | |
1246 layer()->updateLayerPositionsAfterLayout(layer(), RenderLayer::defaultFl ags); | |
1247 } | |
1248 } | |
1249 | |
1250 bool RenderView::needsLayoutOnLogicalHeightChange() const | |
1251 { | |
1252 // FIXME: Move logics that are generic to RenderBox or RenderBlock into thes e classes | |
1253 // so that this function can be also used to optimize layout of them. | |
1254 | |
1255 if (document().inQuirksMode() || document().paginated() || shouldUsePrinting Layout()) | |
1256 return true; | |
1257 | |
1258 // Optimize layout in horizontal writing mode only to simplify the logic. | |
1259 if (!style()->isHorizontalWritingMode()) | |
1260 return true; | |
1261 | |
1262 if (hasPercentHeightDescendants()) | |
1263 return true; | |
1264 | |
1265 if (document().ensureStyleResolver().affectedByViewportChange()) | |
1266 return true; | |
1267 | |
1268 // FIXME: Waiting for document().hasViewportUnits(). | |
1269 // 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
| |
1270 // return true; | |
1271 | |
1272 // Needs layout if there is no body element (e.g. there is frameset). | |
1273 Element* body = document().body(); | |
1274 if (!body || !body->hasTagName(HTMLNames::bodyTag)) | |
1275 return true; | |
1276 | |
1277 // Root background image may be stretched related to the viewport size. | |
1278 Element* documentElement = document().documentElement(); | |
1279 if (!documentElement || !documentElement->renderer() | |
1280 || documentElement->renderer()->rendererForRootBackground()->style()->ha sBackgroundImage()) | |
1281 return true; | |
1282 | |
1283 if (TrackedRendererListHashSet* positionedObjects = this->positionedObjects( )) { | |
1284 TrackedRendererListHashSet::iterator end = positionedObjects->end(); | |
1285 for (TrackedRendererListHashSet::iterator it = positionedObjects->begin( ); it != end; ++it) { | |
1286 if ((*it)->node() && (*it)->node()->hasTagName(HTMLNames::dialogTag) ) | |
1287 return true; | |
1288 | |
1289 RenderStyle* childStyle = (*it)->style(); | |
1290 // Fixed position element may change compositing state when viewport height changes. | |
1291 if (childStyle->position() == FixedPosition) | |
1292 return true; | |
1293 if (childStyle->top().isPercent() || childStyle->height().isPercent( ) || childStyle->minHeight().isPercent() || childStyle->maxHeight().isPercent() || !childStyle->bottom().isAuto()) | |
1294 return true; | |
1295 } | |
1296 } | |
1297 | |
1298 return false; | |
1299 } | |
1300 | |
1238 FragmentationDisabler::FragmentationDisabler(RenderObject* root) | 1301 FragmentationDisabler::FragmentationDisabler(RenderObject* root) |
1239 { | 1302 { |
1240 RenderView* renderView = root->view(); | 1303 RenderView* renderView = root->view(); |
1241 ASSERT(renderView); | 1304 ASSERT(renderView); |
1242 | 1305 |
1243 LayoutState* layoutState = renderView->layoutState(); | 1306 LayoutState* layoutState = renderView->layoutState(); |
1244 | 1307 |
1245 m_root = root; | 1308 m_root = root; |
1246 m_fragmenting = layoutState && layoutState->isPaginated(); | 1309 m_fragmenting = layoutState && layoutState->isPaginated(); |
1247 m_flowThreadState = m_root->flowThreadState(); | 1310 m_flowThreadState = m_root->flowThreadState(); |
(...skipping 19 matching lines...) Expand all Loading... | |
1267 #endif | 1330 #endif |
1268 | 1331 |
1269 if (layoutState) | 1332 if (layoutState) |
1270 layoutState->m_isPaginated = m_fragmenting; | 1333 layoutState->m_isPaginated = m_fragmenting; |
1271 | 1334 |
1272 if (m_flowThreadState != RenderObject::NotInsideFlowThread) | 1335 if (m_flowThreadState != RenderObject::NotInsideFlowThread) |
1273 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState); | 1336 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState); |
1274 } | 1337 } |
1275 | 1338 |
1276 } // namespace WebCore | 1339 } // namespace WebCore |
OLD | NEW |