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

Side by Side Diff: third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp

Issue 2508743002: Changed EWhiteSpace to an enum class and renamed its members to keywords (Closed)
Patch Set: Small mac fix 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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All
3 * rights reserved. 3 * rights reserved.
4 * Copyright (C) 2005 Alexey Proskuryakov. 4 * Copyright (C) 2005 Alexey Proskuryakov.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 } 706 }
707 DCHECK(!nextTextBox || 707 DCHECK(!nextTextBox ||
708 nextTextBox->getLineLayoutItem().isEqual(layoutObject)); 708 nextTextBox->getLineLayoutItem().isEqual(layoutObject));
709 709
710 if (runStart < runEnd) { 710 if (runStart < runEnd) {
711 // Handle either a single newline character (which becomes a space), 711 // Handle either a single newline character (which becomes a space),
712 // or a run of characters that does not include a newline. 712 // or a run of characters that does not include a newline.
713 // This effectively translates newlines to spaces without copying the 713 // This effectively translates newlines to spaces without copying the
714 // text. 714 // text.
715 if (str[runStart] == '\n') { 715 if (str[runStart] == '\n') {
716 // We need to preserve new lines in case of PRE_LINE. 716 // We need to preserve new lines in case of PreLine.
717 // See bug crbug.com/317365. 717 // See bug crbug.com/317365.
718 if (layoutObject->style()->whiteSpace() == PRE_LINE) 718 if (layoutObject->style()->whiteSpace() == EWhiteSpace::PreLine)
719 spliceBuffer('\n', m_node, 0, runStart, runStart); 719 spliceBuffer('\n', m_node, 0, runStart, runStart);
720 else 720 else
721 spliceBuffer(spaceCharacter, m_node, 0, runStart, runStart + 1); 721 spliceBuffer(spaceCharacter, m_node, 0, runStart, runStart + 1);
722 m_offset = runStart + 1; 722 m_offset = runStart + 1;
723 } else { 723 } else {
724 size_t subrunEnd = str.find('\n', runStart); 724 size_t subrunEnd = str.find('\n', runStart);
725 if (subrunEnd == kNotFound || subrunEnd > runEnd) { 725 if (subrunEnd == kNotFound || subrunEnd > runEnd) {
726 subrunEnd = runEnd; 726 subrunEnd = runEnd;
727 runStart = restoreCollapsedLeadingSpace(runStart); 727 runStart = restoreCollapsedLeadingSpace(runStart);
728 subrunEnd = restoreCollapsedTrailingSpace(nextTextBox, subrunEnd); 728 subrunEnd = restoreCollapsedTrailingSpace(nextTextBox, subrunEnd);
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 String plainText(const EphemeralRangeInFlatTree& range, 1349 String plainText(const EphemeralRangeInFlatTree& range,
1350 TextIteratorBehaviorFlags behavior) { 1350 TextIteratorBehaviorFlags behavior) {
1351 return createPlainText<EditingInFlatTreeStrategy>(range, behavior); 1351 return createPlainText<EditingInFlatTreeStrategy>(range, behavior);
1352 } 1352 }
1353 1353
1354 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>; 1354 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>;
1355 template class CORE_TEMPLATE_EXPORT 1355 template class CORE_TEMPLATE_EXPORT
1356 TextIteratorAlgorithm<EditingInFlatTreeStrategy>; 1356 TextIteratorAlgorithm<EditingInFlatTreeStrategy>;
1357 1357
1358 } // namespace blink 1358 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Text.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698