Title: [188744] trunk/Source/WebCore
Revision
188744
Author
[email protected]
Date
2015-08-20 19:57:32 -0700 (Thu, 20 Aug 2015)

Log Message

Make outline: auto repaint rect inflate more explicit.
https://bugs.webkit.org/show_bug.cgi?id=148263

Reviewed by Simon Fraser.

Use RenderObject::adjustRectWithMaximumOutline() when inflating is conditional and call
RenderView::maximalOutlineSize() when it is not.
After this changeset, we can clearly tell calls when inflating is unconditional (adjusting the size of the compositing layer) apart from
calls when we just simply inflate the repaint rect during outline painting phase.

No change in behaviour.

* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::paint):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paint):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutBlock):
* rendering/RenderDetailsMarker.cpp:
(WebCore::RenderDetailsMarker::paint):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::computeMaxOutlineSize):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderLineBoxList.cpp:
(WebCore::isOutlinePhase):
(WebCore::RenderLineBoxList::lineIntersectsDirtyRect):
(WebCore::RenderLineBoxList::paint):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::paint):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::adjustRectWithMaximumOutline):
(WebCore::RenderObject::maximalOutlineSize): Deleted.
* rendering/RenderObject.h:
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::overflowRectForFlowThreadPortion):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::shouldPaint):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::paint):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paintCollapsedBorders):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::paintObject):
* rendering/RenderView.cpp:
(WebCore::RenderView::setMaximalOutlineSize):
(WebCore::RenderView::RenderView): Deleted.
* rendering/RenderView.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (188743 => 188744)


--- trunk/Source/WebCore/ChangeLog	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/ChangeLog	2015-08-21 02:57:32 UTC (rev 188744)
@@ -1,3 +1,54 @@
+2015-08-20  Zalan Bujtas  <[email protected]>
+
+        Make outline: auto repaint rect inflate more explicit.
+        https://bugs.webkit.org/show_bug.cgi?id=148263
+
+        Reviewed by Simon Fraser.
+
+        Use RenderObject::adjustRectWithMaximumOutline() when inflating is conditional and call
+        RenderView::maximalOutlineSize() when it is not.
+        After this changeset, we can clearly tell calls when inflating is unconditional (adjusting the size of the compositing layer) apart from
+        calls when we just simply inflate the repaint rect during outline painting phase.
+
+        No change in behaviour.
+
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::paint):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paint):
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::layoutBlock):
+        * rendering/RenderDetailsMarker.cpp:
+        (WebCore::RenderDetailsMarker::paint):
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::computeMaxOutlineSize):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::calculateClipRects):
+        * rendering/RenderLineBoxList.cpp:
+        (WebCore::isOutlinePhase):
+        (WebCore::RenderLineBoxList::lineIntersectsDirtyRect):
+        (WebCore::RenderLineBoxList::paint):
+        * rendering/RenderListMarker.cpp:
+        (WebCore::RenderListMarker::paint):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::adjustRectWithMaximumOutline):
+        (WebCore::RenderObject::maximalOutlineSize): Deleted.
+        * rendering/RenderObject.h:
+        * rendering/RenderRegion.cpp:
+        (WebCore::RenderRegion::overflowRectForFlowThreadPortion):
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::shouldPaint):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::paint):
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::paintCollapsedBorders):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::paintObject):
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::setMaximalOutlineSize):
+        (WebCore::RenderView::RenderView): Deleted.
+        * rendering/RenderView.h:
+
 2015-08-20  Myles C. Maxfield  <[email protected]>
 
         [OS X] Cleaup after r188591

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -1126,7 +1126,7 @@
         return;
 
     LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom));
-    overflowRect.inflate(renderer().maximalOutlineSize(paintInfo.phase));
+    renderer().adjustRectWithMaximumOutline(paintInfo.phase, overflowRect);
     flipForWritingMode(overflowRect);
     overflowRect.moveBy(paintOffset);
     

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -1400,7 +1400,7 @@
     if (!isRoot()) {
         LayoutRect overflowBox = overflowRectForPaintRejection(namedFlowFragment);
         flipForWritingMode(overflowBox);
-        overflowBox.inflate(maximalOutlineSize(phase));
+        adjustRectWithMaximumOutline(phase, overflowBox);
         overflowBox.moveBy(adjustedPaintOffset);
         if (!overflowBox.intersects(paintInfo.rect)
 #if PLATFORM(IOS)

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -561,7 +561,7 @@
         else
             repaintRect = LayoutRect(repaintLogicalTop, repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft);
 
-        repaintRect.inflate(maximalOutlineSize(PaintPhaseOutline));
+        repaintRect.inflate(view().maximalOutlineSize());
         
         if (hasOverflowClip()) {
             // Adjust repaint rect for scroll offset

Modified: trunk/Source/WebCore/rendering/RenderDetailsMarker.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderDetailsMarker.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderDetailsMarker.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -124,7 +124,7 @@
     LayoutPoint boxOrigin(paintOffset + location());
     LayoutRect overflowRect(visualOverflowRect());
     overflowRect.moveBy(boxOrigin);
-    overflowRect.inflate(maximalOutlineSize(paintInfo.phase));
+    adjustRectWithMaximumOutline(paintInfo.phase, overflowRect);
 
     if (!paintInfo.rect.intersects(snappedIntRect(overflowRect)))
         return;

Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderElement.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -374,7 +374,7 @@
     if (m_style->outlineStyleIsAuto())
         maxOutlineSize = std::max(theme().platformFocusRingWidth() + m_style->outlineOffset(), maxOutlineSize);
 
-    if (maxOutlineSize < maximalOutlineSize(PaintPhaseOutline))
+    if (maxOutlineSize < view().maximalOutlineSize())
         return;
 
     view().setMaximalOutlineSize(maxOutlineSize);

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -5612,7 +5612,7 @@
         // If the region does not clip its overflow, inflate the outline rect.
         if (namedFlowFragment) {
             if (!(namedFlowFragment->parent()->hasOverflowClip() && (&namedFlowFragment->fragmentContainerLayer() != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)))
-                outlineRect.inflate(renderer().maximalOutlineSize(PaintPhaseOutline));
+                outlineRect.inflate(renderer().view().maximalOutlineSize());
         }
     }
 
@@ -5830,7 +5830,7 @@
         }
     }
 
-    result.inflate(renderer().view().maximalOutlineSize()); // Used to apply a fudge factor to dirty-rect checks on blocks/tables.
+    result.inflate(renderer().view().maximalOutlineSize());
     return result;
 }
 

Modified: trunk/Source/WebCore/rendering/RenderLineBoxList.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderLineBoxList.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderLineBoxList.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -200,11 +200,17 @@
     return rangeIntersectsRect(renderer, logicalTop, logicalBottom, rect, offset);
 }
 
+static bool isOutlinePhase(PaintPhase phase)
+{
+    return phase == PaintPhaseOutline || phase == PaintPhaseSelfOutline || phase == PaintPhaseChildOutlines;
+}
+
 bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer, InlineFlowBox* box, const PaintInfo& paintInfo, const LayoutPoint& offset) const
 {
     const RootInlineBox& rootBox = box->root();
-    LayoutUnit logicalTop = std::min<LayoutUnit>(box->logicalTopVisualOverflow(rootBox.lineTop()), rootBox.selectionTop()) - renderer->maximalOutlineSize(paintInfo.phase);
-    LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(rootBox.lineBottom()) + renderer->maximalOutlineSize(paintInfo.phase);
+    const LayoutUnit outlineSize = isOutlinePhase(paintInfo.phase) ? renderer->view().maximalOutlineSize() : 0;
+    LayoutUnit logicalTop = std::min(box->logicalTopVisualOverflow(rootBox.lineTop()), rootBox.selectionTop()) - outlineSize;
+    LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(rootBox.lineBottom()) + outlineSize;
     
     return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.rect, offset);
 }
@@ -221,7 +227,7 @@
     // NSViews.  Do not add any more code for this.
     RenderView& v = renderer->view();
     bool usePrintRect = !v.printRect().isEmpty();
-    LayoutUnit outlineSize = renderer->maximalOutlineSize(paintInfo.phase);
+    LayoutUnit outlineSize = isOutlinePhase(paintInfo.phase) ? v.maximalOutlineSize() : 0;
     if (!anyLineIntersectsRect(renderer, paintInfo.rect, paintOffset, usePrintRect, outlineSize))
         return;
 

Modified: trunk/Source/WebCore/rendering/RenderListMarker.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderListMarker.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderListMarker.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -1184,7 +1184,7 @@
     LayoutPoint boxOrigin(paintOffset + location());
     LayoutRect overflowRect(visualOverflowRect());
     overflowRect.moveBy(boxOrigin);
-    overflowRect.inflate(maximalOutlineSize(paintInfo.phase));
+    adjustRectWithMaximumOutline(paintInfo.phase, overflowRect);
 
     if (!paintInfo.rect.intersects(overflowRect))
         return;

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -1878,11 +1878,11 @@
 }
 #endif
 
-int RenderObject::maximalOutlineSize(PaintPhase p) const
+void RenderObject::adjustRectWithMaximumOutline(PaintPhase phase, LayoutRect& rect) const
 {
-    if (p != PaintPhaseOutline && p != PaintPhaseSelfOutline && p != PaintPhaseChildOutlines)
-        return 0;
-    return view().maximalOutlineSize();
+    if (phase != PaintPhaseOutline && phase != PaintPhaseSelfOutline && phase != PaintPhaseChildOutlines)
+        return;
+    rect.inflate(view().maximalOutlineSize());
 }
 
 int RenderObject::caretMinOffset() const

Modified: trunk/Source/WebCore/rendering/RenderObject.h (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderObject.h	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2015-08-21 02:57:32 UTC (rev 188744)
@@ -764,7 +764,7 @@
     bool isFloatingOrOutOfFlowPositioned() const { return (isFloating() || isOutOfFlowPositioned()); }
 
     // Applied as a "slop" to dirty rect checks during the outline painting phase's dirty-rect checks.
-    int maximalOutlineSize(PaintPhase) const;
+    void adjustRectWithMaximumOutline(PaintPhase, LayoutRect&) const;
 
     enum SelectionState {
         SelectionNone, // The object is not selected.

Modified: trunk/Source/WebCore/rendering/RenderRegion.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderRegion.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderRegion.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -159,7 +159,7 @@
     LayoutRect flowThreadOverflow = overflowType == VisualOverflow ? visualOverflowRectForBox(*m_flowThread) : layoutOverflowRectForBox(m_flowThread);
 
     // We are interested about the outline size only when computing the visual overflow.
-    LayoutUnit outlineSize = overflowType == VisualOverflow ? LayoutUnit(maximalOutlineSize(PaintPhaseOutline)) : LayoutUnit();
+    LayoutUnit outlineSize = overflowType == VisualOverflow ? LayoutUnit(view().maximalOutlineSize()) : LayoutUnit();
     LayoutRect clipRect;
     if (m_flowThread->isHorizontalWritingMode()) {
         LayoutUnit minY = isFirstPortion ? (flowThreadOverflow.y() - outlineSize) : flowThreadPortionRect.y();

Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderReplaced.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -233,7 +233,7 @@
     }
     
     LayoutRect localRepaintRect = paintInfo.rect;
-    localRepaintRect.inflate(maximalOutlineSize(paintInfo.phase));
+    adjustRectWithMaximumOutline(paintInfo.phase, localRepaintRect);
     if (adjustedPaintOffset.x() + visualOverflowRect().x() >= localRepaintRect.maxX() || adjustedPaintOffset.x() + visualOverflowRect().maxX() <= localRepaintRect.x())
         return false;
 

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -661,8 +661,8 @@
 
     if (!isRoot()) {
         LayoutRect overflowBox = visualOverflowRect();
+        adjustRectWithMaximumOutline(paintInfo.phase, overflowBox);
         flipForWritingMode(overflowBox);
-        overflowBox.inflate(maximalOutlineSize(paintInfo.phase));
         overflowBox.moveBy(adjustedPaintOffset);
         if (!overflowBox.intersects(paintInfo.rect))
             return;

Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderTableCell.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -1192,7 +1192,7 @@
         return;
 
     LayoutRect localRepaintRect = paintInfo.rect;
-    localRepaintRect.inflate(maximalOutlineSize(paintInfo.phase));
+    adjustRectWithMaximumOutline(paintInfo.phase, localRepaintRect);
 
     LayoutRect paintRect = LayoutRect(paintOffset + location(), snappedIntRect(frameRect()).size());
     if (paintRect.y() - table()->outerBorderTop() >= localRepaintRect.maxY())

Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderTableSection.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -1228,11 +1228,9 @@
 
 void RenderTableSection::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
-    PaintPhase paintPhase = paintInfo.phase;
-
     LayoutRect localRepaintRect = paintInfo.rect;
+    adjustRectWithMaximumOutline(paintInfo.phase, localRepaintRect);
     localRepaintRect.moveBy(-paintOffset);
-    localRepaintRect.inflate(maximalOutlineSize(paintPhase));
 
     LayoutRect tableAlignedRect = logicalRectForWritingModeAndDirection(localRepaintRect);
 

Modified: trunk/Source/WebCore/rendering/RenderView.cpp (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderView.cpp	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderView.cpp	2015-08-21 02:57:32 UTC (rev 188744)
@@ -122,7 +122,6 @@
     , m_selectionUnsplitStartPos(-1)
     , m_selectionUnsplitEndPos(-1)
     , m_rendererCount(0)
-    , m_maximalOutlineSize(0)
     , m_lazyRepaintTimer(*this, &RenderView::lazyRepaintTimerFired)
     , m_pageLogicalHeight(0)
     , m_pageLogicalHeightChanged(false)
@@ -854,14 +853,15 @@
 // Compositing layer dimensions take outline size into account, so we have to recompute layer
 // bounds when it changes.
 // FIXME: This is ugly; it would be nice to have a better way to do this.
-void RenderView::setMaximalOutlineSize(int o)
+void RenderView::setMaximalOutlineSize(int outlineSize)
 {
-    if (o != m_maximalOutlineSize) {
-        m_maximalOutlineSize = o;
-
-        // maximalOutlineSize affects compositing layer dimensions.
-        compositor().setCompositingLayersNeedRebuild();    // FIXME: this really just needs to be a geometry update.
-    }
+    if (outlineSize == m_maximalOutlineSize)
+        return;
+    
+    m_maximalOutlineSize = outlineSize;
+    // maximalOutlineSize affects compositing layer dimensions.
+    // FIXME: this really just needs to be a geometry update.
+    compositor().setCompositingLayersNeedRebuild();
 }
 
 void RenderView::setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos, SelectionRepaintMode blockRepaintMode)

Modified: trunk/Source/WebCore/rendering/RenderView.h (188743 => 188744)


--- trunk/Source/WebCore/rendering/RenderView.h	2015-08-21 02:54:27 UTC (rev 188743)
+++ trunk/Source/WebCore/rendering/RenderView.h	2015-08-21 02:57:32 UTC (rev 188744)
@@ -98,7 +98,7 @@
     virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const override;
     virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override;
 
-    void setMaximalOutlineSize(int o);
+    void setMaximalOutlineSize(int);
     int maximalOutlineSize() const { return m_maximalOutlineSize; }
 
     LayoutRect viewRect() const;
@@ -345,7 +345,8 @@
     LegacyPrinting m_legacyPrinting;
     // End deprecated members.
 
-    int m_maximalOutlineSize; // Used to apply a fudge factor to dirty-rect checks on blocks/tables.
+    // Used to inflate compositing layers and repaint rects.
+    int m_maximalOutlineSize { 0 };
 
     bool shouldUsePrintingLayout() const;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to