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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 m_needsBoundariesOrTransformUpdate = false; | 221 m_needsBoundariesOrTransformUpdate = false; |
| 222 } | 222 } |
| 223 | 223 |
| 224 updateLayerTransform(); | 224 updateLayerTransform(); |
| 225 | 225 |
| 226 repainter.repaintAfterLayout(); | 226 repainter.repaintAfterLayout(); |
| 227 | 227 |
| 228 clearNeedsLayout(); | 228 clearNeedsLayout(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 bool RenderSVGRoot::applyViewportClip() const | |
|
esprehn
2014/04/05 20:19:22
this should be named with an "is" or "should" pref
| |
| 232 { | |
| 233 // the outermost svg is clipped if auto, and svg document roots are always c lipped | |
| 234 return style()->overflowX() == OHIDDEN || style()->overflowX() == OAUTO || t his->isRoot(); | |
| 235 } | |
| 236 | |
| 231 void RenderSVGRoot::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paint Offset) | 237 void RenderSVGRoot::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paint Offset) |
| 232 { | 238 { |
| 233 // An empty viewport disables rendering. | 239 // An empty viewport disables rendering. |
| 234 if (pixelSnappedBorderBoxRect().isEmpty()) | 240 if (pixelSnappedBorderBoxRect().isEmpty()) |
| 235 return; | 241 return; |
| 236 | 242 |
| 237 // Don't paint, if the context explicitly disabled it. | 243 // Don't paint, if the context explicitly disabled it. |
| 238 if (paintInfo.context->paintingDisabled()) | 244 if (paintInfo.context->paintingDisabled()) |
| 239 return; | 245 return; |
| 240 | 246 |
| 241 // An empty viewBox also disables rendering. | 247 // An empty viewBox also disables rendering. |
| 242 // (http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute) | 248 // (http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute) |
| 243 SVGSVGElement* svg = toSVGSVGElement(node()); | 249 SVGSVGElement* svg = toSVGSVGElement(node()); |
| 244 ASSERT(svg); | 250 ASSERT(svg); |
| 245 if (svg->hasEmptyViewBox()) | 251 if (svg->hasEmptyViewBox()) |
| 246 return; | 252 return; |
| 247 | 253 |
| 248 // Don't paint if we don't have kids, except if we have filters we should pa int those. | 254 // Don't paint if we don't have kids, except if we have filters we should pa int those. |
| 249 if (!firstChild()) { | 255 if (!firstChild()) { |
| 250 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObj ect(this); | 256 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObj ect(this); |
| 251 if (!resources || !resources->filter()) | 257 if (!resources || !resources->filter()) |
| 252 return; | 258 return; |
| 253 } | 259 } |
| 254 | 260 |
| 255 // Make a copy of the PaintInfo because applyTransform will modify the damag e rect. | 261 // Make a copy of the PaintInfo because applyTransform will modify the damag e rect. |
| 256 PaintInfo childPaintInfo(paintInfo); | 262 PaintInfo childPaintInfo(paintInfo); |
| 257 childPaintInfo.context->save(); | 263 childPaintInfo.context->save(); |
| 258 | 264 |
| 259 // Apply initial viewport clip - not affected by overflow handling | 265 // Apply initial viewport clip |
| 260 childPaintInfo.context->clip(pixelSnappedIntRect(overflowClipRect(paintOffse t))); | 266 if (applyViewportClip()) |
| 267 childPaintInfo.context->clip(pixelSnappedIntRect(overflowClipRect(paintO ffset))); | |
| 261 | 268 |
| 262 // Convert from container offsets (html renderers) to a relative transform ( svg renderers). | 269 // Convert from container offsets (html renderers) to a relative transform ( svg renderers). |
| 263 // Transform from our paint container's coordinate system to our local coord s. | 270 // Transform from our paint container's coordinate system to our local coord s. |
| 264 IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset); | 271 IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset); |
| 265 childPaintInfo.applyTransform(AffineTransform::translation(adjustedPaintOffs et.x(), adjustedPaintOffset.y()) * localToBorderBoxTransform()); | 272 childPaintInfo.applyTransform(AffineTransform::translation(adjustedPaintOffs et.x(), adjustedPaintOffset.y()) * localToBorderBoxTransform()); |
| 266 | 273 |
| 267 // SVGRenderingContext must be destroyed before we restore the childPaintInf o.context, because a filter may have | 274 // SVGRenderingContext must be destroyed before we restore the childPaintInf o.context, because a filter may have |
| 268 // changed the context and it is only reverted when the SVGRenderingContext destructor finishes applying the filter. | 275 // changed the context and it is only reverted when the SVGRenderingContext destructor finishes applying the filter. |
| 269 { | 276 { |
| 270 SVGRenderingContext renderingContext; | 277 SVGRenderingContext renderingContext; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 357 { | 364 { |
| 358 return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContaine r); | 365 return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContaine r); |
| 359 } | 366 } |
| 360 | 367 |
| 361 void RenderSVGRoot::computeFloatRectForRepaint(const RenderLayerModelObject* rep aintContainer, FloatRect& repaintRect, bool fixed) const | 368 void RenderSVGRoot::computeFloatRectForRepaint(const RenderLayerModelObject* rep aintContainer, FloatRect& repaintRect, bool fixed) const |
| 362 { | 369 { |
| 363 // Apply our local transforms (except for x/y translation), then our shadow, | 370 // Apply our local transforms (except for x/y translation), then our shadow, |
| 364 // and then call RenderBox's method to handle all the normal CSS Box model b its | 371 // and then call RenderBox's method to handle all the normal CSS Box model b its |
| 365 repaintRect = m_localToBorderBoxTransform.mapRect(repaintRect); | 372 repaintRect = m_localToBorderBoxTransform.mapRect(repaintRect); |
| 366 | 373 |
| 367 // Apply initial viewport clip - not affected by overflow settings | 374 // Apply initial viewport clip |
| 368 repaintRect.intersect(pixelSnappedBorderBoxRect()); | 375 if (applyViewportClip()) |
| 376 repaintRect.intersect(pixelSnappedBorderBoxRect()); | |
| 369 | 377 |
| 370 LayoutRect rect = enclosingIntRect(repaintRect); | 378 LayoutRect rect = enclosingIntRect(repaintRect); |
| 371 RenderReplaced::computeRectForRepaint(repaintContainer, rect, fixed); | 379 RenderReplaced::computeRectForRepaint(repaintContainer, rect, fixed); |
| 372 repaintRect = rect; | 380 repaintRect = rect; |
| 373 } | 381 } |
| 374 | 382 |
| 375 // This method expects local CSS box coordinates. | 383 // This method expects local CSS box coordinates. |
| 376 // Callers with local SVG viewport coordinates should first apply the localToBor derBoxTransform | 384 // Callers with local SVG viewport coordinates should first apply the localToBor derBoxTransform |
| 377 // to convert from SVG viewport coordinates to local CSS box coordinates. | 385 // to convert from SVG viewport coordinates to local CSS box coordinates. |
| 378 void RenderSVGRoot::mapLocalToContainer(const RenderLayerModelObject* repaintCon tainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed ) const | 386 void RenderSVGRoot::mapLocalToContainer(const RenderLayerModelObject* repaintCon tainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed ) const |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 441 | 449 |
| 442 bool RenderSVGRoot::hasRelativeLogicalHeight() const | 450 bool RenderSVGRoot::hasRelativeLogicalHeight() const |
| 443 { | 451 { |
| 444 SVGSVGElement* svg = toSVGSVGElement(node()); | 452 SVGSVGElement* svg = toSVGSVGElement(node()); |
| 445 ASSERT(svg); | 453 ASSERT(svg); |
| 446 | 454 |
| 447 return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent(); | 455 return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent(); |
| 448 } | 456 } |
| 449 | 457 |
| 450 } | 458 } |
| OLD | NEW |