18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/* 28e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Copyright (C) 2006 Apple Computer, Inc. 3a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 4a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * Copyright (C) Research In Motion Limited 2010. All rights reserved. 58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This library is free software; you can redistribute it and/or 78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modify it under the terms of the GNU Library General Public 88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * License as published by the Free Software Foundation; either 98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * version 2 of the License, or (at your option) any later version. 108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This library is distributed in the hope that it will be useful, 128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * but WITHOUT ANY WARRANTY; without even the implied warranty of 138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Library General Public License for more details. 158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * You should have received a copy of the GNU Library General Public License 178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * along with this library; see the file COPYING.LIB. If not, write to 188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Boston, MA 02110-1301, USA. 208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#ifndef RenderSVGText_h 238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define RenderSVGText_h 248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#if ENABLE(SVG) 268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 278a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block#include "AffineTransform.h" 288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "RenderSVGBlock.h" 292bde8e466a4451c7319e3a072d118917957d6554Steve Block#include "SVGTextLayoutAttributes.h" 308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectnamespace WebCore { 328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass SVGTextElement; 348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass RenderSVGText : public RenderSVGBlock { 368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectpublic: 372bde8e466a4451c7319e3a072d118917957d6554Steve Block RenderSVGText(SVGTextElement*); 388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 392daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch virtual bool isChildAllowed(RenderObject*, RenderStyle*) const; 402daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 41a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch void setNeedsPositioningValuesUpdate() { m_needsPositioningValuesUpdate = true; } 42dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; } 4306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen virtual FloatRect repaintRectInLocalCoordinates() const; 44dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 45a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch static RenderSVGText* locateRenderSVGTextAncestor(RenderObject*); 46a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch static const RenderSVGText* locateRenderSVGTextAncestor(const RenderObject*); 47a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 482bde8e466a4451c7319e3a072d118917957d6554Steve Block Vector<SVGTextLayoutAttributes>& layoutAttributes() { return m_layoutAttributes; } 492bde8e466a4451c7319e3a072d118917957d6554Steve Block bool needsReordering() const { return m_needsReordering; } 502bde8e466a4451c7319e3a072d118917957d6554Steve Block 510bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochprivate: 528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual const char* renderName() const { return "RenderSVGText"; } 538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual bool isSVGText() const { return true; } 545f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian 558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual void paint(PaintInfo&, int tx, int ty); 568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); 575f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction); 58a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch virtual VisiblePosition positionForPoint(const IntPoint&); 595f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian 60635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual bool requiresLayer() const { return false; } 618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual void layout(); 625f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian 635f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian virtual void absoluteQuads(Vector<FloatQuad>&); 64635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 658f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); 665f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false); 675f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian 685f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const; 695f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian 7006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen virtual FloatRect objectBoundingBox() const { return frameRect(); } 71d0825bca7fe65beaee391d30da42e937db621564Steve Block virtual FloatRect strokeBoundingBox() const; 725f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian 7306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen virtual const AffineTransform& localToParentTransform() const { return m_localTransform; } 748a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block virtual AffineTransform localTransform() const { return m_localTransform; } 750bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch virtual RootInlineBox* createRootInlineBox(); 768f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 77545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch virtual RenderBlock* firstLineBlock() const; 78545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch virtual void updateFirstLetter(); 79545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch 802bde8e466a4451c7319e3a072d118917957d6554Steve Block bool m_needsReordering : 1; 81a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch bool m_needsPositioningValuesUpdate : 1; 82dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block bool m_needsTransformUpdate : 1; 838a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block AffineTransform m_localTransform; 842bde8e466a4451c7319e3a072d118917957d6554Steve Block Vector<SVGTextLayoutAttributes> m_layoutAttributes; 858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}; 868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 87a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline RenderSVGText* toRenderSVGText(RenderObject* object) 88a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 89a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch ASSERT(!object || object->isSVGText()); 90a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return static_cast<RenderSVGText*>(object); 91a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 92a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 93a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline const RenderSVGText* toRenderSVGText(const RenderObject* object) 94a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 95a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch ASSERT(!object || object->isSVGText()); 96a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return static_cast<const RenderSVGText*>(object); 97a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 98a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 99a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch// This will catch anyone doing an unnecessary cast. 100a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochvoid toRenderSVGText(const RenderSVGText*); 101a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 1028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 1038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif // ENABLE(SVG) 1058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif 106