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 2064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2075 return toLayoutBox(layoutObject())->borderBoxRect(); | 2075 return toLayoutBox(layoutObject())->borderBoxRect(); |
2076 } | 2076 } |
2077 | 2077 |
2078 bool PaintLayer::hitTestClippedOutByClipPath(PaintLayer* rootLayer, const HitTes
tLocation& hitTestLocation) const | 2078 bool PaintLayer::hitTestClippedOutByClipPath(PaintLayer* rootLayer, const HitTes
tLocation& hitTestLocation) const |
2079 { | 2079 { |
2080 if (!layoutObject()->hasClipPath()) | 2080 if (!layoutObject()->hasClipPath()) |
2081 return false; | 2081 return false; |
2082 DCHECK(isSelfPaintingLayer()); | 2082 DCHECK(isSelfPaintingLayer()); |
2083 DCHECK(rootLayer); | 2083 DCHECK(rootLayer); |
2084 | 2084 |
2085 LayoutPoint offsetToRootLayer; | |
2086 convertToLayerCoords(rootLayer, offsetToRootLayer); | |
2087 LayoutRect referenceBox(boxForClipPath()); | 2085 LayoutRect referenceBox(boxForClipPath()); |
2088 referenceBox.moveBy(offsetToRootLayer); | 2086 if (enclosingPaginationLayer()) |
| 2087 convertFromFlowThreadToVisualBoundingBoxInAncestor(rootLayer, referenceB
ox); |
| 2088 else |
| 2089 convertToLayerCoords(rootLayer, referenceBox); |
2089 | 2090 |
2090 FloatPoint point(hitTestLocation.point()); | 2091 FloatPoint point(hitTestLocation.point()); |
2091 | 2092 |
2092 ClipPathOperation* clipPathOperation = layoutObject()->style()->clipPath(); | 2093 ClipPathOperation* clipPathOperation = layoutObject()->style()->clipPath(); |
2093 DCHECK(clipPathOperation); | 2094 DCHECK(clipPathOperation); |
2094 if (clipPathOperation->type() == ClipPathOperation::SHAPE) { | 2095 if (clipPathOperation->type() == ClipPathOperation::SHAPE) { |
2095 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(clipPathOper
ation); | 2096 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(clipPathOper
ation); |
2096 return !clipPath->path(FloatRect(referenceBox)).contains(point); | 2097 return !clipPath->path(FloatRect(referenceBox)).contains(point); |
2097 } | 2098 } |
2098 DCHECK_EQ(clipPathOperation->type(), ClipPathOperation::REFERENCE); | 2099 DCHECK_EQ(clipPathOperation->type(), ClipPathOperation::REFERENCE); |
2099 ReferenceClipPathOperation* referenceClipPathOperation = toReferenceClipPath
Operation(clipPathOperation); | 2100 ReferenceClipPathOperation* referenceClipPathOperation = toReferenceClipPath
Operation(clipPathOperation); |
2100 Element* element = layoutObject()->document().getElementById(referenceClipPa
thOperation->fragment()); | 2101 Element* element = layoutObject()->document().getElementById(referenceClipPa
thOperation->fragment()); |
2101 if (!isSVGClipPathElement(element) || !element->layoutObject()) | 2102 if (!isSVGClipPathElement(element) || !element->layoutObject()) |
2102 return false; | 2103 return false; |
2103 LayoutSVGResourceClipper* clipper = | 2104 LayoutSVGResourceClipper* clipper = |
2104 toLayoutSVGResourceClipper(toLayoutSVGResourceContainer(element->layoutO
bject())); | 2105 toLayoutSVGResourceClipper(toLayoutSVGResourceContainer(element->layoutO
bject())); |
2105 // If the clipPath is using "userspace on use" units, then the origin of | 2106 // If the clipPath is using "userspace on use" units, then the origin of |
2106 // the coordinate system is the top-left of the reference box, so adjust | 2107 // the coordinate system is the top-left of the reference box, so adjust |
2107 // the point accordingly. | 2108 // the point accordingly. |
2108 if (clipper->clipPathUnits() == SVGUnitTypes::kSvgUnitTypeUserspaceonuse) | 2109 if (clipper->clipPathUnits() == SVGUnitTypes::kSvgUnitTypeUserspaceonuse) |
2109 point.moveBy(-offsetToRootLayer); | 2110 point.moveBy(-referenceBox.location()); |
2110 return !clipper->hitTestClipContent(FloatRect(referenceBox), point); | 2111 return !clipper->hitTestClipContent(FloatRect(referenceBox), point); |
2111 } | 2112 } |
2112 | 2113 |
2113 bool PaintLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layou
tRect& damageRect, const LayoutPoint& offsetFromRoot) const | 2114 bool PaintLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layou
tRect& damageRect, const LayoutPoint& offsetFromRoot) const |
2114 { | 2115 { |
2115 // Always examine the canvas and the root. | 2116 // Always examine the canvas and the root. |
2116 // FIXME: Could eliminate the isDocumentElement() check if we fix background
painting so that the LayoutView | 2117 // FIXME: Could eliminate the isDocumentElement() check if we fix background
painting so that the LayoutView |
2117 // paints the root's background. | 2118 // paints the root's background. |
2118 if (isRootLayer() || layoutObject()->isDocumentElement()) | 2119 if (isRootLayer() || layoutObject()->isDocumentElement()) |
2119 return true; | 2120 return true; |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2957 | 2958 |
2958 void showLayerTree(const blink::LayoutObject* layoutObject) | 2959 void showLayerTree(const blink::LayoutObject* layoutObject) |
2959 { | 2960 { |
2960 if (!layoutObject) { | 2961 if (!layoutObject) { |
2961 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2962 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
2962 return; | 2963 return; |
2963 } | 2964 } |
2964 showLayerTree(layoutObject->enclosingLayer()); | 2965 showLayerTree(layoutObject->enclosingLayer()); |
2965 } | 2966 } |
2966 #endif | 2967 #endif |
OLD | NEW |