Chromium Code Reviews| Index: Source/core/dom/Document.cpp |
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
| index f1dd98641183bbe1dade7499e0fca23b60f5a2dc..315c02b4ccb1dab85313944831a494791114885a 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* resolver = styleResolver()) |
| + resolver->invalidateViewportDependentMatchedProperties(); |
| + for (Element* element = ElementTraversal::firstWithin(*this); element; element = ElementTraversal::next(*element)) { |
| + RenderStyle* style = element->renderStyle(); |
| + if (style && style->hasViewportUnits()) |
| + element->setNeedsStyleRecalc(LocalStyleChange); |
| + } |
|
esprehn
2013/12/04 06:02:28
This doesn't handle Shadow DOM, you probably want
Timothy Loh
2013/12/15 23:41:19
Done. Also updated this to iterate over pseudoelem
|
| +} |
| + |
| void Document::styleResolverChanged(RecalcStyleTime updateTime, StyleResolverUpdateMode updateMode) |
| { |
| // styleResolverChanged() can be invoked during Document destruction. |