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

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

Issue 2476293003: Move named constant to CharacterNames.h (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/text/CharacterNames.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) 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 #include "public/platform/WebFrameScheduler.h" 248 #include "public/platform/WebFrameScheduler.h"
249 #include "public/platform/WebPrerenderingSupport.h" 249 #include "public/platform/WebPrerenderingSupport.h"
250 #include "public/platform/WebScheduler.h" 250 #include "public/platform/WebScheduler.h"
251 #include "wtf/AutoReset.h" 251 #include "wtf/AutoReset.h"
252 #include "wtf/CurrentTime.h" 252 #include "wtf/CurrentTime.h"
253 #include "wtf/DateMath.h" 253 #include "wtf/DateMath.h"
254 #include "wtf/Functional.h" 254 #include "wtf/Functional.h"
255 #include "wtf/HashFunctions.h" 255 #include "wtf/HashFunctions.h"
256 #include "wtf/PtrUtil.h" 256 #include "wtf/PtrUtil.h"
257 #include "wtf/StdLibExtras.h" 257 #include "wtf/StdLibExtras.h"
258 #include "wtf/text/CharacterNames.h"
258 #include "wtf/text/StringBuffer.h" 259 #include "wtf/text/StringBuffer.h"
259 #include "wtf/text/TextEncodingRegistry.h" 260 #include "wtf/text/TextEncodingRegistry.h"
260 #include <memory> 261 #include <memory>
261 262
262 using namespace WTF; 263 using namespace WTF;
263 using namespace Unicode; 264 using namespace Unicode;
264 265
265 #ifndef NDEBUG 266 #ifndef NDEBUG
266 using WeakDocumentSet = 267 using WeakDocumentSet =
267 blink::PersistentHeapHashSet<blink::WeakMember<blink::Document>>; 268 blink::PersistentHeapHashSet<blink::WeakMember<blink::Document>>;
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 static inline String canonicalizedTitle(Document* document, 1308 static inline String canonicalizedTitle(Document* document,
1308 const String& title) { 1309 const String& title) {
1309 unsigned length = title.length(); 1310 unsigned length = title.length();
1310 unsigned builderIndex = 0; 1311 unsigned builderIndex = 0;
1311 const CharacterType* characters = title.getCharacters<CharacterType>(); 1312 const CharacterType* characters = title.getCharacters<CharacterType>();
1312 1313
1313 StringBuffer<CharacterType> buffer(length); 1314 StringBuffer<CharacterType> buffer(length);
1314 1315
1315 // Replace control characters with spaces and collapse whitespace. 1316 // Replace control characters with spaces and collapse whitespace.
1316 bool pendingWhitespace = false; 1317 bool pendingWhitespace = false;
1317 const UChar lineTabulationCharacter = 0x0b;
1318 const UChar spaceCharacter = 0x20;
1319 const UChar deleteCharacter = 0x7f;
1320 for (unsigned i = 0; i < length; ++i) { 1318 for (unsigned i = 0; i < length; ++i) {
1321 UChar32 c = characters[i]; 1319 UChar32 c = characters[i];
1322 if ((c <= spaceCharacter && c != lineTabulationCharacter) || 1320 if ((c <= spaceCharacter && c != lineTabulationCharacter) ||
1323 c == deleteCharacter) { 1321 c == deleteCharacter) {
1324 if (builderIndex != 0) 1322 if (builderIndex != 0)
1325 pendingWhitespace = true; 1323 pendingWhitespace = true;
1326 } else { 1324 } else {
1327 if (pendingWhitespace) { 1325 if (pendingWhitespace) {
1328 buffer[builderIndex++] = ' '; 1326 buffer[builderIndex++] = ' ';
1329 pendingWhitespace = false; 1327 pendingWhitespace = false;
(...skipping 5154 matching lines...) Expand 10 before | Expand all | Expand 10 after
6484 } 6482 }
6485 6483
6486 void showLiveDocumentInstances() { 6484 void showLiveDocumentInstances() {
6487 WeakDocumentSet& set = liveDocumentSet(); 6485 WeakDocumentSet& set = liveDocumentSet();
6488 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6486 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6489 for (Document* document : set) 6487 for (Document* document : set)
6490 fprintf(stderr, "- Document %p URL: %s\n", document, 6488 fprintf(stderr, "- Document %p URL: %s\n", document,
6491 document->url().getString().utf8().data()); 6489 document->url().getString().utf8().data());
6492 } 6490 }
6493 #endif 6491 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/text/CharacterNames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698