| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 278 |
| 279 if (mode & TraverseDocumentBoundaries) { | 279 if (mode & TraverseDocumentBoundaries) { |
| 280 if (RenderObject* parentDocRenderer = frame()->ownerRenderer()) { | 280 if (RenderObject* parentDocRenderer = frame()->ownerRenderer()) { |
| 281 transformState.move(-frame()->view()->scrollOffset()); | 281 transformState.move(-frame()->view()->scrollOffset()); |
| 282 if (parentDocRenderer->isBox()) | 282 if (parentDocRenderer->isBox()) |
| 283 transformState.move(toLayoutSize(toRenderBox(parentDocRenderer)-
>contentBoxRect().location())); | 283 transformState.move(toLayoutSize(toRenderBox(parentDocRenderer)-
>contentBoxRect().location())); |
| 284 parentDocRenderer->mapLocalToContainer(repaintContainer, transformSt
ate, mode, wasFixed, paintInvalidationState); | 284 parentDocRenderer->mapLocalToContainer(repaintContainer, transformSt
ate, mode, wasFixed, paintInvalidationState); |
| 285 return; | 285 return; |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 |
| 289 // If a container was specified, and was not 0 or the RenderView, |
| 290 // then we should have found it by now. |
| 291 ASSERT_ARG(repaintContainer, !repaintContainer); |
| 288 } | 292 } |
| 289 | 293 |
| 290 const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObj
ect* ancestorToStopAt, RenderGeometryMap& geometryMap) const | 294 const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObj
ect* ancestorToStopAt, RenderGeometryMap& geometryMap) const |
| 291 { | 295 { |
| 292 LayoutSize offsetForFixedPosition; | 296 LayoutSize offsetForFixedPosition; |
| 293 LayoutSize offset; | 297 LayoutSize offset; |
| 294 RenderObject* container = 0; | 298 RenderObject* container = 0; |
| 295 | 299 |
| 296 if (m_frameView) | 300 if (m_frameView) |
| 297 offsetForFixedPosition = m_frameView->scrollOffsetForFixedPosition(); | 301 offsetForFixedPosition = m_frameView->scrollOffsetForFixedPosition(); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 } | 422 } |
| 419 } | 423 } |
| 420 } | 424 } |
| 421 | 425 |
| 422 void RenderView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval
idationState) | 426 void RenderView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval
idationState) |
| 423 { | 427 { |
| 424 ASSERT(!needsLayout()); | 428 ASSERT(!needsLayout()); |
| 425 | 429 |
| 426 // We specifically need to repaint the viewRect since other renderers | 430 // We specifically need to repaint the viewRect since other renderers |
| 427 // short-circuit on full-repaint. | 431 // short-circuit on full-repaint. |
| 428 LayoutRect dirtyRect = viewRect(); | 432 if (doingFullPaintInvalidation() && !viewRect().isEmpty()) |
| 429 if (doingFullPaintInvalidation() && !dirtyRect.isEmpty()) { | 433 invalidatePaintForRectangle(viewRect()); |
| 430 const RenderLayerModelObject* paintInvalidationContainer = &paintInvalid
ationState.paintInvalidationContainer(); | |
| 431 mapRectToPaintInvalidationBacking(paintInvalidationContainer, dirtyRect)
; | |
| 432 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, Inv
alidationFull); | |
| 433 } | |
| 434 | 434 |
| 435 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState); | 435 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState); |
| 436 } | 436 } |
| 437 | 437 |
| 438 void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation
Rect) const | 438 void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation
Rect) const |
| 439 { | 439 { |
| 440 ASSERT(!paintInvalidationRect.isEmpty()); | 440 ASSERT(!paintInvalidationRect.isEmpty()); |
| 441 | 441 |
| 442 if (document().printing() || !m_frameView) | 442 if (document().printing() || !m_frameView) |
| 443 return; | 443 return; |
| 444 | 444 |
| 445 ASSERT(layer()->compositingState() == PaintsIntoOwnBacking || !frame()->owne
rRenderer()); | 445 // We always just invalidate the root view, since we could be an iframe that
is clipped out |
| 446 | 446 // or even invisible. |
| 447 Element* owner = document().ownerElement(); |
| 447 if (layer()->compositingState() == PaintsIntoOwnBacking) { | 448 if (layer()->compositingState() == PaintsIntoOwnBacking) { |
| 448 layer()->repainter().setBackingNeedsRepaintInRect(paintInvalidationRect)
; | 449 layer()->repainter().setBackingNeedsRepaintInRect(paintInvalidationRect)
; |
| 449 } else { | 450 } else if (!owner) { |
| 450 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(pa
intInvalidationRect)); | 451 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(pa
intInvalidationRect)); |
| 452 } else if (RenderBox* obj = owner->renderBox()) { |
| 453 // Intersect the viewport with the paint invalidation rect. |
| 454 LayoutRect viewRectangle = viewRect(); |
| 455 LayoutRect rectToInvalidate = intersection(paintInvalidationRect, viewRe
ctangle); |
| 456 |
| 457 // Adjust for scroll offset of the view. |
| 458 rectToInvalidate.moveBy(-viewRectangle.location()); |
| 459 |
| 460 // Adjust for frame border. |
| 461 rectToInvalidate.moveBy(obj->contentBoxRect().location()); |
| 462 obj->invalidatePaintRectangle(rectToInvalidate); |
| 451 } | 463 } |
| 452 } | 464 } |
| 453 | 465 |
| 454 void RenderView::invalidatePaintForViewAndCompositedLayers() | 466 void RenderView::invalidatePaintForViewAndCompositedLayers() |
| 455 { | 467 { |
| 456 paintInvalidationForWholeRenderer(); | 468 paintInvalidationForWholeRenderer(); |
| 457 | 469 |
| 458 // The only way we know how to hit these ASSERTS below this point is via the
Chromium OS login screen. | 470 // The only way we know how to hit these ASSERTS below this point is via the
Chromium OS login screen. |
| 459 DisableCompositingQueryAsserts disabler; | 471 DisableCompositingQueryAsserts disabler; |
| 460 | 472 |
| 461 if (compositor()->inCompositingMode()) | 473 if (compositor()->inCompositingMode()) |
| 462 compositor()->fullyInvalidatePaint(); | 474 compositor()->fullyInvalidatePaint(); |
| 463 } | 475 } |
| 464 | 476 |
| 465 void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect& rect, bool fixed, const PaintInvalidati
onState* paintInvalidationState) const | 477 void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect& rect, bool fixed, const PaintInvalidati
onState* paintInvalidationState) const |
| 466 { | 478 { |
| 479 // If a container was specified, and was not 0 or the RenderView, |
| 480 // then we should have found it by now. |
| 481 ASSERT_ARG(paintInvalidationContainer, !paintInvalidationContainer || paintI
nvalidationContainer == this); |
| 482 |
| 467 if (document().printing()) | 483 if (document().printing()) |
| 468 return; | 484 return; |
| 469 | 485 |
| 470 if (style()->isFlippedBlocksWritingMode()) { | 486 if (style()->isFlippedBlocksWritingMode()) { |
| 471 // We have to flip by hand since the view's logical height has not been
determined. We | 487 // We have to flip by hand since the view's logical height has not been
determined. We |
| 472 // can use the viewport width and height. | 488 // can use the viewport width and height. |
| 473 if (style()->isHorizontalWritingMode()) | 489 if (style()->isHorizontalWritingMode()) |
| 474 rect.setY(viewHeight() - rect.maxY()); | 490 rect.setY(viewHeight() - rect.maxY()); |
| 475 else | 491 else |
| 476 rect.setX(viewWidth() - rect.maxX()); | 492 rect.setX(viewWidth() - rect.maxX()); |
| 477 } | 493 } |
| 478 | 494 |
| 479 if (fixed && m_frameView) { | 495 if (fixed && m_frameView) { |
| 480 rect.move(m_frameView->scrollOffsetForFixedPosition()); | 496 rect.move(m_frameView->scrollOffsetForFixedPosition()); |
| 481 // If we have a pending scroll, invalidate the previous scroll position. | 497 // If we have a pending scroll, invalidate the previous scroll position. |
| 482 if (!m_frameView->pendingScrollDelta().isZero()) { | 498 if (!m_frameView->pendingScrollDelta().isZero()) { |
| 483 rect.move(-m_frameView->pendingScrollDelta()); | 499 rect.move(-m_frameView->pendingScrollDelta()); |
| 484 } | 500 } |
| 485 } | 501 } |
| 486 | 502 |
| 487 // Apply our transform if we have one (because of full page zooming). | 503 // Apply our transform if we have one (because of full page zooming). |
| 488 if (!paintInvalidationContainer && layer() && layer()->transform()) | 504 if (!paintInvalidationContainer && layer() && layer()->transform()) |
| 489 rect = layer()->transform()->mapRect(rect); | 505 rect = layer()->transform()->mapRect(rect); |
| 490 | |
| 491 ASSERT(paintInvalidationContainer); | |
| 492 | |
| 493 if (paintInvalidationContainer == this) | |
| 494 return; | |
| 495 | |
| 496 Element* owner = document().ownerElement(); | |
| 497 if (!owner) | |
| 498 return; | |
| 499 if (RenderBox* obj = owner->renderBox()) { | |
| 500 // Intersect the viewport with the paint invalidation rect. | |
| 501 LayoutRect viewRectangle = viewRect(); | |
| 502 rect.intersect(viewRectangle); | |
| 503 | |
| 504 // Adjust for scroll offset of the view. | |
| 505 rect.moveBy(-viewRectangle.location()); | |
| 506 | |
| 507 // Adjust for frame border. | |
| 508 rect.moveBy(obj->contentBoxRect().location()); | |
| 509 obj->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect)
; | |
| 510 } | |
| 511 } | 506 } |
| 512 | 507 |
| 513 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu
latedOffset) const | 508 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu
latedOffset) const |
| 514 { | 509 { |
| 515 rects.append(pixelSnappedIntRect(accumulatedOffset, layer()->size())); | 510 rects.append(pixelSnappedIntRect(accumulatedOffset, layer()->size())); |
| 516 } | 511 } |
| 517 | 512 |
| 518 void RenderView::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const | 513 void RenderView::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const |
| 519 { | 514 { |
| 520 if (wasFixed) | 515 if (wasFixed) |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 return viewWidth(IncludeScrollbars) / scale; | 972 return viewWidth(IncludeScrollbars) / scale; |
| 978 } | 973 } |
| 979 | 974 |
| 980 double RenderView::layoutViewportHeight() const | 975 double RenderView::layoutViewportHeight() const |
| 981 { | 976 { |
| 982 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; | 977 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; |
| 983 return viewHeight(IncludeScrollbars) / scale; | 978 return viewHeight(IncludeScrollbars) / scale; |
| 984 } | 979 } |
| 985 | 980 |
| 986 } // namespace blink | 981 } // namespace blink |
| OLD | NEW |