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

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

Issue 181693003: Have Document::markers() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/editing/Editor.cpp » ('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) 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 { 490 {
491 size_t arraySize = markerPointers.size(); 491 size_t arraySize = markerPointers.size();
492 markers.reserveCapacity(arraySize); 492 markers.reserveCapacity(arraySize);
493 for (size_t i = 0; i < arraySize; ++i) 493 for (size_t i = 0; i < arraySize; ++i)
494 markers.append(*markerPointers[i]); 494 markers.append(*markerPointers[i]);
495 } 495 }
496 496
497 void CompositeEditCommand::replaceTextInNodePreservingMarkers(PassRefPtr<Text> p rpNode, unsigned offset, unsigned count, const String& replacementText) 497 void CompositeEditCommand::replaceTextInNodePreservingMarkers(PassRefPtr<Text> p rpNode, unsigned offset, unsigned count, const String& replacementText)
498 { 498 {
499 RefPtr<Text> node(prpNode); 499 RefPtr<Text> node(prpNode);
500 DocumentMarkerController* markerController = document().markers(); 500 DocumentMarkerController& markerController = document().markers();
501 Vector<DocumentMarker> markers; 501 Vector<DocumentMarker> markers;
502 copyMarkers(markerController->markersInRange(Range::create(document(), node. get(), offset, node.get(), offset + count).get(), DocumentMarker::AllMarkers()), markers); 502 copyMarkers(markerController.markersInRange(Range::create(document(), node.g et(), offset, node.get(), offset + count).get(), DocumentMarker::AllMarkers()), markers);
503 replaceTextInNode(node, offset, count, replacementText); 503 replaceTextInNode(node, offset, count, replacementText);
504 RefPtr<Range> newRange = Range::create(document(), node.get(), offset, node. get(), offset + replacementText.length()); 504 RefPtr<Range> newRange = Range::create(document(), node.get(), offset, node. get(), offset + replacementText.length());
505 for (size_t i = 0; i < markers.size(); ++i) 505 for (size_t i = 0; i < markers.size(); ++i)
506 markerController->addMarker(newRange.get(), markers[i].type(), markers[i ].description()); 506 markerController.addMarker(newRange.get(), markers[i].type(), markers[i] .description());
507 } 507 }
508 508
509 Position CompositeEditCommand::positionOutsideTabSpan(const Position& pos) 509 Position CompositeEditCommand::positionOutsideTabSpan(const Position& pos)
510 { 510 {
511 if (!isTabSpanTextNode(pos.anchorNode())) 511 if (!isTabSpanTextNode(pos.anchorNode()))
512 return pos; 512 return pos;
513 513
514 switch (pos.anchorType()) { 514 switch (pos.anchorType()) {
515 case Position::PositionIsBeforeChildren: 515 case Position::PositionIsBeforeChildren:
516 case Position::PositionIsAfterChildren: 516 case Position::PositionIsAfterChildren:
(...skipping 939 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
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/editing/Editor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698