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

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: fix dom test case 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 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 unsigned length = title.length(); 1307 unsigned length = title.length();
1308 unsigned builderIndex = 0; 1308 unsigned builderIndex = 0;
1309 const CharacterType* characters = title.getCharacters<CharacterType>(); 1309 const CharacterType* characters = title.getCharacters<CharacterType>();
1310 1310
1311 StringBuffer<CharacterType> buffer(length); 1311 StringBuffer<CharacterType> buffer(length);
1312 1312
1313 // Replace control characters with spaces and collapse whitespace. 1313 // Replace control characters with spaces and collapse whitespace.
1314 bool pendingWhitespace = false; 1314 bool pendingWhitespace = false;
1315 for (unsigned i = 0; i < length; ++i) { 1315 for (unsigned i = 0; i < length; ++i) {
1316 UChar32 c = characters[i]; 1316 UChar32 c = characters[i];
1317 if (c <= 0x20 || c == 0x7F || 1317 if ((c <= 0x20 && c != 0x0b) || c == 0x7F) {
skobes 2016/11/03 14:31:41 Can you use named constants for these instead of m
1318 (WTF::Unicode::category(c) &
1319 (WTF::Unicode::Separator_Line | WTF::Unicode::Separator_Paragraph))) {
1320 if (builderIndex != 0) 1318 if (builderIndex != 0)
1321 pendingWhitespace = true; 1319 pendingWhitespace = true;
1322 } else { 1320 } else {
1323 if (pendingWhitespace) { 1321 if (pendingWhitespace) {
1324 buffer[builderIndex++] = ' '; 1322 buffer[builderIndex++] = ' ';
1325 pendingWhitespace = false; 1323 pendingWhitespace = false;
1326 } 1324 }
1327 buffer[builderIndex++] = c; 1325 buffer[builderIndex++] = c;
1328 } 1326 }
1329 } 1327 }
(...skipping 5132 matching lines...) Expand 10 before | Expand all | Expand 10 after
6462 } 6460 }
6463 6461
6464 void showLiveDocumentInstances() { 6462 void showLiveDocumentInstances() {
6465 WeakDocumentSet& set = liveDocumentSet(); 6463 WeakDocumentSet& set = liveDocumentSet();
6466 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6464 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6467 for (Document* document : set) 6465 for (Document* document : set)
6468 fprintf(stderr, "- Document %p URL: %s\n", document, 6466 fprintf(stderr, "- Document %p URL: %s\n", document,
6469 document->url().getString().utf8().data()); 6467 document->url().getString().utf8().data());
6470 } 6468 }
6471 #endif 6469 #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