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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 { | 311 { |
312 // Slightly optimized version of m_localToParentTransform = AffineTransform:
:translation(x(), y()) * m_localToBorderBoxTransform; | 312 // Slightly optimized version of m_localToParentTransform = AffineTransform:
:translation(x(), y()) * m_localToBorderBoxTransform; |
313 m_localToParentTransform = m_localToBorderBoxTransform; | 313 m_localToParentTransform = m_localToBorderBoxTransform; |
314 if (location().x()) | 314 if (location().x()) |
315 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt(
location().x())); | 315 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt(
location().x())); |
316 if (location().y()) | 316 if (location().y()) |
317 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt(
location().y())); | 317 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt(
location().y())); |
318 return m_localToParentTransform; | 318 return m_localToParentTransform; |
319 } | 319 } |
320 | 320 |
321 LayoutRect LayoutSVGRoot::clippedOverflowRectForPaintInvalidation(const LayoutBo
xModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInv
alidationState) const | 321 LayoutRect LayoutSVGRoot::localOverflowRectForPaintInvalidation() const |
322 { | 322 { |
323 // This is an open-coded aggregate of SVGLayoutSupport::clippedOverflowRectF
orPaintInvalidation, | 323 // This is an open-coded aggregate of SVGLayoutSupport::localOverflowRectFor
PaintInvalidation, |
324 // LayoutSVGRoot::mapToVisibleRectInAncestorSpace and LayoutReplaced::clippe
dOverflowRectForPaintInvalidation. | 324 // LayoutSVGRoot::mapToVisibleRectInAncestorSpace and LayoutReplaced::localO
verflowRectForPaintInvalidation. |
325 // The reason for this is to optimize/minimize the paint invalidation rect w
hen the box is not "decorated" | 325 // The reason for this is to optimize/minimize the paint invalidation rect w
hen the box is not "decorated" |
326 // (does not have background/border/etc.) | 326 // (does not have background/border/etc.) |
327 | 327 |
328 // Return early for any cases where we don't actually paint. | 328 // Return early for any cases where we don't actually paint. |
329 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent
()) | 329 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent
()) |
330 return LayoutRect(); | 330 return LayoutRect(); |
331 | 331 |
332 // Compute the paint invalidation rect of the content of the SVG in the bord
er-box coordinate space. | 332 // Compute the paint invalidation rect of the content of the SVG in the bord
er-box coordinate space. |
333 FloatRect contentPaintInvalidationRect = paintInvalidationRectInLocalSVGCoor
dinates(); | 333 FloatRect contentPaintInvalidationRect = paintInvalidationRectInLocalSVGCoor
dinates(); |
334 contentPaintInvalidationRect = m_localToBorderBoxTransform.mapRect(contentPa
intInvalidationRect); | 334 contentPaintInvalidationRect = m_localToBorderBoxTransform.mapRect(contentPa
intInvalidationRect); |
335 | 335 |
336 // Apply initial viewport clip, overflow:visible content is added to visualO
verflow | 336 // Apply initial viewport clip, overflow:visible content is added to visualO
verflow |
337 // but the most common case is that overflow is hidden, so always intersect. | 337 // but the most common case is that overflow is hidden, so always intersect. |
338 contentPaintInvalidationRect.intersect(pixelSnappedBorderBoxRect()); | 338 contentPaintInvalidationRect.intersect(pixelSnappedBorderBoxRect()); |
339 | 339 |
340 LayoutRect paintInvalidationRect = enclosingLayoutRect(contentPaintInvalidat
ionRect); | 340 LayoutRect paintInvalidationRect = enclosingLayoutRect(contentPaintInvalidat
ionRect); |
341 // If the box is decorated or is overflowing, extend it to include the borde
r-box and overflow. | 341 // If the box is decorated or is overflowing, extend it to include the borde
r-box and overflow. |
342 if (m_hasBoxDecorationBackground || hasOverflowModel()) { | 342 if (m_hasBoxDecorationBackground || hasOverflowModel()) { |
343 // The selectionRect can project outside of the overflowRect, so take th
eir union | 343 // The selectionRect can project outside of the overflowRect, so take th
eir union |
344 // for paint invalidation to avoid selection painting glitches. | 344 // for paint invalidation to avoid selection painting glitches. |
345 LayoutRect decoratedPaintInvalidationRect = unionRect(localSelectionRect
(), visualOverflowRect()); | 345 LayoutRect decoratedPaintInvalidationRect = unionRect(localSelectionRect
(), visualOverflowRect()); |
346 paintInvalidationRect.unite(decoratedPaintInvalidationRect); | 346 paintInvalidationRect.unite(decoratedPaintInvalidationRect); |
347 } | 347 } |
348 | 348 |
349 // Compute the paint invalidation rect in the parent coordinate space. | 349 return LayoutRect(enclosingIntRect(paintInvalidationRect)); |
350 LayoutRect rect(enclosingIntRect(paintInvalidationRect)); | |
351 LayoutReplaced::mapToVisibleRectInAncestorSpace(paintInvalidationContainer,
rect, paintInvalidationState); | |
352 return rect; | |
353 } | 350 } |
354 | 351 |
355 void LayoutSVGRoot::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject*
ancestor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState
) const | 352 void LayoutSVGRoot::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject*
ancestor, LayoutRect& rect) const |
356 { | 353 { |
357 // Note that we don't apply the border-box transform here - it's assumed | 354 // Note that we don't apply the border-box transform here - it's assumed |
358 // that whoever called us has done that already. | 355 // that whoever called us has done that already. |
359 | 356 |
360 // Apply initial viewport clip | 357 // Apply initial viewport clip |
| 358 // TODO(crbug.com/597813): We should not apply clip on LayoutSVGRoot's own r
ect. This clip should |
| 359 // be applied in children's mapToVisibleRectInAncestorSpace(). |
361 if (shouldApplyViewportClip()) | 360 if (shouldApplyViewportClip()) |
362 rect.intersect(LayoutRect(pixelSnappedBorderBoxRect())); | 361 rect.intersect(LayoutRect(pixelSnappedBorderBoxRect())); |
363 | 362 |
364 LayoutReplaced::mapToVisibleRectInAncestorSpace(ancestor, rect, paintInvalid
ationState); | 363 LayoutReplaced::mapToVisibleRectInAncestorSpace(ancestor, rect); |
365 } | 364 } |
366 | 365 |
367 // This method expects local CSS box coordinates. | 366 // This method expects local CSS box coordinates. |
368 // Callers with local SVG viewport coordinates should first apply the localToBor
derBoxTransform | 367 // Callers with local SVG viewport coordinates should first apply the localToBor
derBoxTransform |
369 // to convert from SVG viewport coordinates to local CSS box coordinates. | 368 // to convert from SVG viewport coordinates to local CSS box coordinates. |
370 void LayoutSVGRoot::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Tra
nsformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const Pai
ntInvalidationState* paintInvalidationState) const | 369 void LayoutSVGRoot::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Tra
nsformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const |
371 { | 370 { |
372 ASSERT(!(mode & IsFixed)); // We should have no fixed content in the SVG lay
out tree. | 371 ASSERT(!(mode & IsFixed)); // We should have no fixed content in the SVG lay
out tree. |
373 | 372 |
374 LayoutReplaced::mapLocalToAncestor(ancestor, transformState, mode | ApplyCon
tainerFlip, wasFixed, paintInvalidationState); | 373 LayoutReplaced::mapLocalToAncestor(ancestor, transformState, mode | ApplyCon
tainerFlip, wasFixed); |
375 } | 374 } |
376 | 375 |
377 const LayoutObject* LayoutSVGRoot::pushMappingToContainer(const LayoutBoxModelOb
ject* ancestorToStopAt, LayoutGeometryMap& geometryMap) const | 376 const LayoutObject* LayoutSVGRoot::pushMappingToContainer(const LayoutBoxModelOb
ject* ancestorToStopAt, LayoutGeometryMap& geometryMap) const |
378 { | 377 { |
379 return LayoutReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap)
; | 378 return LayoutReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap)
; |
380 } | 379 } |
381 | 380 |
382 void LayoutSVGRoot::updateCachedBoundaries() | 381 void LayoutSVGRoot::updateCachedBoundaries() |
383 { | 382 { |
384 SVGLayoutSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m
_objectBoundingBoxValid, m_strokeBoundingBox, m_paintInvalidationBoundingBox); | 383 SVGLayoutSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m
_objectBoundingBoxValid, m_strokeBoundingBox, m_paintInvalidationBoundingBox); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 updateHitTestResult(result, pointInBorderBox); | 419 updateHitTestResult(result, pointInBorderBox); |
421 if (result.addNodeToListBasedTestResult(node(), locationInContainer,
boundsRect) == StopHitTesting) | 420 if (result.addNodeToListBasedTestResult(node(), locationInContainer,
boundsRect) == StopHitTesting) |
422 return true; | 421 return true; |
423 } | 422 } |
424 } | 423 } |
425 | 424 |
426 return false; | 425 return false; |
427 } | 426 } |
428 | 427 |
429 } // namespace blink | 428 } // namespace blink |
OLD | NEW |