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

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

Issue 264183002: RAL: Eliminate n^2 walk to find repaint containers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: One more simple rebaseline... Created 6 years, 7 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/RenderBox.h ('k') | Source/core/rendering/RenderLayer.h » ('j') | 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 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 } 1539 }
1540 1540
1541 layerRenderer->repaintRectangle(geometry.destRect()); 1541 layerRenderer->repaintRectangle(geometry.destRect());
1542 if (geometry.destRect() == rendererRect) 1542 if (geometry.destRect() == rendererRect)
1543 return true; 1543 return true;
1544 } 1544 }
1545 } 1545 }
1546 return false; 1546 return false;
1547 } 1547 }
1548 1548
1549 void RenderBox::repaintTreeAfterLayout() 1549 void RenderBox::repaintTreeAfterLayout(const RenderLayerModelObject& repaintCont ainer)
1550 { 1550 {
1551 // FIXME: Currently only using this logic for RenderBox and its ilk. Ideally , RenderBlockFlows with 1551 // FIXME: Currently only using this logic for RenderBox and its ilk. Ideally , RenderBlockFlows with
1552 // inline children should track a dirty rect in local coordinates for dirty lines instead of repainting 1552 // inline children should track a dirty rect in local coordinates for dirty lines instead of repainting
1553 // the world. 1553 // the world.
1554 // FIXME: We should still be recursing through inline's children, as they ca n have boxes, but we don't 1554 // FIXME: We should still be recursing through inline's children, as they ca n have boxes, but we don't
1555 // appear to have tests for this? 1555 // appear to have tests for this?
1556 // FIXME: SVG should probably also go through this unified repaint system. 1556 // FIXME: SVG should probably also go through this unified repaint system.
1557 1557
1558 ASSERT(RuntimeEnabledFeatures::repaintAfterLayoutEnabled()); 1558 ASSERT(RuntimeEnabledFeatures::repaintAfterLayoutEnabled());
1559 ASSERT(!needsLayout()); 1559 ASSERT(!needsLayout());
1560 1560
1561 if (!shouldCheckForInvalidationAfterLayout()) 1561 if (!shouldCheckForInvalidationAfterLayout())
1562 return; 1562 return;
1563 1563
1564 bool establishesNewRepaintContainer = isRepaintContainer();
1565 const RenderLayerModelObject& newRepaintContainer = *adjustCompositedContain erForSpecialAncestors(establishesNewRepaintContainer ? this : &repaintContainer) ;
1566 // FIXME: This assert should be re-enabled when we move repaint to after com positing update. crbug.com/360286
1567 // ASSERT(&newRepaintContainer == containerForRepaint());
1568
1564 const LayoutRect oldRepaintRect = previousRepaintRect(); 1569 const LayoutRect oldRepaintRect = previousRepaintRect();
1565 const LayoutPoint oldPositionFromRepaintContainer = previousPositionFromRepa intContainer(); 1570 const LayoutPoint oldPositionFromRepaintContainer = previousPositionFromRepa intContainer();
1566 const RenderLayerModelObject* repaintContainer = containerForRepaint(); 1571 setPreviousRepaintRect(clippedOverflowRectForRepaint(&newRepaintContainer));
1567 setPreviousRepaintRect(clippedOverflowRectForRepaint(repaintContainer)); 1572 setPreviousPositionFromRepaintContainer(positionFromRepaintContainer(&newRep aintContainer));
1568 setPreviousPositionFromRepaintContainer(positionFromRepaintContainer(repaint Container));
1569 1573
1570 // If we are set to do a full repaint that means the RenderView will be 1574 // If we are set to do a full repaint that means the RenderView will be
1571 // invalidated. We can then skip issuing of invalidations for the child 1575 // invalidated. We can then skip issuing of invalidations for the child
1572 // renderers as they'll be covered by the RenderView. 1576 // renderers as they'll be covered by the RenderView.
1573 if (view()->doingFullRepaint() && this != view()) { 1577 if (view()->doingFullRepaint() && this != view()) {
1574 LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : l ocationOffset()); 1578 LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : l ocationOffset());
1575 RenderObject::repaintTreeAfterLayout(); 1579 RenderObject::repaintTreeAfterLayout(newRepaintContainer);
1576 return; 1580 return;
1577 } 1581 }
1578 1582
1579 if ((onlyNeededPositionedMovementLayout() && compositingState() != PaintsInt oOwnBacking) 1583 if ((onlyNeededPositionedMovementLayout() && compositingState() != PaintsInt oOwnBacking)
1580 || (shouldDoFullRepaintIfSelfPaintingLayer() 1584 || (shouldDoFullRepaintIfSelfPaintingLayer()
1581 && hasLayer() 1585 && hasLayer()
1582 && layer()->isSelfPaintingLayer())) { 1586 && layer()->isSelfPaintingLayer())) {
1583 setShouldDoFullRepaintAfterLayout(true); 1587 setShouldDoFullRepaintAfterLayout(true);
1584 } 1588 }
1585 1589
1586 const LayoutRect& newRepaintRect = previousRepaintRect(); 1590 const LayoutRect& newRepaintRect = previousRepaintRect();
1587 const LayoutPoint& newPositionFromRepaintContainer = previousPositionFromRep aintContainer(); 1591 const LayoutPoint& newPositionFromRepaintContainer = previousPositionFromRep aintContainer();
1588 bool didFullRepaint = repaintAfterLayoutIfNeeded(containerForRepaint(), 1592 bool didFullRepaint = repaintAfterLayoutIfNeeded(&newRepaintContainer,
1589 shouldDoFullRepaintAfterLayout(), oldRepaintRect, oldPositionFromRepaint Container, &newRepaintRect, &newPositionFromRepaintContainer); 1593 shouldDoFullRepaintAfterLayout(), oldRepaintRect, oldPositionFromRepaint Container, &newRepaintRect, &newPositionFromRepaintContainer);
1590 1594
1591 if (!didFullRepaint) 1595 if (!didFullRepaint)
1592 repaintOverflowIfNeeded(); 1596 repaintOverflowIfNeeded();
1593 1597
1594 // Repaint any scrollbars if there is a scrollable area for this renderer. 1598 // Repaint any scrollbars if there is a scrollable area for this renderer.
1595 if (enclosingLayer()) { 1599 if (enclosingLayer()) {
1596 if (RenderLayerScrollableArea* area = enclosingLayer()->scrollableArea() ) { 1600 if (RenderLayerScrollableArea* area = enclosingLayer()->scrollableArea() ) {
1597 if (area->hasVerticalBarDamage()) 1601 if (area->hasVerticalBarDamage())
1598 repaintRectangle(area->verticalBarDamage()); 1602 repaintRectangle(area->verticalBarDamage());
1599 if (area->hasHorizontalBarDamage()) 1603 if (area->hasHorizontalBarDamage())
1600 repaintRectangle(area->horizontalBarDamage()); 1604 repaintRectangle(area->horizontalBarDamage());
1601 area->resetScrollbarDamage(); 1605 area->resetScrollbarDamage();
1602 } 1606 }
1603 } 1607 }
1604 1608
1605 // FIXME: This concept of a tree walking state for fast lookups should be ge neralized away from 1609 // FIXME: LayoutState should be enabled for other repaint containers than th e RenderView. crbug.com/363834
1606 // just layout. 1610 if (establishesNewRepaintContainer) {
1607 // FIXME: Table rows shouldn't be special-cased. 1611 LayoutStateDisabler disabler(*this);
1608 LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : locat ionOffset()); 1612 RenderObject::repaintTreeAfterLayout(newRepaintContainer);
1609 RenderObject::repaintTreeAfterLayout(); 1613 } else {
1614 // FIXME: This concept of a tree walking state for fast lookups should b e generalized away from
1615 // just layout.
1616 // FIXME: Table rows shouldn't be special-cased.
1617 LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : l ocationOffset());
1618 RenderObject::repaintTreeAfterLayout(newRepaintContainer);
1619 }
1610 } 1620 }
1611 1621
1612 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu latedOffset, ContentsClipBehavior contentsClipBehavior) 1622 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu latedOffset, ContentsClipBehavior contentsClipBehavior)
1613 { 1623 {
1614 if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == Paint PhaseSelfOutline || paintInfo.phase == PaintPhaseMask) 1624 if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == Paint PhaseSelfOutline || paintInfo.phase == PaintPhaseMask)
1615 return false; 1625 return false;
1616 1626
1617 bool isControlClip = hasControlClip(); 1627 bool isControlClip = hasControlClip();
1618 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer(); 1628 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer();
1619 1629
(...skipping 3051 matching lines...) Expand 10 before | Expand all | Expand 10 after
4671 return 0; 4681 return 0;
4672 4682
4673 if (!layoutState && !flowThreadContainingBlock()) 4683 if (!layoutState && !flowThreadContainingBlock())
4674 return 0; 4684 return 0;
4675 4685
4676 RenderBlock* containerBlock = containingBlock(); 4686 RenderBlock* containerBlock = containingBlock();
4677 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4687 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4678 } 4688 }
4679 4689
4680 } // namespace WebCore 4690 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698