OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. |
5 * Copyright (C) 2013 Google Inc. All rights reserved. | 5 * Copyright (C) 2013 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 * | 21 * |
22 */ | 22 */ |
23 | 23 |
24 #include "config.h" | 24 #include "config.h" |
25 #include "core/rendering/RenderWidget.h" | 25 #include "core/rendering/RenderWidget.h" |
26 | 26 |
27 #include "core/accessibility/AXObjectCache.h" | 27 #include "core/accessibility/AXObjectCache.h" |
28 #include "core/frame/Frame.h" | 28 #include "core/frame/Frame.h" |
29 #include "core/html/HTMLFrameOwnerElement.h" | |
29 #include "core/platform/graphics/GraphicsContext.h" | 30 #include "core/platform/graphics/GraphicsContext.h" |
30 #include "core/rendering/CompositedLayerMapping.h" | 31 #include "core/rendering/CompositedLayerMapping.h" |
31 #include "core/rendering/GraphicsContextAnnotator.h" | 32 #include "core/rendering/GraphicsContextAnnotator.h" |
32 #include "core/rendering/HitTestResult.h" | 33 #include "core/rendering/HitTestResult.h" |
33 #include "core/rendering/LayoutRectRecorder.h" | 34 #include "core/rendering/LayoutRectRecorder.h" |
34 #include "core/rendering/RenderLayer.h" | 35 #include "core/rendering/RenderLayer.h" |
35 #include "core/rendering/RenderView.h" | 36 #include "core/rendering/RenderView.h" |
36 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
37 | 38 |
38 using namespace std; | 39 using namespace std; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 parent->addChild(child); | 83 parent->addChild(child); |
83 else | 84 else |
84 toScrollView(child->parent())->removeChild(child); | 85 toScrollView(child->parent())->removeChild(child); |
85 return; | 86 return; |
86 } | 87 } |
87 widgetNewParentMap().set(child, parent); | 88 widgetNewParentMap().set(child, parent); |
88 } | 89 } |
89 | 90 |
90 RenderWidget::RenderWidget(Element* element) | 91 RenderWidget::RenderWidget(Element* element) |
91 : RenderReplaced(element) | 92 : RenderReplaced(element) |
92 , m_widget(0) | |
93 , m_frameView(element->document().view()) | 93 , m_frameView(element->document().view()) |
94 // Reference counting is used to prevent the widget from being | 94 // Reference counting is used to prevent the widget from being |
95 // destroyed while inside the Widget code, which might not be | 95 // destroyed while inside the Widget code, which might not be |
96 // able to handle that. | 96 // able to handle that. |
97 , m_refCount(1) | 97 , m_refCount(1) |
98 { | 98 { |
99 view()->addWidget(this); | 99 view()->addWidget(this); |
100 } | 100 } |
101 | 101 |
102 void RenderWidget::willBeDestroyed() | 102 void RenderWidget::willBeDestroyed() |
103 { | 103 { |
104 if (RenderView* v = view()) | 104 if (RenderView* v = view()) |
105 v->removeWidget(this); | 105 v->removeWidget(this); |
106 | 106 |
107 if (AXObjectCache* cache = document().existingAXObjectCache()) { | 107 if (AXObjectCache* cache = document().existingAXObjectCache()) { |
108 cache->childrenChanged(this->parent()); | 108 cache->childrenChanged(this->parent()); |
109 cache->remove(this); | 109 cache->remove(this); |
110 } | 110 } |
111 | 111 |
112 setWidget(0); | 112 Element* element = toElement(node()); |
113 if (element && element->isFrameOwnerElement()) | |
114 toHTMLFrameOwnerElement(element)->setWidget(0); | |
113 | 115 |
114 RenderReplaced::willBeDestroyed(); | 116 RenderReplaced::willBeDestroyed(); |
115 } | 117 } |
116 | 118 |
117 void RenderWidget::destroy() | 119 void RenderWidget::destroy() |
118 { | 120 { |
119 willBeDestroyed(); | 121 willBeDestroyed(); |
120 clearNode(); | 122 clearNode(); |
121 deref(); | 123 deref(); |
122 } | 124 } |
123 | 125 |
124 RenderWidget::~RenderWidget() | 126 RenderWidget::~RenderWidget() |
125 { | 127 { |
126 ASSERT(m_refCount <= 0); | 128 ASSERT(m_refCount <= 0); |
127 clearWidget(); | 129 } |
130 | |
131 Widget* RenderWidget::widget() const | |
132 { | |
133 // Plugin widgets are stored in their DOM node. This includes HTMLAppletElem ent. | |
134 Element* element = toElement(node()); | |
135 | |
136 if (element && element->isFrameOwnerElement()) | |
137 return toHTMLFrameOwnerElement(element)->widget(); | |
138 | |
139 return 0; | |
128 } | 140 } |
129 | 141 |
130 // Widgets are always placed on integer boundaries, so rounding the size is actu ally | 142 // Widgets are always placed on integer boundaries, so rounding the size is actu ally |
131 // the desired behavior. This function is here because it's otherwise seldom wha t we | 143 // the desired behavior. This function is here because it's otherwise seldom wha t we |
132 // want to do with a LayoutRect. | 144 // want to do with a LayoutRect. |
133 static inline IntRect roundedIntRect(const LayoutRect& rect) | 145 static inline IntRect roundedIntRect(const LayoutRect& rect) |
134 { | 146 { |
135 return IntRect(roundedIntPoint(rect.location()), roundedIntSize(rect.size()) ); | 147 return IntRect(roundedIntPoint(rect.location()), roundedIntSize(rect.size()) ); |
136 } | 148 } |
137 | 149 |
138 bool RenderWidget::setWidgetGeometry(const LayoutRect& frame) | 150 bool RenderWidget::setWidgetGeometry(const LayoutRect& frame) |
139 { | 151 { |
140 if (!node()) | 152 if (!node()) |
141 return false; | 153 return false; |
142 | 154 |
155 Widget* widget = this->widget(); | |
156 ASSERT(widget); | |
157 | |
143 IntRect clipRect = roundedIntRect(enclosingLayer()->childrenClipRect()); | 158 IntRect clipRect = roundedIntRect(enclosingLayer()->childrenClipRect()); |
144 IntRect newFrame = roundedIntRect(frame); | 159 IntRect newFrame = roundedIntRect(frame); |
145 bool clipChanged = m_clipRect != clipRect; | 160 bool clipChanged = m_clipRect != clipRect; |
146 bool frameRectChanged = m_widget->frameRect() != newFrame; | 161 bool frameRectChanged = widget->frameRect() != newFrame; |
147 | 162 |
148 if (!frameRectChanged && !clipChanged) | 163 if (!frameRectChanged && !clipChanged) |
149 return false; | 164 return false; |
150 | 165 |
151 m_clipRect = clipRect; | 166 m_clipRect = clipRect; |
152 | 167 |
153 RefPtr<RenderWidget> protector(this); | 168 RefPtr<RenderWidget> protector(this); |
154 RefPtr<Node> protectedNode(node()); | 169 RefPtr<Node> protectedNode(node()); |
155 m_widget->setFrameRect(newFrame); | 170 widget->setFrameRect(newFrame); |
156 | 171 |
157 if (clipChanged && !frameRectChanged) | 172 if (clipChanged && !frameRectChanged) |
158 m_widget->clipRectChanged(); | 173 widget->clipRectChanged(); |
159 | 174 |
160 if (hasLayer() && layer()->compositingState() == PaintsIntoOwnBacking) | 175 if (hasLayer() && layer()->compositingState() == PaintsIntoOwnBacking) |
161 layer()->compositedLayerMapping()->updateAfterWidgetResize(); | 176 layer()->compositedLayerMapping()->updateAfterWidgetResize(); |
162 | 177 |
163 bool boundsChanged = m_widget->frameRect().size() != newFrame.size(); | 178 bool boundsChanged = widget->frameRect().size() != newFrame.size(); |
164 return boundsChanged; | 179 return boundsChanged; |
165 } | 180 } |
166 | 181 |
167 bool RenderWidget::updateWidgetGeometry() | 182 bool RenderWidget::updateWidgetGeometry() |
168 { | 183 { |
184 Widget* widget = this->widget(); | |
185 | |
169 LayoutRect contentBox = contentBoxRect(); | 186 LayoutRect contentBox = contentBoxRect(); |
170 LayoutRect absoluteContentBox(localToAbsoluteQuad(FloatQuad(contentBox)).bou ndingBox()); | 187 LayoutRect absoluteContentBox(localToAbsoluteQuad(FloatQuad(contentBox)).bou ndingBox()); |
171 if (m_widget->isFrameView()) { | 188 if (widget->isFrameView()) { |
172 contentBox.setLocation(absoluteContentBox.location()); | 189 contentBox.setLocation(absoluteContentBox.location()); |
173 return setWidgetGeometry(contentBox); | 190 return setWidgetGeometry(contentBox); |
174 } | 191 } |
175 | 192 |
176 return setWidgetGeometry(absoluteContentBox); | 193 return setWidgetGeometry(absoluteContentBox); |
177 } | 194 } |
178 | 195 |
179 void RenderWidget::setWidget(PassRefPtr<Widget> widget) | 196 void RenderWidget::attachWidget(Widget* widget) |
180 { | 197 { |
181 if (widget == m_widget) | 198 if (widget) { |
182 return; | |
183 | |
184 if (m_widget) { | |
185 moveWidgetToParentSoon(m_widget.get(), 0); | |
186 clearWidget(); | |
187 } | |
188 m_widget = widget; | |
189 if (m_widget) { | |
190 // If we've already received a layout, apply the calculated space to the | |
191 // widget immediately, but we have to have really been fully constructed (with a non-null | |
192 // style pointer). | |
193 if (style()) { | 199 if (style()) { |
194 if (!needsLayout()) | 200 if (!needsLayout()) |
195 updateWidgetGeometry(); | 201 updateWidgetGeometry(); |
196 | 202 |
197 if (style()->visibility() != VISIBLE) | 203 if (style()->visibility() != VISIBLE) { |
198 m_widget->hide(); | 204 widget->hide(); |
199 else { | 205 } else { |
200 m_widget->show(); | 206 widget->show(); |
201 repaint(); | 207 repaint(); |
202 } | 208 } |
203 } | 209 } |
204 moveWidgetToParentSoon(m_widget.get(), m_frameView); | 210 moveWidgetToParentSoon(widget, m_frameView); |
205 } | 211 } |
212 if (AXObjectCache* cache = document().existingAXObjectCache()) | |
213 cache->childrenChanged(this); | |
214 } | |
215 | |
216 void RenderWidget::detachWidget(Widget* widget) | |
217 { | |
218 // If the widget has no parent, it means it's already detached. | |
eseidel
2013/12/02 16:28:34
Detach can be called twice?
wjmaclean
2013/12/02 21:51:55
That was a bug I was trying to resolve in this CL.
| |
219 if (!widget || !widget->parent()) | |
220 return; | |
221 | |
222 moveWidgetToParentSoon(widget, 0); | |
206 | 223 |
207 if (AXObjectCache* cache = document().existingAXObjectCache()) | 224 if (AXObjectCache* cache = document().existingAXObjectCache()) |
208 cache->childrenChanged(this); | 225 cache->childrenChanged(this); |
209 } | 226 } |
210 | 227 |
211 void RenderWidget::layout() | 228 void RenderWidget::layout() |
212 { | 229 { |
213 ASSERT(needsLayout()); | 230 ASSERT(needsLayout()); |
214 | 231 |
215 LayoutRectRecorder recorder(*this); | 232 LayoutRectRecorder recorder(*this); |
216 clearNeedsLayout(); | 233 clearNeedsLayout(); |
217 } | 234 } |
218 | 235 |
219 void RenderWidget::styleDidChange(StyleDifference diff, const RenderStyle* oldSt yle) | 236 void RenderWidget::styleDidChange(StyleDifference diff, const RenderStyle* oldSt yle) |
220 { | 237 { |
221 RenderReplaced::styleDidChange(diff, oldStyle); | 238 RenderReplaced::styleDidChange(diff, oldStyle); |
222 if (m_widget) { | 239 Widget* widget = this->widget(); |
240 | |
241 if (widget) { | |
223 if (style()->visibility() != VISIBLE) | 242 if (style()->visibility() != VISIBLE) |
224 m_widget->hide(); | 243 widget->hide(); |
225 else | 244 else |
226 m_widget->show(); | 245 widget->show(); |
227 } | 246 } |
228 } | 247 } |
229 | 248 |
230 void RenderWidget::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintO ffset) | 249 void RenderWidget::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintO ffset) |
231 { | 250 { |
232 LayoutPoint adjustedPaintOffset = paintOffset + location(); | 251 LayoutPoint adjustedPaintOffset = paintOffset + location(); |
233 | 252 |
253 Widget* widget = this->widget(); | |
254 ASSERT(widget); | |
255 | |
234 // Tell the widget to paint now. This is the only time the widget is allowed | 256 // Tell the widget to paint now. This is the only time the widget is allowed |
235 // to paint itself. That way it will composite properly with z-indexed layer s. | 257 // to paint itself. That way it will composite properly with z-indexed layer s. |
236 IntPoint widgetLocation = m_widget->frameRect().location(); | 258 IntPoint widgetLocation = widget->frameRect().location(); |
237 IntPoint paintLocation(roundToInt(adjustedPaintOffset.x() + borderLeft() + p addingLeft()), | 259 IntPoint paintLocation(roundToInt(adjustedPaintOffset.x() + borderLeft() + p addingLeft()), |
238 roundToInt(adjustedPaintOffset.y() + borderTop() + paddingTop())); | 260 roundToInt(adjustedPaintOffset.y() + borderTop() + paddingTop())); |
239 IntRect paintRect = paintInfo.rect; | 261 IntRect paintRect = paintInfo.rect; |
240 | 262 |
241 IntSize widgetPaintOffset = paintLocation - widgetLocation; | 263 IntSize widgetPaintOffset = paintLocation - widgetLocation; |
242 // When painting widgets into compositing layers, tx and ty are relative to the enclosing compositing layer, | 264 // When painting widgets into compositing layers, tx and ty are relative to the enclosing compositing layer, |
243 // not the root. In this case, shift the CTM and adjust the paintRect to be root-relative to fix plug-in drawing. | 265 // not the root. In this case, shift the CTM and adjust the paintRect to be root-relative to fix plug-in drawing. |
244 if (!widgetPaintOffset.isZero()) { | 266 if (!widgetPaintOffset.isZero()) { |
245 paintInfo.context->translate(widgetPaintOffset); | 267 paintInfo.context->translate(widgetPaintOffset); |
246 paintRect.move(-widgetPaintOffset); | 268 paintRect.move(-widgetPaintOffset); |
247 } | 269 } |
248 m_widget->paint(paintInfo.context, paintRect); | 270 widget->paint(paintInfo.context, paintRect); |
249 | 271 |
250 if (!widgetPaintOffset.isZero()) | 272 if (!widgetPaintOffset.isZero()) |
251 paintInfo.context->translate(-widgetPaintOffset); | 273 paintInfo.context->translate(-widgetPaintOffset); |
252 | 274 |
253 if (m_widget->isFrameView()) { | 275 if (widget->isFrameView()) { |
254 FrameView* frameView = toFrameView(m_widget.get()); | 276 FrameView* frameView = toFrameView(widget); |
255 bool runOverlapTests = !frameView->useSlowRepaintsIfNotOverlapped() || f rameView->hasCompositedContent(); | 277 bool runOverlapTests = !frameView->useSlowRepaintsIfNotOverlapped() || f rameView->hasCompositedContent(); |
256 if (paintInfo.overlapTestRequests && runOverlapTests) { | 278 if (paintInfo.overlapTestRequests && runOverlapTests) { |
257 ASSERT(!paintInfo.overlapTestRequests->contains(this)); | 279 ASSERT(!paintInfo.overlapTestRequests->contains(this)); |
258 paintInfo.overlapTestRequests->set(this, m_widget->frameRect()); | 280 paintInfo.overlapTestRequests->set(this, widget->frameRect()); |
259 } | 281 } |
260 } | 282 } |
261 } | 283 } |
262 | 284 |
263 void RenderWidget::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 285 void RenderWidget::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
264 { | 286 { |
265 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); | 287 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); |
266 | 288 |
267 if (!shouldPaint(paintInfo, paintOffset)) | 289 if (!shouldPaint(paintInfo, paintOffset)) |
268 return; | 290 return; |
(...skipping 20 matching lines...) Expand all Loading... | |
289 if (borderRect.isEmpty()) | 311 if (borderRect.isEmpty()) |
290 return; | 312 return; |
291 | 313 |
292 // Push a clip if we have a border radius, since we want to round the fo reground content that gets painted. | 314 // Push a clip if we have a border radius, since we want to round the fo reground content that gets painted. |
293 paintInfo.context->save(); | 315 paintInfo.context->save(); |
294 RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(borderR ect, | 316 RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(borderR ect, |
295 paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddin gLeft() + borderLeft(), paddingRight() + borderRight(), true, true); | 317 paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddin gLeft() + borderLeft(), paddingRight() + borderRight(), true, true); |
296 clipRoundedInnerRect(paintInfo.context, borderRect, roundedInnerRect); | 318 clipRoundedInnerRect(paintInfo.context, borderRect, roundedInnerRect); |
297 } | 319 } |
298 | 320 |
299 if (m_widget) | 321 Widget* widget = this->widget(); |
322 if (widget) | |
300 paintContents(paintInfo, paintOffset); | 323 paintContents(paintInfo, paintOffset); |
301 | 324 |
302 if (style()->hasBorderRadius()) | 325 if (style()->hasBorderRadius()) |
303 paintInfo.context->restore(); | 326 paintInfo.context->restore(); |
304 | 327 |
305 // Paint a partially transparent wash over selected widgets. | 328 // Paint a partially transparent wash over selected widgets. |
306 if (isSelected() && !document().printing()) { | 329 if (isSelected() && !document().printing()) { |
307 // FIXME: selectionRect() is in absolute, not painting coordinates. | 330 // FIXME: selectionRect() is in absolute, not painting coordinates. |
308 paintInfo.context->fillRect(pixelSnappedIntRect(selectionRect()), select ionBackgroundColor()); | 331 paintInfo.context->fillRect(pixelSnappedIntRect(selectionRect()), select ionBackgroundColor()); |
309 } | 332 } |
310 | 333 |
311 if (canResize()) | 334 if (canResize()) |
312 layer()->scrollableArea()->paintResizer(paintInfo.context, roundedIntPoi nt(adjustedPaintOffset), paintInfo.rect); | 335 layer()->scrollableArea()->paintResizer(paintInfo.context, roundedIntPoi nt(adjustedPaintOffset), paintInfo.rect); |
313 } | 336 } |
314 | 337 |
315 void RenderWidget::setIsOverlapped(bool isOverlapped) | 338 void RenderWidget::setIsOverlapped(bool isOverlapped) |
316 { | 339 { |
317 ASSERT(m_widget); | 340 Widget* widget = this->widget(); |
318 ASSERT(m_widget->isFrameView()); | 341 ASSERT(widget); |
319 toFrameView(m_widget.get())->setIsOverlapped(isOverlapped); | 342 ASSERT(widget->isFrameView()); |
343 toFrameView(widget)->setIsOverlapped(isOverlapped); | |
320 } | 344 } |
321 | 345 |
322 void RenderWidget::deref() | 346 void RenderWidget::deref() |
323 { | 347 { |
324 if (--m_refCount <= 0) | 348 if (--m_refCount <= 0) |
325 postDestroy(); | 349 postDestroy(); |
326 } | 350 } |
327 | 351 |
328 void RenderWidget::updateWidgetPosition() | 352 void RenderWidget::updateWidgetPosition() |
329 { | 353 { |
330 if (!m_widget || !node()) // Check the node in case destroy() has been calle d. | 354 Widget* widget = this->widget(); |
355 if (!widget || !node()) // Check the node in case destroy() has been called. | |
331 return; | 356 return; |
332 | 357 |
333 bool boundsChanged = updateWidgetGeometry(); | 358 bool boundsChanged = updateWidgetGeometry(); |
334 | 359 |
335 // if the frame bounds got changed, or if view needs layout (possibly indica ting | 360 // if the frame bounds got changed, or if view needs layout (possibly indica ting |
336 // content size is wrong) we have to do a layout to set the right widget siz e | 361 // content size is wrong) we have to do a layout to set the right widget siz e |
337 if (m_widget && m_widget->isFrameView()) { | 362 if (widget && widget->isFrameView()) { |
338 FrameView* frameView = toFrameView(m_widget.get()); | 363 FrameView* frameView = toFrameView(widget); |
339 // Check the frame's page to make sure that the frame isn't in the proce ss of being destroyed. | 364 // Check the frame's page to make sure that the frame isn't in the proce ss of being destroyed. |
340 if ((boundsChanged || frameView->needsLayout()) && frameView->frame().pa ge()) | 365 if ((boundsChanged || frameView->needsLayout()) && frameView->frame().pa ge()) |
341 frameView->layout(); | 366 frameView->layout(); |
342 } | 367 } |
343 } | 368 } |
344 | 369 |
345 void RenderWidget::widgetPositionsUpdated() | 370 void RenderWidget::widgetPositionsUpdated() |
346 { | 371 { |
347 if (!m_widget) | 372 Widget* widget = this->widget(); |
373 if (!widget) | |
348 return; | 374 return; |
349 m_widget->widgetPositionsUpdated(); | 375 widget->widgetPositionsUpdated(); |
350 } | 376 } |
351 | 377 |
352 IntRect RenderWidget::windowClipRect() const | 378 IntRect RenderWidget::windowClipRect() const |
353 { | 379 { |
354 if (!m_frameView) | 380 if (!m_frameView) |
355 return IntRect(); | 381 return IntRect(); |
356 | 382 |
357 return intersection(m_frameView->contentsToWindow(m_clipRect), m_frameView-> windowClipRect()); | 383 return intersection(m_frameView->contentsToWindow(m_clipRect), m_frameView-> windowClipRect()); |
358 } | 384 } |
359 | 385 |
360 void RenderWidget::clearWidget() | |
361 { | |
362 m_widget = 0; | |
363 } | |
364 | |
365 bool RenderWidget::nodeAtPoint(const HitTestRequest& request, HitTestResult& res ult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedO ffset, HitTestAction action) | 386 bool RenderWidget::nodeAtPoint(const HitTestRequest& request, HitTestResult& res ult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedO ffset, HitTestAction action) |
366 { | 387 { |
367 bool hadResult = result.innerNode(); | 388 bool hadResult = result.innerNode(); |
368 bool inside = RenderReplaced::nodeAtPoint(request, result, locationInContain er, accumulatedOffset, action); | 389 bool inside = RenderReplaced::nodeAtPoint(request, result, locationInContain er, accumulatedOffset, action); |
369 | 390 |
370 // Check to see if we are really over the widget itself (and not just in the border/padding area). | 391 // Check to see if we are really over the widget itself (and not just in the border/padding area). |
371 if ((inside || result.isRectBasedTest()) && !hadResult && result.innerNode() == node()) | 392 if ((inside || result.isRectBasedTest()) && !hadResult && result.innerNode() == node()) |
372 result.setIsOverWidget(contentBoxRect().contains(result.localPoint())); | 393 result.setIsOverWidget(contentBoxRect().contains(result.localPoint())); |
373 return inside; | 394 return inside; |
374 } | 395 } |
375 | 396 |
376 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor ) const | 397 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor ) const |
377 { | 398 { |
378 if (widget() && widget()->isPluginView()) { | 399 if (widget() && widget()->isPluginView()) { |
379 // A plug-in is responsible for setting the cursor when the pointer is o ver it. | 400 // A plug-in is responsible for setting the cursor when the pointer is o ver it. |
380 return DoNotSetCursor; | 401 return DoNotSetCursor; |
381 } | 402 } |
382 return RenderReplaced::getCursor(point, cursor); | 403 return RenderReplaced::getCursor(point, cursor); |
383 } | 404 } |
384 | 405 |
385 } // namespace WebCore | 406 } // namespace WebCore |
OLD | NEW |