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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp

Issue 1817693002: Support edge-inclusive intersections in mapToVisibleRectInAncestorSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src@intersection-observer-idle-callback
Patch Set: Added IntersectionType flag and unit test for LayoutRect::inclusiveIntersect. Created 4 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. 5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2011. 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 // If the box is decorated or is overflowing, extend it to include the borde r-box and overflow. 341 // If the box is decorated or is overflowing, extend it to include the borde r-box and overflow.
342 if (m_hasBoxDecorationBackground || hasOverflowModel()) { 342 if (m_hasBoxDecorationBackground || hasOverflowModel()) {
343 // The selectionRect can project outside of the overflowRect, so take th eir union 343 // The selectionRect can project outside of the overflowRect, so take th eir union
344 // for paint invalidation to avoid selection painting glitches. 344 // for paint invalidation to avoid selection painting glitches.
345 LayoutRect decoratedPaintInvalidationRect = unionRect(localSelectionRect (), visualOverflowRect()); 345 LayoutRect decoratedPaintInvalidationRect = unionRect(localSelectionRect (), visualOverflowRect());
346 paintInvalidationRect.unite(decoratedPaintInvalidationRect); 346 paintInvalidationRect.unite(decoratedPaintInvalidationRect);
347 } 347 }
348 348
349 // Compute the paint invalidation rect in the parent coordinate space. 349 // Compute the paint invalidation rect in the parent coordinate space.
350 LayoutRect rect(enclosingIntRect(paintInvalidationRect)); 350 LayoutRect rect(enclosingIntRect(paintInvalidationRect));
351 LayoutReplaced::mapToVisibleRectInAncestorSpace(paintInvalidationContainer, rect, paintInvalidationState); 351 LayoutReplaced::mapToVisibleRectInAncestorSpace(paintInvalidationContainer, rect, paintInvalidationState, false);
352 return rect; 352 return rect;
353 } 353 }
354 354
355 void LayoutSVGRoot::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ancestor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState ) const 355 bool LayoutSVGRoot::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ancestor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState , int flags) const
356 { 356 {
357 // Note that we don't apply the border-box transform here - it's assumed 357 // Note that we don't apply the border-box transform here - it's assumed
358 // that whoever called us has done that already. 358 // that whoever called us has done that already.
359 359
360 // Apply initial viewport clip 360 // Apply initial viewport clip
361 if (shouldApplyViewportClip()) 361 if (shouldApplyViewportClip()) {
362 rect.intersect(LayoutRect(pixelSnappedBorderBoxRect())); 362 if (flags & EdgeInclusive) {
363 if (!rect.inclusiveIntersect(LayoutRect(pixelSnappedBorderBoxRect()) ))
364 return false;
365 } else {
366 rect.intersect(LayoutRect(pixelSnappedBorderBoxRect()));
chrishtr 2016/03/22 17:25:49 early out?
szager1 2016/03/22 19:42:24 I'm hesitant to do that, because the call to Layou
367 }
368 }
363 369
364 LayoutReplaced::mapToVisibleRectInAncestorSpace(ancestor, rect, paintInvalid ationState); 370 return LayoutReplaced::mapToVisibleRectInAncestorSpace(ancestor, rect, paint InvalidationState, flags);
365 } 371 }
366 372
367 // This method expects local CSS box coordinates. 373 // This method expects local CSS box coordinates.
368 // Callers with local SVG viewport coordinates should first apply the localToBor derBoxTransform 374 // Callers with local SVG viewport coordinates should first apply the localToBor derBoxTransform
369 // to convert from SVG viewport coordinates to local CSS box coordinates. 375 // to convert from SVG viewport coordinates to local CSS box coordinates.
370 void LayoutSVGRoot::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Tra nsformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const Pai ntInvalidationState* paintInvalidationState) const 376 void LayoutSVGRoot::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Tra nsformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const Pai ntInvalidationState* paintInvalidationState) const
371 { 377 {
372 ASSERT(!(mode & IsFixed)); // We should have no fixed content in the SVG lay out tree. 378 ASSERT(!(mode & IsFixed)); // We should have no fixed content in the SVG lay out tree.
373 379
374 LayoutReplaced::mapLocalToAncestor(ancestor, transformState, mode | ApplyCon tainerFlip, wasFixed, paintInvalidationState); 380 LayoutReplaced::mapLocalToAncestor(ancestor, transformState, mode | ApplyCon tainerFlip, wasFixed, paintInvalidationState);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 updateHitTestResult(result, pointInBorderBox); 426 updateHitTestResult(result, pointInBorderBox);
421 if (result.addNodeToListBasedTestResult(node(), locationInContainer, boundsRect) == StopHitTesting) 427 if (result.addNodeToListBasedTestResult(node(), locationInContainer, boundsRect) == StopHitTesting)
422 return true; 428 return true;
423 } 429 }
424 } 430 }
425 431
426 return false; 432 return false;
427 } 433 }
428 434
429 } // namespace blink 435 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698