summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/svg/SVGTextChunk.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/svg/SVGTextChunk.h')
-rw-r--r--Source/WebCore/rendering/svg/SVGTextChunk.h32
1 files changed, 17 insertions, 15 deletions
diff --git a/Source/WebCore/rendering/svg/SVGTextChunk.h b/Source/WebCore/rendering/svg/SVGTextChunk.h
index 9618d9fb6..f000f26da 100644
--- a/Source/WebCore/rendering/svg/SVGTextChunk.h
+++ b/Source/WebCore/rendering/svg/SVGTextChunk.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -17,10 +18,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef SVGTextChunk_h
-#define SVGTextChunk_h
+#pragma once
-#if ENABLE(SVG)
#include "SVGRenderStyleDefs.h"
#include "SVGTextContentElement.h"
@@ -41,31 +40,34 @@ public:
LengthAdjustSpacingAndGlyphs = 1 << 6
};
- SVGTextChunk(unsigned chunkStyle, float desiredTextLength);
+ SVGTextChunk(const Vector<SVGInlineTextBox*>&, unsigned first, unsigned limit);
- void calculateLength(float& length, unsigned& characters) const;
- float calculateTextAnchorShift(float length) const;
+ unsigned totalCharacters() const;
+ float totalLength() const;
+ float totalAnchorShift() const;
+ void layout(HashMap<SVGInlineTextBox*, AffineTransform>&) const;
+
+private:
+ void processTextAnchorCorrection() const;
+ void buildBoxTransformations(HashMap<SVGInlineTextBox*, AffineTransform>&) const;
+ void processTextLengthSpacingCorrection() const;
bool isVerticalText() const { return m_chunkStyle & VerticalText; }
float desiredTextLength() const { return m_desiredTextLength; }
- Vector<SVGInlineTextBox*>& boxes() { return m_boxes; }
- const Vector<SVGInlineTextBox*>& boxes() const { return m_boxes; }
-
bool hasDesiredTextLength() const { return m_desiredTextLength > 0 && ((m_chunkStyle & LengthAdjustSpacing) || (m_chunkStyle & LengthAdjustSpacingAndGlyphs)); }
- bool hasTextAnchor() const { return m_chunkStyle & RightToLeftText ? !(m_chunkStyle & EndAnchor) : (m_chunkStyle & MiddleAnchor) || (m_chunkStyle & EndAnchor); }
+ bool hasTextAnchor() const { return m_chunkStyle & RightToLeftText ? !(m_chunkStyle & EndAnchor) : (m_chunkStyle & (MiddleAnchor | EndAnchor)); }
bool hasLengthAdjustSpacing() const { return m_chunkStyle & LengthAdjustSpacing; }
bool hasLengthAdjustSpacingAndGlyphs() const { return m_chunkStyle & LengthAdjustSpacingAndGlyphs; }
+ bool boxSpacingAndGlyphsTransform(const SVGInlineTextBox*, AffineTransform&) const;
+
private:
// Contains all SVGInlineTextBoxes this chunk spans.
Vector<SVGInlineTextBox*> m_boxes;
- unsigned m_chunkStyle;
- float m_desiredTextLength;
+ unsigned m_chunkStyle { DefaultStyle };
+ float m_desiredTextLength { 0 };
};
} // namespace WebCore
-
-#endif // ENABLE(SVG)
-#endif