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

Unified Diff: Source/core/dom/Document.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, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/TreeScope.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index ea9c184fa87e0b8de0815dc4378518cdb443b9ad..67fec51bb19ece797e6e4c1f2ff3e0e450054e3b 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -450,6 +450,7 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_transitionTimeline(TransitionTimeline::create(this))
, m_templateDocumentHost(0)
, m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsTimerFired)
+ , m_hasViewportUnits(false)
{
setClient(this);
ScriptWrappable::init(this);
@@ -1894,7 +1895,6 @@ bool Document::isPageBoxVisible(int pageIndex)
void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft)
{
RefPtr<RenderStyle> style = styleForPage(pageIndex);
- RenderView* view = renderView();
int width = pageSize.width();
int height = pageSize.height();
@@ -1913,8 +1913,8 @@ void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
LengthSize size = style->pageSize();
ASSERT(size.width().isFixed());
ASSERT(size.height().isFixed());
- width = valueForLength(size.width(), 0, view);
- height = valueForLength(size.height(), 0, view);
+ width = valueForLength(size.width(), 0);
+ height = valueForLength(size.height(), 0);
break;
}
default:
@@ -1924,10 +1924,10 @@ void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
// The percentage is calculated with respect to the width even for margin top and bottom.
// http://www.w3.org/TR/CSS2/box.html#margin-properties
- marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(style->marginTop(), width, view);
- marginRight = style->marginRight().isAuto() ? marginRight : intValueForLength(style->marginRight(), width, view);
- marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLength(style->marginBottom(), width, view);
- marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(style->marginLeft(), width, view);
+ marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(style->marginTop(), width);
+ marginRight = style->marginRight().isAuto() ? marginRight : intValueForLength(style->marginRight(), width);
+ marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLength(style->marginBottom(), width);
+ marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(style->marginLeft(), width);
}
void Document::setIsViewSource(bool isViewSource)
@@ -3195,6 +3195,14 @@ void Document::evaluateMediaQueryList()
m_mediaQueryMatcher->styleResolverChanged();
}
+void Document::notifyResizeForViewportUnits()
+{
+ if (!hasViewportUnits())
+ return;
+ ensureStyleResolver().notifyResizeForViewportUnits();
+ setNeedsStyleRecalcForViewportUnits();
+}
+
void Document::styleResolverChanged(RecalcStyleTime updateTime, StyleResolverUpdateMode updateMode)
{
// styleResolverChanged() can be invoked during Document destruction.
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/TreeScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698