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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 return resolveLengthAttributeForSVG(svg->intrinsicHeight(), style()->eff
ectiveZoom(), containingBlock()->availableLogicalHeight(IncludeMarginBorderPaddi
ng).toFloat()); | 156 return resolveLengthAttributeForSVG(svg->intrinsicHeight(), style()->eff
ectiveZoom(), containingBlock()->availableLogicalHeight(IncludeMarginBorderPaddi
ng).toFloat()); |
157 | 157 |
158 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SV
G. | 158 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SV
G. |
159 return RenderReplaced::computeReplacedLogicalHeight(); | 159 return RenderReplaced::computeReplacedLogicalHeight(); |
160 } | 160 } |
161 | 161 |
162 void RenderSVGRoot::layout() | 162 void RenderSVGRoot::layout() |
163 { | 163 { |
164 ASSERT(needsLayout()); | 164 ASSERT(needsLayout()); |
165 | 165 |
166 // Arbitrary affine transforms are incompatible with LayoutState. | |
167 ForceHorriblySlowRectMapping slowRectMapping(*this); | |
168 | |
169 bool needsLayout = selfNeedsLayout(); | 166 bool needsLayout = selfNeedsLayout(); |
170 | 167 |
171 LayoutSize oldSize = size(); | 168 LayoutSize oldSize = size(); |
172 updateLogicalWidth(); | 169 updateLogicalWidth(); |
173 updateLogicalHeight(); | 170 updateLogicalHeight(); |
174 buildLocalToBorderBoxTransform(); | 171 buildLocalToBorderBoxTransform(); |
175 | 172 |
176 SVGRenderSupport::layoutResourcesIfNeeded(this); | 173 SVGRenderSupport::layoutResourcesIfNeeded(this); |
177 | 174 |
178 SVGSVGElement* svg = toSVGSVGElement(node()); | 175 SVGSVGElement* svg = toSVGSVGElement(node()); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 { | 337 { |
341 // Slightly optimized version of m_localToParentTransform = AffineTransform:
:translation(x(), y()) * m_localToBorderBoxTransform; | 338 // Slightly optimized version of m_localToParentTransform = AffineTransform:
:translation(x(), y()) * m_localToBorderBoxTransform; |
342 m_localToParentTransform = m_localToBorderBoxTransform; | 339 m_localToParentTransform = m_localToBorderBoxTransform; |
343 if (x()) | 340 if (x()) |
344 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt(
x())); | 341 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt(
x())); |
345 if (y()) | 342 if (y()) |
346 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt(
y())); | 343 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt(
y())); |
347 return m_localToParentTransform; | 344 return m_localToParentTransform; |
348 } | 345 } |
349 | 346 |
350 LayoutRect RenderSVGRoot::clippedOverflowRectForPaintInvalidation(const RenderLa
yerModelObject* paintInvalidationContainer) const | 347 LayoutRect RenderSVGRoot::clippedOverflowRectForPaintInvalidation(const RenderLa
yerModelObject* paintInvalidationContainer, const PaintInvalidationState* paintI
nvalidationState) const |
351 { | 348 { |
352 // This is an open-coded aggregate of SVGRenderSupport::clippedOverflowRectF
orPaintInvalidation, | 349 // This is an open-coded aggregate of SVGRenderSupport::clippedOverflowRectF
orPaintInvalidation, |
353 // RenderSVGRoot::computeFloatRectForPaintInvalidation and RenderReplaced::c
lippedOverflowRectForPaintInvalidation. | 350 // RenderSVGRoot::computeFloatRectForPaintInvalidation and RenderReplaced::c
lippedOverflowRectForPaintInvalidation. |
354 // The reason for this is to optimize/minimize the repaint rect when the box
is not "decorated" | 351 // The reason for this is to optimize/minimize the repaint rect when the box
is not "decorated" |
355 // (does not have background/border/etc.) | 352 // (does not have background/border/etc.) |
356 | 353 |
357 // Return early for any cases where we don't actually paint. | 354 // Return early for any cases where we don't actually paint. |
358 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent
()) | 355 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent
()) |
359 return LayoutRect(); | 356 return LayoutRect(); |
360 | 357 |
361 // Compute the repaint rect of the content of the SVG in the border-box coor
dinate space. | 358 // Compute the repaint rect of the content of the SVG in the border-box coor
dinate space. |
362 FloatRect contentRepaintRect = paintInvalidationRectInLocalCoordinates(); | 359 FloatRect contentRepaintRect = paintInvalidationRectInLocalCoordinates(); |
363 contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintRect)
; | 360 contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintRect)
; |
364 | 361 |
365 // Apply initial viewport clip, overflow:visible content is added to visualO
verflow | 362 // Apply initial viewport clip, overflow:visible content is added to visualO
verflow |
366 // but the most common case is that overflow is hidden, so always intersect. | 363 // but the most common case is that overflow is hidden, so always intersect. |
367 contentRepaintRect.intersect(pixelSnappedBorderBoxRect()); | 364 contentRepaintRect.intersect(pixelSnappedBorderBoxRect()); |
368 | 365 |
369 LayoutRect repaintRect = enclosingLayoutRect(contentRepaintRect); | 366 LayoutRect repaintRect = enclosingLayoutRect(contentRepaintRect); |
370 // If the box is decorated or is overflowing, extend it to include the borde
r-box and overflow. | 367 // If the box is decorated or is overflowing, extend it to include the borde
r-box and overflow. |
371 if (m_hasBoxDecorationBackground || hasRenderOverflow()) { | 368 if (m_hasBoxDecorationBackground || hasRenderOverflow()) { |
372 // The selectionRect can project outside of the overflowRect, so take th
eir union | 369 // The selectionRect can project outside of the overflowRect, so take th
eir union |
373 // for repainting to avoid selection painting glitches. | 370 // for repainting to avoid selection painting glitches. |
374 LayoutRect decoratedRepaintRect = unionRect(localSelectionRect(false), v
isualOverflowRect()); | 371 LayoutRect decoratedRepaintRect = unionRect(localSelectionRect(false), v
isualOverflowRect()); |
375 repaintRect.unite(decoratedRepaintRect); | 372 repaintRect.unite(decoratedRepaintRect); |
376 } | 373 } |
377 | 374 |
378 // Compute the repaint rect in the parent coordinate space. | 375 // Compute the repaint rect in the parent coordinate space. |
379 LayoutRect rect = enclosingIntRect(repaintRect); | 376 LayoutRect rect = enclosingIntRect(repaintRect); |
380 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer
, rect); | 377 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer
, rect, paintInvalidationState); |
381 return rect; | 378 return rect; |
382 } | 379 } |
383 | 380 |
384 void RenderSVGRoot::computeFloatRectForPaintInvalidation(const RenderLayerModelO
bject* paintInvalidationContainer, FloatRect& paintInvalidationRect, bool fixed)
const | 381 void RenderSVGRoot::computeFloatRectForPaintInvalidation(const RenderLayerModelO
bject* paintInvalidationContainer, FloatRect& paintInvalidationRect, bool fixed,
const PaintInvalidationState* paintInvalidationState) const |
385 { | 382 { |
386 // Apply our local transforms (except for x/y translation), then our shadow, | 383 // Apply our local transforms (except for x/y translation), then our shadow, |
387 // and then call RenderBox's method to handle all the normal CSS Box model b
its | 384 // and then call RenderBox's method to handle all the normal CSS Box model b
its |
388 paintInvalidationRect = m_localToBorderBoxTransform.mapRect(paintInvalidatio
nRect); | 385 paintInvalidationRect = m_localToBorderBoxTransform.mapRect(paintInvalidatio
nRect); |
389 | 386 |
390 // Apply initial viewport clip | 387 // Apply initial viewport clip |
391 if (shouldApplyViewportClip()) | 388 if (shouldApplyViewportClip()) |
392 paintInvalidationRect.intersect(pixelSnappedBorderBoxRect()); | 389 paintInvalidationRect.intersect(pixelSnappedBorderBoxRect()); |
393 | 390 |
394 LayoutRect rect = enclosingIntRect(paintInvalidationRect); | 391 LayoutRect rect = enclosingIntRect(paintInvalidationRect); |
395 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer
, rect, fixed); | 392 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer
, rect, fixed, paintInvalidationState); |
396 paintInvalidationRect = rect; | 393 paintInvalidationRect = rect; |
397 } | 394 } |
398 | 395 |
399 // This method expects local CSS box coordinates. | 396 // This method expects local CSS box coordinates. |
400 // Callers with local SVG viewport coordinates should first apply the localToBor
derBoxTransform | 397 // Callers with local SVG viewport coordinates should first apply the localToBor
derBoxTransform |
401 // to convert from SVG viewport coordinates to local CSS box coordinates. | 398 // to convert from SVG viewport coordinates to local CSS box coordinates. |
402 void RenderSVGRoot::mapLocalToContainer(const RenderLayerModelObject* repaintCon
tainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed
) const | 399 void RenderSVGRoot::mapLocalToContainer(const RenderLayerModelObject* repaintCon
tainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed
, const PaintInvalidationState* paintInvalidationState) const |
403 { | 400 { |
404 ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG rende
ring tree. | 401 ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG rende
ring tree. |
405 // We used to have this ASSERT here, but we removed it when enabling layer s
quashing. | 402 // We used to have this ASSERT here, but we removed it when enabling layer s
quashing. |
406 // See http://crbug.com/364901 | 403 // See http://crbug.com/364901 |
407 // ASSERT(mode & UseTransforms); // mapping a point through SVG w/o respecti
ng trasnforms is useless. | 404 // ASSERT(mode & UseTransforms); // mapping a point through SVG w/o respecti
ng trasnforms is useless. |
408 | 405 |
409 RenderReplaced::mapLocalToContainer(repaintContainer, transformState, mode |
ApplyContainerFlip, wasFixed); | 406 RenderReplaced::mapLocalToContainer(repaintContainer, transformState, mode |
ApplyContainerFlip, wasFixed, paintInvalidationState); |
410 } | 407 } |
411 | 408 |
412 const RenderObject* RenderSVGRoot::pushMappingToContainer(const RenderLayerModel
Object* ancestorToStopAt, RenderGeometryMap& geometryMap) const | 409 const RenderObject* RenderSVGRoot::pushMappingToContainer(const RenderLayerModel
Object* ancestorToStopAt, RenderGeometryMap& geometryMap) const |
413 { | 410 { |
414 return RenderReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap)
; | 411 return RenderReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap)
; |
415 } | 412 } |
416 | 413 |
417 void RenderSVGRoot::updateCachedBoundaries() | 414 void RenderSVGRoot::updateCachedBoundaries() |
418 { | 415 { |
419 SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m
_objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBox); | 416 SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m
_objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBox); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 updateHitTestResult(result, pointInBorderBox); | 448 updateHitTestResult(result, pointInBorderBox); |
452 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn
Container, boundsRect)) | 449 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn
Container, boundsRect)) |
453 return true; | 450 return true; |
454 } | 451 } |
455 } | 452 } |
456 | 453 |
457 return false; | 454 return false; |
458 } | 455 } |
459 | 456 |
460 } | 457 } |
OLD | NEW |