Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: Source/core/rendering/RenderView.cpp

Issue 43873004: Relayout RenderObjects with viewport-percentage CSS properties when viewport size changes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView || width () != viewWidth() || height() != viewHeight()); 312 bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView || width () != viewWidth() || height() != viewHeight());
313 if (relayoutChildren) { 313 if (relayoutChildren) {
314 layoutScope.setChildNeedsLayout(this); 314 layoutScope.setChildNeedsLayout(this);
315 for (RenderObject* child = firstChild(); child; child = child->nextSibli ng()) { 315 for (RenderObject* child = firstChild(); child; child = child->nextSibli ng()) {
316 if (child->isSVGRoot()) 316 if (child->isSVGRoot())
317 continue; 317 continue;
318 318
319 if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight( )) 319 if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight( ))
320 || child->style()->logicalHeight().isPercent() 320 || child->style()->logicalHeight().isPercent()
321 || child->style()->logicalMinHeight().isPercent() 321 || child->style()->logicalMinHeight().isPercent()
322 || child->style()->logicalMaxHeight().isPercent() 322 || child->style()->logicalMaxHeight().isPercent())
323 || child->style()->logicalHeight().isViewportPercentage()
324 || child->style()->logicalMinHeight().isViewportPercentage()
325 || child->style()->logicalMaxHeight().isViewportPercentage() )
326 layoutScope.setChildNeedsLayout(child); 323 layoutScope.setChildNeedsLayout(child);
327 } 324 }
328 325
326 if (m_viewportPercentageStyleObjects) {
327 ViewportPercentageStyleObjectSet::const_iterator end = m_viewportPer centageStyleObjects->end();
328 for (ViewportPercentageStyleObjectSet::const_iterator it = m_viewpor tPercentageStyleObjects->begin(); it != end; ++it)
329 layoutScope.setChildNeedsLayout(*it);
330 }
331
329 if (document().svgExtensions()) 332 if (document().svgExtensions())
330 document().accessSVGExtensions()->invalidateSVGRootsWithRelativeLeng thDescendents(&layoutScope); 333 document().accessSVGExtensions()->invalidateSVGRootsWithRelativeLeng thDescendents(&layoutScope);
331 } 334 }
332 335
333 ASSERT(!m_layoutState); 336 ASSERT(!m_layoutState);
334 if (!needsLayout()) 337 if (!needsLayout())
335 return; 338 return;
336 339
337 LayoutState state; 340 LayoutState state;
338 bool isSeamlessAncestorInFlowThread = initializeLayoutState(state); 341 bool isSeamlessAncestorInFlowThread = initializeLayoutState(state);
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 return std::min(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars)) 1232 return std::min(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars))
1230 * percentage / 100.f; 1233 * percentage / 100.f;
1231 } 1234 }
1232 1235
1233 LayoutUnit RenderView::viewportPercentageMax(float percentage) const 1236 LayoutUnit RenderView::viewportPercentageMax(float percentage) const
1234 { 1237 {
1235 return std::max(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars)) 1238 return std::max(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars))
1236 * percentage / 100.f; 1239 * percentage / 100.f;
1237 } 1240 }
1238 1241
1242 void RenderView::addViewportPercentageStyleObject(RenderObject* object)
1243 {
1244 if (!m_viewportPercentageStyleObjects)
1245 m_viewportPercentageStyleObjects = adoptPtr(new ViewportPercentageStyleO bjectSet);
1246
1247 m_viewportPercentageStyleObjects->add(object);
leviw_travelin_and_unemployed 2013/10/25 20:30:35 Can you add asserts that we aren't double-adding o
1248 }
1249
1250 void RenderView::removeViewportPercentageStyleObject(RenderObject* object)
1251 {
1252 if (m_viewportPercentageStyleObjects)
1253 m_viewportPercentageStyleObjects->remove(object);
1254 }
1255
1239 FragmentationDisabler::FragmentationDisabler(RenderObject* root) 1256 FragmentationDisabler::FragmentationDisabler(RenderObject* root)
1240 { 1257 {
1241 RenderView* renderView = root->view(); 1258 RenderView* renderView = root->view();
1242 ASSERT(renderView); 1259 ASSERT(renderView);
1243 1260
1244 LayoutState* layoutState = renderView->layoutState(); 1261 LayoutState* layoutState = renderView->layoutState();
1245 1262
1246 m_root = root; 1263 m_root = root;
1247 m_fragmenting = layoutState && layoutState->isPaginated(); 1264 m_fragmenting = layoutState && layoutState->isPaginated();
1248 m_flowThreadState = m_root->flowThreadState(); 1265 m_flowThreadState = m_root->flowThreadState();
(...skipping 19 matching lines...) Expand all
1268 #endif 1285 #endif
1269 1286
1270 if (layoutState) 1287 if (layoutState)
1271 layoutState->m_isPaginated = m_fragmenting; 1288 layoutState->m_isPaginated = m_fragmenting;
1272 1289
1273 if (m_flowThreadState != RenderObject::NotInsideFlowThread) 1290 if (m_flowThreadState != RenderObject::NotInsideFlowThread)
1274 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState); 1291 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState);
1275 } 1292 }
1276 1293
1277 } // namespace WebCore 1294 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698