Reduce 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.)

Review URL: https://codereview.chromium.org/183203003

git-svn-id: svn://svn.chromium.org/blink/trunk@168342 bbb929c8-8fbe-4397-9dbb-9b2b20218538
2 files changed
tree: 259fa02b5a6f65813eb84f7bf705aa895fc5cdca
  1. third_party/