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 |
11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
12 * | 12 * |
13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
17 * | 17 * |
18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
22 */ | 22 */ |
23 | 23 |
24 #include "config.h" | 24 #include "config.h" |
25 | 25 |
26 #include "core/rendering/svg/RenderSVGRoot.h" | 26 #include "core/rendering/svg/RenderSVGRoot.h" |
27 | 27 |
28 #include "core/frame/LocalFrame.h" | 28 #include "core/frame/LocalFrame.h" |
29 #include "core/layout/HitTestResult.h" | 29 #include "core/layout/HitTestResult.h" |
| 30 #include "core/layout/Layer.h" |
30 #include "core/paint/SVGRootPainter.h" | 31 #include "core/paint/SVGRootPainter.h" |
31 #include "core/rendering/RenderLayer.h" | |
32 #include "core/rendering/RenderPart.h" | 32 #include "core/rendering/RenderPart.h" |
33 #include "core/rendering/RenderView.h" | 33 #include "core/rendering/RenderView.h" |
34 #include "core/rendering/svg/SVGRenderSupport.h" | 34 #include "core/rendering/svg/SVGRenderSupport.h" |
35 #include "core/rendering/svg/SVGResourcesCache.h" | 35 #include "core/rendering/svg/SVGResourcesCache.h" |
36 #include "core/svg/SVGElement.h" | 36 #include "core/svg/SVGElement.h" |
37 #include "core/svg/SVGSVGElement.h" | 37 #include "core/svg/SVGSVGElement.h" |
38 #include "core/svg/graphics/SVGImage.h" | 38 #include "core/svg/graphics/SVGImage.h" |
39 #include "platform/LengthFunctions.h" | 39 #include "platform/LengthFunctions.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 { | 313 { |
314 // Slightly optimized version of m_localToParentTransform = AffineTransform:
:translation(x(), y()) * m_localToBorderBoxTransform; | 314 // Slightly optimized version of m_localToParentTransform = AffineTransform:
:translation(x(), y()) * m_localToBorderBoxTransform; |
315 m_localToParentTransform = m_localToBorderBoxTransform; | 315 m_localToParentTransform = m_localToBorderBoxTransform; |
316 if (location().x()) | 316 if (location().x()) |
317 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt(
location().x())); | 317 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt(
location().x())); |
318 if (location().y()) | 318 if (location().y()) |
319 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt(
location().y())); | 319 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt(
location().y())); |
320 return m_localToParentTransform; | 320 return m_localToParentTransform; |
321 } | 321 } |
322 | 322 |
323 LayoutRect RenderSVGRoot::clippedOverflowRectForPaintInvalidation(const RenderLa
yerModelObject* paintInvalidationContainer, const PaintInvalidationState* paintI
nvalidationState) const | 323 LayoutRect RenderSVGRoot::clippedOverflowRectForPaintInvalidation(const LayoutLa
yerModelObject* paintInvalidationContainer, const PaintInvalidationState* paintI
nvalidationState) const |
324 { | 324 { |
325 // This is an open-coded aggregate of SVGRenderSupport::clippedOverflowRectF
orPaintInvalidation, | 325 // This is an open-coded aggregate of SVGRenderSupport::clippedOverflowRectF
orPaintInvalidation, |
326 // RenderSVGRoot::mapRectToPaintInvalidationBacking and RenderReplaced::clip
pedOverflowRectForPaintInvalidation. | 326 // RenderSVGRoot::mapRectToPaintInvalidationBacking and RenderReplaced::clip
pedOverflowRectForPaintInvalidation. |
327 // The reason for this is to optimize/minimize the paint invalidation rect w
hen the box is not "decorated" | 327 // The reason for this is to optimize/minimize the paint invalidation rect w
hen the box is not "decorated" |
328 // (does not have background/border/etc.) | 328 // (does not have background/border/etc.) |
329 | 329 |
330 // Return early for any cases where we don't actually paint. | 330 // Return early for any cases where we don't actually paint. |
331 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent
()) | 331 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent
()) |
332 return LayoutRect(); | 332 return LayoutRect(); |
333 | 333 |
(...skipping 13 matching lines...) Expand all Loading... |
347 LayoutRect decoratedPaintInvalidationRect = unionRect(localSelectionRect
(false), visualOverflowRect()); | 347 LayoutRect decoratedPaintInvalidationRect = unionRect(localSelectionRect
(false), visualOverflowRect()); |
348 paintInvalidationRect.unite(decoratedPaintInvalidationRect); | 348 paintInvalidationRect.unite(decoratedPaintInvalidationRect); |
349 } | 349 } |
350 | 350 |
351 // Compute the paint invalidation rect in the parent coordinate space. | 351 // Compute the paint invalidation rect in the parent coordinate space. |
352 LayoutRect rect = enclosingIntRect(paintInvalidationRect); | 352 LayoutRect rect = enclosingIntRect(paintInvalidationRect); |
353 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer
, rect, paintInvalidationState); | 353 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer
, rect, paintInvalidationState); |
354 return rect; | 354 return rect; |
355 } | 355 } |
356 | 356 |
357 void RenderSVGRoot::mapRectToPaintInvalidationBacking(const RenderLayerModelObje
ct* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState*
paintInvalidationState) const | 357 void RenderSVGRoot::mapRectToPaintInvalidationBacking(const LayoutLayerModelObje
ct* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState*
paintInvalidationState) const |
358 { | 358 { |
359 // Note that we don't apply the border-box transform here - it's assumed | 359 // Note that we don't apply the border-box transform here - it's assumed |
360 // that whoever called us has done that already. | 360 // that whoever called us has done that already. |
361 | 361 |
362 // Apply initial viewport clip | 362 // Apply initial viewport clip |
363 if (shouldApplyViewportClip()) | 363 if (shouldApplyViewportClip()) |
364 rect.intersect(pixelSnappedBorderBoxRect()); | 364 rect.intersect(pixelSnappedBorderBoxRect()); |
365 | 365 |
366 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer
, rect, paintInvalidationState); | 366 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer
, rect, paintInvalidationState); |
367 } | 367 } |
368 | 368 |
369 // This method expects local CSS box coordinates. | 369 // This method expects local CSS box coordinates. |
370 // Callers with local SVG viewport coordinates should first apply the localToBor
derBoxTransform | 370 // Callers with local SVG viewport coordinates should first apply the localToBor
derBoxTransform |
371 // to convert from SVG viewport coordinates to local CSS box coordinates. | 371 // to convert from SVG viewport coordinates to local CSS box coordinates. |
372 void RenderSVGRoot::mapLocalToContainer(const RenderLayerModelObject* paintInval
idationContainer, TransformState& transformState, MapCoordinatesFlags mode, bool
* wasFixed, const PaintInvalidationState* paintInvalidationState) const | 372 void RenderSVGRoot::mapLocalToContainer(const LayoutLayerModelObject* paintInval
idationContainer, TransformState& transformState, MapCoordinatesFlags mode, bool
* wasFixed, const PaintInvalidationState* paintInvalidationState) const |
373 { | 373 { |
374 ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG rende
ring tree. | 374 ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG rende
ring tree. |
375 // We used to have this ASSERT here, but we removed it when enabling layer s
quashing. | 375 // We used to have this ASSERT here, but we removed it when enabling layer s
quashing. |
376 // See http://crbug.com/364901 | 376 // See http://crbug.com/364901 |
377 // ASSERT(mode & UseTransforms); // mapping a point through SVG w/o respecti
ng trasnforms is useless. | 377 // ASSERT(mode & UseTransforms); // mapping a point through SVG w/o respecti
ng trasnforms is useless. |
378 | 378 |
379 RenderReplaced::mapLocalToContainer(paintInvalidationContainer, transformSta
te, mode | ApplyContainerFlip, wasFixed, paintInvalidationState); | 379 RenderReplaced::mapLocalToContainer(paintInvalidationContainer, transformSta
te, mode | ApplyContainerFlip, wasFixed, paintInvalidationState); |
380 } | 380 } |
381 | 381 |
382 const RenderObject* RenderSVGRoot::pushMappingToContainer(const RenderLayerModel
Object* ancestorToStopAt, RenderGeometryMap& geometryMap) const | 382 const RenderObject* RenderSVGRoot::pushMappingToContainer(const LayoutLayerModel
Object* ancestorToStopAt, RenderGeometryMap& geometryMap) const |
383 { | 383 { |
384 return RenderReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap)
; | 384 return RenderReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap)
; |
385 } | 385 } |
386 | 386 |
387 void RenderSVGRoot::updateCachedBoundaries() | 387 void RenderSVGRoot::updateCachedBoundaries() |
388 { | 388 { |
389 SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m
_objectBoundingBoxValid, m_strokeBoundingBox, m_paintInvalidationBoundingBox); | 389 SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m
_objectBoundingBoxValid, m_strokeBoundingBox, m_paintInvalidationBoundingBox); |
390 SVGRenderSupport::intersectPaintInvalidationRectWithResources(this, m_paintI
nvalidationBoundingBox); | 390 SVGRenderSupport::intersectPaintInvalidationRectWithResources(this, m_paintI
nvalidationBoundingBox); |
391 } | 391 } |
392 | 392 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 updateHitTestResult(result, pointInBorderBox); | 425 updateHitTestResult(result, pointInBorderBox); |
426 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn
Container, boundsRect)) | 426 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn
Container, boundsRect)) |
427 return true; | 427 return true; |
428 } | 428 } |
429 } | 429 } |
430 | 430 |
431 return false; | 431 return false; |
432 } | 432 } |
433 | 433 |
434 } | 434 } |
OLD | NEW |