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 (!RuntimeEnabledFeatures::optimizedLayoutOnViewHeightChangeEnabled() || w idth() != 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
| |
1241 setNeedsLayout(); | |
1242 } else { | |
1243 setHeight(viewHeight()); | |
1244 if (m_overflow) | |
1245 m_overflow->setVisualOverflow(borderBoxRect()); | |
1246 layer()->updateLayerPositionsAfterLayout(layer(), RenderLayer::defaultFl ags); | |
1247 } | |
1248 } | |
1249 | |
1250 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.
| |
1251 { | |
1252 if (!style()->isHorizontalWritingMode() || hasPercentHeightDescendants() || document().paginated()) | |
1253 return true; | |
1254 | |
1255 if (!document().styleResolver() || document().styleResolver()->affectedByVie wportChange()) | |
ojan
2013/12/18 00:48:20
It's not uncommon that we destroy the styleResolve
| |
1256 return true; | |
1257 | |
1258 // Needs layout if there is no body element (e.g. there is frameset). | |
1259 Element* body = document().body(); | |
1260 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
| |
1261 return true; | |
1262 | |
1263 Element* documentElement = document().documentElement(); | |
1264 if (RenderObject* rootRenderer = documentElement ? documentElement->renderer () : 0) { | |
1265 // Background image may be stretched related to the viewport size. | |
1266 if (rootRenderer->rendererForRootBackground()->style()->hasBackgroundIma ge()) | |
1267 return true; | |
1268 } else { | |
1269 return true; | |
1270 } | |
1271 | |
1272 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); | |
1273 if (positionedDescendants) { | |
1274 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); | |
1275 for (TrackedRendererListHashSet::iterator it = positionedDescendants->be gin(); it != end; ++it) { | |
1276 RenderStyle* style = (*it)->style(); | |
1277 // Fixed position element may change compositing state when viewport height changes. | |
1278 if (style->position() == FixedPosition) | |
1279 return true; | |
1280 if (style->top().isPercent() || style->height().isPercent() || style ->maxHeight().isPercent() || !style->bottom().isAuto()) | |
1281 return true; | |
1282 } | |
1283 } | |
1284 | |
1285 return false; | |
1286 } | |
1287 | |
1238 FragmentationDisabler::FragmentationDisabler(RenderObject* root) | 1288 FragmentationDisabler::FragmentationDisabler(RenderObject* root) |
1239 { | 1289 { |
1240 RenderView* renderView = root->view(); | 1290 RenderView* renderView = root->view(); |
1241 ASSERT(renderView); | 1291 ASSERT(renderView); |
1242 | 1292 |
1243 LayoutState* layoutState = renderView->layoutState(); | 1293 LayoutState* layoutState = renderView->layoutState(); |
1244 | 1294 |
1245 m_root = root; | 1295 m_root = root; |
1246 m_fragmenting = layoutState && layoutState->isPaginated(); | 1296 m_fragmenting = layoutState && layoutState->isPaginated(); |
1247 m_flowThreadState = m_root->flowThreadState(); | 1297 m_flowThreadState = m_root->flowThreadState(); |
(...skipping 19 matching lines...) Expand all Loading... | |
1267 #endif | 1317 #endif |
1268 | 1318 |
1269 if (layoutState) | 1319 if (layoutState) |
1270 layoutState->m_isPaginated = m_fragmenting; | 1320 layoutState->m_isPaginated = m_fragmenting; |
1271 | 1321 |
1272 if (m_flowThreadState != RenderObject::NotInsideFlowThread) | 1322 if (m_flowThreadState != RenderObject::NotInsideFlowThread) |
1273 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState); | 1323 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState); |
1274 } | 1324 } |
1275 | 1325 |
1276 } // namespace WebCore | 1326 } // namespace WebCore |
OLD | NEW |