OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 return toLayoutBox(layoutObject())->borderBoxRect(); | 2069 return toLayoutBox(layoutObject())->borderBoxRect(); |
2070 } | 2070 } |
2071 | 2071 |
2072 bool PaintLayer::hitTestClippedOutByClipPath(PaintLayer* rootLayer, const HitTes
tLocation& hitTestLocation) const | 2072 bool PaintLayer::hitTestClippedOutByClipPath(PaintLayer* rootLayer, const HitTes
tLocation& hitTestLocation) const |
2073 { | 2073 { |
2074 if (!layoutObject()->hasClipPath()) | 2074 if (!layoutObject()->hasClipPath()) |
2075 return false; | 2075 return false; |
2076 DCHECK(isSelfPaintingLayer()); | 2076 DCHECK(isSelfPaintingLayer()); |
2077 DCHECK(rootLayer); | 2077 DCHECK(rootLayer); |
2078 | 2078 |
2079 LayoutPoint offsetToRootLayer; | |
2080 convertToLayerCoords(rootLayer, offsetToRootLayer); | |
2081 LayoutRect referenceBox(boxForClipPath()); | 2079 LayoutRect referenceBox(boxForClipPath()); |
2082 referenceBox.moveBy(offsetToRootLayer); | 2080 if (enclosingPaginationLayer()) |
| 2081 convertFromFlowThreadToVisualBoundingBoxInAncestor(rootLayer, referenceB
ox); |
| 2082 else |
| 2083 convertToLayerCoords(rootLayer, referenceBox); |
2083 | 2084 |
2084 FloatPoint point(hitTestLocation.point()); | 2085 FloatPoint point(hitTestLocation.point()); |
2085 | 2086 |
2086 ClipPathOperation* clipPathOperation = layoutObject()->style()->clipPath(); | 2087 ClipPathOperation* clipPathOperation = layoutObject()->style()->clipPath(); |
2087 DCHECK(clipPathOperation); | 2088 DCHECK(clipPathOperation); |
2088 if (clipPathOperation->type() == ClipPathOperation::SHAPE) { | 2089 if (clipPathOperation->type() == ClipPathOperation::SHAPE) { |
2089 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(clipPathOper
ation); | 2090 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(clipPathOper
ation); |
2090 return !clipPath->path(FloatRect(referenceBox)).contains(point); | 2091 return !clipPath->path(FloatRect(referenceBox)).contains(point); |
2091 } | 2092 } |
2092 DCHECK_EQ(clipPathOperation->type(), ClipPathOperation::REFERENCE); | 2093 DCHECK_EQ(clipPathOperation->type(), ClipPathOperation::REFERENCE); |
2093 ReferenceClipPathOperation* referenceClipPathOperation = toReferenceClipPath
Operation(clipPathOperation); | 2094 ReferenceClipPathOperation* referenceClipPathOperation = toReferenceClipPath
Operation(clipPathOperation); |
2094 Element* element = layoutObject()->document().getElementById(referenceClipPa
thOperation->fragment()); | 2095 Element* element = layoutObject()->document().getElementById(referenceClipPa
thOperation->fragment()); |
2095 if (!isSVGClipPathElement(element) || !element->layoutObject()) | 2096 if (!isSVGClipPathElement(element) || !element->layoutObject()) |
2096 return false; | 2097 return false; |
2097 LayoutSVGResourceClipper* clipper = | 2098 LayoutSVGResourceClipper* clipper = |
2098 toLayoutSVGResourceClipper(toLayoutSVGResourceContainer(element->layoutO
bject())); | 2099 toLayoutSVGResourceClipper(toLayoutSVGResourceContainer(element->layoutO
bject())); |
2099 // If the clipPath is using "userspace on use" units, then the origin of | 2100 // If the clipPath is using "userspace on use" units, then the origin of |
2100 // the coordinate system is the top-left of the reference box, so adjust | 2101 // the coordinate system is the top-left of the reference box, so adjust |
2101 // the point accordingly. | 2102 // the point accordingly. |
2102 if (clipper->clipPathUnits() == SVGUnitTypes::kSvgUnitTypeUserspaceonuse) | 2103 if (clipper->clipPathUnits() == SVGUnitTypes::kSvgUnitTypeUserspaceonuse) |
2103 point.moveBy(-offsetToRootLayer); | 2104 point.moveBy(-referenceBox.location()); |
2104 return !clipper->hitTestClipContent(FloatRect(referenceBox), point); | 2105 return !clipper->hitTestClipContent(FloatRect(referenceBox), point); |
2105 } | 2106 } |
2106 | 2107 |
2107 bool PaintLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layou
tRect& damageRect, const LayoutPoint& offsetFromRoot) const | 2108 bool PaintLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layou
tRect& damageRect, const LayoutPoint& offsetFromRoot) const |
2108 { | 2109 { |
2109 // Always examine the canvas and the root. | 2110 // Always examine the canvas and the root. |
2110 // FIXME: Could eliminate the isDocumentElement() check if we fix background
painting so that the LayoutView | 2111 // FIXME: Could eliminate the isDocumentElement() check if we fix background
painting so that the LayoutView |
2111 // paints the root's background. | 2112 // paints the root's background. |
2112 if (isRootLayer() || layoutObject()->isDocumentElement()) | 2113 if (isRootLayer() || layoutObject()->isDocumentElement()) |
2113 return true; | 2114 return true; |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2951 | 2952 |
2952 void showLayerTree(const blink::LayoutObject* layoutObject) | 2953 void showLayerTree(const blink::LayoutObject* layoutObject) |
2953 { | 2954 { |
2954 if (!layoutObject) { | 2955 if (!layoutObject) { |
2955 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2956 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
2956 return; | 2957 return; |
2957 } | 2958 } |
2958 showLayerTree(layoutObject->enclosingLayer()); | 2959 showLayerTree(layoutObject->enclosingLayer()); |
2959 } | 2960 } |
2960 #endif | 2961 #endif |
OLD | NEW |