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

Side by Side Diff: Source/core/editing/CompositeEditCommand.cpp

Issue 23703016: [blink] Use functions for AllMarkers and MisspellingMarkers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 markers.reserveCapacity(arraySize); 498 markers.reserveCapacity(arraySize);
499 for (size_t i = 0; i < arraySize; ++i) 499 for (size_t i = 0; i < arraySize; ++i)
500 markers.append(*markerPointers[i]); 500 markers.append(*markerPointers[i]);
501 } 501 }
502 502
503 void CompositeEditCommand::replaceTextInNodePreservingMarkers(PassRefPtr<Text> p rpNode, unsigned offset, unsigned count, const String& replacementText) 503 void CompositeEditCommand::replaceTextInNodePreservingMarkers(PassRefPtr<Text> p rpNode, unsigned offset, unsigned count, const String& replacementText)
504 { 504 {
505 RefPtr<Text> node(prpNode); 505 RefPtr<Text> node(prpNode);
506 DocumentMarkerController* markerController = document().markers(); 506 DocumentMarkerController* markerController = document().markers();
507 Vector<DocumentMarker> markers; 507 Vector<DocumentMarker> markers;
508 copyMarkers(markerController->markersInRange(Range::create(document(), node. get(), offset, node.get(), offset + count).get(), DocumentMarker::AllMarkers()), markers); 508 copyMarkers(markerController->markersInRange(Range::create(document(), node. get(), offset, node.get(), offset + count).get(), DocumentMarker::allMarkers()), markers);
509 replaceTextInNode(node, offset, count, replacementText); 509 replaceTextInNode(node, offset, count, replacementText);
510 RefPtr<Range> newRange = Range::create(document(), node.get(), offset, node. get(), offset + replacementText.length()); 510 RefPtr<Range> newRange = Range::create(document(), node.get(), offset, node. get(), offset + replacementText.length());
511 for (size_t i = 0; i < markers.size(); ++i) 511 for (size_t i = 0; i < markers.size(); ++i)
512 markerController->addMarker(newRange.get(), markers[i].type(), markers[i ].description()); 512 markerController->addMarker(newRange.get(), markers[i].type(), markers[i ].description());
513 } 513 }
514 514
515 Position CompositeEditCommand::positionOutsideTabSpan(const Position& pos) 515 Position CompositeEditCommand::positionOutsideTabSpan(const Position& pos)
516 { 516 {
517 if (!isTabSpanTextNode(pos.anchorNode())) 517 if (!isTabSpanTextNode(pos.anchorNode()))
518 return pos; 518 return pos;
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 return node.release(); 1456 return node.release();
1457 } 1457 }
1458 1458
1459 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) 1459 PassRefPtr<Element> createBlockPlaceholderElement(Document& document)
1460 { 1460 {
1461 RefPtr<Element> breakNode = document.createElement(brTag, false); 1461 RefPtr<Element> breakNode = document.createElement(brTag, false);
1462 return breakNode.release(); 1462 return breakNode.release();
1463 } 1463 }
1464 1464
1465 } // namespace WebCore 1465 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698