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

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

Issue 2312713002: Unprefix -webkit-clip-path (Closed)
Patch Set: Baselines Created 4 years, 3 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) 2007, 2008 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@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. All rights reserved. 5 * Copyright (C) 2009 Google, Inc. All rights reserved.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 363 }
364 364
365 bool SVGLayoutSupport::hasFilterResource(const LayoutObject& object) 365 bool SVGLayoutSupport::hasFilterResource(const LayoutObject& object)
366 { 366 {
367 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject( &object); 367 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject( &object);
368 return resources && resources->filter(); 368 return resources && resources->filter();
369 } 369 }
370 370
371 bool SVGLayoutSupport::pointInClippingArea(const LayoutObject& object, const Flo atPoint& point) 371 bool SVGLayoutSupport::pointInClippingArea(const LayoutObject& object, const Flo atPoint& point)
372 { 372 {
373 // We just take clippers into account to determine if a point is on the node . The Specification may 373 ClipPathOperation* clipPathOperation = object.styleRef().clipPath();
374 // change later and we also need to check maskers. 374 if (!clipPathOperation)
375 return true;
376 if (clipPathOperation->type() == ClipPathOperation::SHAPE) {
chrishtr 2016/09/09 02:04:46 Why this new code to support SHAPE? Is this to imp
fs 2016/09/09 08:28:10 No, this is actually what falls out by starting to
fs 2016/09/09 08:31:35 I should probably mention that "Support for nestin
fs 2016/09/09 16:26:42 I've split out <basic-shape> support for 'clip-pat
fs 2016/09/09 20:12:16 Done.
377 ShapeClipPathOperation& clipPath = toShapeClipPathOperation(*clipPathOpe ration);
378 return clipPath.path(object.objectBoundingBox()).contains(point);
379 }
380 DCHECK_EQ(clipPathOperation->type(), ClipPathOperation::REFERENCE);
375 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject( &object); 381 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject( &object);
376 if (!resources) 382 if (!resources || !resources->clipper())
377 return true; 383 return true;
378 384 return resources->clipper()->hitTestClipContent(object.objectBoundingBox(), point);
379 if (LayoutSVGResourceClipper* clipper = resources->clipper())
380 return clipper->hitTestClipContent(object.objectBoundingBox(), point);
381
382 return true;
383 } 385 }
384 386
385 bool SVGLayoutSupport::transformToUserSpaceAndCheckClipping(const LayoutObject& object, const AffineTransform& localTransform, const FloatPoint& pointInParent, FloatPoint& localPoint) 387 bool SVGLayoutSupport::transformToUserSpaceAndCheckClipping(const LayoutObject& object, const AffineTransform& localTransform, const FloatPoint& pointInParent, FloatPoint& localPoint)
386 { 388 {
387 if (!localTransform.isInvertible()) 389 if (!localTransform.isInvertible())
388 return false; 390 return false;
389 localPoint = localTransform.inverse().mapPoint(pointInParent); 391 localPoint = localTransform.inverse().mapPoint(pointInParent);
390 return pointInClippingArea(object, localPoint); 392 return pointInClippingArea(object, localPoint);
391 } 393 }
392 394
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 ASSERT(object->isText()); 430 ASSERT(object->isText());
429 // <br> is marked as text, but is not handled by the SVG layout code-path. 431 // <br> is marked as text, but is not handled by the SVG layout code-path.
430 return object->isSVGInlineText() && !toLayoutSVGInlineText(object)->hasEmpty Text(); 432 return object->isSVGInlineText() && !toLayoutSVGInlineText(object)->hasEmpty Text();
431 } 433 }
432 434
433 bool SVGLayoutSupport::willIsolateBlendingDescendantsForStyle(const ComputedStyl e& style) 435 bool SVGLayoutSupport::willIsolateBlendingDescendantsForStyle(const ComputedStyl e& style)
434 { 436 {
435 const SVGComputedStyle& svgStyle = style.svgStyle(); 437 const SVGComputedStyle& svgStyle = style.svgStyle();
436 438
437 return style.hasIsolation() || style.opacity() < 1 || style.hasBlendMode() 439 return style.hasIsolation() || style.opacity() < 1 || style.hasBlendMode()
438 || style.hasFilter() || svgStyle.hasMasker() || svgStyle.hasClipper(); 440 || style.hasFilter() || svgStyle.hasMasker() || style.clipPath();
439 } 441 }
440 442
441 bool SVGLayoutSupport::willIsolateBlendingDescendantsForObject(const LayoutObjec t* object) 443 bool SVGLayoutSupport::willIsolateBlendingDescendantsForObject(const LayoutObjec t* object)
442 { 444 {
443 if (object->isSVGHiddenContainer()) 445 if (object->isSVGHiddenContainer())
444 return false; 446 return false;
445 if (!object->isSVGRoot() && !object->isSVGContainer()) 447 if (!object->isSVGRoot() && !object->isSVGContainer())
446 return false; 448 return false;
447 return willIsolateBlendingDescendantsForStyle(object->styleRef()); 449 return willIsolateBlendingDescendantsForStyle(object->styleRef());
448 } 450 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 576
575 return closestText; 577 return closestText;
576 } 578 }
577 579
578 LayoutObject* SVGLayoutSupport::findClosestLayoutSVGText(LayoutObject* layoutObj ect, const FloatPoint& point) 580 LayoutObject* SVGLayoutSupport::findClosestLayoutSVGText(LayoutObject* layoutObj ect, const FloatPoint& point)
579 { 581 {
580 return searchTreeForFindClosestLayoutSVGText(layoutObject, point).candidateL ayoutObject; 582 return searchTreeForFindClosestLayoutSVGText(layoutObject, point).candidateL ayoutObject;
581 } 583 }
582 584
583 } // namespace blink 585 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698