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. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 void RenderWidget::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) | 224 void RenderWidget::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) |
225 { | 225 { |
226 LayoutPoint adjustedPaintOffset = paintOffset + location(); | 226 LayoutPoint adjustedPaintOffset = paintOffset + location(); |
227 | 227 |
228 // Tell the widget to paint now. This is the only time the widget is allowed | 228 // Tell the widget to paint now. This is the only time the widget is allowed |
229 // to paint itself. That way it will composite properly with z-indexed layer
s. | 229 // to paint itself. That way it will composite properly with z-indexed layer
s. |
230 IntPoint widgetLocation = m_widget->frameRect().location(); | 230 IntPoint widgetLocation = m_widget->frameRect().location(); |
231 IntPoint paintLocation(roundToInt(adjustedPaintOffset.x() + borderLeft() + p
addingLeft()), | 231 IntPoint paintLocation(roundToInt(adjustedPaintOffset.x() + borderLeft() + p
addingLeft()), |
232 roundToInt(adjustedPaintOffset.y() + borderTop() + paddingTop())); | 232 roundToInt(adjustedPaintOffset.y() + borderTop() + paddingTop())); |
233 IntRect paintRect = paintInfo.rect; | 233 IntRect paintRect = paintInfo.getRect(); |
234 | 234 |
235 IntSize widgetPaintOffset = paintLocation - widgetLocation; | 235 IntSize widgetPaintOffset = paintLocation - widgetLocation; |
236 // When painting widgets into compositing layers, tx and ty are relative to
the enclosing compositing layer, | 236 // When painting widgets into compositing layers, tx and ty are relative to
the enclosing compositing layer, |
237 // not the root. In this case, shift the CTM and adjust the paintRect to be
root-relative to fix plug-in drawing. | 237 // not the root. In this case, shift the CTM and adjust the paintRect to be
root-relative to fix plug-in drawing. |
238 if (!widgetPaintOffset.isZero()) { | 238 if (!widgetPaintOffset.isZero()) { |
239 paintInfo.context->translate(widgetPaintOffset); | 239 paintInfo.getContext()->translate(widgetPaintOffset); |
240 paintRect.move(-widgetPaintOffset); | 240 paintRect.move(-widgetPaintOffset); |
241 } | 241 } |
242 m_widget->paint(paintInfo.context, paintRect); | 242 m_widget->paint(paintInfo.getContext(), paintRect); |
243 | 243 |
244 if (!widgetPaintOffset.isZero()) | 244 if (!widgetPaintOffset.isZero()) |
245 paintInfo.context->translate(-widgetPaintOffset); | 245 paintInfo.getContext()->translate(-widgetPaintOffset); |
246 | 246 |
247 if (m_widget->isFrameView()) { | 247 if (m_widget->isFrameView()) { |
248 FrameView* frameView = toFrameView(m_widget.get()); | 248 FrameView* frameView = toFrameView(m_widget.get()); |
249 bool runOverlapTests = !frameView->useSlowRepaintsIfNotOverlapped() || f
rameView->hasCompositedContent(); | 249 bool runOverlapTests = !frameView->useSlowRepaintsIfNotOverlapped() || f
rameView->hasCompositedContent(); |
250 if (paintInfo.overlapTestRequests && runOverlapTests) { | 250 if (paintInfo.getOverlapTestRequests() && runOverlapTests) { |
251 ASSERT(!paintInfo.overlapTestRequests->contains(this)); | 251 ASSERT(!paintInfo.getOverlapTestRequests()->contains(this)); |
252 paintInfo.overlapTestRequests->set(this, m_widget->frameRect()); | 252 paintInfo.getOverlapTestRequests()->set(this, m_widget->frameRect())
; |
253 } | 253 } |
254 } | 254 } |
255 } | 255 } |
256 | 256 |
257 void RenderWidget::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 257 void RenderWidget::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
258 { | 258 { |
259 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); | 259 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); |
260 | 260 |
261 if (!shouldPaint(paintInfo, paintOffset)) | 261 if (!shouldPaint(paintInfo, paintOffset)) |
262 return; | 262 return; |
263 | 263 |
264 LayoutPoint adjustedPaintOffset = paintOffset + location(); | 264 LayoutPoint adjustedPaintOffset = paintOffset + location(); |
265 | 265 |
266 if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paint
Info.phase == PaintPhaseSelection)) | 266 if (hasBoxDecorations() && (paintInfo.getPhase() == PaintPhaseForeground ||
paintInfo.getPhase() == PaintPhaseSelection)) |
267 paintBoxDecorations(paintInfo, adjustedPaintOffset); | 267 paintBoxDecorations(paintInfo, adjustedPaintOffset); |
268 | 268 |
269 if (paintInfo.phase == PaintPhaseMask) { | 269 if (paintInfo.getPhase() == PaintPhaseMask) { |
270 paintMask(paintInfo, adjustedPaintOffset); | 270 paintMask(paintInfo, adjustedPaintOffset); |
271 return; | 271 return; |
272 } | 272 } |
273 | 273 |
274 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe
lfOutline) && hasOutline()) | 274 if ((paintInfo.getPhase() == PaintPhaseOutline || paintInfo.getPhase() == Pa
intPhaseSelfOutline) && hasOutline()) |
275 paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, size())); | 275 paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, size())); |
276 | 276 |
277 if (!m_frameView || paintInfo.phase != PaintPhaseForeground) | 277 if (!m_frameView || paintInfo.getPhase() != PaintPhaseForeground) |
278 return; | 278 return; |
279 | 279 |
280 if (style()->hasBorderRadius()) { | 280 if (style()->hasBorderRadius()) { |
281 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size()); | 281 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size()); |
282 | 282 |
283 if (borderRect.isEmpty()) | 283 if (borderRect.isEmpty()) |
284 return; | 284 return; |
285 | 285 |
286 // Push a clip if we have a border radius, since we want to round the fo
reground content that gets painted. | 286 // Push a clip if we have a border radius, since we want to round the fo
reground content that gets painted. |
287 paintInfo.context->save(); | 287 paintInfo.getContext()->save(); |
288 RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(borderR
ect, | 288 RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(borderR
ect, |
289 paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddin
gLeft() + borderLeft(), paddingRight() + borderRight(), true, true); | 289 paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddin
gLeft() + borderLeft(), paddingRight() + borderRight(), true, true); |
290 clipRoundedInnerRect(paintInfo.context, borderRect, roundedInnerRect); | 290 clipRoundedInnerRect(paintInfo.getContext(), borderRect, roundedInnerRec
t); |
291 } | 291 } |
292 | 292 |
293 if (m_widget) | 293 if (m_widget) |
294 paintContents(paintInfo, paintOffset); | 294 paintContents(paintInfo, paintOffset); |
295 | 295 |
296 if (style()->hasBorderRadius()) | 296 if (style()->hasBorderRadius()) |
297 paintInfo.context->restore(); | 297 paintInfo.getContext()->restore(); |
298 | 298 |
299 // Paint a partially transparent wash over selected widgets. | 299 // Paint a partially transparent wash over selected widgets. |
300 if (isSelected() && !document()->printing()) { | 300 if (isSelected() && !document()->printing()) { |
301 // FIXME: selectionRect() is in absolute, not painting coordinates. | 301 // FIXME: selectionRect() is in absolute, not painting coordinates. |
302 paintInfo.context->fillRect(pixelSnappedIntRect(selectionRect()), select
ionBackgroundColor()); | 302 paintInfo.getContext()->fillRect(pixelSnappedIntRect(selectionRect()), s
electionBackgroundColor()); |
303 } | 303 } |
304 | 304 |
305 if (hasLayer() && layer()->canResize()) | 305 if (hasLayer() && layer()->canResize()) |
306 layer()->paintResizer(paintInfo.context, roundedIntPoint(adjustedPaintOf
fset), paintInfo.rect); | 306 layer()->paintResizer(paintInfo.getContext(), roundedIntPoint(adjustedPa
intOffset), paintInfo.getRect()); |
307 } | 307 } |
308 | 308 |
309 void RenderWidget::setOverlapTestResult(bool isOverlapped) | 309 void RenderWidget::setOverlapTestResult(bool isOverlapped) |
310 { | 310 { |
311 ASSERT(m_widget); | 311 ASSERT(m_widget); |
312 ASSERT(m_widget->isFrameView()); | 312 ASSERT(m_widget->isFrameView()); |
313 toFrameView(m_widget.get())->setIsOverlapped(isOverlapped); | 313 toFrameView(m_widget.get())->setIsOverlapped(isOverlapped); |
314 } | 314 } |
315 | 315 |
316 void RenderWidget::deref() | 316 void RenderWidget::deref() |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor
) const | 375 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor
) const |
376 { | 376 { |
377 if (widget() && widget()->isPluginView()) { | 377 if (widget() && widget()->isPluginView()) { |
378 // A plug-in is responsible for setting the cursor when the pointer is o
ver it. | 378 // A plug-in is responsible for setting the cursor when the pointer is o
ver it. |
379 return DoNotSetCursor; | 379 return DoNotSetCursor; |
380 } | 380 } |
381 return RenderReplaced::getCursor(point, cursor); | 381 return RenderReplaced::getCursor(point, cursor); |
382 } | 382 } |
383 | 383 |
384 } // namespace WebCore | 384 } // namespace WebCore |
OLD | NEW |