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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2469983007: Fix document title with LINE SEPARATOR/PARAGRAPH SEPARATOR/LINE TABULATION (Closed)
Patch Set: upload with --similarity=100 --no-find-copies Created 4 years, 1 month 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 static inline String canonicalizedTitle(Document* document, 1306 static inline String canonicalizedTitle(Document* document,
1307 const String& title) { 1307 const String& title) {
1308 unsigned length = title.length(); 1308 unsigned length = title.length();
1309 unsigned builderIndex = 0; 1309 unsigned builderIndex = 0;
1310 const CharacterType* characters = title.getCharacters<CharacterType>(); 1310 const CharacterType* characters = title.getCharacters<CharacterType>();
1311 1311
1312 StringBuffer<CharacterType> buffer(length); 1312 StringBuffer<CharacterType> buffer(length);
1313 1313
1314 // Replace control characters with spaces and collapse whitespace. 1314 // Replace control characters with spaces and collapse whitespace.
1315 bool pendingWhitespace = false; 1315 bool pendingWhitespace = false;
1316 const UChar lineTabulationCharacter = 0x0b;
tkent 2016/11/08 03:57:15 Please use symbols defined in wtf/text/CharacterNa
1317 const UChar spaceCharacter = 0x20;
1318 const UChar deleteCharacter = 0x7f;
1316 for (unsigned i = 0; i < length; ++i) { 1319 for (unsigned i = 0; i < length; ++i) {
1317 UChar32 c = characters[i]; 1320 UChar32 c = characters[i];
1318 if (c <= 0x20 || c == 0x7F || 1321 if ((c <= spaceCharacter && c != lineTabulationCharacter) ||
1319 (WTF::Unicode::category(c) & 1322 c == deleteCharacter) {
1320 (WTF::Unicode::Separator_Line | WTF::Unicode::Separator_Paragraph))) {
1321 if (builderIndex != 0) 1323 if (builderIndex != 0)
1322 pendingWhitespace = true; 1324 pendingWhitespace = true;
1323 } else { 1325 } else {
1324 if (pendingWhitespace) { 1326 if (pendingWhitespace) {
1325 buffer[builderIndex++] = ' '; 1327 buffer[builderIndex++] = ' ';
1326 pendingWhitespace = false; 1328 pendingWhitespace = false;
1327 } 1329 }
1328 buffer[builderIndex++] = c; 1330 buffer[builderIndex++] = c;
1329 } 1331 }
1330 } 1332 }
(...skipping 5147 matching lines...) Expand 10 before | Expand all | Expand 10 after
6478 } 6480 }
6479 6481
6480 void showLiveDocumentInstances() { 6482 void showLiveDocumentInstances() {
6481 WeakDocumentSet& set = liveDocumentSet(); 6483 WeakDocumentSet& set = liveDocumentSet();
6482 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6484 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6483 for (Document* document : set) 6485 for (Document* document : set)
6484 fprintf(stderr, "- Document %p URL: %s\n", document, 6486 fprintf(stderr, "- Document %p URL: %s\n", document,
6485 document->url().getString().utf8().data()); 6487 document->url().getString().utf8().data());
6486 } 6488 }
6487 #endif 6489 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/imported/wpt/html/dom/documents/dom-tree-accessors/document.title-05-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698