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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/RenderView.cpp
diff --git a/Source/core/rendering/RenderView.cpp b/Source/core/rendering/RenderView.cpp
index 05955691af573fc99f2d0102d0b46c6a62b72e2f..4fa84d30c22c9a2e7dec036128aadb105bffbc63 100644
--- a/Source/core/rendering/RenderView.cpp
+++ b/Source/core/rendering/RenderView.cpp
@@ -320,10 +320,7 @@ void RenderView::layout()
if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight())
|| child->style()->logicalHeight().isPercent()
|| child->style()->logicalMinHeight().isPercent()
- || child->style()->logicalMaxHeight().isPercent()
- || child->style()->logicalHeight().isViewportPercentage()
- || child->style()->logicalMinHeight().isViewportPercentage()
- || child->style()->logicalMaxHeight().isViewportPercentage())
+ || child->style()->logicalMaxHeight().isPercent())
layoutScope.setChildNeedsLayout(child);
}
@@ -1213,26 +1210,26 @@ bool RenderView::backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const
return m_frameView->hasOpaqueBackground();
}
-LayoutUnit RenderView::viewportPercentageWidth(float percentage) const
+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.
{
- return viewLogicalWidth(ScrollableArea::IncludeScrollbars) * percentage / 100.f;
+ float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1;
+ 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
}
-LayoutUnit RenderView::viewportPercentageHeight(float percentage) const
+double RenderView::viewportHeightPercent() const
{
- return viewLogicalHeight(ScrollableArea::IncludeScrollbars) * percentage / 100.f;
+ float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1;
+ return viewHeight(ScrollableArea::IncludeScrollbars) / scale / 100.f;
}
-LayoutUnit RenderView::viewportPercentageMin(float percentage) const
+double RenderView::viewportMinPercent() const
{
- return std::min(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLogicalHeight(ScrollableArea::IncludeScrollbars))
- * percentage / 100.f;
+ return std::min(viewportWidthPercent(), viewportHeightPercent());
}
-LayoutUnit RenderView::viewportPercentageMax(float percentage) const
+double RenderView::viewportMaxPercent() const
{
- return std::max(viewLogicalWidth(ScrollableArea::IncludeScrollbars), viewLogicalHeight(ScrollableArea::IncludeScrollbars))
- * percentage / 100.f;
+ return std::max(viewportWidthPercent(), viewportHeightPercent());
}
FragmentationDisabler::FragmentationDisabler(RenderObject* root)

Powered by Google App Engine
This is Rietveld 408576698