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

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

Issue 482063005: Allow paint invalidation containers to cross frame boundaries. (re-land #2) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Made it work with position:fixed. 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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) ;
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 paintInvalidationForWholeRenderer(); 464 paintInvalidationForWholeRenderer();
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, bool fixed, const PaintInvalidati onState* paintInvalidationState) const 473 void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, bool fixed, const PaintInvalidati onState* paintInvalidationState) 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 if (fixed && m_frameView) { 487 if (fixed && m_frameView) {
505 rect.move(m_frameView->scrollOffsetForFixedPosition()); 488 rect.move(m_frameView->scrollOffsetForFixedPosition());
506 // If we have a pending scroll, invalidate the previous scroll position. 489 // If we have a pending scroll, invalidate the previous scroll position.
507 if (!m_frameView->pendingScrollDelta().isZero()) { 490 if (!m_frameView->pendingScrollDelta().isZero()) {
508 rect.move(-m_frameView->pendingScrollDelta()); 491 rect.move(-m_frameView->pendingScrollDelta());
509 } 492 }
510 } 493 }
511 494
512 // Apply our transform if we have one (because of full page zooming). 495 // Apply our transform if we have one (because of full page zooming).
513 if (!paintInvalidationContainer && layer() && layer()->transform()) 496 if (!paintInvalidationContainer && layer() && layer()->transform())
514 rect = layer()->transform()->mapRect(rect); 497 rect = layer()->transform()->mapRect(rect);
498
499 ASSERT(paintInvalidationContainer);
500 if (paintInvalidationContainer == this)
501 return;
502
503 Element* owner = document().ownerElement();
504 if (!owner)
505 return;
506
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) ;
519 }
515 } 520 }
516 521
522
517 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu latedOffset) const 523 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu latedOffset) const
518 { 524 {
519 rects.append(pixelSnappedIntRect(accumulatedOffset, layer()->size())); 525 rects.append(pixelSnappedIntRect(accumulatedOffset, layer()->size()));
520 } 526 }
521 527
522 void RenderView::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const 528 void RenderView::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
523 { 529 {
524 if (wasFixed) 530 if (wasFixed)
525 *wasFixed = false; 531 *wasFixed = false;
526 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
981 return viewWidth(IncludeScrollbars) / scale; 987 return viewWidth(IncludeScrollbars) / scale;
982 } 988 }
983 989
984 double RenderView::layoutViewportHeight() const 990 double RenderView::layoutViewportHeight() const
985 { 991 {
986 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; 992 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1;
987 return viewHeight(IncludeScrollbars) / scale; 993 return viewHeight(IncludeScrollbars) / scale;
988 } 994 }
989 995
990 } // namespace blink 996 } // namespace blink
OLDNEW
« Source/core/rendering/PaintInvalidationState.cpp ('K') | « Source/core/rendering/RenderView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698