Chromium Code Reviews| Index: Source/core/css/parser/BisonCSSParser-in.cpp |
| diff --git a/Source/core/css/parser/BisonCSSParser-in.cpp b/Source/core/css/parser/BisonCSSParser-in.cpp |
| index beddcb89d944af671876e7e29c0902d59a06647a..bfe675e25f08150b72a2a8ff3e87fec1eb87f0dd 100644 |
| --- a/Source/core/css/parser/BisonCSSParser-in.cpp |
| +++ b/Source/core/css/parser/BisonCSSParser-in.cpp |
| @@ -1783,15 +1783,16 @@ ALWAYS_INLINE static void makeLower(const CharacterType* input, CharacterType* o |
| } |
| } |
| -void BisonCSSParser::tokenToLowerCase(const CSSParserString& token) |
| +void BisonCSSParser::tokenToLowerCase(CSSParserString& token) |
| { |
| + // Since it's our internal token, we know that we created it out |
| + // of our writable work buffers. Therefore the const_cast is just |
| + // ugly and not a potential crash. |
| size_t length = token.length(); |
| - if (m_tokenizer.is8BitSource()) { |
| - size_t offset = token.characters8() - m_tokenizer.m_dataStart8.get(); |
| - makeLower(token.characters8(), m_tokenizer.m_dataStart8.get() + offset, length); |
| + if (token.is8Bit()) { |
|
eseidel
2014/04/04 06:54:30
when is the token bits different from the source?
eseidel
2014/04/04 06:55:21
i see, only for escape chars.
|
| + makeLower(token.characters8(), const_cast<LChar*>(token.characters8()), length); |
| } else { |
| - size_t offset = token.characters16() - m_tokenizer.m_dataStart16.get(); |
| - makeLower(token.characters16(), m_tokenizer.m_dataStart16.get() + offset, length); |
| + makeLower(token.characters16(), const_cast<UChar*>(token.characters16()), length); |
| } |
| } |