Chromium Code Reviews| Index: Source/core/dom/Document.cpp |
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
| index 7c446e0546ed6698b1cbd90502d3ded1c5c37769..df548eedc4c1b70d056d462f5a395cfa7ff855cb 100644 |
| --- a/Source/core/dom/Document.cpp |
| +++ b/Source/core/dom/Document.cpp |
| @@ -448,6 +448,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); |
| @@ -1879,7 +1880,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(); |
| @@ -1898,8 +1898,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: |
| @@ -1909,10 +1909,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) |
| @@ -3165,6 +3165,14 @@ void Document::evaluateMediaQueryList() |
| m_mediaQueryMatcher->styleResolverChanged(); |
| } |
| +void Document::notifyResizeForViewportUnits() |
| +{ |
| + if (!hasViewportUnits()) |
| + return; |
| + ensureStyleResolver().notifyResizeForViewportUnits(); |
|
esprehn
2013/12/18 01:03:55
Do you really need to force creation of the style
Timothy Loh
2013/12/18 01:54:43
I think the only case where we won't end up creati
|
| + setNeedsStyleRecalcForViewportUnits(); |
| +} |
| + |
| void Document::styleResolverChanged(RecalcStyleTime updateTime, StyleResolverUpdateMode updateMode) |
| { |
| // styleResolverChanged() can be invoked during Document destruction. |