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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 void RenderView::checkLayoutState() | 178 void RenderView::checkLayoutState() |
179 { | 179 { |
180 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { | 180 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { |
181 ASSERT(layoutDeltaMatches(LayoutSize())); | 181 ASSERT(layoutDeltaMatches(LayoutSize())); |
182 } | 182 } |
183 ASSERT(!m_layoutStateDisableCount); | 183 ASSERT(!m_layoutStateDisableCount); |
184 ASSERT(!m_layoutState->next()); | 184 ASSERT(!m_layoutState->next()); |
185 } | 185 } |
186 #endif | 186 #endif |
187 | 187 |
188 bool RenderView::shouldDoFullRepaintForNextLayout() const | |
189 { | |
190 // It's hard to predict here which of full repaint or per-descendant repaint costs less. | |
191 // For vertical writing mode or width change it's more likely that per-desce ndant repaint | |
192 // eventually turns out to be full repaint but with the cost to handle more layout states | |
193 // and discrete repaint rects, so marking full repaint here is more likely t o cost less. | |
194 // Otherwise, per-descendant repaint is more likely to avoid unnecessary ful l repaints. | |
195 | |
196 if (shouldUsePrintingLayout()) | |
197 return true; | |
198 | |
199 if (!style()->isHorizontalWritingMode() || width() != viewWidth()) | |
200 return true; | |
201 | |
202 if (height() != viewHeight()) { | |
203 if (RenderObject* backgroundRenderer = this->backgroundRenderer()) { | |
204 if (backgroundRenderer->style()->backgroundImageNeedsFullRepaintOnCo ntainerHeightChange()) | |
205 return true; | |
206 } | |
207 } | |
208 | |
209 return false; | |
210 } | |
211 | |
188 void RenderView::layout() | 212 void RenderView::layout() |
189 { | 213 { |
190 if (!document().paginated()) | 214 if (!document().paginated()) |
191 setPageLogicalHeight(0); | 215 setPageLogicalHeight(0); |
192 | 216 |
193 if (shouldUsePrintingLayout()) | 217 if (shouldUsePrintingLayout()) |
194 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth() ; | 218 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth() ; |
195 | 219 |
196 SubtreeLayoutScope layoutScope(*this); | 220 SubtreeLayoutScope layoutScope(*this); |
197 | 221 |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
780 | 804 |
781 IntRect RenderView::unscaledDocumentRect() const | 805 IntRect RenderView::unscaledDocumentRect() const |
782 { | 806 { |
783 LayoutRect overflowRect(layoutOverflowRect()); | 807 LayoutRect overflowRect(layoutOverflowRect()); |
784 flipForWritingMode(overflowRect); | 808 flipForWritingMode(overflowRect); |
785 return pixelSnappedIntRect(overflowRect); | 809 return pixelSnappedIntRect(overflowRect); |
786 } | 810 } |
787 | 811 |
788 bool RenderView::rootBackgroundIsEntirelyFixed() const | 812 bool RenderView::rootBackgroundIsEntirelyFixed() const |
789 { | 813 { |
790 RenderObject* rootObject = document().documentElement() ? document().documen tElement()->renderer() : 0; | 814 if (RenderObject* backgroundRenderer = this->backgroundRenderer()) |
791 if (!rootObject) | 815 return backgroundRenderer->hasEntirelyFixedBackground(); |
792 return false; | 816 return false; |
817 } | |
793 | 818 |
794 RenderObject* rootRenderer = rootObject->rendererForRootBackground(); | 819 RenderObject* RenderView::backgroundRenderer() const |
795 return rootRenderer->hasEntirelyFixedBackground(); | 820 { |
821 if (Element* documentElement = document().documentElement()) { | |
822 if (RenderObject* rootObject = documentElement->renderer()) | |
823 return rootObject->rendererForRootBackground(); | |
esprehn
2014/05/20 22:27:09
I'm not sure this is always correct, if the <body>
Xianzhu
2014/05/20 22:49:42
rendererForRootBackground() will return <body>'s r
| |
824 } | |
825 return 0; | |
796 } | 826 } |
797 | 827 |
798 LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const | 828 LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const |
799 { | 829 { |
800 if (!hasColumns()) | 830 if (!hasColumns()) |
801 return unscaledDocumentRect(); | 831 return unscaledDocumentRect(); |
802 | 832 |
803 ColumnInfo* columnInfo = this->columnInfo(); | 833 ColumnInfo* columnInfo = this->columnInfo(); |
804 LayoutRect backgroundRect(0, 0, columnInfo->desiredColumnWidth(), columnInfo ->columnHeight() * columnInfo->columnCount()); | 834 LayoutRect backgroundRect(0, 0, columnInfo->desiredColumnWidth(), columnInfo ->columnHeight() * columnInfo->columnCount()); |
805 if (!isHorizontalWritingMode()) | 835 if (!isHorizontalWritingMode()) |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
963 return viewWidth(IncludeScrollbars) / scale; | 993 return viewWidth(IncludeScrollbars) / scale; |
964 } | 994 } |
965 | 995 |
966 double RenderView::layoutViewportHeight() const | 996 double RenderView::layoutViewportHeight() const |
967 { | 997 { |
968 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; | 998 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; |
969 return viewHeight(IncludeScrollbars) / scale; | 999 return viewHeight(IncludeScrollbars) / scale; |
970 } | 1000 } |
971 | 1001 |
972 } // namespace WebCore | 1002 } // namespace WebCore |
OLD | NEW |