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

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: add a unit test Created 4 years, 7 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
« no previous file with comments | « chrome/test/data/save_page/1.css ('k') | third_party/WebKit/Source/wtf/text/TextCodec.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 continue; 476 continue;
477 } 477 }
478 emitsMinus = ch == '-'; 478 emitsMinus = ch == '-';
479 builder.append(ch); 479 builder.append(ch);
480 } 480 }
481 CString escapedUrl = builder.toString().ascii(); 481 CString escapedUrl = builder.toString().ascii();
482 return String::format("saved from url=(%04d)%s", static_cast<int>(escapedUrl .length()), escapedUrl.data()); 482 return String::format("saved from url=(%04d)%s", static_cast<int>(escapedUrl .length()), escapedUrl.data());
483 } 483 }
484 484
485 } // namespace blink 485 } // namespace blink
OLDNEW
« no previous file with comments | « chrome/test/data/save_page/1.css ('k') | third_party/WebKit/Source/wtf/text/TextCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698