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 26 matching lines...) Expand all Loading... |
37 #include "core/plugins/PluginView.h" | 37 #include "core/plugins/PluginView.h" |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 LayoutPart::LayoutPart(Element* element) | 41 LayoutPart::LayoutPart(Element* element) |
42 : LayoutReplaced(element), | 42 : LayoutReplaced(element), |
43 // Reference counting is used to prevent the part from being destroyed | 43 // Reference counting is used to prevent the part from being destroyed |
44 // while inside the FrameViewBase code, which might not be able to handle | 44 // while inside the FrameViewBase code, which might not be able to handle |
45 // that. | 45 // that. |
46 m_refCount(1) { | 46 m_refCount(1) { |
47 ASSERT(element); | 47 DCHECK(element); |
48 frameView()->addPart(this); | 48 frameView()->addPart(this); |
49 setInline(false); | 49 setInline(false); |
50 } | 50 } |
51 | 51 |
52 void LayoutPart::deref() { | 52 void LayoutPart::deref() { |
53 if (--m_refCount <= 0) | 53 if (--m_refCount <= 0) |
54 delete this; | 54 delete this; |
55 } | 55 } |
56 | 56 |
57 void LayoutPart::willBeDestroyed() { | 57 void LayoutPart::willBeDestroyed() { |
(...skipping 20 matching lines...) Expand all Loading... |
78 // | 78 // |
79 // But, we've told the system we've destroyed the layoutObject, which happens | 79 // But, we've told the system we've destroyed the layoutObject, which happens |
80 // when the DOM node is destroyed. So there is a good change the DOM node this | 80 // when the DOM node is destroyed. So there is a good change the DOM node this |
81 // object points too is invalid, so we have to clear the node so we make sure | 81 // object points too is invalid, so we have to clear the node so we make sure |
82 // we don't access it in the future. | 82 // we don't access it in the future. |
83 clearNode(); | 83 clearNode(); |
84 deref(); | 84 deref(); |
85 } | 85 } |
86 | 86 |
87 LayoutPart::~LayoutPart() { | 87 LayoutPart::~LayoutPart() { |
88 ASSERT(m_refCount <= 0); | 88 DCHECK_LE(m_refCount, 0); |
89 } | 89 } |
90 | 90 |
91 FrameViewBase* LayoutPart::frameViewBase() const { | 91 FrameViewBase* LayoutPart::frameViewBase() const { |
92 // Plugin FrameViewBases are stored in their DOM node. | 92 // Plugin FrameViewBases are stored in their DOM node. |
93 Element* element = toElement(node()); | 93 Element* element = toElement(node()); |
94 | 94 |
95 if (element && element->isFrameOwnerElement()) | 95 if (element && element->isFrameOwnerElement()) |
96 return toHTMLFrameOwnerElement(element)->ownedWidget(); | 96 return toHTMLFrameOwnerElement(element)->ownedWidget(); |
97 | 97 |
98 return nullptr; | 98 return nullptr; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 accumulatedOffset, action); | 165 accumulatedOffset, action); |
166 } | 166 } |
167 | 167 |
168 // 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 |
169 // throttled; therefore, hit tests can skip descending into throttled iframes. | 169 // throttled; therefore, hit tests can skip descending into throttled iframes. |
170 if (toFrameView(frameViewBase())->shouldThrottleRendering()) { | 170 if (toFrameView(frameViewBase())->shouldThrottleRendering()) { |
171 return nodeAtPointOverFrameViewBase(result, locationInContainer, | 171 return nodeAtPointOverFrameViewBase(result, locationInContainer, |
172 accumulatedOffset, action); | 172 accumulatedOffset, action); |
173 } | 173 } |
174 | 174 |
175 ASSERT(document().lifecycle().state() >= DocumentLifecycle::CompositingClean); | 175 DCHECK_GE(document().lifecycle().state(), |
| 176 DocumentLifecycle::CompositingClean); |
176 | 177 |
177 if (action == HitTestForeground) { | 178 if (action == HitTestForeground) { |
178 FrameView* childFrameView = toFrameView(frameViewBase()); | 179 FrameView* childFrameView = toFrameView(frameViewBase()); |
179 LayoutViewItem childRootItem = childFrameView->layoutViewItem(); | 180 LayoutViewItem childRootItem = childFrameView->layoutViewItem(); |
180 | 181 |
181 if (visibleToHitTestRequest(result.hitTestRequest()) && | 182 if (visibleToHitTestRequest(result.hitTestRequest()) && |
182 !childRootItem.isNull()) { | 183 !childRootItem.isNull()) { |
183 LayoutPoint adjustedLocation = accumulatedOffset + location(); | 184 LayoutPoint adjustedLocation = accumulatedOffset + location(); |
184 LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft(), | 185 LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft(), |
185 borderTop() + paddingTop()) - | 186 borderTop() + paddingTop()) - |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 toFrameView(frameViewBase)->recalculateCustomScrollbarStyle(); | 249 toFrameView(frameViewBase)->recalculateCustomScrollbarStyle(); |
249 | 250 |
250 if (style()->visibility() != EVisibility::kVisible) { | 251 if (style()->visibility() != EVisibility::kVisible) { |
251 frameViewBase->hide(); | 252 frameViewBase->hide(); |
252 } else { | 253 } else { |
253 frameViewBase->show(); | 254 frameViewBase->show(); |
254 } | 255 } |
255 } | 256 } |
256 | 257 |
257 void LayoutPart::layout() { | 258 void LayoutPart::layout() { |
258 ASSERT(needsLayout()); | 259 DCHECK(needsLayout()); |
259 LayoutAnalyzer::Scope analyzer(*this); | 260 LayoutAnalyzer::Scope analyzer(*this); |
260 clearNeedsLayout(); | 261 clearNeedsLayout(); |
261 } | 262 } |
262 | 263 |
263 void LayoutPart::paint(const PaintInfo& paintInfo, | 264 void LayoutPart::paint(const PaintInfo& paintInfo, |
264 const LayoutPoint& paintOffset) const { | 265 const LayoutPoint& paintOffset) const { |
265 PartPainter(*this).paint(paintInfo, paintOffset); | 266 PartPainter(*this).paint(paintInfo, paintOffset); |
266 } | 267 } |
267 | 268 |
268 void LayoutPart::paintContents(const PaintInfo& paintInfo, | 269 void LayoutPart::paintContents(const PaintInfo& paintInfo, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 } | 397 } |
397 | 398 |
398 bool LayoutPart::isThrottledFrameView() const { | 399 bool LayoutPart::isThrottledFrameView() const { |
399 if (!frameViewBase() || !frameViewBase()->isFrameView()) | 400 if (!frameViewBase() || !frameViewBase()->isFrameView()) |
400 return false; | 401 return false; |
401 const FrameView* frameView = toFrameView(frameViewBase()); | 402 const FrameView* frameView = toFrameView(frameViewBase()); |
402 return frameView->shouldThrottleRendering(); | 403 return frameView->shouldThrottleRendering(); |
403 } | 404 } |
404 | 405 |
405 } // namespace blink | 406 } // namespace blink |
OLD | NEW |