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

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

Issue 478733002: Rename repaint to paintInvalidation for remaining methods. (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
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBlockFlow.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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 386
387 // Take care of positioned objects. This is required as PaintInvalidationSta te keeps a single clip rect. 387 // Take care of positioned objects. This is required as PaintInvalidationSta te keeps a single clip rect.
388 if (TrackedRendererListHashSet* positionedObjects = this->positionedObjects( )) { 388 if (TrackedRendererListHashSet* positionedObjects = this->positionedObjects( )) {
389 TrackedRendererListHashSet::iterator end = positionedObjects->end(); 389 TrackedRendererListHashSet::iterator end = positionedObjects->end();
390 bool establishesNewPaintInvalidationContainer = isPaintInvalidationConta iner(); 390 bool establishesNewPaintInvalidationContainer = isPaintInvalidationConta iner();
391 const RenderLayerModelObject& newPaintInvalidationContainer = *adjustCom positedContainerForSpecialAncestors(establishesNewPaintInvalidationContainer ? t his : &paintInvalidationState.paintInvalidationContainer()); 391 const RenderLayerModelObject& newPaintInvalidationContainer = *adjustCom positedContainerForSpecialAncestors(establishesNewPaintInvalidationContainer ? t his : &paintInvalidationState.paintInvalidationContainer());
392 PaintInvalidationState childPaintInvalidationState(paintInvalidationStat e, *this, newPaintInvalidationContainer); 392 PaintInvalidationState childPaintInvalidationState(paintInvalidationStat e, *this, newPaintInvalidationContainer);
393 for (TrackedRendererListHashSet::iterator it = positionedObjects->begin( ); it != end; ++it) { 393 for (TrackedRendererListHashSet::iterator it = positionedObjects->begin( ); it != end; ++it) {
394 RenderBox* box = *it; 394 RenderBox* box = *it;
395 395
396 // One of the renderers we're skipping over here may be the child's repaint container, 396 // One of the renderers we're skipping over here may be the child's paint invalidation container,
397 // so we can't pass our own repaint container along. 397 // so we can't pass our own paint invalidation container along.
398 const RenderLayerModelObject& repaintContainerForChild = *box->conta inerForPaintInvalidation(); 398 const RenderLayerModelObject& paintInvalidationContainerForChild = * box->containerForPaintInvalidation();
399 399
400 // If it's a new paint invalidation container, we won't have properl y accumulated the offset into the 400 // If it's a new paint invalidation container, we won't have properl y accumulated the offset into the
401 // PaintInvalidationState. 401 // PaintInvalidationState.
402 // FIXME: Teach PaintInvalidationState to handle this case. crbug.co m/371485 402 // FIXME: Teach PaintInvalidationState to handle this case. crbug.co m/371485
403 if (&repaintContainerForChild != newPaintInvalidationContainer) { 403 if (&paintInvalidationContainerForChild != newPaintInvalidationConta iner) {
404 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInvalida tionState); 404 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInvalida tionState);
405 PaintInvalidationState disabledPaintInvalidationState(childPaint InvalidationState, *this, repaintContainerForChild); 405 PaintInvalidationState disabledPaintInvalidationState(childPaint InvalidationState, *this, paintInvalidationContainerForChild);
406 box->invalidateTreeIfNeeded(disabledPaintInvalidationState); 406 box->invalidateTreeIfNeeded(disabledPaintInvalidationState);
407 continue; 407 continue;
408 } 408 }
409 409
410 // If the positioned renderer is absolutely positioned and it is ins ide 410 // If the positioned renderer is absolutely positioned and it is ins ide
411 // a relatively positioned inline element, we need to account for 411 // a relatively positioned inline element, we need to account for
412 // the inline elements position in PaintInvalidationState. 412 // the inline elements position in PaintInvalidationState.
413 if (box->style()->position() == AbsolutePosition) { 413 if (box->style()->position() == AbsolutePosition) {
414 RenderObject* container = box->container(&repaintContainerForChi ld, 0); 414 RenderObject* container = box->container(&paintInvalidationConta inerForChild, 0);
415 if (container->isRelPositioned() && container->isRenderInline()) { 415 if (container->isRelPositioned() && container->isRenderInline()) {
416 // FIXME: We should be able to use PaintInvalidationState fo r this. 416 // FIXME: We should be able to use PaintInvalidationState fo r this.
417 // Currently, we will place absolutely positioned elements i nside 417 // Currently, we will place absolutely positioned elements i nside
418 // relatively positioned inline blocks in the wrong location . crbug.com/371485 418 // relatively positioned inline blocks in the wrong location . crbug.com/371485
419 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInva lidationState); 419 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInva lidationState);
420 PaintInvalidationState disabledPaintInvalidationState(childP aintInvalidationState, *this, repaintContainerForChild); 420 PaintInvalidationState disabledPaintInvalidationState(childP aintInvalidationState, *this, paintInvalidationContainerForChild);
421 box->invalidateTreeIfNeeded(disabledPaintInvalidationState); 421 box->invalidateTreeIfNeeded(disabledPaintInvalidationState);
422 continue; 422 continue;
423 } 423 }
424 } 424 }
425 425
426 box->invalidateTreeIfNeeded(childPaintInvalidationState); 426 box->invalidateTreeIfNeeded(childPaintInvalidationState);
427 } 427 }
428 } 428 }
429 } 429 }
430 430
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 addOverflowFromChild(positionedObject, LayoutSize(positionedObject-> x(), positionedObject->y())); 1511 addOverflowFromChild(positionedObject, LayoutSize(positionedObject-> x(), positionedObject->y()));
1512 } 1512 }
1513 } 1513 }
1514 1514
1515 void RenderBlock::addVisualOverflowFromTheme() 1515 void RenderBlock::addVisualOverflowFromTheme()
1516 { 1516 {
1517 if (!style()->hasAppearance()) 1517 if (!style()->hasAppearance())
1518 return; 1518 return;
1519 1519
1520 IntRect inflatedRect = pixelSnappedBorderBoxRect(); 1520 IntRect inflatedRect = pixelSnappedBorderBoxRect();
1521 RenderTheme::theme().adjustRepaintRect(this, inflatedRect); 1521 RenderTheme::theme().adjustPaintInvalidationRect(this, inflatedRect);
1522 addVisualOverflow(inflatedRect); 1522 addVisualOverflow(inflatedRect);
1523 } 1523 }
1524 1524
1525 bool RenderBlock::createsBlockFormattingContext() const 1525 bool RenderBlock::createsBlockFormattingContext() const
1526 { 1526 {
1527 return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || isFlexItemIncludingDeprecated() 1527 return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || isFlexItemIncludingDeprecated()
1528 || style()->specifiesColumns() || isRenderFlowThread() || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isDocumentElement( ) || style()->columnSpan(); 1528 || style()->specifiesColumns() || isRenderFlowThread() || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isDocumentElement( ) || style()->columnSpan();
1529 } 1529 }
1530 1530
1531 void RenderBlock::updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, R enderBox* child) 1531 void RenderBlock::updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, R enderBox* child)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 // Check if we need to do a full layout. 1576 // Check if we need to do a full layout.
1577 if (normalChildNeedsLayout() || selfNeedsLayout()) 1577 if (normalChildNeedsLayout() || selfNeedsLayout())
1578 return false; 1578 return false;
1579 1579
1580 // Check that we actually need to do a simplified layout. 1580 // Check that we actually need to do a simplified layout.
1581 if (!posChildNeedsLayout() && !(needsSimplifiedNormalFlowLayout() || needsPo sitionedMovementLayout())) 1581 if (!posChildNeedsLayout() && !(needsSimplifiedNormalFlowLayout() || needsPo sitionedMovementLayout()))
1582 return false; 1582 return false;
1583 1583
1584 1584
1585 { 1585 {
1586 // LayoutState needs this deliberate scope to pop before repaint 1586 // LayoutState needs this deliberate scope to pop before paint invalidat ion.
1587 LayoutState state(*this, locationOffset()); 1587 LayoutState state(*this, locationOffset());
1588 1588
1589 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovement Only()) 1589 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovement Only())
1590 return false; 1590 return false;
1591 1591
1592 TextAutosizer::LayoutScope textAutosizerLayoutScope(this); 1592 TextAutosizer::LayoutScope textAutosizerLayoutScope(this);
1593 1593
1594 // Lay out positioned descendants or objects that just need to recompute overflow. 1594 // Lay out positioned descendants or objects that just need to recompute overflow.
1595 if (needsSimplifiedNormalFlowLayout()) 1595 if (needsSimplifiedNormalFlowLayout())
1596 simplifiedNormalFlowLayout(); 1596 simplifiedNormalFlowLayout();
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 currLogicalTopOffset += blockDelta; 1956 currLogicalTopOffset += blockDelta;
1957 else 1957 else
1958 currLogicalTopOffset -= blockDelta; 1958 currLogicalTopOffset -= blockDelta;
1959 } 1959 }
1960 } 1960 }
1961 1961
1962 void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf fset) 1962 void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf fset)
1963 { 1963 {
1964 // Avoid painting descendants of the root element when stylesheets haven't l oaded. This eliminates FOUC. 1964 // Avoid painting descendants of the root element when stylesheets haven't l oaded. This eliminates FOUC.
1965 // It's ok not to draw, because later on, when all the stylesheets do load, styleResolverChanged() on the Document 1965 // It's ok not to draw, because later on, when all the stylesheets do load, styleResolverChanged() on the Document
1966 // will do a full repaint. 1966 // will do a full paint invalidation.
1967 if (document().didLayoutWithPendingStylesheets() && !isRenderView()) 1967 if (document().didLayoutWithPendingStylesheets() && !isRenderView())
1968 return; 1968 return;
1969 1969
1970 if (childrenInline()) 1970 if (childrenInline())
1971 m_lineBoxes.paint(this, paintInfo, paintOffset); 1971 m_lineBoxes.paint(this, paintInfo, paintOffset);
1972 else { 1972 else {
1973 PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? Pai ntPhaseOutline : paintInfo.phase; 1973 PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? Pai ntPhaseOutline : paintInfo.phase;
1974 newPhase = (newPhase == PaintPhaseChildBlockBackgrounds) ? PaintPhaseChi ldBlockBackground : newPhase; 1974 newPhase = (newPhase == PaintPhaseChildBlockBackgrounds) ? PaintPhaseChi ldBlockBackground : newPhase;
1975 1975
1976 // We don't paint our own background, but we do let the kids paint their backgrounds. 1976 // We don't paint our own background, but we do let the kids paint their backgrounds.
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 2254
2255 if (view() && view()->selectionStart()) { 2255 if (view() && view()->selectionStart()) {
2256 Node* startElement = view()->selectionStart()->node(); 2256 Node* startElement = view()->selectionStart()->node();
2257 if (startElement && startElement->rootEditableElement() == node()) 2257 if (startElement && startElement->rootEditableElement() == node())
2258 return true; 2258 return true;
2259 } 2259 }
2260 2260
2261 return false; 2261 return false;
2262 } 2262 }
2263 2263
2264 GapRects RenderBlock::selectionGapRectsForRepaint(const RenderLayerModelObject* repaintContainer) 2264 GapRects RenderBlock::selectionGapRectsForPaintInvalidation(const RenderLayerMod elObject* paintInvalidationContainer)
2265 { 2265 {
2266 ASSERT(!needsLayout()); 2266 ASSERT(!needsLayout());
2267 2267
2268 if (!shouldPaintSelectionGaps()) 2268 if (!shouldPaintSelectionGaps())
2269 return GapRects(); 2269 return GapRects();
2270 2270
2271 TransformState transformState(TransformState::ApplyTransformDirection, Float Point()); 2271 TransformState transformState(TransformState::ApplyTransformDirection, Float Point());
2272 mapLocalToContainer(repaintContainer, transformState, ApplyContainerFlip | U seTransforms); 2272 mapLocalToContainer(paintInvalidationContainer, transformState, ApplyContain erFlip | UseTransforms);
2273 LayoutPoint offsetFromRepaintContainer = roundedLayoutPoint(transformState.m appedPoint()); 2273 LayoutPoint offsetFromPaintInvalidationContainer = roundedLayoutPoint(transf ormState.mappedPoint());
2274 2274
2275 if (hasOverflowClip()) 2275 if (hasOverflowClip())
2276 offsetFromRepaintContainer -= scrolledContentOffset(); 2276 offsetFromPaintInvalidationContainer -= scrolledContentOffset();
2277 2277
2278 LayoutUnit lastTop = 0; 2278 LayoutUnit lastTop = 0;
2279 LayoutUnit lastLeft = logicalLeftSelectionOffset(this, lastTop); 2279 LayoutUnit lastLeft = logicalLeftSelectionOffset(this, lastTop);
2280 LayoutUnit lastRight = logicalRightSelectionOffset(this, lastTop); 2280 LayoutUnit lastRight = logicalRightSelectionOffset(this, lastTop);
2281 2281
2282 return selectionGaps(this, offsetFromRepaintContainer, IntSize(), lastTop, l astLeft, lastRight); 2282 return selectionGaps(this, offsetFromPaintInvalidationContainer, IntSize(), lastTop, lastLeft, lastRight);
2283 } 2283 }
2284 2284
2285 void RenderBlock::paintSelection(PaintInfo& paintInfo, const LayoutPoint& paintO ffset) 2285 void RenderBlock::paintSelection(PaintInfo& paintInfo, const LayoutPoint& paintO ffset)
2286 { 2286 {
2287 if (shouldPaintSelectionGaps() && paintInfo.phase == PaintPhaseForeground) { 2287 if (shouldPaintSelectionGaps() && paintInfo.phase == PaintPhaseForeground) {
2288 LayoutUnit lastTop = 0; 2288 LayoutUnit lastTop = 0;
2289 LayoutUnit lastLeft = logicalLeftSelectionOffset(this, lastTop); 2289 LayoutUnit lastLeft = logicalLeftSelectionOffset(this, lastTop);
2290 LayoutUnit lastRight = logicalRightSelectionOffset(this, lastTop); 2290 LayoutUnit lastRight = logicalRightSelectionOffset(this, lastTop);
2291 GraphicsContextStateSaver stateSaver(*paintInfo.context); 2291 GraphicsContextStateSaver stateSaver(*paintInfo.context);
2292 2292
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
3489 3489
3490 LayoutUnit startOffset = std::max(isHorizontal ? r.y() : r.x(), beforeBorder Padding); 3490 LayoutUnit startOffset = std::max(isHorizontal ? r.y() : r.x(), beforeBorder Padding);
3491 LayoutUnit endOffset = std::max(std::min<LayoutUnit>(isHorizontal ? r.maxY() : r.maxX(), beforeBorderPadding + colCount * colHeight), beforeBorderPadding); 3491 LayoutUnit endOffset = std::max(std::min<LayoutUnit>(isHorizontal ? r.maxY() : r.maxX(), beforeBorderPadding + colCount * colHeight), beforeBorderPadding);
3492 3492
3493 // FIXME: Can overflow on fast/block/float/float-not-removed-from-next-sibli ng4.html, see https://bugs.webkit.org/show_bug.cgi?id=68744 3493 // FIXME: Can overflow on fast/block/float/float-not-removed-from-next-sibli ng4.html, see https://bugs.webkit.org/show_bug.cgi?id=68744
3494 unsigned startColumn = (startOffset - beforeBorderPadding) / colHeight; 3494 unsigned startColumn = (startOffset - beforeBorderPadding) / colHeight;
3495 unsigned endColumn = (endOffset - beforeBorderPadding) / colHeight; 3495 unsigned endColumn = (endOffset - beforeBorderPadding) / colHeight;
3496 3496
3497 if (startColumn == endColumn) { 3497 if (startColumn == endColumn) {
3498 // The rect is fully contained within one column. Adjust for our offsets 3498 // The rect is fully contained within one column. Adjust for our offsets
3499 // and repaint only that portion. 3499 // and issue paint invalidations only that portion.
3500 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(); 3500 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent();
3501 LayoutRect colRect = columnRectAt(colInfo, startColumn); 3501 LayoutRect colRect = columnRectAt(colInfo, startColumn);
3502 LayoutRect repaintRect = r; 3502 LayoutRect paintInvalidationRect = r;
3503 3503
3504 if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) { 3504 if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) {
3505 if (isHorizontal) 3505 if (isHorizontal)
3506 repaintRect.move(colRect.x() - logicalLeftOffset, - static_cast< int>(startColumn) * colHeight); 3506 paintInvalidationRect.move(colRect.x() - logicalLeftOffset, - st atic_cast<int>(startColumn) * colHeight);
3507 else 3507 else
3508 repaintRect.move(- static_cast<int>(startColumn) * colHeight, co lRect.y() - logicalLeftOffset); 3508 paintInvalidationRect.move(- static_cast<int>(startColumn) * col Height, colRect.y() - logicalLeftOffset);
3509 } else { 3509 } else {
3510 if (isHorizontal) 3510 if (isHorizontal)
3511 repaintRect.move(0, colRect.y() - startColumn * colHeight - befo reBorderPadding); 3511 paintInvalidationRect.move(0, colRect.y() - startColumn * colHei ght - beforeBorderPadding);
3512 else 3512 else
3513 repaintRect.move(colRect.x() - startColumn * colHeight - beforeB orderPadding, 0); 3513 paintInvalidationRect.move(colRect.x() - startColumn * colHeight - beforeBorderPadding, 0);
3514 } 3514 }
3515 repaintRect.intersect(colRect); 3515 paintInvalidationRect.intersect(colRect);
3516 result.unite(repaintRect); 3516 result.unite(paintInvalidationRect);
3517 } else { 3517 } else {
3518 // We span multiple columns. We can just unite the start and end column to get the final 3518 // We span multiple columns. We can just unite the start and end column to get the final
3519 // repaint rect. 3519 // paint invalidation rect.
3520 result.unite(columnRectAt(colInfo, startColumn)); 3520 result.unite(columnRectAt(colInfo, startColumn));
3521 result.unite(columnRectAt(colInfo, endColumn)); 3521 result.unite(columnRectAt(colInfo, endColumn));
3522 } 3522 }
3523 3523
3524 r = result; 3524 r = result;
3525 } 3525 }
3526 3526
3527 LayoutPoint RenderBlock::flipForWritingModeIncludingColumns(const LayoutPoint& p oint) const 3527 LayoutPoint RenderBlock::flipForWritingModeIncludingColumns(const LayoutPoint& p oint) const
3528 { 3528 {
3529 ASSERT(hasColumns()); 3529 ASSERT(hasColumns());
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
4848 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 4848 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
4849 { 4849 {
4850 showRenderObject(); 4850 showRenderObject();
4851 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 4851 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
4852 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 4852 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
4853 } 4853 }
4854 4854
4855 #endif 4855 #endif
4856 4856
4857 } // namespace blink 4857 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698