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

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

Issue 82083002: Move viewport unit resolution to style recalc time (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rebased.. Created 7 years 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
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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView || width () != viewWidth() || height() != viewHeight()); 314 bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView || width () != viewWidth() || height() != viewHeight());
315 if (relayoutChildren) { 315 if (relayoutChildren) {
316 layoutScope.setChildNeedsLayout(this); 316 layoutScope.setChildNeedsLayout(this);
317 for (RenderObject* child = firstChild(); child; child = child->nextSibli ng()) { 317 for (RenderObject* child = firstChild(); child; child = child->nextSibli ng()) {
318 if (child->isSVGRoot()) 318 if (child->isSVGRoot())
319 continue; 319 continue;
320 320
321 if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight( )) 321 if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight( ))
322 || child->style()->logicalHeight().isPercent() 322 || child->style()->logicalHeight().isPercent()
323 || child->style()->logicalMinHeight().isPercent() 323 || child->style()->logicalMinHeight().isPercent()
324 || child->style()->logicalMaxHeight().isPercent() 324 || child->style()->logicalMaxHeight().isPercent())
325 || child->style()->logicalHeight().isViewportPercentage()
326 || child->style()->logicalMinHeight().isViewportPercentage()
327 || child->style()->logicalMaxHeight().isViewportPercentage() )
328 layoutScope.setChildNeedsLayout(child); 325 layoutScope.setChildNeedsLayout(child);
329 } 326 }
330 327
331 if (document().svgExtensions()) 328 if (document().svgExtensions())
332 document().accessSVGExtensions()->invalidateSVGRootsWithRelativeLeng thDescendents(&layoutScope); 329 document().accessSVGExtensions()->invalidateSVGRootsWithRelativeLeng thDescendents(&layoutScope);
333 } 330 }
334 331
335 ASSERT(!m_layoutState); 332 ASSERT(!m_layoutState);
336 if (!needsLayout()) 333 if (!needsLayout())
337 return; 334 return;
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 1204
1208 bool RenderView::backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const 1205 bool RenderView::backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const
1209 { 1206 {
1210 // FIXME: Remove this main frame check. Same concept applies to subframes to o. 1207 // FIXME: Remove this main frame check. Same concept applies to subframes to o.
1211 if (!m_frameView || !m_frameView->isMainFrame()) 1208 if (!m_frameView || !m_frameView->isMainFrame())
1212 return false; 1209 return false;
1213 1210
1214 return m_frameView->hasOpaqueBackground(); 1211 return m_frameView->hasOpaqueBackground();
1215 } 1212 }
1216 1213
1217 LayoutUnit RenderView::viewportPercentageWidth(float percentage) const 1214 double RenderView::viewportWidthPercent() const
1218 { 1215 {
1219 return viewLogicalWidth(ScrollableArea::IncludeScrollbars) * percentage / 10 0.f; 1216 return viewLogicalWidth(ScrollableArea::IncludeScrollbars) / 100.f;
1220 } 1217 }
1221 1218
1222 LayoutUnit RenderView::viewportPercentageHeight(float percentage) const 1219 double RenderView::viewportHeightPercent() const
1223 { 1220 {
1224 return viewLogicalHeight(ScrollableArea::IncludeScrollbars) * percentage / 1 00.f; 1221 return viewLogicalHeight(ScrollableArea::IncludeScrollbars) / 100.f;
1225 } 1222 }
1226 1223
1227 LayoutUnit RenderView::viewportPercentageMin(float percentage) const 1224 double RenderView::viewportMinPercent() const
1228 { 1225 {
1229 return std::min(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars)) 1226 return std::min(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars)) / 100.f;
1230 * percentage / 100.f;
1231 } 1227 }
1232 1228
1233 LayoutUnit RenderView::viewportPercentageMax(float percentage) const 1229 double RenderView::viewportMaxPercent() const
1234 { 1230 {
1235 return std::max(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars)) 1231 return std::max(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars)) / 100.f;
1236 * percentage / 100.f;
1237 } 1232 }
1238 1233
1239 FragmentationDisabler::FragmentationDisabler(RenderObject* root) 1234 FragmentationDisabler::FragmentationDisabler(RenderObject* root)
1240 { 1235 {
1241 RenderView* renderView = root->view(); 1236 RenderView* renderView = root->view();
1242 ASSERT(renderView); 1237 ASSERT(renderView);
1243 1238
1244 LayoutState* layoutState = renderView->layoutState(); 1239 LayoutState* layoutState = renderView->layoutState();
1245 1240
1246 m_root = root; 1241 m_root = root;
(...skipping 21 matching lines...) Expand all
1268 #endif 1263 #endif
1269 1264
1270 if (layoutState) 1265 if (layoutState)
1271 layoutState->m_isPaginated = m_fragmenting; 1266 layoutState->m_isPaginated = m_fragmenting;
1272 1267
1273 if (m_flowThreadState != RenderObject::NotInsideFlowThread) 1268 if (m_flowThreadState != RenderObject::NotInsideFlowThread)
1274 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState); 1269 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState);
1275 } 1270 }
1276 1271
1277 } // namespace WebCore 1272 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698