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

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: 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
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/ViewportDescription.cpp » ('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 f11d7a2570f626e1641881244c12afe597cbbdac..7222ba910f06e499c3c8dd1d6dac7d9d5fd3e9f9 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1896,7 +1896,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();
@@ -1915,8 +1914,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:
@@ -1926,10 +1925,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)
@@ -3170,6 +3169,19 @@ void Document::evaluateMediaQueryList()
m_mediaQueryMatcher->styleResolverChanged();
}
+void Document::notifyResizeForViewportUnits()
+{
+ if (!hasViewportUnits())
+ return;
+ if (StyleResolver* styleResolver = styleResolverIfExists())
+ styleResolver->invalidateViewportDependentMatchedProperties();
+ for (Element* element = ElementTraversal::firstWithin(*this); element; element = ElementTraversal::next(*element)) {
+ RenderStyle* style = element->renderStyle();
+ if (style && style->hasViewportUnits())
+ element->setNeedsStyleRecalc(LocalStyleChange);
rune 2013/12/04 08:27:17 Does LocalStyleChange work for explicit or implici
+ }
+}
+
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/ViewportDescription.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698