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

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: fix compile on mac 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView || width () != viewWidth() || height() != viewHeight()); 313 bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView || width () != viewWidth() || height() != viewHeight());
314 if (relayoutChildren) { 314 if (relayoutChildren) {
315 layoutScope.setChildNeedsLayout(this); 315 layoutScope.setChildNeedsLayout(this);
316 for (RenderObject* child = firstChild(); child; child = child->nextSibli ng()) { 316 for (RenderObject* child = firstChild(); child; child = child->nextSibli ng()) {
317 if (child->isSVGRoot()) 317 if (child->isSVGRoot())
318 continue; 318 continue;
319 319
320 if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight( )) 320 if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight( ))
321 || child->style()->logicalHeight().isPercent() 321 || child->style()->logicalHeight().isPercent()
322 || child->style()->logicalMinHeight().isPercent() 322 || child->style()->logicalMinHeight().isPercent()
323 || child->style()->logicalMaxHeight().isPercent() 323 || child->style()->logicalMaxHeight().isPercent())
324 || child->style()->logicalHeight().isViewportPercentage()
325 || child->style()->logicalMinHeight().isViewportPercentage()
326 || child->style()->logicalMaxHeight().isViewportPercentage() )
327 layoutScope.setChildNeedsLayout(child); 324 layoutScope.setChildNeedsLayout(child);
328 } 325 }
329 326
330 if (document().svgExtensions()) 327 if (document().svgExtensions())
331 document().accessSVGExtensions()->invalidateSVGRootsWithRelativeLeng thDescendents(&layoutScope); 328 document().accessSVGExtensions()->invalidateSVGRootsWithRelativeLeng thDescendents(&layoutScope);
332 } 329 }
333 330
334 ASSERT(!m_layoutState); 331 ASSERT(!m_layoutState);
335 if (!needsLayout()) 332 if (!needsLayout())
336 return; 333 return;
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 1203
1207 bool RenderView::backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const 1204 bool RenderView::backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const
1208 { 1205 {
1209 // FIXME: Remove this main frame check. Same concept applies to subframes to o. 1206 // FIXME: Remove this main frame check. Same concept applies to subframes to o.
1210 if (!m_frameView || !m_frameView->isMainFrame()) 1207 if (!m_frameView || !m_frameView->isMainFrame())
1211 return false; 1208 return false;
1212 1209
1213 return m_frameView->hasOpaqueBackground(); 1210 return m_frameView->hasOpaqueBackground();
1214 } 1211 }
1215 1212
1216 LayoutUnit RenderView::viewportPercentageWidth(float percentage) const 1213 double RenderView::viewportWidthPercent() const
johnme 2013/12/18 12:04:15 1. This doesn't seem to return a percentage? 2. I
Timothy Loh 2013/12/23 06:28:16 See comment (message) above.
1217 { 1214 {
1218 return viewLogicalWidth(ScrollableArea::IncludeScrollbars) * percentage / 10 0.f; 1215 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1;
1216 return viewWidth(ScrollableArea::IncludeScrollbars) / scale / 100.f;
johnme 2013/12/18 12:04:15 According to http://www.w3.org/TR/css3-values/#vie
Timothy Loh 2013/12/23 06:28:16 Possibly; but that would have to be a separate pat
1219 } 1217 }
1220 1218
1221 LayoutUnit RenderView::viewportPercentageHeight(float percentage) const 1219 double RenderView::viewportHeightPercent() const
1222 { 1220 {
1223 return viewLogicalHeight(ScrollableArea::IncludeScrollbars) * percentage / 1 00.f; 1221 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1;
1222 return viewHeight(ScrollableArea::IncludeScrollbars) / scale / 100.f;
1224 } 1223 }
1225 1224
1226 LayoutUnit RenderView::viewportPercentageMin(float percentage) const 1225 double RenderView::viewportMinPercent() const
1227 { 1226 {
1228 return std::min(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars)) 1227 return std::min(viewportWidthPercent(), viewportHeightPercent());
1229 * percentage / 100.f;
1230 } 1228 }
1231 1229
1232 LayoutUnit RenderView::viewportPercentageMax(float percentage) const 1230 double RenderView::viewportMaxPercent() const
1233 { 1231 {
1234 return std::max(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars)) 1232 return std::max(viewportWidthPercent(), viewportHeightPercent());
1235 * percentage / 100.f;
1236 } 1233 }
1237 1234
1238 FragmentationDisabler::FragmentationDisabler(RenderObject* root) 1235 FragmentationDisabler::FragmentationDisabler(RenderObject* root)
1239 { 1236 {
1240 RenderView* renderView = root->view(); 1237 RenderView* renderView = root->view();
1241 ASSERT(renderView); 1238 ASSERT(renderView);
1242 1239
1243 LayoutState* layoutState = renderView->layoutState(); 1240 LayoutState* layoutState = renderView->layoutState();
1244 1241
1245 m_root = root; 1242 m_root = root;
(...skipping 21 matching lines...) Expand all
1267 #endif 1264 #endif
1268 1265
1269 if (layoutState) 1266 if (layoutState)
1270 layoutState->m_isPaginated = m_fragmenting; 1267 layoutState->m_isPaginated = m_fragmenting;
1271 1268
1272 if (m_flowThreadState != RenderObject::NotInsideFlowThread) 1269 if (m_flowThreadState != RenderObject::NotInsideFlowThread)
1273 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState); 1270 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState);
1274 } 1271 }
1275 1272
1276 } // namespace WebCore 1273 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698