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

Side by Side Diff: Source/core/rendering/RenderBlockFlow.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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 RenderView* renderView = view(); 362 RenderView* renderView = view();
363 if (renderView->layoutState()->pageLogicalHeight()) 363 if (renderView->layoutState()->pageLogicalHeight())
364 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(*this, logicalTop())); 364 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(*this, logicalTop()));
365 365
366 updateLayerTransformAfterLayout(); 366 updateLayerTransformAfterLayout();
367 367
368 // Update our scroll information if we're overflow:auto/scroll/hidden now th at we know if 368 // Update our scroll information if we're overflow:auto/scroll/hidden now th at we know if
369 // we overflow or not. 369 // we overflow or not.
370 updateScrollInfoAfterLayout(); 370 updateScrollInfoAfterLayout();
371 371
372 if (m_repaintLogicalTop != m_repaintLogicalBottom) { 372 if (m_paintInvalidationLogicalTop != m_paintInvalidationLogicalBottom) {
373 bool hasVisibleContent = style()->visibility() == VISIBLE; 373 bool hasVisibleContent = style()->visibility() == VISIBLE;
374 if (!hasVisibleContent) { 374 if (!hasVisibleContent) {
375 RenderLayer* layer = enclosingLayer(); 375 RenderLayer* layer = enclosingLayer();
376 layer->updateDescendantDependentFlags(); 376 layer->updateDescendantDependentFlags();
377 hasVisibleContent = layer->hasVisibleContent(); 377 hasVisibleContent = layer->hasVisibleContent();
378 } 378 }
379 if (hasVisibleContent) 379 if (hasVisibleContent)
380 setShouldInvalidateOverflowForPaint(true); 380 setShouldInvalidateOverflowForPaint(true);
381 } 381 }
382 382
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 setHasMarginBeforeQuirk(style()->hasMarginBeforeQuirk()); 414 setHasMarginBeforeQuirk(style()->hasMarginBeforeQuirk());
415 setHasMarginAfterQuirk(style()->hasMarginAfterQuirk()); 415 setHasMarginAfterQuirk(style()->hasMarginAfterQuirk());
416 setPaginationStrut(0); 416 setPaginationStrut(0);
417 } 417 }
418 418
419 LayoutUnit beforeEdge = borderBefore() + paddingBefore(); 419 LayoutUnit beforeEdge = borderBefore() + paddingBefore();
420 LayoutUnit afterEdge = borderAfter() + paddingAfter() + scrollbarLogicalHeig ht(); 420 LayoutUnit afterEdge = borderAfter() + paddingAfter() + scrollbarLogicalHeig ht();
421 LayoutUnit previousHeight = logicalHeight(); 421 LayoutUnit previousHeight = logicalHeight();
422 setLogicalHeight(beforeEdge); 422 setLogicalHeight(beforeEdge);
423 423
424 m_repaintLogicalTop = 0; 424 m_paintInvalidationLogicalTop = 0;
425 m_repaintLogicalBottom = 0; 425 m_paintInvalidationLogicalBottom = 0;
426 if (!firstChild() && !isAnonymousBlock()) 426 if (!firstChild() && !isAnonymousBlock())
427 setChildrenInline(true); 427 setChildrenInline(true);
428 428
429 TextAutosizer::LayoutScope textAutosizerLayoutScope(this); 429 TextAutosizer::LayoutScope textAutosizerLayoutScope(this);
430 430
431 if (childrenInline()) 431 if (childrenInline())
432 layoutInlineChildren(relayoutChildren, m_repaintLogicalTop, m_repaintLog icalBottom, afterEdge); 432 layoutInlineChildren(relayoutChildren, m_paintInvalidationLogicalTop, m_ paintInvalidationLogicalBottom, afterEdge);
433 else 433 else
434 layoutBlockChildren(relayoutChildren, layoutScope, beforeEdge, afterEdge ); 434 layoutBlockChildren(relayoutChildren, layoutScope, beforeEdge, afterEdge );
435 435
436 // Expand our intrinsic height to encompass floats. 436 // Expand our intrinsic height to encompass floats.
437 if (lowestFloatLogicalBottom() > (logicalHeight() - afterEdge) && createsBlo ckFormattingContext()) 437 if (lowestFloatLogicalBottom() > (logicalHeight() - afterEdge) && createsBlo ckFormattingContext())
438 setLogicalHeight(lowestFloatLogicalBottom() + afterEdge); 438 setLogicalHeight(lowestFloatLogicalBottom() + afterEdge);
439 439
440 if (RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { 440 if (RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread()) {
441 if (flowThread->recalculateColumnHeights()) { 441 if (flowThread->recalculateColumnHeights()) {
442 setChildNeedsLayout(MarkOnlyThis); 442 setChildNeedsLayout(MarkOnlyThis);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 541
542 // The child is a normal flow object. Compute the margins we will use for co llapsing now. 542 // The child is a normal flow object. Compute the margins we will use for co llapsing now.
543 child->computeAndSetBlockDirectionMargins(this); 543 child->computeAndSetBlockDirectionMargins(this);
544 544
545 // Try to guess our correct logical top position. In most cases this guess w ill 545 // Try to guess our correct logical top position. In most cases this guess w ill
546 // be correct. Only if we're wrong (when we compute the real logical top pos ition) 546 // be correct. Only if we're wrong (when we compute the real logical top pos ition)
547 // will we have to potentially relayout. 547 // will we have to potentially relayout.
548 LayoutUnit estimateWithoutPagination; 548 LayoutUnit estimateWithoutPagination;
549 LayoutUnit logicalTopEstimate = estimateLogicalTopPosition(child, marginInfo , estimateWithoutPagination); 549 LayoutUnit logicalTopEstimate = estimateLogicalTopPosition(child, marginInfo , estimateWithoutPagination);
550 550
551 // Cache our old rect so that we can dirty the proper repaint rects if the c hild moves. 551 // Cache our old rect so that we can dirty the proper paint invalidation rec ts if the child moves.
552 LayoutRect oldRect = child->frameRect(); 552 LayoutRect oldRect = child->frameRect();
553 LayoutUnit oldLogicalTop = logicalTopForChild(child); 553 LayoutUnit oldLogicalTop = logicalTopForChild(child);
554 554
555 // Go ahead and position the child as though it didn't collapse with the top . 555 // Go ahead and position the child as though it didn't collapse with the top .
556 setLogicalTopForChild(child, logicalTopEstimate); 556 setLogicalTopForChild(child, logicalTopEstimate);
557 557
558 RenderBlockFlow* childRenderBlockFlow = child->isRenderBlockFlow() ? toRende rBlockFlow(child) : 0; 558 RenderBlockFlow* childRenderBlockFlow = child->isRenderBlockFlow() ? toRende rBlockFlow(child) : 0;
559 bool markDescendantsWithFloats = false; 559 bool markDescendantsWithFloats = false;
560 if (logicalTopEstimate != oldLogicalTop && childRenderBlockFlow && !childRen derBlockFlow->avoidsFloats() && childRenderBlockFlow->containsFloats()) { 560 if (logicalTopEstimate != oldLogicalTop && childRenderBlockFlow && !childRen derBlockFlow->avoidsFloats() && childRenderBlockFlow->containsFloats()) {
561 markDescendantsWithFloats = true; 561 markDescendantsWithFloats = true;
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 continue; 2041 continue;
2042 2042
2043 toBlockFlow->m_floatingObjects->add(floatingObject->unsafeClone()); 2043 toBlockFlow->m_floatingObjects->add(floatingObject->unsafeClone());
2044 } 2044 }
2045 } 2045 }
2046 2046
2047 } 2047 }
2048 2048
2049 void RenderBlockFlow::invalidatePaintForOverhangingFloats(bool paintAllDescendan ts) 2049 void RenderBlockFlow::invalidatePaintForOverhangingFloats(bool paintAllDescendan ts)
2050 { 2050 {
2051 // Repaint any overhanging floats (if we know we're the one to paint them). 2051 // Invalidate paint of any overhanging floats (if we know we're the one to p aint them).
2052 // Otherwise, bail out. 2052 // Otherwise, bail out.
2053 if (!hasOverhangingFloats()) 2053 if (!hasOverhangingFloats())
2054 return; 2054 return;
2055 2055
2056 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 2056 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
2057 FloatingObjectSetIterator end = floatingObjectSet.end(); 2057 FloatingObjectSetIterator end = floatingObjectSet.end();
2058 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++ it) { 2058 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++ it) {
2059 FloatingObject* floatingObject = it->get(); 2059 FloatingObject* floatingObject = it->get();
2060 // Only repaint the object if it is overhanging, is not in its own layer , and 2060 // Only issue paint invaldiations for the object if it is overhanging, i s not in its own layer, and
2061 // is our responsibility to paint (m_shouldPaint is set). When paintAllD escendants is true, the latter 2061 // is our responsibility to paint (m_shouldPaint is set). When paintAllD escendants is true, the latter
2062 // condition is replaced with being a descendant of us. 2062 // condition is replaced with being a descendant of us.
2063 if (logicalBottomForFloat(floatingObject) > logicalHeight() 2063 if (logicalBottomForFloat(floatingObject) > logicalHeight()
2064 && !floatingObject->renderer()->hasSelfPaintingLayer() 2064 && !floatingObject->renderer()->hasSelfPaintingLayer()
2065 && (floatingObject->shouldPaint() || (paintAllDescendants && floatin gObject->renderer()->isDescendantOf(this)))) { 2065 && (floatingObject->shouldPaint() || (paintAllDescendants && floatin gObject->renderer()->isDescendantOf(this)))) {
2066 2066
2067 RenderBox* floatingRenderer = floatingObject->renderer(); 2067 RenderBox* floatingRenderer = floatingObject->renderer();
2068 floatingRenderer->setShouldDoFullPaintInvalidation(true); 2068 floatingRenderer->setShouldDoFullPaintInvalidation(true);
2069 floatingRenderer->invalidatePaintForOverhangingFloats(false); 2069 floatingRenderer->invalidatePaintForOverhangingFloats(false);
2070 } 2070 }
2071 } 2071 }
2072 } 2072 }
2073 2073
2074 void RenderBlockFlow::invalidatePaintForOverflow() 2074 void RenderBlockFlow::invalidatePaintForOverflow()
2075 { 2075 {
2076 // FIXME: We could tighten up the left and right invalidation points if we l et layoutInlineChildren fill them in based off the particular lines 2076 // FIXME: We could tighten up the left and right invalidation points if we l et layoutInlineChildren fill them in based off the particular lines
2077 // it had to lay out. We wouldn't need the hasOverflowClip() hack in that ca se either. 2077 // it had to lay out. We wouldn't need the hasOverflowClip() hack in that ca se either.
2078 LayoutUnit repaintLogicalLeft = logicalLeftVisualOverflow(); 2078 LayoutUnit paintInvalidationLogicalLeft = logicalLeftVisualOverflow();
2079 LayoutUnit repaintLogicalRight = logicalRightVisualOverflow(); 2079 LayoutUnit paintInvalidationLogicalRight = logicalRightVisualOverflow();
2080 if (hasOverflowClip()) { 2080 if (hasOverflowClip()) {
2081 // If we have clipped overflow, we should use layout overflow as well, s ince visual overflow from lines didn't propagate to our block's overflow. 2081 // If we have clipped overflow, we should use layout overflow as well, s ince visual overflow from lines didn't propagate to our block's overflow.
2082 // Note the old code did this as well but even for overflow:visible. The addition of hasOverflowClip() at least tightens up the hack a bit. 2082 // Note the old code did this as well but even for overflow:visible. The addition of hasOverflowClip() at least tightens up the hack a bit.
2083 // layoutInlineChildren should be patched to compute the entire repaint rect. 2083 // layoutInlineChildren should be patched to compute the entire paint in validation rect.
2084 repaintLogicalLeft = std::min(repaintLogicalLeft, logicalLeftLayoutOverf low()); 2084 paintInvalidationLogicalLeft = std::min(paintInvalidationLogicalLeft, lo gicalLeftLayoutOverflow());
2085 repaintLogicalRight = std::max(repaintLogicalRight, logicalRightLayoutOv erflow()); 2085 paintInvalidationLogicalRight = std::max(paintInvalidationLogicalRight, logicalRightLayoutOverflow());
2086 } 2086 }
2087 2087
2088 LayoutRect repaintRect; 2088 LayoutRect paintInvalidationRect;
2089 if (isHorizontalWritingMode()) 2089 if (isHorizontalWritingMode())
2090 repaintRect = LayoutRect(repaintLogicalLeft, m_repaintLogicalTop, repain tLogicalRight - repaintLogicalLeft, m_repaintLogicalBottom - m_repaintLogicalTop ); 2090 paintInvalidationRect = LayoutRect(paintInvalidationLogicalLeft, m_paint InvalidationLogicalTop, paintInvalidationLogicalRight - paintInvalidationLogical Left, m_paintInvalidationLogicalBottom - m_paintInvalidationLogicalTop);
2091 else 2091 else
2092 repaintRect = LayoutRect(m_repaintLogicalTop, repaintLogicalLeft, m_repa intLogicalBottom - m_repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft ); 2092 paintInvalidationRect = LayoutRect(m_paintInvalidationLogicalTop, paintI nvalidationLogicalLeft, m_paintInvalidationLogicalBottom - m_paintInvalidationLo gicalTop, paintInvalidationLogicalRight - paintInvalidationLogicalLeft);
2093 2093
2094 // The repaint rect may be split across columns, in which case adjustRectFor Columns() will return the union. 2094 // The paint invalidation rect may be split across columns, in which case ad justRectForColumns() will return the union.
2095 adjustRectForColumns(repaintRect); 2095 adjustRectForColumns(paintInvalidationRect);
2096 2096
2097 if (hasOverflowClip()) { 2097 if (hasOverflowClip()) {
2098 // Adjust repaint rect for scroll offset 2098 // Adjust the paint invalidation rect for scroll offset
2099 repaintRect.move(-scrolledContentOffset()); 2099 paintInvalidationRect.move(-scrolledContentOffset());
2100 2100
2101 // Don't allow this rect to spill out of our overflow box. 2101 // Don't allow this rect to spill out of our overflow box.
2102 repaintRect.intersect(LayoutRect(LayoutPoint(), size())); 2102 paintInvalidationRect.intersect(LayoutRect(LayoutPoint(), size()));
2103 } 2103 }
2104 2104
2105 // Make sure the rect is still non-empty after intersecting for overflow abo ve 2105 // Make sure the rect is still non-empty after intersecting for overflow abo ve
2106 if (!repaintRect.isEmpty()) { 2106 if (!paintInvalidationRect.isEmpty()) {
2107 // Hits in media/event-attributes.html 2107 // Hits in media/event-attributes.html
2108 DisableCompositingQueryAsserts disabler; 2108 DisableCompositingQueryAsserts disabler;
2109 2109
2110 invalidatePaintRectangle(repaintRect); // We need to do a partial repain t of our content. 2110 invalidatePaintRectangle(paintInvalidationRect); // We need to do a part ial paint invalidation of our content.
2111 if (hasReflection()) 2111 if (hasReflection())
2112 invalidatePaintRectangle(reflectedRect(repaintRect)); 2112 invalidatePaintRectangle(reflectedRect(paintInvalidationRect));
2113 } 2113 }
2114 2114
2115 m_repaintLogicalTop = 0; 2115 m_paintInvalidationLogicalTop = 0;
2116 m_repaintLogicalBottom = 0; 2116 m_paintInvalidationLogicalBottom = 0;
2117 } 2117 }
2118 2118
2119 void RenderBlockFlow::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paint Offset, bool preservePhase) 2119 void RenderBlockFlow::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paint Offset, bool preservePhase)
2120 { 2120 {
2121 if (!m_floatingObjects) 2121 if (!m_floatingObjects)
2122 return; 2122 return;
2123 2123
2124 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 2124 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
2125 FloatingObjectSetIterator end = floatingObjectSet.end(); 2125 FloatingObjectSetIterator end = floatingObjectSet.end();
2126 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++ it) { 2126 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++ it) {
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
2925 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() 2925 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData()
2926 { 2926 {
2927 if (m_rareData) 2927 if (m_rareData)
2928 return *m_rareData; 2928 return *m_rareData;
2929 2929
2930 m_rareData = adoptPtrWillBeNoop(new RenderBlockFlowRareData(this)); 2930 m_rareData = adoptPtrWillBeNoop(new RenderBlockFlowRareData(this));
2931 return *m_rareData; 2931 return *m_rareData;
2932 } 2932 }
2933 2933
2934 } // namespace blink 2934 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698