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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameSerializer.cpp

Issue 1709293002: Add support for CSS unicod encoding to the text codec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 322 }
323 323
324 // Some rules have resources associated with them that we need to retrie ve. 324 // Some rules have resources associated with them that we need to retrie ve.
325 serializeCSSRule(rule); 325 serializeCSSRule(rule);
326 } 326 }
327 327
328 if (shouldAddURL(url)) { 328 if (shouldAddURL(url)) {
329 WTF::TextEncoding textEncoding(styleSheet.contents()->charset()); 329 WTF::TextEncoding textEncoding(styleSheet.contents()->charset());
330 ASSERT(textEncoding.isValid()); 330 ASSERT(textEncoding.isValid());
331 String textString = cssText.toString(); 331 String textString = cssText.toString();
332 CString text = textEncoding.encode(textString, WTF::EntitiesForUnencodab les); 332 CString text = textEncoding.encode(textString, WTF::CSSEncodedEntitiesFo rUnencodables);
333 m_resources->append(SerializedResource(url, String("text/css"), SharedBu ffer::create(text.data(), text.length()))); 333 m_resources->append(SerializedResource(url, String("text/css"), SharedBu ffer::create(text.data(), text.length())));
334 m_resourceURLs.add(url); 334 m_resourceURLs.add(url);
335 } 335 }
336 } 336 }
337 337
338 void FrameSerializer::serializeCSSRule(CSSRule* rule) 338 void FrameSerializer::serializeCSSRule(CSSRule* rule)
339 { 339 {
340 ASSERT(rule->parentStyleSheet()->ownerDocument()); 340 ASSERT(rule->parentStyleSheet()->ownerDocument());
341 Document& document = *rule->parentStyleSheet()->ownerDocument(); 341 Document& document = *rule->parentStyleSheet()->ownerDocument();
342 342
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 continue; 479 continue;
480 } 480 }
481 emitsMinus = ch == '-'; 481 emitsMinus = ch == '-';
482 builder.append(ch); 482 builder.append(ch);
483 } 483 }
484 CString escapedUrl = builder.toString().ascii(); 484 CString escapedUrl = builder.toString().ascii();
485 return String::format("saved from url=(%04d)%s", static_cast<int>(escapedUrl .length()), escapedUrl.data()); 485 return String::format("saved from url=(%04d)%s", static_cast<int>(escapedUrl .length()), escapedUrl.data());
486 } 486 }
487 487
488 } // namespace blink 488 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/text/TextCodec.h » ('j') | third_party/WebKit/Source/wtf/text/TextCodecICU.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698