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

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: rename browser zoom to page zoom Created 6 years, 11 months 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
« no previous file with comments | « Source/core/rendering/RenderView.h ('k') | Source/core/rendering/RootInlineBox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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::layoutViewportWidth() const
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;
1219 } 1217 }
1220 1218
1221 LayoutUnit RenderView::viewportPercentageHeight(float percentage) const 1219 double RenderView::layoutViewportHeight() const
1222 { 1220 {
1223 return viewLogicalHeight(ScrollableArea::IncludeScrollbars) * percentage / 1 00.f; 1221 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1;
1224 } 1222 return viewHeight(ScrollableArea::IncludeScrollbars) / scale;
1225
1226 LayoutUnit RenderView::viewportPercentageMin(float percentage) const
1227 {
1228 return std::min(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars))
1229 * percentage / 100.f;
1230 }
1231
1232 LayoutUnit RenderView::viewportPercentageMax(float percentage) const
1233 {
1234 return std::max(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLog icalHeight(ScrollableArea::IncludeScrollbars))
1235 * percentage / 100.f;
1236 } 1223 }
1237 1224
1238 FragmentationDisabler::FragmentationDisabler(RenderObject* root) 1225 FragmentationDisabler::FragmentationDisabler(RenderObject* root)
1239 { 1226 {
1240 RenderView* renderView = root->view(); 1227 RenderView* renderView = root->view();
1241 ASSERT(renderView); 1228 ASSERT(renderView);
1242 1229
1243 LayoutState* layoutState = renderView->layoutState(); 1230 LayoutState* layoutState = renderView->layoutState();
1244 1231
1245 m_root = root; 1232 m_root = root;
(...skipping 21 matching lines...) Expand all
1267 #endif 1254 #endif
1268 1255
1269 if (layoutState) 1256 if (layoutState)
1270 layoutState->m_isPaginated = m_fragmenting; 1257 layoutState->m_isPaginated = m_fragmenting;
1271 1258
1272 if (m_flowThreadState != RenderObject::NotInsideFlowThread) 1259 if (m_flowThreadState != RenderObject::NotInsideFlowThread)
1273 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState); 1260 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState);
1274 } 1261 }
1275 1262
1276 } // namespace WebCore 1263 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderView.h ('k') | Source/core/rendering/RootInlineBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698