| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
| 3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> | 3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> |
| 4 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> | 4 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> |
| 5 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 5 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 6 * Copyright (C) 2008 Rob Buis <buis@kde.org> | 6 * Copyright (C) 2008 Rob Buis <buis@kde.org> |
| 7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 8 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. | 8 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. |
| 9 * Copyright (C) 2012 Google Inc. | 9 * Copyright (C) 2012 Google Inc. |
| 10 * | 10 * |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * along with this library; see the file COPYING.LIB. If not, write to | 22 * along with this library; see the file COPYING.LIB. If not, write to |
| 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 24 * Boston, MA 02110-1301, USA. | 24 * Boston, MA 02110-1301, USA. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 | 28 |
| 29 #include "core/rendering/svg/RenderSVGText.h" | 29 #include "core/rendering/svg/RenderSVGText.h" |
| 30 | 30 |
| 31 #include "core/editing/PositionWithAffinity.h" | 31 #include "core/editing/PositionWithAffinity.h" |
| 32 #include "core/paint/SVGTextPainter.h" |
| 32 #include "core/rendering/HitTestRequest.h" | 33 #include "core/rendering/HitTestRequest.h" |
| 33 #include "core/rendering/HitTestResult.h" | 34 #include "core/rendering/HitTestResult.h" |
| 34 #include "core/rendering/PaintInfo.h" | 35 #include "core/rendering/PaintInfo.h" |
| 35 #include "core/rendering/PointerEventsHitRules.h" | 36 #include "core/rendering/PointerEventsHitRules.h" |
| 36 #include "core/rendering/style/ShadowList.h" | 37 #include "core/rendering/style/ShadowList.h" |
| 37 #include "core/rendering/svg/RenderSVGInline.h" | 38 #include "core/rendering/svg/RenderSVGInline.h" |
| 38 #include "core/rendering/svg/RenderSVGInlineText.h" | 39 #include "core/rendering/svg/RenderSVGInlineText.h" |
| 39 #include "core/rendering/svg/RenderSVGResource.h" | 40 #include "core/rendering/svg/RenderSVGResource.h" |
| 40 #include "core/rendering/svg/RenderSVGRoot.h" | 41 #include "core/rendering/svg/RenderSVGRoot.h" |
| 41 #include "core/rendering/svg/SVGRenderSupport.h" | 42 #include "core/rendering/svg/SVGRenderSupport.h" |
| 42 #include "core/rendering/svg/SVGResourcesCache.h" | 43 #include "core/rendering/svg/SVGResourcesCache.h" |
| 43 #include "core/rendering/svg/SVGRootInlineBox.h" | 44 #include "core/rendering/svg/SVGRootInlineBox.h" |
| 44 #include "core/rendering/svg/SVGTextRunRenderingContext.h" | 45 #include "core/rendering/svg/SVGTextRunRenderingContext.h" |
| 45 #include "core/svg/SVGLengthList.h" | 46 #include "core/svg/SVGLengthList.h" |
| 46 #include "core/svg/SVGTextElement.h" | 47 #include "core/svg/SVGTextElement.h" |
| 47 #include "core/svg/SVGTransformList.h" | 48 #include "core/svg/SVGTransformList.h" |
| 48 #include "core/svg/SVGURIReference.h" | 49 #include "core/svg/SVGURIReference.h" |
| 49 #include "platform/FloatConversion.h" | 50 #include "platform/FloatConversion.h" |
| 50 #include "platform/fonts/FontCache.h" | 51 #include "platform/fonts/FontCache.h" |
| 51 #include "platform/fonts/SimpleFontData.h" | 52 #include "platform/fonts/SimpleFontData.h" |
| 52 #include "platform/geometry/FloatQuad.h" | 53 #include "platform/geometry/FloatQuad.h" |
| 53 #include "platform/geometry/TransformState.h" | 54 #include "platform/geometry/TransformState.h" |
| 54 #include "platform/graphics/GraphicsContextStateSaver.h" | |
| 55 | 55 |
| 56 namespace blink { | 56 namespace blink { |
| 57 | 57 |
| 58 RenderSVGText::RenderSVGText(SVGTextElement* node) | 58 RenderSVGText::RenderSVGText(SVGTextElement* node) |
| 59 : RenderSVGBlock(node) | 59 : RenderSVGBlock(node) |
| 60 , m_needsReordering(false) | 60 , m_needsReordering(false) |
| 61 , m_needsPositioningValuesUpdate(false) | 61 , m_needsPositioningValuesUpdate(false) |
| 62 , m_needsTransformUpdate(true) | 62 , m_needsTransformUpdate(true) |
| 63 , m_needsTextMetricsUpdate(false) | 63 , m_needsTextMetricsUpdate(false) |
| 64 { | 64 { |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 return closestBox->renderer().positionForPoint(LayoutPoint(pointInContents.x
(), closestBox->y())); | 460 return closestBox->renderer().positionForPoint(LayoutPoint(pointInContents.x
(), closestBox->y())); |
| 461 } | 461 } |
| 462 | 462 |
| 463 void RenderSVGText::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) cons
t | 463 void RenderSVGText::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) cons
t |
| 464 { | 464 { |
| 465 quads.append(localToAbsoluteQuad(strokeBoundingBox(), 0 /* mode */, wasFixed
)); | 465 quads.append(localToAbsoluteQuad(strokeBoundingBox(), 0 /* mode */, wasFixed
)); |
| 466 } | 466 } |
| 467 | 467 |
| 468 void RenderSVGText::paint(PaintInfo& paintInfo, const LayoutPoint&) | 468 void RenderSVGText::paint(PaintInfo& paintInfo, const LayoutPoint&) |
| 469 { | 469 { |
| 470 if (paintInfo.phase != PaintPhaseForeground | 470 SVGTextPainter(*this).paint(paintInfo); |
| 471 && paintInfo.phase != PaintPhaseSelection) | |
| 472 return; | |
| 473 | |
| 474 PaintInfo blockInfo(paintInfo); | |
| 475 GraphicsContextStateSaver stateSaver(*blockInfo.context, false); | |
| 476 const AffineTransform& localTransform = localToParentTransform(); | |
| 477 if (!localTransform.isIdentity()) { | |
| 478 stateSaver.save(); | |
| 479 blockInfo.applyTransform(localTransform, false); | |
| 480 } | |
| 481 RenderBlock::paint(blockInfo, LayoutPoint()); | |
| 482 | |
| 483 // Paint the outlines, if any | |
| 484 if (paintInfo.phase == PaintPhaseForeground) { | |
| 485 blockInfo.phase = PaintPhaseSelfOutline; | |
| 486 RenderBlock::paint(blockInfo, LayoutPoint()); | |
| 487 } | |
| 488 } | 471 } |
| 489 | 472 |
| 490 FloatRect RenderSVGText::strokeBoundingBox() const | 473 FloatRect RenderSVGText::strokeBoundingBox() const |
| 491 { | 474 { |
| 492 FloatRect strokeBoundaries = objectBoundingBox(); | 475 FloatRect strokeBoundaries = objectBoundingBox(); |
| 493 const SVGRenderStyle& svgStyle = style()->svgStyle(); | 476 const SVGRenderStyle& svgStyle = style()->svgStyle(); |
| 494 if (!svgStyle.hasStroke()) | 477 if (!svgStyle.hasStroke()) |
| 495 return strokeBoundaries; | 478 return strokeBoundaries; |
| 496 | 479 |
| 497 ASSERT(node()); | 480 ASSERT(node()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 525 SVGResourcesCache::clientWillBeRemovedFromTree(child); | 508 SVGResourcesCache::clientWillBeRemovedFromTree(child); |
| 526 | 509 |
| 527 Vector<SVGTextLayoutAttributes*, 2> affectedAttributes; | 510 Vector<SVGTextLayoutAttributes*, 2> affectedAttributes; |
| 528 FontCachePurgePreventer fontCachePurgePreventer; | 511 FontCachePurgePreventer fontCachePurgePreventer; |
| 529 subtreeChildWillBeRemoved(child, affectedAttributes); | 512 subtreeChildWillBeRemoved(child, affectedAttributes); |
| 530 RenderSVGBlock::removeChild(child); | 513 RenderSVGBlock::removeChild(child); |
| 531 subtreeChildWasRemoved(affectedAttributes); | 514 subtreeChildWasRemoved(affectedAttributes); |
| 532 } | 515 } |
| 533 | 516 |
| 534 } | 517 } |
| OLD | NEW |