| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | |
| 3 * (C) 2000 Simon Hausmann <hausmann@kde.org> | |
| 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) | |
| 5 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | |
| 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | |
| 7 * | |
| 8 * This library is free software; you can redistribute it and/or | |
| 9 * modify it under the terms of the GNU Library General Public | |
| 10 * License as published by the Free Software Foundation; either | |
| 11 * version 2 of the License, or (at your option) any later version. | |
| 12 * | |
| 13 * This library is distributed in the hope that it will be useful, | |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 16 * Library General Public License for more details. | |
| 17 * | |
| 18 * You should have received a copy of the GNU Library General Public License | |
| 19 * along with this library; see the file COPYING.LIB. If not, write to | |
| 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
| 21 * Boston, MA 02110-1301, USA. | |
| 22 * | |
| 23 */ | |
| 24 | |
| 25 #include "config.h" | |
| 26 #include "core/rendering/RenderPart.h" | |
| 27 | |
| 28 #include "core/frame/FrameView.h" | |
| 29 #include "core/frame/LocalFrame.h" | |
| 30 #include "core/rendering/HitTestResult.h" | |
| 31 #include "core/rendering/RenderLayer.h" | |
| 32 #include "core/rendering/RenderView.h" | |
| 33 | |
| 34 namespace blink { | |
| 35 | |
| 36 RenderPart::RenderPart(Element* node) | |
| 37 : RenderWidget(node) | |
| 38 { | |
| 39 setInline(false); | |
| 40 } | |
| 41 | |
| 42 RenderPart::~RenderPart() | |
| 43 { | |
| 44 } | |
| 45 | |
| 46 LayerType RenderPart::layerTypeRequired() const | |
| 47 { | |
| 48 LayerType type = RenderWidget::layerTypeRequired(); | |
| 49 if (type != NoLayer) | |
| 50 return type; | |
| 51 return ForcedLayer; | |
| 52 } | |
| 53 | |
| 54 bool RenderPart::requiresAcceleratedCompositing() const | |
| 55 { | |
| 56 return false; | |
| 57 } | |
| 58 | |
| 59 bool RenderPart::needsPreferredWidthsRecalculation() const | |
| 60 { | |
| 61 return RenderWidget::needsPreferredWidthsRecalculation(); | |
| 62 } | |
| 63 | |
| 64 bool RenderPart::nodeAtPoint(const HitTestRequest& request, HitTestResult& resul
t, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOff
set, HitTestAction action) | |
| 65 { | |
| 66 if (!widget() || !widget()->isFrameView() || !request.allowsChildFrameConten
t()) | |
| 67 return RenderWidget::nodeAtPoint(request, result, locationInContainer, a
ccumulatedOffset, action); | |
| 68 | |
| 69 FrameView* childFrameView = toFrameView(widget()); | |
| 70 RenderView* childRoot = childFrameView->renderView(); | |
| 71 | |
| 72 if (childRoot) { | |
| 73 LayoutPoint adjustedLocation = accumulatedOffset + location(); | |
| 74 LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft(), bo
rderTop() + paddingTop()) - childFrameView->scrollOffset(); | |
| 75 HitTestLocation newHitTestLocation(locationInContainer, -adjustedLocatio
n - contentOffset); | |
| 76 HitTestRequest newHitTestRequest(request.type() | HitTestRequest::ChildF
rameHitTest); | |
| 77 HitTestResult childFrameResult(newHitTestLocation); | |
| 78 | |
| 79 bool isInsideChildFrame = childRoot->hitTest(newHitTestRequest, newHitTe
stLocation, childFrameResult); | |
| 80 | |
| 81 if (newHitTestLocation.isRectBasedTest()) | |
| 82 result.append(childFrameResult); | |
| 83 else if (isInsideChildFrame) | |
| 84 result = childFrameResult; | |
| 85 | |
| 86 if (isInsideChildFrame) | |
| 87 return true; | |
| 88 } | |
| 89 | |
| 90 return RenderWidget::nodeAtPoint(request, result, locationInContainer, accum
ulatedOffset, action); | |
| 91 } | |
| 92 | |
| 93 CompositingReasons RenderPart::additionalCompositingReasons() const | |
| 94 { | |
| 95 if (requiresAcceleratedCompositing()) | |
| 96 return CompositingReasonIFrame; | |
| 97 return CompositingReasonNone; | |
| 98 } | |
| 99 | |
| 100 } | |
| OLD | NEW |