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

Unified Diff: Source/core/css/parser/BisonCSSParser-in.cpp

Issue 213743018: Fix for CSS identifier related assert (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added explanation in a comment. Created 6 years, 9 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/core/css/parser/BisonCSSParser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « Source/core/css/parser/BisonCSSParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698