Chromium Code Reviews| Index: Source/core/rendering/svg/RenderSVGRoot.cpp |
| diff --git a/Source/core/rendering/svg/RenderSVGRoot.cpp b/Source/core/rendering/svg/RenderSVGRoot.cpp |
| index f63f5f9a8c9583b583577bff16721aabd575d66e..a0fa76c5349b1baa23350a6cf84219de66cb27f9 100644 |
| --- a/Source/core/rendering/svg/RenderSVGRoot.cpp |
| +++ b/Source/core/rendering/svg/RenderSVGRoot.cpp |
| @@ -29,6 +29,7 @@ |
| #include "core/rendering/HitTestResult.h" |
| #include "core/rendering/LayoutRectRecorder.h" |
| #include "core/rendering/LayoutRepainter.h" |
| +#include "core/rendering/RenderLayer.h" |
| #include "core/rendering/RenderPart.h" |
| #include "core/rendering/RenderView.h" |
| #include "core/rendering/svg/RenderSVGResourceContainer.h" |
| @@ -353,9 +354,51 @@ const AffineTransform& RenderSVGRoot::localToParentTransform() const |
| return m_localToParentTransform; |
| } |
| +static bool shouldRepaintBorderBox(const RenderObject& object) |
| +{ |
| + // If it's the document root, then include the border-box in the repaint |
| + // rect if it's got a background or a border specified. This is a reduced |
| + // version of the predicate found in RenderBoxModelObject::updateFromStyle, |
| + // that is used to set the hasBoxDecorations flag. The reason it's used at |
| + // all is because said flag is unconditionally set to 'true' for the |
| + // document root. |
| + if (object.isRoot()) |
|
pdr.
2014/04/01 18:55:48
Should this be an assert instead of a conditional?
fs
2014/04/02 08:01:54
You mean:
ASSERT(object.isRoot());
(or the negat
|
| + return object.hasBackground() || object.style()->hasBorder(); |
|
pdr.
2014/04/01 18:55:48
I suspect there are additional accoutrements we're
fs
2014/04/02 08:01:54
The "original" check/predicate (from RenderBoxMode
|
| + // Otherwise, consider all box decorations. |
| + return object.hasBoxDecorations(); |
| +} |
| + |
| LayoutRect RenderSVGRoot::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const |
| { |
| - return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer); |
| + // This is an open-coded aggregate of SVGRenderSupport::clippedOverflowRectForRepaint, |
|
pdr.
2014/04/01 18:55:48
This is a lot of code but it's sort of expected fo
pdr.
2014/04/02 06:15:31
Looking at this again, I see falling back to regul
fs
2014/04/02 08:01:54
I look into 'outline', and the mentioned transitio
|
| + // RenderSVGRoot::computeFloatRectForRepaint and RenderReplaced::clippedOverflowRectForRepaint. |
| + // The reason for this is to optimize/minimize the repaint rect when the box is not "decorated" |
| + // (does not have background/border/etc.) |
| + |
| + // Return early for any cases where we don't actually paint. |
| + if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent()) |
| + return LayoutRect(); |
| + |
| + // Compute the repaint rect of the content of the SVG in the border-box coordinate space. |
| + FloatRect contentRepaintRect = repaintRectInLocalCoordinates(); |
| + contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintRect); |
| + |
| + // Apply initial viewport clip - not affected by overflow settings |
| + contentRepaintRect.intersect(pixelSnappedBorderBoxRect()); |
| + |
| + LayoutRect repaintRect = enclosingLayoutRect(contentRepaintRect); |
| + // If the box is decorated, extend it to include the border-box. |
| + if (shouldRepaintBorderBox(*this)) { |
|
pdr.
2014/04/01 18:55:48
I see how this can work when changing or gaining a
|
| + // The selectionRect can project outside of the overflowRect, so take their union |
| + // for repainting to avoid selection painting glitches. |
| + LayoutRect decoratedRepaintRect = unionRect(localSelectionRect(false), visualOverflowRect()); |
| + repaintRect.unite(decoratedRepaintRect); |
| + } |
| + |
| + // Compute the repaint rect in the parent coordinate space. |
| + LayoutRect rect = enclosingIntRect(repaintRect); |
| + RenderReplaced::computeRectForRepaint(repaintContainer, rect); |
| + return rect; |
| } |
| void RenderSVGRoot::computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const |
| @@ -392,7 +435,6 @@ void RenderSVGRoot::updateCachedBoundaries() |
| { |
| SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m_objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBox); |
| SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingBox); |
| - m_repaintBoundingBox.inflate(borderAndPaddingWidth().toFloat()); |
| } |
| bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) |