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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 #endif | 189 #endif |
190 } | 190 } |
191 | 191 |
192 #if ENABLE(ASSERT) | 192 #if ENABLE(ASSERT) |
193 void LayoutView::checkLayoutState() | 193 void LayoutView::checkLayoutState() |
194 { | 194 { |
195 ASSERT(!m_layoutState->next()); | 195 ASSERT(!m_layoutState->next()); |
196 } | 196 } |
197 #endif | 197 #endif |
198 | 198 |
199 bool LayoutView::shouldDoFullPaintInvalidationForNextLayout() const | 199 void LayoutView::setShouldDoFullPaintInvalidationOnResizeIfNeeded() |
200 { | 200 { |
201 // It's hard to predict here which of full paint invalidation or per-descend
ant paint invalidation costs less. | 201 // When background-attachment is 'fixed', we treat the viewport (instead of
the 'root' |
202 // For vertical writing mode or width change it's more likely that per-desce
ndant paint invalidation | 202 // i.e. html or body) as the background positioning area, and we should full
y invalidate |
203 // eventually turns out to be full paint invalidation but with the cost to h
andle more layout states | 203 // on viewport resize if the background image is not composited and needs fu
ll paint |
204 // and discrete paint invalidation rects, so marking full paint invalidation
here is more likely to cost less. | 204 // invalidation on background positioning area resize. |
205 // Otherwise, per-descendant paint invalidation is more likely to avoid unne
cessary full paint invalidation. | 205 if (style()->hasFixedBackgroundImage() && (!m_compositor || !m_compositor->n
eedsFixedRootBackgroundLayer(layer()))) { |
206 | 206 IncludeScrollbarsInRect includeScrollbars = document().settings() && doc
ument().settings()->rootLayerScrolls() ? IncludeScrollbars : ExcludeScrollbars; |
207 if (shouldUsePrintingLayout()) | 207 if ((offsetWidth() != viewWidth(includeScrollbars) && mustInvalidateFill
LayersPaintOnWidthChange(style()->backgroundLayers())) |
208 return true; | 208 || (offsetHeight() != viewHeight(includeScrollbars) && mustInvalidat
eFillLayersPaintOnHeightChange(style()->backgroundLayers()))) |
209 | 209 setShouldDoFullPaintInvalidation(PaintInvalidationBoundsChange); |
210 if (!style()->isHorizontalWritingMode()) | |
211 return true; | |
212 | |
213 // The width/height checks below assume horizontal writing mode. | |
214 ASSERT(style()->isHorizontalWritingMode()); | |
215 | |
216 if (size().width() != viewLogicalWidthForBoxSizing()) | |
217 return true; | |
218 | |
219 if (size().height() != viewLogicalHeightForBoxSizing()) { | |
220 // When background-attachment is 'fixed', we treat the viewport (instead
of the 'root' | |
221 // i.e. html or body) as the background positioning area, and we should
full paint invalidation | |
222 // viewport resize if the background image is not composited and needs f
ull paint invalidation on | |
223 // background positioning area resize. | |
224 if (!m_compositor || !m_compositor->needsFixedRootBackgroundLayer(layer(
))) { | |
225 if (style()->hasFixedBackgroundImage() | |
226 && mustInvalidateFillLayersPaintOnHeightChange(style()->backgrou
ndLayers())) | |
227 return true; | |
228 } | |
229 } | 210 } |
230 | |
231 return false; | |
232 } | |
233 | |
234 bool LayoutView::doingFullPaintInvalidation() const | |
235 { | |
236 return m_frameView->needsFullPaintInvalidation(); | |
237 } | 211 } |
238 | 212 |
239 void LayoutView::layout() | 213 void LayoutView::layout() |
240 { | 214 { |
241 if (!document().paginated()) | 215 if (!document().paginated()) |
242 setPageLogicalHeight(LayoutUnit()); | 216 setPageLogicalHeight(LayoutUnit()); |
243 | 217 |
| 218 setShouldDoFullPaintInvalidationOnResizeIfNeeded(); |
| 219 |
244 if (pageLogicalHeight() && shouldUsePrintingLayout()) { | 220 if (pageLogicalHeight() && shouldUsePrintingLayout()) { |
245 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth()
; | 221 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth()
; |
246 if (!m_fragmentationContext) | 222 if (!m_fragmentationContext) |
247 m_fragmentationContext = wrapUnique(new ViewFragmentationContext(*th
is)); | 223 m_fragmentationContext = wrapUnique(new ViewFragmentationContext(*th
is)); |
248 } else if (m_fragmentationContext) { | 224 } else if (m_fragmentationContext) { |
249 m_fragmentationContext.reset(); | 225 m_fragmentationContext.reset(); |
250 } | 226 } |
251 | 227 |
252 SubtreeLayoutScope layoutScope(*this); | 228 SubtreeLayoutScope layoutScope(*this); |
253 | 229 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 void LayoutView::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffse
t) const | 410 void LayoutView::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffse
t) const |
435 { | 411 { |
436 ViewPainter(*this).paint(paintInfo, paintOffset); | 412 ViewPainter(*this).paint(paintInfo, paintOffset); |
437 } | 413 } |
438 | 414 |
439 void LayoutView::paintBoxDecorationBackground(const PaintInfo& paintInfo, const
LayoutPoint&) const | 415 void LayoutView::paintBoxDecorationBackground(const PaintInfo& paintInfo, const
LayoutPoint&) const |
440 { | 416 { |
441 ViewPainter(*this).paintBoxDecorationBackground(paintInfo); | 417 ViewPainter(*this).paintBoxDecorationBackground(paintInfo); |
442 } | 418 } |
443 | 419 |
444 void LayoutView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval
idationState) | |
445 { | |
446 ASSERT(!needsLayout()); | |
447 | |
448 // We specifically need to issue paint invalidations for the viewRect since
other layoutObjects | |
449 // short-circuit on full-paint invalidation. | |
450 LayoutRect dirtyRect = viewRect(); | |
451 if (doingFullPaintInvalidation() && !dirtyRect.isEmpty()) { | |
452 const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidati
onState.paintInvalidationContainer(); | |
453 paintInvalidationState.mapLocalRectToPaintInvalidationBacking(dirtyRect)
; | |
454 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, Pai
ntInvalidationFull); | |
455 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation
State, PaintInvalidationFull); | |
456 } | |
457 LayoutBlock::invalidateTreeIfNeeded(paintInvalidationState); | |
458 } | |
459 | |
460 static void setShouldDoFullPaintInvalidationForViewAndAllDescendantsInternal(Lay
outObject* object) | 420 static void setShouldDoFullPaintInvalidationForViewAndAllDescendantsInternal(Lay
outObject* object) |
461 { | 421 { |
462 object->setShouldDoFullPaintInvalidation(); | 422 object->setShouldDoFullPaintInvalidation(); |
463 for (LayoutObject* child = object->slowFirstChild(); child; child = child->n
extSibling()) { | 423 for (LayoutObject* child = object->slowFirstChild(); child; child = child->n
extSibling()) { |
464 setShouldDoFullPaintInvalidationForViewAndAllDescendantsInternal(child); | 424 setShouldDoFullPaintInvalidationForViewAndAllDescendantsInternal(child); |
465 } | 425 } |
466 } | 426 } |
467 | 427 |
468 void LayoutView::setShouldDoFullPaintInvalidationForViewAndAllDescendants() | 428 void LayoutView::setShouldDoFullPaintInvalidationForViewAndAllDescendants() |
469 { | 429 { |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 // ASSERT(!frame()->isMainFrame()) here. All main frame scrolling should | 1003 // ASSERT(!frame()->isMainFrame()) here. All main frame scrolling should |
1044 // be handled by the ViewportScrollCallback. | 1004 // be handled by the ViewportScrollCallback. |
1045 | 1005 |
1046 if (!frameView()) | 1006 if (!frameView()) |
1047 return ScrollResult(false, false, delta.width(), delta.height()); | 1007 return ScrollResult(false, false, delta.width(), delta.height()); |
1048 | 1008 |
1049 return frameView()->getScrollableArea()->userScroll(granularity, delta); | 1009 return frameView()->getScrollableArea()->userScroll(granularity, delta); |
1050 } | 1010 } |
1051 | 1011 |
1052 } // namespace blink | 1012 } // namespace blink |
OLD | NEW |