| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007 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) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 bool acquirePaintingResource(GraphicsContext*&, float scalingFactor, RenderS
tyle*, RenderSVGResourceModeFlags); | 356 bool acquirePaintingResource(GraphicsContext*&, float scalingFactor, RenderS
tyle*, RenderSVGResourceModeFlags); |
| 357 void releasePaintingResource(GraphicsContext*&); | 357 void releasePaintingResource(GraphicsContext*&); |
| 358 | 358 |
| 359 private: | 359 private: |
| 360 RenderObject& m_renderer; | 360 RenderObject& m_renderer; |
| 361 TextRun::RenderingContext* m_renderingContext; | 361 TextRun::RenderingContext* m_renderingContext; |
| 362 RenderSVGResource* m_paintingResource; | 362 RenderSVGResource* m_paintingResource; |
| 363 }; | 363 }; |
| 364 | 364 |
| 365 bool PaintingResourceScope::acquirePaintingResource(GraphicsContext*& context, f
loat scalingFactor, | 365 bool PaintingResourceScope::acquirePaintingResource(GraphicsContext*& context, f
loat scalingFactor, |
| 366 RenderStyle* style, RenderSVGResourceModeFlags resourceMode) | 366 RenderStyle* style, RenderSVGResourceModeFlags resourceModeFlags) |
| 367 { | 367 { |
| 368 // Callers must save the context state before calling when scalingFactor is
not 1. | 368 // Callers must save the context state before calling when scalingFactor is
not 1. |
| 369 ASSERT(scalingFactor); | 369 ASSERT(scalingFactor); |
| 370 ASSERT(style); | 370 ASSERT(style); |
| 371 ASSERT(resourceMode != ApplyToDefaultMode); | 371 ASSERT(resourceModeFlags != ApplyToDefaultMode); |
| 372 RenderSVGResourceMode resourceMode = static_cast<RenderSVGResourceMode>(reso
urceModeFlags & (ApplyToFillMode | ApplyToStrokeMode)); |
| 373 ASSERT(resourceMode == ApplyToFillMode || resourceMode == ApplyToStrokeMode)
; |
| 372 | 374 |
| 373 bool hasFallback = false; | 375 bool hasFallback = false; |
| 374 if (resourceMode & ApplyToFillMode) | 376 m_paintingResource = RenderSVGResource::requestPaintingResource(resourceMode
, &m_renderer, style, hasFallback); |
| 375 m_paintingResource = RenderSVGResource::fillPaintingResource(&m_renderer
, style, hasFallback); | |
| 376 else if (resourceMode & ApplyToStrokeMode) | |
| 377 m_paintingResource = RenderSVGResource::strokePaintingResource(&m_render
er, style, hasFallback); | |
| 378 else { | |
| 379 // We're either called for stroking or filling. | |
| 380 ASSERT_NOT_REACHED(); | |
| 381 } | |
| 382 | |
| 383 if (!m_paintingResource) | 377 if (!m_paintingResource) |
| 384 return false; | 378 return false; |
| 385 | 379 |
| 386 if (!m_paintingResource->applyResource(&m_renderer, style, context, resource
Mode)) { | 380 if (!m_paintingResource->applyResource(&m_renderer, style, context, resource
ModeFlags)) { |
| 387 if (hasFallback) { | 381 if (hasFallback) { |
| 388 m_paintingResource = RenderSVGResource::sharedSolidPaintingResource(
); | 382 m_paintingResource = RenderSVGResource::sharedSolidPaintingResource(
); |
| 389 m_paintingResource->applyResource(&m_renderer, style, context, resou
rceMode); | 383 m_paintingResource->applyResource(&m_renderer, style, context, resou
rceModeFlags); |
| 390 } | 384 } |
| 391 } | 385 } |
| 392 | 386 |
| 393 if (scalingFactor != 1 && resourceMode & ApplyToStrokeMode) | 387 if (scalingFactor != 1 && resourceModeFlags & ApplyToStrokeMode) |
| 394 context->setStrokeThickness(context->strokeThickness() * scalingFactor); | 388 context->setStrokeThickness(context->strokeThickness() * scalingFactor); |
| 395 | 389 |
| 396 #if ENABLE(SVG_FONTS) | 390 #if ENABLE(SVG_FONTS) |
| 397 // SVG Fonts need access to the painting resource used to draw the current t
ext chunk. | 391 // SVG Fonts need access to the painting resource used to draw the current t
ext chunk. |
| 398 if (m_renderingContext) | 392 if (m_renderingContext) |
| 399 static_cast<SVGTextRunRenderingContext*>(m_renderingContext)->setActiveP
aintingResource(m_paintingResource); | 393 static_cast<SVGTextRunRenderingContext*>(m_renderingContext)->setActiveP
aintingResource(m_paintingResource); |
| 400 #endif | 394 #endif |
| 401 | 395 |
| 402 return true; | 396 return true; |
| 403 } | 397 } |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 renderer().updateHitTestResult(result, locationInContainer.point
() - toLayoutSize(accumulatedOffset)); | 786 renderer().updateHitTestResult(result, locationInContainer.point
() - toLayoutSize(accumulatedOffset)); |
| 793 if (!result.addNodeToRectBasedTestResult(renderer().node(), requ
est, locationInContainer, rect)) | 787 if (!result.addNodeToRectBasedTestResult(renderer().node(), requ
est, locationInContainer, rect)) |
| 794 return true; | 788 return true; |
| 795 } | 789 } |
| 796 } | 790 } |
| 797 } | 791 } |
| 798 return false; | 792 return false; |
| 799 } | 793 } |
| 800 | 794 |
| 801 } // namespace blink | 795 } // namespace blink |
| OLD | NEW |