Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 if (shouldUsePrintingLayout()) { | 193 if (shouldUsePrintingLayout()) { |
| 194 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth() ; | 194 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth() ; |
| 195 setShouldDoFullRepaintAfterLayout(true); | 195 setShouldDoFullRepaintAfterLayout(true); |
| 196 } | 196 } |
| 197 | 197 |
| 198 SubtreeLayoutScope layoutScope(*this); | 198 SubtreeLayoutScope layoutScope(*this); |
| 199 | 199 |
| 200 // Use calcWidth/Height to get the new width/height, since this will take th e full page zoom factor into account. | 200 // Use calcWidth/Height to get the new width/height, since this will take th e full page zoom factor into account. |
| 201 bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView || width () != viewWidth() || height() != viewHeight()); | 201 bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView || width () != viewWidth() || height() != viewHeight()); |
| 202 if (relayoutChildren) { | 202 if (relayoutChildren) { |
| 203 // FIXME: Should not always fully repaint on resize. | 203 // It's hard to predict here which of full repaint or per-descendant rep aint costs less. |
| 204 setShouldDoFullRepaintAfterLayout(true); | 204 // For vertical writing mode or width change it's more likely that per-d escendant repaint |
| 205 // eventually turns out to be full repaint but with the cost to handle m ore layout states | |
| 206 // and discrete repaint rects, so marking full repaint here is more like ly to cost less. | |
| 207 // Otherwise, per-descendant repaint is more likely to avoid unnecessary full repaints. | |
| 208 if (!style()->isHorizontalWritingMode() || width() != viewWidth()) { | |
| 209 setShouldDoFullRepaintAfterLayout(true); | |
| 210 } else if (RenderObject* backgroundRenderer = this->backgroundRenderer() ) { | |
| 211 if (backgroundRenderer->style()->backgroundImageNeedsFullRepaintOnCo ntainerHeightChange()) | |
| 212 setShouldDoFullRepaintAfterLayout(true); | |
| 213 } | |
|
esprehn
2014/05/08 20:42:03
Does this work if repaint-after-layout is turned o
Xianzhu
2014/05/08 22:31:08
Yes. This is also based on https://codereview.chro
| |
| 205 | 214 |
| 206 layoutScope.setChildNeedsLayout(this); | 215 layoutScope.setChildNeedsLayout(this); |
| 207 for (RenderObject* child = firstChild(); child; child = child->nextSibli ng()) { | 216 for (RenderObject* child = firstChild(); child; child = child->nextSibli ng()) { |
| 208 if (child->isSVGRoot()) | 217 if (child->isSVGRoot()) |
| 209 continue; | 218 continue; |
| 210 | 219 |
| 211 if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight( )) | 220 if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight( )) |
| 212 || child->style()->logicalHeight().isPercent() | 221 || child->style()->logicalHeight().isPercent() |
| 213 || child->style()->logicalMinHeight().isPercent() | 222 || child->style()->logicalMinHeight().isPercent() |
| 214 || child->style()->logicalMaxHeight().isPercent()) | 223 || child->style()->logicalMaxHeight().isPercent()) |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 785 | 794 |
| 786 IntRect RenderView::unscaledDocumentRect() const | 795 IntRect RenderView::unscaledDocumentRect() const |
| 787 { | 796 { |
| 788 LayoutRect overflowRect(layoutOverflowRect()); | 797 LayoutRect overflowRect(layoutOverflowRect()); |
| 789 flipForWritingMode(overflowRect); | 798 flipForWritingMode(overflowRect); |
| 790 return pixelSnappedIntRect(overflowRect); | 799 return pixelSnappedIntRect(overflowRect); |
| 791 } | 800 } |
| 792 | 801 |
| 793 bool RenderView::rootBackgroundIsEntirelyFixed() const | 802 bool RenderView::rootBackgroundIsEntirelyFixed() const |
| 794 { | 803 { |
| 795 RenderObject* rootObject = document().documentElement() ? document().documen tElement()->renderer() : 0; | 804 if (RenderObject* backgroundRenderer = this->backgroundRenderer()) |
| 796 if (!rootObject) | 805 return backgroundRenderer->hasEntirelyFixedBackground(); |
| 797 return false; | 806 return false; |
| 807 } | |
| 798 | 808 |
| 799 RenderObject* rootRenderer = rootObject->rendererForRootBackground(); | 809 RenderObject* RenderView::backgroundRenderer() const |
| 800 return rootRenderer->hasEntirelyFixedBackground(); | 810 { |
| 811 if (Element* documentElement = document().documentElement()) { | |
| 812 if (RenderObject* rootObject = documentElement->renderer()) | |
| 813 return rootObject->rendererForRootBackground(); | |
| 814 } | |
| 815 return 0; | |
| 801 } | 816 } |
| 802 | 817 |
| 803 LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const | 818 LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const |
| 804 { | 819 { |
| 805 if (!hasColumns()) | 820 if (!hasColumns()) |
| 806 return unscaledDocumentRect(); | 821 return unscaledDocumentRect(); |
| 807 | 822 |
| 808 ColumnInfo* columnInfo = this->columnInfo(); | 823 ColumnInfo* columnInfo = this->columnInfo(); |
| 809 LayoutRect backgroundRect(0, 0, columnInfo->desiredColumnWidth(), columnInfo ->columnHeight() * columnInfo->columnCount()); | 824 LayoutRect backgroundRect(0, 0, columnInfo->desiredColumnWidth(), columnInfo ->columnHeight() * columnInfo->columnCount()); |
| 810 if (!isHorizontalWritingMode()) | 825 if (!isHorizontalWritingMode()) |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 961 return viewWidth(IncludeScrollbars) / scale; | 976 return viewWidth(IncludeScrollbars) / scale; |
| 962 } | 977 } |
| 963 | 978 |
| 964 double RenderView::layoutViewportHeight() const | 979 double RenderView::layoutViewportHeight() const |
| 965 { | 980 { |
| 966 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; | 981 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; |
| 967 return viewHeight(IncludeScrollbars) / scale; | 982 return viewHeight(IncludeScrollbars) / scale; |
| 968 } | 983 } |
| 969 | 984 |
| 970 } // namespace WebCore | 985 } // namespace WebCore |
| OLD | NEW |