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 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; | 1215 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; |
1216 return viewWidth(ScrollableArea::IncludeScrollbars) / scale; | 1216 return viewWidth(ScrollableArea::IncludeScrollbars) / scale; |
1217 } | 1217 } |
1218 | 1218 |
1219 double RenderView::layoutViewportHeight() const | 1219 double RenderView::layoutViewportHeight() const |
1220 { | 1220 { |
1221 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; | 1221 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; |
1222 return viewHeight(ScrollableArea::IncludeScrollbars) / scale; | 1222 return viewHeight(ScrollableArea::IncludeScrollbars) / scale; |
1223 } | 1223 } |
1224 | 1224 |
| 1225 void RenderView::viewResized() |
| 1226 { |
| 1227 if (logicalWidth() != viewLogicalWidth() || needsLayoutOnLogicalHeightChange
()) { |
| 1228 setNeedsLayout(); |
| 1229 } else if (!needsLayout()) { |
| 1230 setLogicalHeight(viewLogicalHeight()); |
| 1231 if (m_overflow) |
| 1232 m_overflow->setVisualOverflow(borderBoxRect()); |
| 1233 layer()->updateLayerPositionsAfterLayout(layer(), RenderLayer::defaultFl
ags); |
| 1234 } |
| 1235 } |
| 1236 |
| 1237 bool RenderView::needsLayoutOnLogicalHeightChange() const |
| 1238 { |
| 1239 // FIXME: Move logics that are generic to RenderBox or RenderBlock into thes
e classes |
| 1240 // so that this function can be also used to optimize layout of them. |
| 1241 |
| 1242 if (document().inQuirksMode() || document().paginated() || shouldUsePrinting
Layout()) |
| 1243 return true; |
| 1244 |
| 1245 // Optimize layout in horizontal writing mode only to simplify the logic. |
| 1246 if (!style()->isHorizontalWritingMode()) |
| 1247 return true; |
| 1248 |
| 1249 if (hasPercentHeightDescendants()) |
| 1250 return true; |
| 1251 |
| 1252 if (document().ensureStyleResolver().mediaQueryAffectedByViewportChange() ||
document().hasViewportUnits()) |
| 1253 return true; |
| 1254 |
| 1255 // Needs layout if there is no body element (e.g. there is frameset). |
| 1256 Element* body = document().body(); |
| 1257 if (!body || !body->hasTagName(HTMLNames::bodyTag)) |
| 1258 return true; |
| 1259 |
| 1260 // Root background image may be stretched related to the viewport size. |
| 1261 Element* documentElement = document().documentElement(); |
| 1262 if (!documentElement || !documentElement->renderer() |
| 1263 || documentElement->renderer()->rendererForRootBackground()->style()->ha
sBackgroundImage()) |
| 1264 return true; |
| 1265 |
| 1266 if (TrackedRendererListHashSet* positionedObjects = this->positionedObjects(
)) { |
| 1267 TrackedRendererListHashSet::iterator end = positionedObjects->end(); |
| 1268 for (TrackedRendererListHashSet::iterator it = positionedObjects->begin(
); it != end; ++it) { |
| 1269 if ((*it)->node() && (*it)->node()->hasTagName(HTMLNames::dialogTag)
) |
| 1270 return true; |
| 1271 |
| 1272 RenderStyle* childStyle = (*it)->style(); |
| 1273 // Fixed position element may change compositing state when viewport
height changes. |
| 1274 if (childStyle->position() == FixedPosition) |
| 1275 return true; |
| 1276 if (childStyle->top().isPercent() || childStyle->height().isPercent(
) || childStyle->minHeight().isPercent() || childStyle->maxHeight().isPercent()
|| !childStyle->bottom().isAuto()) |
| 1277 return true; |
| 1278 } |
| 1279 } |
| 1280 |
| 1281 return false; |
| 1282 } |
| 1283 |
1225 FragmentationDisabler::FragmentationDisabler(RenderObject* root) | 1284 FragmentationDisabler::FragmentationDisabler(RenderObject* root) |
1226 { | 1285 { |
1227 RenderView* renderView = root->view(); | 1286 RenderView* renderView = root->view(); |
1228 ASSERT(renderView); | 1287 ASSERT(renderView); |
1229 | 1288 |
1230 LayoutState* layoutState = renderView->layoutState(); | 1289 LayoutState* layoutState = renderView->layoutState(); |
1231 | 1290 |
1232 m_root = root; | 1291 m_root = root; |
1233 m_fragmenting = layoutState && layoutState->isPaginated(); | 1292 m_fragmenting = layoutState && layoutState->isPaginated(); |
1234 m_flowThreadState = m_root->flowThreadState(); | 1293 m_flowThreadState = m_root->flowThreadState(); |
(...skipping 19 matching lines...) Expand all Loading... |
1254 #endif | 1313 #endif |
1255 | 1314 |
1256 if (layoutState) | 1315 if (layoutState) |
1257 layoutState->m_isPaginated = m_fragmenting; | 1316 layoutState->m_isPaginated = m_fragmenting; |
1258 | 1317 |
1259 if (m_flowThreadState != RenderObject::NotInsideFlowThread) | 1318 if (m_flowThreadState != RenderObject::NotInsideFlowThread) |
1260 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState); | 1319 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState); |
1261 } | 1320 } |
1262 | 1321 |
1263 } // namespace WebCore | 1322 } // namespace WebCore |
OLD | NEW |