Title: [163248] trunk/Source/WebCore
- Revision
- 163248
- Author
- [email protected]
- Date
- 2014-02-01 12:37:15 -0800 (Sat, 01 Feb 2014)
Log Message
SVGTextLayoutAttributesBuilder shouldn't use RenderText::deprecatedCharacters()
https://bugs.webkit.org/show_bug.cgi?id=128048
Reviewed by Sam Weinig.
Change UChar*& lastCharacter to bool& lastCharacterWasSpace since that's what the parameter was used for.
* rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
(WebCore::SVGTextLayoutAttributesBuilder::buildLayoutAttributesForTextRenderer):
Initialize lastCharacterWasSpace to true to match the previous behavior.
(WebCore::SVGTextLayoutAttributesBuilder::buildLayoutAttributesForForSubtree):
Ditto.
(WebCore::processRenderSVGInlineText):
Take a reference instead of a pointer, get the character using RenderText::operator[] and compute lastCharacterWasSpace.
(WebCore::SVGTextLayoutAttributesBuilder::collectTextPositioningElements):
This now takes a bool reference instead.
* rendering/svg/SVGTextLayoutAttributesBuilder.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (163247 => 163248)
--- trunk/Source/WebCore/ChangeLog 2014-02-01 20:29:23 UTC (rev 163247)
+++ trunk/Source/WebCore/ChangeLog 2014-02-01 20:37:15 UTC (rev 163248)
@@ -1,3 +1,27 @@
+2014-02-01 Anders Carlsson <[email protected]>
+
+ SVGTextLayoutAttributesBuilder shouldn't use RenderText::deprecatedCharacters()
+ https://bugs.webkit.org/show_bug.cgi?id=128048
+
+ Reviewed by Sam Weinig.
+
+ Change UChar*& lastCharacter to bool& lastCharacterWasSpace since that's what the parameter was used for.
+
+ * rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
+ (WebCore::SVGTextLayoutAttributesBuilder::buildLayoutAttributesForTextRenderer):
+ Initialize lastCharacterWasSpace to true to match the previous behavior.
+
+ (WebCore::SVGTextLayoutAttributesBuilder::buildLayoutAttributesForForSubtree):
+ Ditto.
+
+ (WebCore::processRenderSVGInlineText):
+ Take a reference instead of a pointer, get the character using RenderText::operator[] and compute lastCharacterWasSpace.
+
+ (WebCore::SVGTextLayoutAttributesBuilder::collectTextPositioningElements):
+ This now takes a bool reference instead.
+
+ * rendering/svg/SVGTextLayoutAttributesBuilder.h:
+
2014-02-01 Brady Eidson <[email protected]>
IDB: Index cursor complete advance() and iterate() support
Modified: trunk/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp (163247 => 163248)
--- trunk/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp 2014-02-01 20:29:23 UTC (rev 163247)
+++ trunk/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp 2014-02-01 20:37:15 UTC (rev 163248)
@@ -43,8 +43,8 @@
m_characterDataMap.clear();
m_textLength = 0;
- const UChar* lastCharacter = 0;
- collectTextPositioningElements(textRoot, lastCharacter);
+ bool lastCharacterWasSpace = true;
+ collectTextPositioningElements(textRoot, lastCharacterWasSpace);
if (!m_textLength)
return;
@@ -63,8 +63,8 @@
if (m_textPositions.isEmpty()) {
m_textLength = 0;
- const UChar* lastCharacter = 0;
- collectTextPositioningElements(textRoot, lastCharacter);
+ bool lastCharacterWasSpace = true;
+ collectTextPositioningElements(textRoot, lastCharacterWasSpace);
}
if (!m_textLength)
@@ -81,32 +81,30 @@
m_metricsBuilder.measureTextRenderer(text);
}
-static inline void processRenderSVGInlineText(RenderSVGInlineText* text, unsigned& atCharacter, const UChar*& lastCharacter)
+static inline void processRenderSVGInlineText(const RenderSVGInlineText& text, unsigned& atCharacter, bool& lastCharacterWasSpace)
{
- if (text->style().whiteSpace() == PRE) {
- atCharacter += text->textLength();
+ if (text.style().whiteSpace() == PRE) {
+ atCharacter += text.textLength();
return;
}
- const UChar* characters = text->deprecatedCharacters();
- unsigned textLength = text->textLength();
- for (unsigned textPosition = 0; textPosition < textLength; ++textPosition) {
- const UChar* currentCharacter = characters + textPosition;
- if (*currentCharacter == ' ' && (!lastCharacter || *lastCharacter == ' '))
+ for (unsigned textPosition = 0, textLength = text.textLength(); textPosition < textLength; ++textPosition) {
+ const UChar currentCharacter = text[textPosition];
+ if (currentCharacter == ' ' && lastCharacterWasSpace)
continue;
- lastCharacter = currentCharacter;
+ lastCharacterWasSpace = currentCharacter == ' ';
++atCharacter;
}
}
-void SVGTextLayoutAttributesBuilder::collectTextPositioningElements(RenderObject* start, const UChar*& lastCharacter)
+void SVGTextLayoutAttributesBuilder::collectTextPositioningElements(RenderObject* start, bool& lastCharacterWasSpace)
{
ASSERT(!start->isSVGText() || m_textPositions.isEmpty());
for (RenderObject* child = start->firstChildSlow(); child; child = child->nextSibling()) {
if (child->isSVGInlineText()) {
- processRenderSVGInlineText(toRenderSVGInlineText(child), m_textLength, lastCharacter);
+ processRenderSVGInlineText(*toRenderSVGInlineText(child), m_textLength, lastCharacterWasSpace);
continue;
}
@@ -118,7 +116,7 @@
if (element)
m_textPositions.append(TextPosition(element, m_textLength));
- collectTextPositioningElements(child, lastCharacter);
+ collectTextPositioningElements(child, lastCharacterWasSpace);
if (!element)
continue;
Modified: trunk/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.h (163247 => 163248)
--- trunk/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.h 2014-02-01 20:29:23 UTC (rev 163247)
+++ trunk/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.h 2014-02-01 20:37:15 UTC (rev 163248)
@@ -66,7 +66,7 @@
};
void buildCharacterDataMap(RenderSVGText*);
- void collectTextPositioningElements(RenderObject*, const UChar*& lastCharacter);
+ void collectTextPositioningElements(RenderObject*, bool& lastCharacterWasSpace);
void fillCharacterDataMap(const TextPosition&);
private:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes