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

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

Issue 473093002: Revert "Re-land of: Allow paint invalidation containers to cross frame boundaries." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix compile error 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
« no previous file with comments | « Source/core/rendering/RenderObject.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(repaintContainer, transformSt ate, mode, wasFixed, paintInvalidationState); 293 parentDocRenderer->mapLocalToContainer(repaintContainer, transformSt ate, 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(repaintContainer, !repaintContainer);
297 } 301 }
298 302
299 const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap& geometryMap) const 303 const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap& geometryMap) const
300 { 304 {
301 LayoutSize offsetForFixedPosition; 305 LayoutSize offsetForFixedPosition;
302 LayoutSize offset; 306 LayoutSize offset;
303 RenderObject* container = 0; 307 RenderObject* container = 0;
304 308
305 if (m_frameView) 309 if (m_frameView)
306 offsetForFixedPosition = m_frameView->scrollOffsetForFixedPosition(); 310 offsetForFixedPosition = m_frameView->scrollOffsetForFixedPosition();
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } 431 }
428 } 432 }
429 } 433 }
430 434
431 void RenderView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval idationState) 435 void RenderView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval idationState)
432 { 436 {
433 ASSERT(!needsLayout()); 437 ASSERT(!needsLayout());
434 438
435 // We specifically need to repaint the viewRect since other renderers 439 // We specifically need to repaint the viewRect since other renderers
436 // short-circuit on full-repaint. 440 // short-circuit on full-repaint.
437 LayoutRect dirtyRect = viewRect(); 441 if (doingFullPaintInvalidation() && !viewRect().isEmpty())
438 if (doingFullPaintInvalidation() && !dirtyRect.isEmpty()) { 442 invalidatePaintForRectangle(viewRect());
439 const RenderLayerModelObject* paintInvalidationContainer = &paintInvalid ationState.paintInvalidationContainer();
440 mapRectToPaintInvalidationBacking(paintInvalidationContainer, dirtyRect) ;
441 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, Inv alidationFull);
442 }
443 443
444 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState); 444 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState);
445 } 445 }
446 446
447 void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation Rect) const 447 void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation Rect) const
448 { 448 {
449 ASSERT(!paintInvalidationRect.isEmpty()); 449 ASSERT(!paintInvalidationRect.isEmpty());
450 450
451 if (document().printing() || !m_frameView) 451 if (document().printing() || !m_frameView)
452 return; 452 return;
453 453
454 ASSERT(layer()->compositingState() == PaintsIntoOwnBacking || !frame()->owne rRenderer()); 454 // We always just invalidate the root view, since we could be an iframe that is clipped out
455 455 // or even invisible.
456 Element* owner = document().ownerElement();
456 if (layer()->compositingState() == PaintsIntoOwnBacking) { 457 if (layer()->compositingState() == PaintsIntoOwnBacking) {
457 layer()->paintInvalidator().setBackingNeedsRepaintInRect(paintInvalidati onRect); 458 layer()->paintInvalidator().setBackingNeedsRepaintInRect(paintInvalidati onRect);
458 } else { 459 } else if (!owner) {
459 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(pa intInvalidationRect)); 460 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);
460 } 472 }
461 } 473 }
462 474
463 void RenderView::invalidatePaintForViewAndCompositedLayers() 475 void RenderView::invalidatePaintForViewAndCompositedLayers()
464 { 476 {
465 paintInvalidationForWholeRenderer(); 477 paintInvalidationForWholeRenderer();
466 478
467 // 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.
468 DisableCompositingQueryAsserts disabler; 480 DisableCompositingQueryAsserts disabler;
469 481
470 if (compositor()->inCompositingMode()) 482 if (compositor()->inCompositingMode())
471 compositor()->fullyInvalidatePaint(); 483 compositor()->fullyInvalidatePaint();
472 } 484 }
473 485
474 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
475 { 487 {
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
476 if (document().printing()) 492 if (document().printing())
477 return; 493 return;
478 494
479 if (style()->isFlippedBlocksWritingMode()) { 495 if (style()->isFlippedBlocksWritingMode()) {
480 // We have to flip by hand since the view's logical height has not been determined. We 496 // We have to flip by hand since the view's logical height has not been determined. We
481 // can use the viewport width and height. 497 // can use the viewport width and height.
482 if (style()->isHorizontalWritingMode()) 498 if (style()->isHorizontalWritingMode())
483 rect.setY(viewHeight() - rect.maxY()); 499 rect.setY(viewHeight() - rect.maxY());
484 else 500 else
485 rect.setX(viewWidth() - rect.maxX()); 501 rect.setX(viewWidth() - rect.maxX());
486 } 502 }
487 503
488 if (fixed && m_frameView) { 504 if (fixed && m_frameView) {
489 rect.move(m_frameView->scrollOffsetForFixedPosition()); 505 rect.move(m_frameView->scrollOffsetForFixedPosition());
490 // If we have a pending scroll, invalidate the previous scroll position. 506 // If we have a pending scroll, invalidate the previous scroll position.
491 if (!m_frameView->pendingScrollDelta().isZero()) { 507 if (!m_frameView->pendingScrollDelta().isZero()) {
492 rect.move(-m_frameView->pendingScrollDelta()); 508 rect.move(-m_frameView->pendingScrollDelta());
493 } 509 }
494 } 510 }
495 511
496 // Apply our transform if we have one (because of full page zooming). 512 // Apply our transform if we have one (because of full page zooming).
497 if (!paintInvalidationContainer && layer() && layer()->transform()) 513 if (!paintInvalidationContainer && layer() && layer()->transform())
498 rect = layer()->transform()->mapRect(rect); 514 rect = layer()->transform()->mapRect(rect);
499
500 ASSERT(paintInvalidationContainer);
501
502 if (paintInvalidationContainer == this)
503 return;
504
505 Element* owner = document().ownerElement();
506 if (!owner)
507 return;
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 }
520 } 515 }
521 516
522 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu latedOffset) const 517 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu latedOffset) const
523 { 518 {
524 rects.append(pixelSnappedIntRect(accumulatedOffset, layer()->size())); 519 rects.append(pixelSnappedIntRect(accumulatedOffset, layer()->size()));
525 } 520 }
526 521
527 void RenderView::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const 522 void RenderView::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
528 { 523 {
529 if (wasFixed) 524 if (wasFixed)
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 return viewWidth(IncludeScrollbars) / scale; 981 return viewWidth(IncludeScrollbars) / scale;
987 } 982 }
988 983
989 double RenderView::layoutViewportHeight() const 984 double RenderView::layoutViewportHeight() const
990 { 985 {
991 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; 986 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1;
992 return viewHeight(IncludeScrollbars) / scale; 987 return viewHeight(IncludeScrollbars) / scale;
993 } 988 }
994 989
995 } // namespace blink 990 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698