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

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

Issue 2802723002: Rename duplicate symbols inside core/dom (Closed)
Patch Set: Created 3 years, 8 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) 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/CharacterNames.h"
259 #include "wtf/text/StringBuffer.h" 259 #include "wtf/text/StringBuffer.h"
260 #include "wtf/text/TextEncodingRegistry.h" 260 #include "wtf/text/TextEncodingRegistry.h"
261 261
262 #include <memory> 262 #include <memory>
263 263
264 using namespace WTF;
265 using namespace Unicode;
266
267 #ifndef NDEBUG 264 #ifndef NDEBUG
268 using WeakDocumentSet = 265 using WeakDocumentSet =
269 blink::PersistentHeapHashSet<blink::WeakMember<blink::Document>>; 266 blink::PersistentHeapHashSet<blink::WeakMember<blink::Document>>;
270 static WeakDocumentSet& liveDocumentSet(); 267 static WeakDocumentSet& liveDocumentSet();
271 #endif 268 #endif
272 269
273 namespace blink { 270 namespace blink {
274 271
275 using namespace HTMLNames; 272 using namespace HTMLNames;
276 273
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 static inline bool isValidNameStart(UChar32 c) { 307 static inline bool isValidNameStart(UChar32 c) {
311 // rule (e) above 308 // rule (e) above
312 if ((c >= 0x02BB && c <= 0x02C1) || c == 0x559 || c == 0x6E5 || c == 0x6E6) 309 if ((c >= 0x02BB && c <= 0x02C1) || c == 0x559 || c == 0x6E5 || c == 0x6E6)
313 return true; 310 return true;
314 311
315 // rule (i) above 312 // rule (i) above
316 if (c == ':' || c == '_') 313 if (c == ':' || c == '_')
317 return true; 314 return true;
318 315
319 // rules (a) and (f) above 316 // rules (a) and (f) above
320 const uint32_t nameStartMask = Letter_Lowercase | Letter_Uppercase | 317 const uint32_t nameStartMask =
321 Letter_Other | Letter_Titlecase | 318 WTF::Unicode::Letter_Lowercase | WTF::Unicode::Letter_Uppercase |
322 Number_Letter; 319 WTF::Unicode::Letter_Other | WTF::Unicode::Letter_Titlecase |
323 if (!(Unicode::category(c) & nameStartMask)) 320 WTF::Unicode::Number_Letter;
321 if (!(WTF::Unicode::category(c) & nameStartMask))
324 return false; 322 return false;
325 323
326 // rule (c) above 324 // rule (c) above
327 if (c >= 0xF900 && c < 0xFFFE) 325 if (c >= 0xF900 && c < 0xFFFE)
328 return false; 326 return false;
329 327
330 // rule (d) above 328 // rule (d) above
331 CharDecompositionType decompType = decompositionType(c); 329 WTF::Unicode::CharDecompositionType decompType =
332 if (decompType == DecompositionFont || decompType == DecompositionCompat) 330 WTF::Unicode::decompositionType(c);
331 if (decompType == WTF::Unicode::DecompositionFont ||
332 decompType == WTF::Unicode::DecompositionCompat)
333 return false; 333 return false;
334 334
335 return true; 335 return true;
336 } 336 }
337 337
338 static inline bool isValidNamePart(UChar32 c) { 338 static inline bool isValidNamePart(UChar32 c) {
339 // rules (a), (e), and (i) above 339 // rules (a), (e), and (i) above
340 if (isValidNameStart(c)) 340 if (isValidNameStart(c))
341 return true; 341 return true;
342 342
343 // rules (g) and (h) above 343 // rules (g) and (h) above
344 if (c == 0x00B7 || c == 0x0387) 344 if (c == 0x00B7 || c == 0x0387)
345 return true; 345 return true;
346 346
347 // rule (j) above 347 // rule (j) above
348 if (c == '-' || c == '.') 348 if (c == '-' || c == '.')
349 return true; 349 return true;
350 350
351 // rules (b) and (f) above 351 // rules (b) and (f) above
352 const uint32_t otherNamePartMask = Mark_NonSpacing | Mark_Enclosing | 352 const uint32_t otherNamePartMask =
353 Mark_SpacingCombining | Letter_Modifier | 353 WTF::Unicode::Mark_NonSpacing | WTF::Unicode::Mark_Enclosing |
354 Number_DecimalDigit; 354 WTF::Unicode::Mark_SpacingCombining | WTF::Unicode::Letter_Modifier |
355 if (!(Unicode::category(c) & otherNamePartMask)) 355 WTF::Unicode::Number_DecimalDigit;
356 if (!(WTF::Unicode::category(c) & otherNamePartMask))
356 return false; 357 return false;
357 358
358 // rule (c) above 359 // rule (c) above
359 if (c >= 0xF900 && c < 0xFFFE) 360 if (c >= 0xF900 && c < 0xFFFE)
360 return false; 361 return false;
361 362
362 // rule (d) above 363 // rule (d) above
363 CharDecompositionType decompType = decompositionType(c); 364 WTF::Unicode::CharDecompositionType decompType =
364 if (decompType == DecompositionFont || decompType == DecompositionCompat) 365 WTF::Unicode::decompositionType(c);
366 if (decompType == WTF::Unicode::DecompositionFont ||
367 decompType == WTF::Unicode::DecompositionCompat)
365 return false; 368 return false;
366 369
367 return true; 370 return true;
368 } 371 }
369 372
370 static FrameViewBase* frameViewBaseForElement(const Element& focusedElement) { 373 static FrameViewBase* frameViewBaseForElement(const Element& focusedElement) {
371 LayoutObject* layoutObject = focusedElement.layoutObject(); 374 LayoutObject* layoutObject = focusedElement.layoutObject();
372 if (!layoutObject || !layoutObject->isLayoutPart()) 375 if (!layoutObject || !layoutObject->isLayoutPart())
373 return 0; 376 return 0;
374 return toLayoutPart(layoutObject)->frameViewBase(); 377 return toLayoutPart(layoutObject)->frameViewBase();
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 unsigned length = title.length(); 1449 unsigned length = title.length();
1447 unsigned builderIndex = 0; 1450 unsigned builderIndex = 0;
1448 const CharacterType* characters = title.getCharacters<CharacterType>(); 1451 const CharacterType* characters = title.getCharacters<CharacterType>();
1449 1452
1450 StringBuffer<CharacterType> buffer(length); 1453 StringBuffer<CharacterType> buffer(length);
1451 1454
1452 // Replace control characters with spaces and collapse whitespace. 1455 // Replace control characters with spaces and collapse whitespace.
1453 bool pendingWhitespace = false; 1456 bool pendingWhitespace = false;
1454 for (unsigned i = 0; i < length; ++i) { 1457 for (unsigned i = 0; i < length; ++i) {
1455 UChar32 c = characters[i]; 1458 UChar32 c = characters[i];
1456 if ((c <= spaceCharacter && c != lineTabulationCharacter) || 1459 if ((c <= WTF::Unicode::spaceCharacter &&
1457 c == deleteCharacter) { 1460 c != WTF::Unicode::lineTabulationCharacter) ||
1461 c == WTF::Unicode::deleteCharacter) {
1458 if (builderIndex != 0) 1462 if (builderIndex != 0)
1459 pendingWhitespace = true; 1463 pendingWhitespace = true;
1460 } else { 1464 } else {
1461 if (pendingWhitespace) { 1465 if (pendingWhitespace) {
1462 buffer[builderIndex++] = ' '; 1466 buffer[builderIndex++] = ' ';
1463 pendingWhitespace = false; 1467 pendingWhitespace = false;
1464 } 1468 }
1465 buffer[builderIndex++] = c; 1469 buffer[builderIndex++] = c;
1466 } 1470 }
1467 } 1471 }
(...skipping 3547 matching lines...) Expand 10 before | Expand all | Expand 10 after
5015 // portion of the document. There isn't much user-visible content in the 5019 // portion of the document. There isn't much user-visible content in the
5016 // <head>, but there is the <title> element. This function detects that 5020 // <head>, but there is the <title> element. This function detects that
5017 // situation and re-decodes the document's title so that the user doesn't see 5021 // situation and re-decodes the document's title so that the user doesn't see
5018 // an incorrectly decoded title in the title bar. 5022 // an incorrectly decoded title in the title bar.
5019 if (m_titleElement && encoding() != newData.encoding() && 5023 if (m_titleElement && encoding() != newData.encoding() &&
5020 !ElementTraversal::firstWithin(*m_titleElement) && 5024 !ElementTraversal::firstWithin(*m_titleElement) &&
5021 encoding() == Latin1Encoding() && 5025 encoding() == Latin1Encoding() &&
5022 m_titleElement->textContent().containsOnlyLatin1()) { 5026 m_titleElement->textContent().containsOnlyLatin1()) {
5023 CString originalBytes = m_titleElement->textContent().latin1(); 5027 CString originalBytes = m_titleElement->textContent().latin1();
5024 std::unique_ptr<TextCodec> codec = newTextCodec(newData.encoding()); 5028 std::unique_ptr<TextCodec> codec = newTextCodec(newData.encoding());
5025 String correctlyDecodedTitle = 5029 String correctlyDecodedTitle = codec->decode(
5026 codec->decode(originalBytes.data(), originalBytes.length(), DataEOF); 5030 originalBytes.data(), originalBytes.length(), WTF::DataEOF);
5027 m_titleElement->setTextContent(correctlyDecodedTitle); 5031 m_titleElement->setTextContent(correctlyDecodedTitle);
5028 } 5032 }
5029 5033
5030 DCHECK(newData.encoding().isValid()); 5034 DCHECK(newData.encoding().isValid());
5031 m_encodingData = newData; 5035 m_encodingData = newData;
5032 5036
5033 // FIXME: Should be removed as part of 5037 // FIXME: Should be removed as part of
5034 // https://code.google.com/p/chromium/issues/detail?id=319643 5038 // https://code.google.com/p/chromium/issues/detail?id=319643
5035 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering(); 5039 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering();
5036 if (shouldUseVisualOrdering != m_visuallyOrdered) { 5040 if (shouldUseVisualOrdering != m_visuallyOrdered) {
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
6629 } 6633 }
6630 6634
6631 void showLiveDocumentInstances() { 6635 void showLiveDocumentInstances() {
6632 WeakDocumentSet& set = liveDocumentSet(); 6636 WeakDocumentSet& set = liveDocumentSet();
6633 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6637 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6634 for (blink::Document* document : set) 6638 for (blink::Document* document : set)
6635 fprintf(stderr, "- Document %p URL: %s\n", document, 6639 fprintf(stderr, "- Document %p URL: %s\n", document,
6636 document->url().getString().utf8().data()); 6640 document->url().getString().utf8().data());
6637 } 6641 }
6638 #endif 6642 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp ('k') | third_party/WebKit/Source/core/dom/DocumentParserTiming.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698