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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 | 287 |
| 288 if (mode & TraverseDocumentBoundaries) { | 288 if (mode & TraverseDocumentBoundaries) { |
| 289 if (RenderObject* parentDocRenderer = frame()->ownerRenderer()) { | 289 if (RenderObject* parentDocRenderer = frame()->ownerRenderer()) { |
| 290 transformState.move(-frame()->view()->scrollOffset()); | 290 transformState.move(-frame()->view()->scrollOffset()); |
| 291 if (parentDocRenderer->isBox()) | 291 if (parentDocRenderer->isBox()) |
| 292 transformState.move(toLayoutSize(toRenderBox(parentDocRenderer)- >contentBoxRect().location())); | 292 transformState.move(toLayoutSize(toRenderBox(parentDocRenderer)- >contentBoxRect().location())); |
| 293 parentDocRenderer->mapLocalToContainer(paintInvalidationContainer, t ransformState, mode, wasFixed, paintInvalidationState); | 293 parentDocRenderer->mapLocalToContainer(paintInvalidationContainer, t ransformState, mode, wasFixed, paintInvalidationState); |
| 294 return; | 294 return; |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | |
| 298 // If a container was specified, and was not 0 or the RenderView, | |
| 299 // then we should have found it by now. | |
| 300 ASSERT_ARG(paintInvalidationContainer, !paintInvalidationContainer); | |
| 301 } | 297 } |
| 302 | 298 |
| 303 const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap& geometryMap) const | 299 const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap& geometryMap) const |
| 304 { | 300 { |
| 305 LayoutSize offsetForFixedPosition; | 301 LayoutSize offsetForFixedPosition; |
| 306 LayoutSize offset; | 302 LayoutSize offset; |
| 307 RenderObject* container = 0; | 303 RenderObject* container = 0; |
| 308 | 304 |
| 309 if (m_frameView) | 305 if (m_frameView) |
| 310 offsetForFixedPosition = m_frameView->scrollOffsetForFixedPosition(); | 306 offsetForFixedPosition = m_frameView->scrollOffsetForFixedPosition(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 429 } else { | 425 } else { |
| 430 paintInfo.context->clearRect(paintInfo.rect); | 426 paintInfo.context->clearRect(paintInfo.rect); |
| 431 } | 427 } |
| 432 } | 428 } |
| 433 } | 429 } |
| 434 | 430 |
| 435 void RenderView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval idationState) | 431 void RenderView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval idationState) |
| 436 { | 432 { |
| 437 ASSERT(!needsLayout()); | 433 ASSERT(!needsLayout()); |
| 438 | 434 |
| 439 // We specifically need to issue paint invalidations for the viewRect since other renderers | 435 // We specifically need to repaint the viewRect since other renderers |
|
leviw_travelin_and_unemployed
2014/08/20 18:30:02
Why are you changing the language back to repaint?
chrishtr
2014/08/20 21:39:36
Done.
| |
| 440 // short-circuit on full-paint invalidation. | 436 // short-circuit on full-paint invalidation. |
| 441 if (doingFullPaintInvalidation() && !viewRect().isEmpty()) | 437 LayoutRect dirtyRect = viewRect(); |
| 442 invalidatePaintForRectangle(viewRect()); | 438 if (doingFullPaintInvalidation() && !dirtyRect.isEmpty()) { |
| 443 | 439 const RenderLayerModelObject* paintInvalidationContainer = &paintInvalid ationState.paintInvalidationContainer(); |
| 440 mapRectToPaintInvalidationBacking(paintInvalidationContainer, dirtyRect, IsNotFixedPosition, &paintInvalidationState); | |
| 441 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, Inv alidationFull); | |
| 442 } | |
| 444 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState); | 443 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState); |
| 445 } | 444 } |
| 446 | 445 |
| 447 void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation Rect) const | 446 void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation Rect) const |
| 448 { | 447 { |
| 449 ASSERT(!paintInvalidationRect.isEmpty()); | 448 ASSERT(!paintInvalidationRect.isEmpty()); |
| 450 | 449 |
| 451 if (document().printing() || !m_frameView) | 450 if (document().printing() || !m_frameView) |
| 452 return; | 451 return; |
| 453 | 452 |
| 454 // We always just invalidate the root view, since we could be an iframe that is clipped out | 453 ASSERT(layer()->compositingState() == PaintsIntoOwnBacking || !frame()->owne rRenderer()); |
| 455 // or even invisible. | 454 |
| 456 HTMLFrameOwnerElement* owner = document().ownerElement(); | |
| 457 if (layer()->compositingState() == PaintsIntoOwnBacking) { | 455 if (layer()->compositingState() == PaintsIntoOwnBacking) { |
| 458 layer()->paintInvalidator().setBackingNeedsPaintInvalidationInRect(paint InvalidationRect); | 456 layer()->paintInvalidator().setBackingNeedsPaintInvalidationInRect(paint InvalidationRect); |
| 459 } else if (!owner) { | 457 } else { |
| 460 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(pa intInvalidationRect)); | 458 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(pa intInvalidationRect)); |
| 461 } else if (RenderBox* obj = owner->renderBox()) { | |
| 462 // Intersect the viewport with the paint invalidation rect. | |
| 463 LayoutRect viewRectangle = viewRect(); | |
| 464 LayoutRect rectToInvalidate = intersection(paintInvalidationRect, viewRe ctangle); | |
| 465 | |
| 466 // Adjust for scroll offset of the view. | |
| 467 rectToInvalidate.moveBy(-viewRectangle.location()); | |
| 468 | |
| 469 // Adjust for frame border. | |
| 470 rectToInvalidate.moveBy(obj->contentBoxRect().location()); | |
| 471 obj->invalidatePaintRectangle(rectToInvalidate); | |
| 472 } | 459 } |
| 473 } | 460 } |
| 474 | 461 |
| 475 void RenderView::invalidatePaintForViewAndCompositedLayers() | 462 void RenderView::invalidatePaintForViewAndCompositedLayers() |
| 476 { | 463 { |
| 477 setShouldDoFullPaintInvalidation(true); | 464 setShouldDoFullPaintInvalidation(true); |
| 478 | 465 |
| 479 // The only way we know how to hit these ASSERTS below this point is via the Chromium OS login screen. | 466 // The only way we know how to hit these ASSERTS below this point is via the Chromium OS login screen. |
| 480 DisableCompositingQueryAsserts disabler; | 467 DisableCompositingQueryAsserts disabler; |
| 481 | 468 |
| 482 if (compositor()->inCompositingMode()) | 469 if (compositor()->inCompositingMode()) |
| 483 compositor()->fullyInvalidatePaint(); | 470 compositor()->fullyInvalidatePaint(); |
| 484 } | 471 } |
| 485 | 472 |
| 486 void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, ViewportConstrainedPosition viewp ortConstraint, const PaintInvalidationState*) const | 473 void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, ViewportConstrainedPosition viewp ortConstraint, const PaintInvalidationState* state) const |
| 487 { | 474 { |
| 488 // If a container was specified, and was not 0 or the RenderView, | |
| 489 // then we should have found it by now. | |
| 490 ASSERT_ARG(paintInvalidationContainer, !paintInvalidationContainer || paintI nvalidationContainer == this); | |
| 491 | |
| 492 if (document().printing()) | 475 if (document().printing()) |
| 493 return; | 476 return; |
| 494 | 477 |
| 495 if (style()->isFlippedBlocksWritingMode()) { | 478 if (style()->isFlippedBlocksWritingMode()) { |
| 496 // We have to flip by hand since the view's logical height has not been determined. We | 479 // We have to flip by hand since the view's logical height has not been determined. We |
| 497 // can use the viewport width and height. | 480 // can use the viewport width and height. |
| 498 if (style()->isHorizontalWritingMode()) | 481 if (style()->isHorizontalWritingMode()) |
| 499 rect.setY(viewHeight() - rect.maxY()); | 482 rect.setY(viewHeight() - rect.maxY()); |
| 500 else | 483 else |
| 501 rect.setX(viewWidth() - rect.maxX()); | 484 rect.setX(viewWidth() - rect.maxX()); |
| 502 } | 485 } |
| 503 | 486 |
| 504 ASSERT(viewportConstraint != ViewportConstraintDoesNotMatter); | 487 ASSERT(viewportConstraint != ViewportConstraintDoesNotMatter); |
| 505 if (viewportConstraint == IsFixedPosition && m_frameView) { | 488 if (viewportConstraint == IsFixedPosition && m_frameView) { |
| 506 rect.move(m_frameView->scrollOffsetForFixedPosition()); | 489 rect.move(m_frameView->scrollOffsetForFixedPosition()); |
| 507 // If we have a pending scroll, invalidate the previous scroll position. | 490 // If we have a pending scroll, invalidate the previous scroll position. |
| 508 if (!m_frameView->pendingScrollDelta().isZero()) { | 491 if (!m_frameView->pendingScrollDelta().isZero()) { |
| 509 rect.move(-m_frameView->pendingScrollDelta()); | 492 rect.move(-m_frameView->pendingScrollDelta()); |
| 510 } | 493 } |
| 511 } | 494 } |
| 512 | 495 |
| 513 // Apply our transform if we have one (because of full page zooming). | 496 // Apply our transform if we have one (because of full page zooming). |
| 514 if (!paintInvalidationContainer && layer() && layer()->transform()) | 497 if (!paintInvalidationContainer && layer() && layer()->transform()) |
| 515 rect = layer()->transform()->mapRect(rect); | 498 rect = layer()->transform()->mapRect(rect); |
| 499 | |
| 500 ASSERT(paintInvalidationContainer); | |
| 501 if (paintInvalidationContainer == this) | |
| 502 return; | |
| 503 | |
| 504 Element* owner = document().ownerElement(); | |
| 505 if (!owner) | |
| 506 return; | |
| 507 | |
| 508 if (RenderBox* obj = owner->renderBox()) { | |
| 509 // Intersect the viewport with the paint invalidation rect. | |
| 510 LayoutRect viewRectangle = viewRect(); | |
| 511 rect.intersect(viewRectangle); | |
| 512 | |
| 513 // Adjust for scroll offset of the view. | |
| 514 rect.moveBy(-viewRectangle.location()); | |
| 515 | |
| 516 // Adjust for frame border. | |
| 517 rect.moveBy(obj->contentBoxRect().location()); | |
| 518 obj->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, IsNotFixedPosition, 0); | |
| 519 } | |
| 516 } | 520 } |
| 517 | 521 |
| 522 | |
| 518 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu latedOffset) const | 523 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu latedOffset) const |
| 519 { | 524 { |
| 520 rects.append(pixelSnappedIntRect(accumulatedOffset, layer()->size())); | 525 rects.append(pixelSnappedIntRect(accumulatedOffset, layer()->size())); |
| 521 } | 526 } |
| 522 | 527 |
| 523 void RenderView::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const | 528 void RenderView::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const |
| 524 { | 529 { |
| 525 if (wasFixed) | 530 if (wasFixed) |
| 526 *wasFixed = false; | 531 *wasFixed = false; |
| 527 quads.append(FloatRect(FloatPoint(), layer()->size())); | 532 quads.append(FloatRect(FloatPoint(), layer()->size())); |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 982 return viewWidth(IncludeScrollbars) / scale; | 987 return viewWidth(IncludeScrollbars) / scale; |
| 983 } | 988 } |
| 984 | 989 |
| 985 double RenderView::layoutViewportHeight() const | 990 double RenderView::layoutViewportHeight() const |
| 986 { | 991 { |
| 987 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; | 992 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; |
| 988 return viewHeight(IncludeScrollbars) / scale; | 993 return viewHeight(IncludeScrollbars) / scale; |
| 989 } | 994 } |
| 990 | 995 |
| 991 } // namespace blink | 996 } // namespace blink |
| OLD | NEW |