OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2009 Google, Inc. | 5 * Copyright (C) 2009 Google, Inc. |
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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 if (location().x()) | 305 if (location().x()) |
306 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt(
location().x())); | 306 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt(
location().x())); |
307 if (location().y()) | 307 if (location().y()) |
308 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt(
location().y())); | 308 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt(
location().y())); |
309 return m_localToParentTransform; | 309 return m_localToParentTransform; |
310 } | 310 } |
311 | 311 |
312 LayoutRect LayoutSVGRoot::clippedOverflowRectForPaintInvalidation(const LayoutBo
xModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInv
alidationState) const | 312 LayoutRect LayoutSVGRoot::clippedOverflowRectForPaintInvalidation(const LayoutBo
xModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInv
alidationState) const |
313 { | 313 { |
314 // This is an open-coded aggregate of SVGLayoutSupport::clippedOverflowRectF
orPaintInvalidation, | 314 // This is an open-coded aggregate of SVGLayoutSupport::clippedOverflowRectF
orPaintInvalidation, |
315 // LayoutSVGRoot::mapRectToPaintInvalidationBacking and LayoutReplaced::clip
pedOverflowRectForPaintInvalidation. | 315 // LayoutSVGRoot::mapToVisibleRectInContainerSpace and LayoutReplaced::clipp
edOverflowRectForPaintInvalidation. |
316 // The reason for this is to optimize/minimize the paint invalidation rect w
hen the box is not "decorated" | 316 // The reason for this is to optimize/minimize the paint invalidation rect w
hen the box is not "decorated" |
317 // (does not have background/border/etc.) | 317 // (does not have background/border/etc.) |
318 | 318 |
319 // Return early for any cases where we don't actually paint. | 319 // Return early for any cases where we don't actually paint. |
320 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent
()) | 320 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent
()) |
321 return LayoutRect(); | 321 return LayoutRect(); |
322 | 322 |
323 // Compute the paint invalidation rect of the content of the SVG in the bord
er-box coordinate space. | 323 // Compute the paint invalidation rect of the content of the SVG in the bord
er-box coordinate space. |
324 FloatRect contentPaintInvalidationRect = paintInvalidationRectInLocalCoordin
ates(); | 324 FloatRect contentPaintInvalidationRect = paintInvalidationRectInLocalCoordin
ates(); |
325 contentPaintInvalidationRect = m_localToBorderBoxTransform.mapRect(contentPa
intInvalidationRect); | 325 contentPaintInvalidationRect = m_localToBorderBoxTransform.mapRect(contentPa
intInvalidationRect); |
326 | 326 |
327 // Apply initial viewport clip, overflow:visible content is added to visualO
verflow | 327 // Apply initial viewport clip, overflow:visible content is added to visualO
verflow |
328 // but the most common case is that overflow is hidden, so always intersect. | 328 // but the most common case is that overflow is hidden, so always intersect. |
329 contentPaintInvalidationRect.intersect(pixelSnappedBorderBoxRect()); | 329 contentPaintInvalidationRect.intersect(pixelSnappedBorderBoxRect()); |
330 | 330 |
331 LayoutRect paintInvalidationRect = enclosingLayoutRect(contentPaintInvalidat
ionRect); | 331 LayoutRect paintInvalidationRect = enclosingLayoutRect(contentPaintInvalidat
ionRect); |
332 // If the box is decorated or is overflowing, extend it to include the borde
r-box and overflow. | 332 // If the box is decorated or is overflowing, extend it to include the borde
r-box and overflow. |
333 if (m_hasBoxDecorationBackground || hasOverflowModel()) { | 333 if (m_hasBoxDecorationBackground || hasOverflowModel()) { |
334 // The selectionRect can project outside of the overflowRect, so take th
eir union | 334 // The selectionRect can project outside of the overflowRect, so take th
eir union |
335 // for paint invalidation to avoid selection painting glitches. | 335 // for paint invalidation to avoid selection painting glitches. |
336 LayoutRect decoratedPaintInvalidationRect = unionRect(localSelectionRect
(), visualOverflowRect()); | 336 LayoutRect decoratedPaintInvalidationRect = unionRect(localSelectionRect
(), visualOverflowRect()); |
337 paintInvalidationRect.unite(decoratedPaintInvalidationRect); | 337 paintInvalidationRect.unite(decoratedPaintInvalidationRect); |
338 } | 338 } |
339 | 339 |
340 // Compute the paint invalidation rect in the parent coordinate space. | 340 // Compute the paint invalidation rect in the parent coordinate space. |
341 LayoutRect rect(enclosingIntRect(paintInvalidationRect)); | 341 LayoutRect rect(enclosingIntRect(paintInvalidationRect)); |
342 LayoutReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer
, rect, paintInvalidationState); | 342 LayoutReplaced::mapToVisibleRectInContainerSpace(paintInvalidationContainer,
rect, paintInvalidationState); |
343 return rect; | 343 return rect; |
344 } | 344 } |
345 | 345 |
346 void LayoutSVGRoot::mapRectToPaintInvalidationBacking(const LayoutBoxModelObject
* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* pa
intInvalidationState) const | 346 void LayoutSVGRoot::mapToVisibleRectInContainerSpace(const LayoutBoxModelObject*
paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* pai
ntInvalidationState) const |
347 { | 347 { |
348 // Note that we don't apply the border-box transform here - it's assumed | 348 // Note that we don't apply the border-box transform here - it's assumed |
349 // that whoever called us has done that already. | 349 // that whoever called us has done that already. |
350 | 350 |
351 // Apply initial viewport clip | 351 // Apply initial viewport clip |
352 if (shouldApplyViewportClip()) | 352 if (shouldApplyViewportClip()) |
353 rect.intersect(LayoutRect(pixelSnappedBorderBoxRect())); | 353 rect.intersect(LayoutRect(pixelSnappedBorderBoxRect())); |
354 | 354 |
355 LayoutReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer
, rect, paintInvalidationState); | 355 LayoutReplaced::mapToVisibleRectInContainerSpace(paintInvalidationContainer,
rect, paintInvalidationState); |
356 } | 356 } |
357 | 357 |
358 // This method expects local CSS box coordinates. | 358 // This method expects local CSS box coordinates. |
359 // Callers with local SVG viewport coordinates should first apply the localToBor
derBoxTransform | 359 // Callers with local SVG viewport coordinates should first apply the localToBor
derBoxTransform |
360 // to convert from SVG viewport coordinates to local CSS box coordinates. | 360 // to convert from SVG viewport coordinates to local CSS box coordinates. |
361 void LayoutSVGRoot::mapLocalToContainer(const LayoutBoxModelObject* paintInvalid
ationContainer, TransformState& transformState, MapCoordinatesFlags mode, bool*
wasFixed, const PaintInvalidationState* paintInvalidationState) const | 361 void LayoutSVGRoot::mapLocalToContainer(const LayoutBoxModelObject* paintInvalid
ationContainer, TransformState& transformState, MapCoordinatesFlags mode, bool*
wasFixed, const PaintInvalidationState* paintInvalidationState) const |
362 { | 362 { |
363 ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG layou
t tree. | 363 ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG layou
t tree. |
364 | 364 |
365 LayoutReplaced::mapLocalToContainer(paintInvalidationContainer, transformSta
te, mode | ApplyContainerFlip, wasFixed, paintInvalidationState); | 365 LayoutReplaced::mapLocalToContainer(paintInvalidationContainer, transformSta
te, mode | ApplyContainerFlip, wasFixed, paintInvalidationState); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 updateHitTestResult(result, pointInBorderBox); | 411 updateHitTestResult(result, pointInBorderBox); |
412 if (!result.addNodeToListBasedTestResult(node(), locationInContainer
, boundsRect)) | 412 if (!result.addNodeToListBasedTestResult(node(), locationInContainer
, boundsRect)) |
413 return true; | 413 return true; |
414 } | 414 } |
415 } | 415 } |
416 | 416 |
417 return false; | 417 return false; |
418 } | 418 } |
419 | 419 |
420 } | 420 } |
OLD | NEW |