Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: Source/core/rendering/RenderView.cpp

Issue 455883002: Re-land of: Allow paint invalidation containers to cross frame boundaries. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 } 418 }
423 } 419 }
424 } 420 }
425 421
426 void RenderView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval idationState) 422 void RenderView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval idationState)
427 { 423 {
428 ASSERT(!needsLayout()); 424 ASSERT(!needsLayout());
429 425
430 // We specifically need to repaint the viewRect since other renderers 426 // We specifically need to repaint the viewRect since other renderers
431 // short-circuit on full-repaint. 427 // short-circuit on full-repaint.
432 if (doingFullPaintInvalidation() && !viewRect().isEmpty()) 428 LayoutRect dirtyRect = viewRect();
433 invalidatePaintForRectangle(viewRect()); 429 if (doingFullPaintInvalidation() && !dirtyRect.isEmpty()) {
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 // We always just invalidate the root view, since we could be an iframe that is clipped out 445 ASSERT(layer()->compositingState() == PaintsIntoOwnBacking || !frame()->owne rRenderer());
446 // or even invisible. 446
447 Element* owner = document().ownerElement();
448 if (layer()->compositingState() == PaintsIntoOwnBacking) { 447 if (layer()->compositingState() == PaintsIntoOwnBacking) {
449 layer()->repainter().setBackingNeedsRepaintInRect(paintInvalidationRect) ; 448 layer()->repainter().setBackingNeedsRepaintInRect(paintInvalidationRect) ;
450 } else if (!owner) { 449 } else {
451 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(pa intInvalidationRect)); 450 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);
463 } 451 }
464 } 452 }
465 453
466 void RenderView::invalidatePaintForViewAndCompositedLayers() 454 void RenderView::invalidatePaintForViewAndCompositedLayers()
467 { 455 {
468 paintInvalidationForWholeRenderer(); 456 paintInvalidationForWholeRenderer();
469 457
470 // The only way we know how to hit these ASSERTS below this point is via the Chromium OS login screen. 458 // The only way we know how to hit these ASSERTS below this point is via the Chromium OS login screen.
471 DisableCompositingQueryAsserts disabler; 459 DisableCompositingQueryAsserts disabler;
472 460
473 if (compositor()->inCompositingMode()) 461 if (compositor()->inCompositingMode())
474 compositor()->fullyInvalidatePaint(); 462 compositor()->fullyInvalidatePaint();
475 } 463 }
476 464
477 void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, bool fixed, const PaintInvalidati onState* paintInvalidationState) const 465 void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, bool fixed, const PaintInvalidati onState* paintInvalidationState) const
478 { 466 {
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
483 if (document().printing()) 467 if (document().printing())
484 return; 468 return;
485 469
486 if (style()->isFlippedBlocksWritingMode()) { 470 if (style()->isFlippedBlocksWritingMode()) {
487 // We have to flip by hand since the view's logical height has not been determined. We 471 // We have to flip by hand since the view's logical height has not been determined. We
488 // can use the viewport width and height. 472 // can use the viewport width and height.
489 if (style()->isHorizontalWritingMode()) 473 if (style()->isHorizontalWritingMode())
490 rect.setY(viewHeight() - rect.maxY()); 474 rect.setY(viewHeight() - rect.maxY());
491 else 475 else
492 rect.setX(viewWidth() - rect.maxX()); 476 rect.setX(viewWidth() - rect.maxX());
493 } 477 }
494 478
495 if (fixed && m_frameView) { 479 if (fixed && m_frameView) {
496 rect.move(m_frameView->scrollOffsetForFixedPosition()); 480 rect.move(m_frameView->scrollOffsetForFixedPosition());
497 // If we have a pending scroll, invalidate the previous scroll position. 481 // If we have a pending scroll, invalidate the previous scroll position.
498 if (!m_frameView->pendingScrollDelta().isZero()) { 482 if (!m_frameView->pendingScrollDelta().isZero()) {
499 rect.move(-m_frameView->pendingScrollDelta()); 483 rect.move(-m_frameView->pendingScrollDelta());
500 } 484 }
501 } 485 }
502 486
503 // Apply our transform if we have one (because of full page zooming). 487 // Apply our transform if we have one (because of full page zooming).
504 if (!paintInvalidationContainer && layer() && layer()->transform()) 488 if (!paintInvalidationContainer && layer() && layer()->transform())
505 rect = layer()->transform()->mapRect(rect); 489 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 }
506 } 511 }
507 512
508 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu latedOffset) const 513 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu latedOffset) const
509 { 514 {
510 rects.append(pixelSnappedIntRect(accumulatedOffset, layer()->size())); 515 rects.append(pixelSnappedIntRect(accumulatedOffset, layer()->size()));
511 } 516 }
512 517
513 void RenderView::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const 518 void RenderView::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
514 { 519 {
515 if (wasFixed) 520 if (wasFixed)
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 return viewWidth(IncludeScrollbars) / scale; 977 return viewWidth(IncludeScrollbars) / scale;
973 } 978 }
974 979
975 double RenderView::layoutViewportHeight() const 980 double RenderView::layoutViewportHeight() const
976 { 981 {
977 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; 982 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1;
978 return viewHeight(IncludeScrollbars) / scale; 983 return viewHeight(IncludeScrollbars) / scale;
979 } 984 }
980 985
981 } // namespace blink 986 } // namespace blink
OLDNEW
« Source/core/rendering/RenderObject.cpp ('K') | « Source/core/rendering/RenderObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698