DescriptionReduce state kept in MeasureTextData by SVGTextMetricsBuilder
MeasureTextData::processRenderer is only used within
SVGTextMetricsBuilder::measureTextRenderer, and is always set before a
call to that method. This makes a good candidate for removal from the
traversal state struct (MeasureTextData) and being passed as an argument
to measureTextRenderer instead.
There's no need to track both the last character and whether there was
a previous character. It's sufficient to track if the the last character
was a whitespace or not. (The initial case which previously had
hasLastCharacter == false can be represented as having a been a whitespace
character.) This allows replacing the two fields hasLastCharacter and
lastCharacter with a single field lastCharacterWasWhiteSpace.
MeasureTextData::skippedCharacters is reset to zero (0) at the end of
SVGTextMetricsBuilder::measureTextRenderer, and is only read or written
if MeasureTextData::allCharactersMap is non-null.
This means it can be kept on the stack of measureTextRenderer instead.
Also change the type of surrogatePairCharacters from int to unsigned,
since it's a simple counter, that should never be negative (and is used
in arithmetic with unsigned typed variables.)
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=168342
Patch Set 1 #
Messages
Total messages: 10 (0 generated)
|