Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp

Issue 10443073: Merge 117225 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.h ('k') | Source/WebCore/svg/SVGAElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp
===================================================================
--- Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp (revision 118874)
+++ Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp (working copy)
@@ -26,9 +26,6 @@
#include "RenderSVGText.h"
#include "SVGTextPositioningElement.h"
-// Set to a value > 0 to dump the text layout attributes
-#define DUMP_TEXT_LAYOUT_ATTRIBUTES 0
-
namespace WebCore {
SVGTextLayoutAttributesBuilder::SVGTextLayoutAttributesBuilder()
@@ -44,56 +41,48 @@
if (!textRoot)
return;
- if (!buildLayoutAttributesIfNeeded(textRoot))
- return;
+ if (m_textPositions.isEmpty()) {
+ m_characterDataMap.clear();
- m_metricsBuilder.buildMetricsAndLayoutAttributes(textRoot, text, m_characterDataMap);
-}
+ m_textLength = 0;
+ const UChar* lastCharacter = 0;
+ collectTextPositioningElements(textRoot, lastCharacter);
-void SVGTextLayoutAttributesBuilder::buildLayoutAttributesForWholeTree(RenderSVGText* textRoot)
-{
- ASSERT(textRoot);
+ if (!m_textLength)
+ return;
- if (!buildLayoutAttributesIfNeeded(textRoot))
- return;
+ buildCharacterDataMap(textRoot);
+ }
- m_metricsBuilder.buildMetricsAndLayoutAttributes(textRoot, 0, m_characterDataMap);
+ m_metricsBuilder.buildMetricsAndLayoutAttributes(textRoot, text, m_characterDataMap);
}
-void SVGTextLayoutAttributesBuilder::rebuildMetricsForTextRenderer(RenderSVGInlineText* text)
+bool SVGTextLayoutAttributesBuilder::buildLayoutAttributesForForSubtree(RenderSVGText* textRoot)
{
- ASSERT(text);
- m_metricsBuilder.measureTextRenderer(text);
-}
-
-void SVGTextLayoutAttributesBuilder::rebuildMetricsForWholeTree(RenderSVGText* textRoot)
-{
ASSERT(textRoot);
- Vector<SVGTextLayoutAttributes*>& layoutAttributes = textRoot->layoutAttributes();
- size_t layoutAttributesSize = layoutAttributes.size();
- for (size_t i = 0; i < layoutAttributesSize; ++i)
- m_metricsBuilder.measureTextRenderer(layoutAttributes[i]->context());
-}
+ m_characterDataMap.clear();
-bool SVGTextLayoutAttributesBuilder::buildLayoutAttributesIfNeeded(RenderSVGText* textRoot)
-{
- ASSERT(textRoot);
-
if (m_textPositions.isEmpty()) {
m_textLength = 0;
const UChar* lastCharacter = 0;
collectTextPositioningElements(textRoot, lastCharacter);
}
- m_characterDataMap.clear();
if (!m_textLength)
return false;
- buildLayoutAttributes(textRoot);
+ buildCharacterDataMap(textRoot);
+ m_metricsBuilder.buildMetricsAndLayoutAttributes(textRoot, 0, m_characterDataMap);
return true;
}
+void SVGTextLayoutAttributesBuilder::rebuildMetricsForTextRenderer(RenderSVGInlineText* text)
+{
+ ASSERT(text);
+ m_metricsBuilder.measureTextRenderer(text);
+}
+
static inline void processRenderSVGInlineText(RenderSVGInlineText* text, unsigned& atCharacter, const UChar*& lastCharacter)
{
if (text->style()->whiteSpace() == PRE) {
@@ -143,10 +132,8 @@
}
}
-void SVGTextLayoutAttributesBuilder::buildLayoutAttributes(RenderSVGText* textRoot)
+void SVGTextLayoutAttributesBuilder::buildCharacterDataMap(RenderSVGText* textRoot)
{
- ASSERT(m_textLength);
-
SVGTextPositioningElement* outermostTextElement = SVGTextPositioningElement::elementFromRenderer(textRoot);
ASSERT(outermostTextElement);
@@ -173,11 +160,6 @@
unsigned size = m_textPositions.size();
for (unsigned i = 0; i < size; ++i)
fillCharacterDataMap(m_textPositions[i]);
-
-#if DUMP_TEXT_LAYOUT_ATTRIBUTES > 0
- fprintf(stderr, "\nDumping ALL layout attributes for RenderSVGText, renderer=%p, node=%p (m_textLength: %i)\n", textRoot, textRoot->node(), m_textLength);
- m_characterDataMap.dump();
-#endif
}
static inline void updateCharacterData(unsigned i, float& lastRotation, SVGCharacterData& data, const SVGLengthContext& lengthContext, const SVGLengthList* xList, const SVGLengthList* yList, const SVGLengthList* dxList, const SVGLengthList* dyList, const SVGNumberList* rotateList)
« no previous file with comments | « Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.h ('k') | Source/WebCore/svg/SVGAElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698