| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Simon Hausmann <hausmann@kde.org> | 3 * (C) 2000 Simon Hausmann <hausmann@kde.org> |
| 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) | 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) |
| 5 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 return false; | 130 return false; |
| 131 } | 131 } |
| 132 | 132 |
| 133 bool LayoutPart::needsPreferredWidthsRecalculation() const { | 133 bool LayoutPart::needsPreferredWidthsRecalculation() const { |
| 134 if (LayoutReplaced::needsPreferredWidthsRecalculation()) | 134 if (LayoutReplaced::needsPreferredWidthsRecalculation()) |
| 135 return true; | 135 return true; |
| 136 return embeddedReplacedContent(); | 136 return embeddedReplacedContent(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool LayoutPart::nodeAtPointOverWidget( | 139 bool LayoutPart::nodeAtPointOverFrameViewBase( |
| 140 HitTestResult& result, | 140 HitTestResult& result, |
| 141 const HitTestLocation& locationInContainer, | 141 const HitTestLocation& locationInContainer, |
| 142 const LayoutPoint& accumulatedOffset, | 142 const LayoutPoint& accumulatedOffset, |
| 143 HitTestAction action) { | 143 HitTestAction action) { |
| 144 bool hadResult = result.innerNode(); | 144 bool hadResult = result.innerNode(); |
| 145 bool inside = LayoutReplaced::nodeAtPoint(result, locationInContainer, | 145 bool inside = LayoutReplaced::nodeAtPoint(result, locationInContainer, |
| 146 accumulatedOffset, action); | 146 accumulatedOffset, action); |
| 147 | 147 |
| 148 // Check to see if we are really over the FrameViewBase itself (and not just | 148 // Check to see if we are really over the FrameViewBase itself (and not just |
| 149 // in the border/padding area). | 149 // in the border/padding area). |
| 150 if ((inside || result.isRectBasedTest()) && !hadResult && | 150 if ((inside || result.isRectBasedTest()) && !hadResult && |
| 151 result.innerNode() == node()) | 151 result.innerNode() == node()) { |
| 152 result.setIsOverWidget(contentBoxRect().contains(result.localPoint())); | 152 result.setIsOverFrameViewBase( |
| 153 contentBoxRect().contains(result.localPoint())); |
| 154 } |
| 153 return inside; | 155 return inside; |
| 154 } | 156 } |
| 155 | 157 |
| 156 bool LayoutPart::nodeAtPoint(HitTestResult& result, | 158 bool LayoutPart::nodeAtPoint(HitTestResult& result, |
| 157 const HitTestLocation& locationInContainer, | 159 const HitTestLocation& locationInContainer, |
| 158 const LayoutPoint& accumulatedOffset, | 160 const LayoutPoint& accumulatedOffset, |
| 159 HitTestAction action) { | 161 HitTestAction action) { |
| 160 if (!widget() || !widget()->isFrameView() || | 162 if (!widget() || !widget()->isFrameView() || |
| 161 !result.hitTestRequest().allowsChildFrameContent()) | 163 !result.hitTestRequest().allowsChildFrameContent()) { |
| 162 return nodeAtPointOverWidget(result, locationInContainer, accumulatedOffset, | 164 return nodeAtPointOverFrameViewBase(result, locationInContainer, |
| 163 action); | 165 accumulatedOffset, action); |
| 166 } |
| 164 | 167 |
| 165 // A hit test can never hit an off-screen element; only off-screen iframes are | 168 // A hit test can never hit an off-screen element; only off-screen iframes are |
| 166 // throttled; therefore, hit tests can skip descending into throttled iframes. | 169 // throttled; therefore, hit tests can skip descending into throttled iframes. |
| 167 if (toFrameView(widget())->shouldThrottleRendering()) | 170 if (toFrameView(widget())->shouldThrottleRendering()) { |
| 168 return nodeAtPointOverWidget(result, locationInContainer, accumulatedOffset, | 171 return nodeAtPointOverFrameViewBase(result, locationInContainer, |
| 169 action); | 172 accumulatedOffset, action); |
| 173 } |
| 170 | 174 |
| 171 ASSERT(document().lifecycle().state() >= DocumentLifecycle::CompositingClean); | 175 ASSERT(document().lifecycle().state() >= DocumentLifecycle::CompositingClean); |
| 172 | 176 |
| 173 if (action == HitTestForeground) { | 177 if (action == HitTestForeground) { |
| 174 FrameView* childFrameView = toFrameView(widget()); | 178 FrameView* childFrameView = toFrameView(widget()); |
| 175 LayoutViewItem childRootItem = childFrameView->layoutViewItem(); | 179 LayoutViewItem childRootItem = childFrameView->layoutViewItem(); |
| 176 | 180 |
| 177 if (visibleToHitTestRequest(result.hitTestRequest()) && | 181 if (visibleToHitTestRequest(result.hitTestRequest()) && |
| 178 !childRootItem.isNull()) { | 182 !childRootItem.isNull()) { |
| 179 LayoutPoint adjustedLocation = accumulatedOffset + location(); | 183 LayoutPoint adjustedLocation = accumulatedOffset + location(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 195 } else if (isInsideChildFrame) { | 199 } else if (isInsideChildFrame) { |
| 196 // Force the result not to be cacheable because the parent frame should | 200 // Force the result not to be cacheable because the parent frame should |
| 197 // not cache this result; as it won't be notified of changes in the | 201 // not cache this result; as it won't be notified of changes in the |
| 198 // child. | 202 // child. |
| 199 childFrameResult.setCacheable(false); | 203 childFrameResult.setCacheable(false); |
| 200 result = childFrameResult; | 204 result = childFrameResult; |
| 201 } | 205 } |
| 202 | 206 |
| 203 // Don't trust |isInsideChildFrame|. For rect-based hit-test, returns | 207 // Don't trust |isInsideChildFrame|. For rect-based hit-test, returns |
| 204 // true only when the hit test rect is totally within the iframe, | 208 // true only when the hit test rect is totally within the iframe, |
| 205 // i.e. nodeAtPointOverWidget() also returns true. | 209 // i.e. nodeAtPointOverFrameViewBase() also returns true. |
| 206 // Use a temporary HitTestResult because we don't want to collect the | 210 // Use a temporary HitTestResult because we don't want to collect the |
| 207 // iframe element itself if the hit-test rect is totally within the | 211 // iframe element itself if the hit-test rect is totally within the |
| 208 // iframe. | 212 // iframe. |
| 209 if (isInsideChildFrame) { | 213 if (isInsideChildFrame) { |
| 210 if (!locationInContainer.isRectBasedTest()) | 214 if (!locationInContainer.isRectBasedTest()) |
| 211 return true; | 215 return true; |
| 212 HitTestResult pointOverWidgetResult = result; | 216 HitTestResult pointOverFrameViewBaseResult = result; |
| 213 bool pointOverWidget = | 217 bool pointOverFrameViewBase = nodeAtPointOverFrameViewBase( |
| 214 nodeAtPointOverWidget(pointOverWidgetResult, locationInContainer, | 218 pointOverFrameViewBaseResult, locationInContainer, |
| 215 accumulatedOffset, action); | 219 accumulatedOffset, action); |
| 216 if (pointOverWidget) | 220 if (pointOverFrameViewBase) |
| 217 return true; | 221 return true; |
| 218 result = pointOverWidgetResult; | 222 result = pointOverFrameViewBaseResult; |
| 219 return false; | 223 return false; |
| 220 } | 224 } |
| 221 } | 225 } |
| 222 } | 226 } |
| 223 | 227 |
| 224 return nodeAtPointOverWidget(result, locationInContainer, accumulatedOffset, | 228 return nodeAtPointOverFrameViewBase(result, locationInContainer, |
| 225 action); | 229 accumulatedOffset, action); |
| 226 } | 230 } |
| 227 | 231 |
| 228 CompositingReasons LayoutPart::additionalCompositingReasons() const { | 232 CompositingReasons LayoutPart::additionalCompositingReasons() const { |
| 229 if (requiresAcceleratedCompositing()) | 233 if (requiresAcceleratedCompositing()) |
| 230 return CompositingReasonIFrame; | 234 return CompositingReasonIFrame; |
| 231 return CompositingReasonNone; | 235 return CompositingReasonNone; |
| 232 } | 236 } |
| 233 | 237 |
| 234 void LayoutPart::styleDidChange(StyleDifference diff, | 238 void LayoutPart::styleDidChange(StyleDifference diff, |
| 235 const ComputedStyle* oldStyle) { | 239 const ComputedStyle* oldStyle) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 } | 395 } |
| 392 | 396 |
| 393 bool LayoutPart::isThrottledFrameView() const { | 397 bool LayoutPart::isThrottledFrameView() const { |
| 394 if (!widget() || !widget()->isFrameView()) | 398 if (!widget() || !widget()->isFrameView()) |
| 395 return false; | 399 return false; |
| 396 const FrameView* frameView = toFrameView(widget()); | 400 const FrameView* frameView = toFrameView(widget()); |
| 397 return frameView->shouldThrottleRendering(); | 401 return frameView->shouldThrottleRendering(); |
| 398 } | 402 } |
| 399 | 403 |
| 400 } // namespace blink | 404 } // namespace blink |
| OLD | NEW |