Chromium Code Reviews| 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, |
|
pdr.
2016/03/25 01:08:01
This comment is no longer correct because mapToVis
Xianzhu
2016/03/25 16:35:54
Removed LayoutSVGRoot::mapToVisibleRectInAncestorS
| |
| 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()); |
|
pdr.
2016/03/25 01:08:01
It seems wrong that this is missing the shouldAppl
Xianzhu
2016/03/25 16:35:55
Actually the shouldApplyViewportClip is wrong in L
| |
| 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 |
| 361 if (shouldApplyViewportClip()) | 358 if (shouldApplyViewportClip()) |
| 362 rect.intersect(LayoutRect(pixelSnappedBorderBoxRect())); | 359 rect.intersect(LayoutRect(pixelSnappedBorderBoxRect())); |
| 363 | 360 |
| 364 LayoutReplaced::mapToVisibleRectInAncestorSpace(ancestor, rect, paintInvalid ationState); | 361 LayoutReplaced::mapToVisibleRectInAncestorSpace(ancestor, rect); |
| 365 } | 362 } |
| 366 | 363 |
| 367 // This method expects local CSS box coordinates. | 364 // This method expects local CSS box coordinates. |
| 368 // Callers with local SVG viewport coordinates should first apply the localToBor derBoxTransform | 365 // Callers with local SVG viewport coordinates should first apply the localToBor derBoxTransform |
| 369 // to convert from SVG viewport coordinates to local CSS box coordinates. | 366 // 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 | 367 void LayoutSVGRoot::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Tra nsformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const |
| 371 { | 368 { |
| 372 ASSERT(!(mode & IsFixed)); // We should have no fixed content in the SVG lay out tree. | 369 ASSERT(!(mode & IsFixed)); // We should have no fixed content in the SVG lay out tree. |
| 373 | 370 |
| 374 LayoutReplaced::mapLocalToAncestor(ancestor, transformState, mode | ApplyCon tainerFlip, wasFixed, paintInvalidationState); | 371 LayoutReplaced::mapLocalToAncestor(ancestor, transformState, mode | ApplyCon tainerFlip, wasFixed); |
| 375 } | 372 } |
| 376 | 373 |
| 377 const LayoutObject* LayoutSVGRoot::pushMappingToContainer(const LayoutBoxModelOb ject* ancestorToStopAt, LayoutGeometryMap& geometryMap) const | 374 const LayoutObject* LayoutSVGRoot::pushMappingToContainer(const LayoutBoxModelOb ject* ancestorToStopAt, LayoutGeometryMap& geometryMap) const |
| 378 { | 375 { |
| 379 return LayoutReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap) ; | 376 return LayoutReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap) ; |
| 380 } | 377 } |
| 381 | 378 |
| 382 void LayoutSVGRoot::updateCachedBoundaries() | 379 void LayoutSVGRoot::updateCachedBoundaries() |
| 383 { | 380 { |
| 384 SVGLayoutSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m _objectBoundingBoxValid, m_strokeBoundingBox, m_paintInvalidationBoundingBox); | 381 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); | 417 updateHitTestResult(result, pointInBorderBox); |
| 421 if (result.addNodeToListBasedTestResult(node(), locationInContainer, boundsRect) == StopHitTesting) | 418 if (result.addNodeToListBasedTestResult(node(), locationInContainer, boundsRect) == StopHitTesting) |
| 422 return true; | 419 return true; |
| 423 } | 420 } |
| 424 } | 421 } |
| 425 | 422 |
| 426 return false; | 423 return false; |
| 427 } | 424 } |
| 428 | 425 |
| 429 } // namespace blink | 426 } // namespace blink |
| OLD | NEW |