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 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); | |
| 292 } | 288 } |
| 293 | 289 |
| 294 const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap& geometryMap) const | 290 const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap& geometryMap) const |
| 295 { | 291 { |
| 296 LayoutSize offsetForFixedPosition; | 292 LayoutSize offsetForFixedPosition; |
| 297 LayoutSize offset; | 293 LayoutSize offset; |
| 298 RenderObject* container = 0; | 294 RenderObject* container = 0; |
| 299 | 295 |
| 300 if (m_frameView) | 296 if (m_frameView) |
| 301 offsetForFixedPosition = m_frameView->scrollOffsetForFixedPosition(); | 297 offsetForFixedPosition = m_frameView->scrollOffsetForFixedPosition(); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 443 } | 439 } |
| 444 } | 440 } |
| 445 } | 441 } |
| 446 | 442 |
| 447 void RenderView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval idationState) | 443 void RenderView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval idationState) |
| 448 { | 444 { |
| 449 ASSERT(!needsLayout()); | 445 ASSERT(!needsLayout()); |
| 450 | 446 |
| 451 // We specifically need to repaint the viewRect since other renderers | 447 // We specifically need to repaint the viewRect since other renderers |
| 452 // short-circuit on full-repaint. | 448 // short-circuit on full-repaint. |
| 453 if (doingFullPaintInvalidation() && !viewRect().isEmpty()) | 449 LayoutRect dirtyRect = viewRect(); |
| 454 invalidatePaintForRectangle(viewRect()); | 450 if (doingFullPaintInvalidation() && !dirtyRect.isEmpty()) { |
| 451 const RenderLayerModelObject* paintInvalidationContainer = &paintInvalid ationState.paintInvalidationContainer(); | |
| 452 mapRectToPaintInvalidationBacking(paintInvalidationContainer, dirtyRect) ; | |
| 453 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, Inv alidationFull); | |
| 454 } | |
| 455 | 455 |
| 456 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState); | 456 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState); |
| 457 } | 457 } |
| 458 | 458 |
| 459 void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation Rect) const | 459 void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation Rect) const |
| 460 { | 460 { |
| 461 ASSERT(!paintInvalidationRect.isEmpty()); | 461 ASSERT(!paintInvalidationRect.isEmpty()); |
| 462 | 462 |
| 463 if (document().printing() || !m_frameView) | 463 if (document().printing() || !m_frameView) |
| 464 return; | 464 return; |
| 465 | 465 |
| 466 // We always just invalidate the root view, since we could be an iframe that is clipped out | 466 ASSERT(layer()->compositingState() == PaintsIntoOwnBacking || !document().ow nerElement()); |
| 467 // or even invisible. | 467 |
| 468 Element* owner = document().ownerElement(); | |
| 469 if (layer()->compositingState() == PaintsIntoOwnBacking) { | 468 if (layer()->compositingState() == PaintsIntoOwnBacking) { |
| 470 layer()->repainter().setBackingNeedsRepaintInRect(paintInvalidationRect) ; | 469 layer()->repainter().setBackingNeedsRepaintInRect(paintInvalidationRect) ; |
| 471 } else if (!owner) { | 470 } else { |
| 472 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(pa intInvalidationRect)); | 471 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(pa intInvalidationRect)); |
| 473 } else if (RenderBox* obj = owner->renderBox()) { | |
| 474 // Intersect the viewport with the paint invalidation rect. | |
| 475 LayoutRect viewRectangle = viewRect(); | |
| 476 LayoutRect rectToInvalidate = intersection(paintInvalidationRect, viewRe ctangle); | |
| 477 | |
| 478 // Adjust for scroll offset of the view. | |
| 479 rectToInvalidate.moveBy(-viewRectangle.location()); | |
| 480 | |
| 481 // Adjust for frame border. | |
| 482 rectToInvalidate.moveBy(obj->contentBoxRect().location()); | |
| 483 obj->invalidatePaintRectangle(rectToInvalidate); | |
| 484 } | 472 } |
| 485 } | 473 } |
| 486 | 474 |
| 487 void RenderView::invalidatePaintForViewAndCompositedLayers() | 475 void RenderView::invalidatePaintForViewAndCompositedLayers() |
| 488 { | 476 { |
| 489 paintInvalidationForWholeRenderer(); | 477 paintInvalidationForWholeRenderer(); |
| 490 | 478 |
| 491 // The only way we know how to hit these ASSERTS below this point is via the Chromium OS login screen. | 479 // The only way we know how to hit these ASSERTS below this point is via the Chromium OS login screen. |
| 492 DisableCompositingQueryAsserts disabler; | 480 DisableCompositingQueryAsserts disabler; |
| 493 | 481 |
| 494 if (compositor()->inCompositingMode()) | 482 if (compositor()->inCompositingMode()) |
| 495 compositor()->fullyInvalidatePaint(); | 483 compositor()->fullyInvalidatePaint(); |
| 496 } | 484 } |
| 497 | 485 |
| 498 void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, bool fixed, const PaintInvalidati onState* paintInvalidationState) const | 486 void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, bool fixed, const PaintInvalidati onState* paintInvalidationState) const |
| 499 { | 487 { |
| 500 // If a container was specified, and was not 0 or the RenderView, | |
| 501 // then we should have found it by now. | |
| 502 ASSERT_ARG(paintInvalidationContainer, !paintInvalidationContainer || paintI nvalidationContainer == this); | |
| 503 | |
| 504 if (document().printing()) | 488 if (document().printing()) |
| 505 return; | 489 return; |
| 506 | 490 |
| 507 if (style()->isFlippedBlocksWritingMode()) { | 491 if (style()->isFlippedBlocksWritingMode()) { |
| 508 // We have to flip by hand since the view's logical height has not been determined. We | 492 // We have to flip by hand since the view's logical height has not been determined. We |
| 509 // can use the viewport width and height. | 493 // can use the viewport width and height. |
| 510 if (style()->isHorizontalWritingMode()) | 494 if (style()->isHorizontalWritingMode()) |
| 511 rect.setY(viewHeight() - rect.maxY()); | 495 rect.setY(viewHeight() - rect.maxY()); |
| 512 else | 496 else |
| 513 rect.setX(viewWidth() - rect.maxX()); | 497 rect.setX(viewWidth() - rect.maxX()); |
| 514 } | 498 } |
| 515 | 499 |
| 516 if (fixed && m_frameView) { | 500 if (fixed && m_frameView) { |
| 517 rect.move(m_frameView->scrollOffsetForFixedPosition()); | 501 rect.move(m_frameView->scrollOffsetForFixedPosition()); |
| 518 // If we have a pending scroll, invalidate the previous scroll position. | 502 // If we have a pending scroll, invalidate the previous scroll position. |
| 519 if (!m_frameView->pendingScrollDelta().isZero()) { | 503 if (!m_frameView->pendingScrollDelta().isZero()) { |
| 520 rect.move(-m_frameView->pendingScrollDelta()); | 504 rect.move(-m_frameView->pendingScrollDelta()); |
| 521 } | 505 } |
| 522 } | 506 } |
| 523 | 507 |
| 524 // Apply our transform if we have one (because of full page zooming). | 508 // Apply our transform if we have one (because of full page zooming). |
| 525 if (!paintInvalidationContainer && layer() && layer()->transform()) | 509 if (!paintInvalidationContainer && layer() && layer()->transform()) |
| 526 rect = layer()->transform()->mapRect(rect); | 510 rect = layer()->transform()->mapRect(rect); |
| 511 | |
| 512 if (!paintInvalidationContainer || paintInvalidationContainer == this) | |
|
leviw_travelin_and_unemployed
2014/08/06 22:04:32
What's the case where paintInvalidationContainer i
chrishtr
2014/08/06 22:54:20
I don't think there is one. Fixed and added ASSERT
philipj_slow
2014/08/28 14:02:28
There is such a case in RenderObject::selectionRec
| |
| 513 return; | |
| 514 | |
| 515 Element* owner = document().ownerElement(); | |
| 516 if (!owner) | |
| 517 return; | |
| 518 if (RenderBox* obj = owner->renderBox()) { | |
| 519 // Intersect the viewport with the paint invalidation rect. | |
| 520 LayoutRect viewRectangle = viewRect(); | |
| 521 rect.intersect(viewRectangle); | |
| 522 | |
| 523 // Adjust for scroll offset of the view. | |
| 524 rect.moveBy(-viewRectangle.location()); | |
| 525 | |
| 526 // Adjust for frame border. | |
| 527 rect.moveBy(obj->contentBoxRect().location()); | |
| 528 obj->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect) ; | |
| 529 } | |
| 527 } | 530 } |
| 528 | 531 |
| 529 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu latedOffset) const | 532 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu latedOffset) const |
| 530 { | 533 { |
| 531 rects.append(pixelSnappedIntRect(accumulatedOffset, layer()->size())); | 534 rects.append(pixelSnappedIntRect(accumulatedOffset, layer()->size())); |
| 532 } | 535 } |
| 533 | 536 |
| 534 void RenderView::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const | 537 void RenderView::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const |
| 535 { | 538 { |
| 536 if (wasFixed) | 539 if (wasFixed) |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 993 return viewWidth(IncludeScrollbars) / scale; | 996 return viewWidth(IncludeScrollbars) / scale; |
| 994 } | 997 } |
| 995 | 998 |
| 996 double RenderView::layoutViewportHeight() const | 999 double RenderView::layoutViewportHeight() const |
| 997 { | 1000 { |
| 998 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; | 1001 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; |
| 999 return viewHeight(IncludeScrollbars) / scale; | 1002 return viewHeight(IncludeScrollbars) / scale; |
| 1000 } | 1003 } |
| 1001 | 1004 |
| 1002 } // namespace blink | 1005 } // namespace blink |
| OLD | NEW |