| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> |
| 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@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. All rights reserved. | 5 * Copyright (C) 2009 Google, Inc. All rights reserved. |
| 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| 11 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
| 12 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
| 13 * | 13 * |
| 14 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
| 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 * Library General Public License for more details. | 17 * Library General Public License for more details. |
| 18 * | 18 * |
| 19 * You should have received a copy of the GNU Library General Public License | 19 * You should have received a copy of the GNU Library General Public License |
| 20 * along with this library; see the file COPYING.LIB. If not, write to | 20 * along with this library; see the file COPYING.LIB. If not, write to |
| 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 22 * Boston, MA 02110-1301, USA. | 22 * Boston, MA 02110-1301, USA. |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 #include "core/rendering/svg/SVGRenderSupport.h" | 26 #include "core/rendering/svg/SVGRenderSupport.h" |
| 27 | 27 |
| 28 #include "core/frame/FrameView.h" | |
| 29 #include "core/frame/LocalFrame.h" | |
| 30 #include "core/rendering/PaintInfo.h" | 28 #include "core/rendering/PaintInfo.h" |
| 31 #include "core/rendering/RenderGeometryMap.h" | 29 #include "core/rendering/RenderGeometryMap.h" |
| 32 #include "core/rendering/RenderLayer.h" | 30 #include "core/rendering/RenderLayer.h" |
| 33 #include "core/rendering/SubtreeLayoutScope.h" | 31 #include "core/rendering/SubtreeLayoutScope.h" |
| 34 #include "core/rendering/svg/RenderSVGInlineText.h" | 32 #include "core/rendering/svg/RenderSVGInlineText.h" |
| 35 #include "core/rendering/svg/RenderSVGResourceClipper.h" | 33 #include "core/rendering/svg/RenderSVGResourceClipper.h" |
| 36 #include "core/rendering/svg/RenderSVGResourceFilter.h" | 34 #include "core/rendering/svg/RenderSVGResourceFilter.h" |
| 37 #include "core/rendering/svg/RenderSVGResourceMasker.h" | 35 #include "core/rendering/svg/RenderSVGResourceMasker.h" |
| 38 #include "core/rendering/svg/RenderSVGRoot.h" | 36 #include "core/rendering/svg/RenderSVGRoot.h" |
| 39 #include "core/rendering/svg/RenderSVGShape.h" | 37 #include "core/rendering/svg/RenderSVGShape.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 } | 266 } |
| 269 | 267 |
| 270 bool SVGRenderSupport::isOverflowHidden(const RenderObject* object) | 268 bool SVGRenderSupport::isOverflowHidden(const RenderObject* object) |
| 271 { | 269 { |
| 272 // RenderSVGRoot should never query for overflow state - it should always cl
ip itself to the initial viewport size. | 270 // RenderSVGRoot should never query for overflow state - it should always cl
ip itself to the initial viewport size. |
| 273 ASSERT(!object->isDocumentElement()); | 271 ASSERT(!object->isDocumentElement()); |
| 274 | 272 |
| 275 return object->style()->overflowX() == OHIDDEN || object->style()->overflowX
() == OSCROLL; | 273 return object->style()->overflowX() == OHIDDEN || object->style()->overflowX
() == OSCROLL; |
| 276 } | 274 } |
| 277 | 275 |
| 278 bool SVGRenderSupport::isRenderingClipPathAsMaskImage(const RenderObject& object
) | |
| 279 { | |
| 280 return object.frame() && object.frame()->view() && object.frame()->view()->p
aintBehavior() & PaintBehaviorRenderingClipPathAsMask; | |
| 281 } | |
| 282 | |
| 283 void SVGRenderSupport::intersectPaintInvalidationRectWithResources(const RenderO
bject* renderer, FloatRect& paintInvalidationRect) | 276 void SVGRenderSupport::intersectPaintInvalidationRectWithResources(const RenderO
bject* renderer, FloatRect& paintInvalidationRect) |
| 284 { | 277 { |
| 285 ASSERT(renderer); | 278 ASSERT(renderer); |
| 286 | 279 |
| 287 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(
renderer); | 280 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(
renderer); |
| 288 if (!resources) | 281 if (!resources) |
| 289 return; | 282 return; |
| 290 | 283 |
| 291 if (RenderSVGResourceFilter* filter = resources->filter()) | 284 if (RenderSVGResourceFilter* filter = resources->filter()) |
| 292 paintInvalidationRect = filter->resourceBoundingBox(renderer); | 285 paintInvalidationRect = filter->resourceBoundingBox(renderer); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 return; | 379 return; |
| 387 | 380 |
| 388 DashArray dashArray; | 381 DashArray dashArray; |
| 389 size_t length = dashes->length(); | 382 size_t length = dashes->length(); |
| 390 for (size_t i = 0; i < length; ++i) | 383 for (size_t i = 0; i < length; ++i) |
| 391 dashArray.append(dashes->at(i)->value(lengthContext)); | 384 dashArray.append(dashes->at(i)->value(lengthContext)); |
| 392 | 385 |
| 393 strokeData->setLineDash(dashArray, svgStyle.strokeDashOffset()->value(length
Context)); | 386 strokeData->setLineDash(dashArray, svgStyle.strokeDashOffset()->value(length
Context)); |
| 394 } | 387 } |
| 395 | 388 |
| 396 bool SVGRenderSupport::updateGraphicsContext(GraphicsContextStateSaver& stateSav
er, RenderStyle* style, RenderObject& renderer, RenderSVGResourceMode resourceMo
de, const AffineTransform* additionalPaintServerTransform) | 389 bool SVGRenderSupport::updateGraphicsContext(const PaintInfo& paintInfo, Graphic
sContextStateSaver& stateSaver, RenderStyle* style, RenderObject& renderer, Rend
erSVGResourceMode resourceMode, const AffineTransform* additionalPaintServerTran
sform) |
| 397 { | 390 { |
| 398 ASSERT(style); | 391 ASSERT(style); |
| 392 ASSERT(paintInfo.context == stateSaver.context()); |
| 399 | 393 |
| 400 GraphicsContext* context = stateSaver.context(); | 394 GraphicsContext* context = paintInfo.context; |
| 401 if (isRenderingClipPathAsMaskImage(renderer)) { | 395 if (paintInfo.isRenderingClipPathAsMaskImage()) { |
| 402 if (resourceMode == ApplyToStrokeMode) | 396 if (resourceMode == ApplyToStrokeMode) |
| 403 return false; | 397 return false; |
| 404 context->setAlphaAsFloat(1); | 398 context->setAlphaAsFloat(1); |
| 405 context->setFillColor(SVGRenderStyle::initialFillPaintColor()); | 399 context->setFillColor(SVGRenderStyle::initialFillPaintColor()); |
| 406 return true; | 400 return true; |
| 407 } | 401 } |
| 408 | 402 |
| 409 SVGPaintServer paintServer = SVGPaintServer::requestForRenderer(renderer, st
yle, resourceMode); | 403 SVGPaintServer paintServer = SVGPaintServer::requestForRenderer(renderer, st
yle, resourceMode); |
| 410 if (!paintServer.isValid()) | 404 if (!paintServer.isValid()) |
| 411 return false; | 405 return false; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 428 } | 422 } |
| 429 | 423 |
| 430 bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object) | 424 bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object) |
| 431 { | 425 { |
| 432 ASSERT(object->isText()); | 426 ASSERT(object->isText()); |
| 433 // <br> is marked as text, but is not handled by the SVG rendering code-path
. | 427 // <br> is marked as text, but is not handled by the SVG rendering code-path
. |
| 434 return object->isSVGInlineText() && !toRenderSVGInlineText(object)->hasEmpty
Text(); | 428 return object->isSVGInlineText() && !toRenderSVGInlineText(object)->hasEmpty
Text(); |
| 435 } | 429 } |
| 436 | 430 |
| 437 } | 431 } |
| OLD | NEW |