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

Unified Diff: third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp

Issue 2465983002: Rename "paint invalidation rect" etc. to "visual rect". (Closed)
Patch Set: - Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
index 3977ea3e4ce9815de5b580aac5f8880c334ce645..814c96753020d817e9df9d77b2be0e667756636d 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
@@ -56,35 +56,31 @@ struct SearchCandidate {
float candidateDistance;
};
-FloatRect SVGLayoutSupport::localOverflowRectForPaintInvalidation(
- const LayoutObject& object) {
- // This doesn't apply to LayoutSVGRoot. Use
- // LayoutSVGRoot::localOverflowRectForPaintInvalidation() instead.
- ASSERT(!object.isSVGRoot());
+FloatRect SVGLayoutSupport::localVisualRect(const LayoutObject& object) {
+ // For LayoutSVGRoot, use LayoutSVGRoot::localVisualRect() instead.
+ DCHECK(!object.isSVGRoot());
// Return early for any cases where we don't actually paint
if (object.styleRef().visibility() != EVisibility::Visible &&
!object.enclosingLayer()->hasVisibleContent())
return FloatRect();
- FloatRect paintInvalidationRect =
- object.paintInvalidationRectInLocalSVGCoordinates();
+ FloatRect visualRect = object.visualRectInLocalSVGCoordinates();
if (int outlineOutset = object.styleRef().outlineOutsetExtent())
- paintInvalidationRect.inflate(outlineOutset);
- return paintInvalidationRect;
+ visualRect.inflate(outlineOutset);
+ return visualRect;
}
-LayoutRect SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(
+LayoutRect SVGLayoutSupport::visualRectInAncestorSpace(
const LayoutObject& object,
- const LayoutBoxModelObject& paintInvalidationContainer) {
+ const LayoutBoxModelObject& ancestor) {
LayoutRect rect;
- mapToVisualRectInAncestorSpace(object, &paintInvalidationContainer,
- localOverflowRectForPaintInvalidation(object),
+ mapToVisualRectInAncestorSpace(object, &ancestor, localVisualRect(object),
rect);
return rect;
}
-LayoutRect SVGLayoutSupport::transformPaintInvalidationRect(
+LayoutRect SVGLayoutSupport::transformVisualRect(
const LayoutObject& object,
const AffineTransform& rootTransform,
const FloatRect& localRect) {
@@ -116,14 +112,14 @@ static const LayoutSVGRoot& computeTransformToSVGRoot(
bool SVGLayoutSupport::mapToVisualRectInAncestorSpace(
const LayoutObject& object,
const LayoutBoxModelObject* ancestor,
- const FloatRect& localPaintInvalidationRect,
+ const FloatRect& localVisualRect,
LayoutRect& resultRect,
VisualRectFlags visualRectFlags) {
AffineTransform rootBorderBoxTransform;
const LayoutSVGRoot& svgRoot =
computeTransformToSVGRoot(object, rootBorderBoxTransform);
- resultRect = transformPaintInvalidationRect(object, rootBorderBoxTransform,
- localPaintInvalidationRect);
+ resultRect =
+ transformVisualRect(object, rootBorderBoxTransform, localVisualRect);
// Apply initial viewport clip.
if (svgRoot.shouldApplyViewportClip()) {
@@ -230,12 +226,12 @@ void SVGLayoutSupport::computeContainerBoundingBoxes(
FloatRect& objectBoundingBox,
bool& objectBoundingBoxValid,
FloatRect& strokeBoundingBox,
- FloatRect& paintInvalidationBoundingBox) {
+ FloatRect& localVisualRect) {
objectBoundingBox = FloatRect();
objectBoundingBoxValid = false;
strokeBoundingBox = FloatRect();
- // When computing the strokeBoundingBox, we use the paintInvalidationRects of
+ // When computing the strokeBoundingBox, we use the visualRects of
// the container's children so that the container's stroke includes the
// resources applied to the children (such as clips and filters). This allows
// filters applied to containers to correctly bound the children, and also
@@ -257,11 +253,12 @@ void SVGLayoutSupport::computeContainerBoundingBoxes(
const AffineTransform& transform = current->localToSVGParentTransform();
updateObjectBoundingBox(objectBoundingBox, objectBoundingBoxValid, current,
transform.mapRect(current->objectBoundingBox()));
- strokeBoundingBox.unite(transform.mapRect(
- current->paintInvalidationRectInLocalSVGCoordinates()));
+ strokeBoundingBox.unite(
+ transform.mapRect(current->visualRectInLocalSVGCoordinates()));
}
- paintInvalidationBoundingBox = strokeBoundingBox;
+ localVisualRect = strokeBoundingBox;
+ adjustVisualRectWithResources(container, localVisualRect);
}
const LayoutSVGRoot* SVGLayoutSupport::findTreeRootObject(
@@ -380,9 +377,9 @@ bool SVGLayoutSupport::isOverflowHidden(const LayoutObject* object) {
object->style()->overflowX() == OverflowScroll;
}
-void SVGLayoutSupport::intersectPaintInvalidationRectWithResources(
+void SVGLayoutSupport::adjustVisualRectWithResources(
const LayoutObject* layoutObject,
- FloatRect& paintInvalidationRect) {
+ FloatRect& visualRect) {
ASSERT(layoutObject);
SVGResources* resources =
@@ -391,14 +388,14 @@ void SVGLayoutSupport::intersectPaintInvalidationRectWithResources(
return;
if (LayoutSVGResourceFilter* filter = resources->filter())
- paintInvalidationRect = filter->resourceBoundingBox(layoutObject);
+ visualRect = filter->resourceBoundingBox(layoutObject);
if (LayoutSVGResourceClipper* clipper = resources->clipper())
- paintInvalidationRect.intersect(
+ visualRect.intersect(
clipper->resourceBoundingBox(layoutObject->objectBoundingBox()));
if (LayoutSVGResourceMasker* masker = resources->masker())
- paintInvalidationRect.intersect(masker->resourceBoundingBox(layoutObject));
+ visualRect.intersect(masker->resourceBoundingBox(layoutObject));
}
bool SVGLayoutSupport::hasFilterResource(const LayoutObject& object) {

Powered by Google App Engine
This is Rietveld 408576698