| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
| 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "core/layout/LayoutListBox.h" | 47 #include "core/layout/LayoutListBox.h" |
| 48 #include "core/layout/LayoutListMarker.h" | 48 #include "core/layout/LayoutListMarker.h" |
| 49 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" | 49 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" |
| 50 #include "core/layout/LayoutPart.h" | 50 #include "core/layout/LayoutPart.h" |
| 51 #include "core/layout/LayoutReplica.h" | 51 #include "core/layout/LayoutReplica.h" |
| 52 #include "core/layout/LayoutScrollbarPart.h" | 52 #include "core/layout/LayoutScrollbarPart.h" |
| 53 #include "core/layout/LayoutTableCell.h" | 53 #include "core/layout/LayoutTableCell.h" |
| 54 #include "core/layout/LayoutView.h" | 54 #include "core/layout/LayoutView.h" |
| 55 #include "core/layout/compositing/PaintLayerCompositor.h" | 55 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 56 #include "core/layout/shapes/ShapeOutsideInfo.h" | 56 #include "core/layout/shapes/ShapeOutsideInfo.h" |
| 57 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
| 57 #include "core/page/AutoscrollController.h" | 58 #include "core/page/AutoscrollController.h" |
| 58 #include "core/page/Page.h" | 59 #include "core/page/Page.h" |
| 59 #include "core/paint/BackgroundImageGeometry.h" | 60 #include "core/paint/BackgroundImageGeometry.h" |
| 60 #include "core/paint/BoxPainter.h" | 61 #include "core/paint/BoxPainter.h" |
| 61 #include "core/paint/PaintLayer.h" | 62 #include "core/paint/PaintLayer.h" |
| 62 #include "core/style/ShadowList.h" | 63 #include "core/style/ShadowList.h" |
| 63 #include "platform/LengthFunctions.h" | 64 #include "platform/LengthFunctions.h" |
| 64 #include "platform/geometry/DoubleRect.h" | 65 #include "platform/geometry/DoubleRect.h" |
| 65 #include "platform/geometry/FloatQuad.h" | 66 #include "platform/geometry/FloatQuad.h" |
| 66 #include "platform/geometry/FloatRoundedRect.h" | 67 #include "platform/geometry/FloatRoundedRect.h" |
| (...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 } | 1159 } |
| 1159 | 1160 |
| 1160 // Hit Testing | 1161 // Hit Testing |
| 1161 bool LayoutBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& locati
onInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action) | 1162 bool LayoutBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& locati
onInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action) |
| 1162 { | 1163 { |
| 1163 LayoutPoint adjustedLocation = accumulatedOffset + location(); | 1164 LayoutPoint adjustedLocation = accumulatedOffset + location(); |
| 1164 | 1165 |
| 1165 // Exit early if no children can be hit. | 1166 // Exit early if no children can be hit. |
| 1166 LayoutRect overflowRect = visualOverflowRect(); | 1167 LayoutRect overflowRect = visualOverflowRect(); |
| 1167 overflowRect.moveBy(adjustedLocation); | 1168 overflowRect.moveBy(adjustedLocation); |
| 1168 if (!locationInContainer.intersects(overflowRect)) { | 1169 if (!locationInContainer.intersects(overflowRect)) |
| 1169 return false; | 1170 return false; |
| 1170 } | 1171 |
| 1172 if (hitTestClippedOutByClipPath(locationInContainer, adjustedLocation)) |
| 1173 return false; |
| 1171 | 1174 |
| 1172 // Check kids first. | 1175 // Check kids first. |
| 1173 for (LayoutObject* child = slowLastChild(); child; child = child->previousSi
bling()) { | 1176 for (LayoutObject* child = slowLastChild(); child; child = child->previousSi
bling()) { |
| 1174 if ((!child->hasLayer() || !toLayoutBoxModelObject(child)->layer()->isSe
lfPaintingLayer()) && child->nodeAtPoint(result, locationInContainer, adjustedLo
cation, action)) { | 1177 if ((!child->hasLayer() || !toLayoutBoxModelObject(child)->layer()->isSe
lfPaintingLayer()) && child->nodeAtPoint(result, locationInContainer, adjustedLo
cation, action)) { |
| 1175 updateHitTestResult(result, locationInContainer.point() - toLayoutSi
ze(adjustedLocation)); | 1178 updateHitTestResult(result, locationInContainer.point() - toLayoutSi
ze(adjustedLocation)); |
| 1176 return true; | 1179 return true; |
| 1177 } | 1180 } |
| 1178 } | 1181 } |
| 1179 | 1182 |
| 1183 if (hitTestClippedOutByRoundedBorder(locationInContainer, adjustedLocation)) |
| 1184 return false; |
| 1185 |
| 1180 // Check our bounds next. For this purpose always assume that we can only be
hit in the | 1186 // Check our bounds next. For this purpose always assume that we can only be
hit in the |
| 1181 // foreground phase (which is true for replaced elements like images). | 1187 // foreground phase (which is true for replaced elements like images). |
| 1182 LayoutRect boundsRect = borderBoxRect(); | 1188 LayoutRect boundsRect = borderBoxRect(); |
| 1183 boundsRect.moveBy(adjustedLocation); | 1189 boundsRect.moveBy(adjustedLocation); |
| 1184 if (visibleToHitTestRequest(result.hitTestRequest()) && action == HitTestFor
eground && locationInContainer.intersects(boundsRect)) { | 1190 if (visibleToHitTestRequest(result.hitTestRequest()) && action == HitTestFor
eground && locationInContainer.intersects(boundsRect)) { |
| 1185 updateHitTestResult(result, locationInContainer.point() - toLayoutSize(a
djustedLocation)); | 1191 updateHitTestResult(result, locationInContainer.point() - toLayoutSize(a
djustedLocation)); |
| 1186 if (!result.addNodeToListBasedTestResult(node(), locationInContainer, bo
undsRect)) | 1192 if (!result.addNodeToListBasedTestResult(node(), locationInContainer, bo
undsRect)) |
| 1187 return true; | 1193 return true; |
| 1188 } | 1194 } |
| 1189 | 1195 |
| 1190 return false; | 1196 return false; |
| 1191 } | 1197 } |
| 1192 | 1198 |
| 1199 bool LayoutBox::hitTestClippedOutByClipPath(const HitTestLocation& locationInCon
tainer, const LayoutPoint& borderBoxLocation) const |
| 1200 { |
| 1201 if (!style()->clipPath()) |
| 1202 return false; |
| 1203 |
| 1204 if (style()->clipPath()->type() == ClipPathOperation::SHAPE) { |
| 1205 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style()->cli
pPath()); |
| 1206 // FIXME: handle marginBox etc. |
| 1207 if (!clipPath->path(FloatRect(borderBoxRect())).contains(FloatPoint(loca
tionInContainer.point() - borderBoxLocation), clipPath->windRule())) |
| 1208 return true; |
| 1209 } else { |
| 1210 ASSERT(style()->clipPath()->type() == ClipPathOperation::REFERENCE); |
| 1211 ReferenceClipPathOperation* referenceClipPathOperation = toReferenceClip
PathOperation(style()->clipPath()); |
| 1212 Element* element = document().getElementById(referenceClipPathOperation-
>fragment()); |
| 1213 if (isSVGClipPathElement(element) && element->layoutObject()) { |
| 1214 LayoutSVGResourceClipper* clipper = toLayoutSVGResourceClipper(toLay
outSVGResourceContainer(element->layoutObject())); |
| 1215 if (!clipper->hitTestClipContent(FloatRect(borderBoxRect()), FloatPo
int(locationInContainer.point() - borderBoxLocation))) |
| 1216 return true; |
| 1217 } |
| 1218 } |
| 1219 |
| 1220 return false; |
| 1221 } |
| 1222 |
| 1223 bool LayoutBox::hitTestClippedOutByRoundedBorder(const HitTestLocation& location
InContainer, const LayoutPoint& borderBoxLocation) const |
| 1224 { |
| 1225 if (!style()->hasBorderRadius()) |
| 1226 return false; |
| 1227 |
| 1228 LayoutRect borderRect = borderBoxRect(); |
| 1229 borderRect.moveBy(borderBoxLocation); |
| 1230 return !locationInContainer.intersects(style()->getRoundedBorderFor(borderRe
ct)); |
| 1231 } |
| 1232 |
| 1193 void LayoutBox::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset
) const | 1233 void LayoutBox::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset
) const |
| 1194 { | 1234 { |
| 1195 BoxPainter(*this).paint(paintInfo, paintOffset); | 1235 BoxPainter(*this).paint(paintInfo, paintOffset); |
| 1196 } | 1236 } |
| 1197 | 1237 |
| 1198 | 1238 |
| 1199 void LayoutBox::paintBoxDecorationBackground(const PaintInfo& paintInfo, const L
ayoutPoint& paintOffset) const | 1239 void LayoutBox::paintBoxDecorationBackground(const PaintInfo& paintInfo, const L
ayoutPoint& paintOffset) const |
| 1200 { | 1240 { |
| 1201 BoxPainter(*this).paintBoxDecorationBackground(paintInfo, paintOffset); | 1241 BoxPainter(*this).paintBoxDecorationBackground(paintInfo, paintOffset); |
| 1202 } | 1242 } |
| (...skipping 3654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4857 } | 4897 } |
| 4858 | 4898 |
| 4859 void LayoutBox::clearPreviousPaintInvalidationRects() | 4899 void LayoutBox::clearPreviousPaintInvalidationRects() |
| 4860 { | 4900 { |
| 4861 LayoutBoxModelObject::clearPreviousPaintInvalidationRects(); | 4901 LayoutBoxModelObject::clearPreviousPaintInvalidationRects(); |
| 4862 if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea()) | 4902 if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea()) |
| 4863 scrollableArea->clearPreviousPaintInvalidationRects(); | 4903 scrollableArea->clearPreviousPaintInvalidationRects(); |
| 4864 } | 4904 } |
| 4865 | 4905 |
| 4866 } // namespace blink | 4906 } // namespace blink |
| OLD | NEW |