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

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

Issue 424493003: Use tighter typing in editing: CompositeEditCommand (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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/editing/htmlediting.cpp ('k') | no next file » | 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) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved.
4 * Copyright (C) 2011 Igalia S.L. 4 * Copyright (C) 2011 Igalia S.L.
5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "core/dom/ExceptionCode.h" 44 #include "core/dom/ExceptionCode.h"
45 #include "core/dom/NodeTraversal.h" 45 #include "core/dom/NodeTraversal.h"
46 #include "core/dom/Range.h" 46 #include "core/dom/Range.h"
47 #include "core/editing/Editor.h" 47 #include "core/editing/Editor.h"
48 #include "core/editing/MarkupAccumulator.h" 48 #include "core/editing/MarkupAccumulator.h"
49 #include "core/editing/TextIterator.h" 49 #include "core/editing/TextIterator.h"
50 #include "core/editing/VisibleSelection.h" 50 #include "core/editing/VisibleSelection.h"
51 #include "core/editing/VisibleUnits.h" 51 #include "core/editing/VisibleUnits.h"
52 #include "core/editing/htmlediting.h" 52 #include "core/editing/htmlediting.h"
53 #include "core/frame/LocalFrame.h" 53 #include "core/frame/LocalFrame.h"
54 #include "core/html/HTMLBRElement.h"
54 #include "core/html/HTMLBodyElement.h" 55 #include "core/html/HTMLBodyElement.h"
55 #include "core/html/HTMLElement.h" 56 #include "core/html/HTMLElement.h"
56 #include "core/html/HTMLSpanElement.h" 57 #include "core/html/HTMLSpanElement.h"
57 #include "core/html/HTMLTableCellElement.h" 58 #include "core/html/HTMLTableCellElement.h"
58 #include "core/html/HTMLTextFormControlElement.h" 59 #include "core/html/HTMLTextFormControlElement.h"
59 #include "core/rendering/RenderObject.h" 60 #include "core/rendering/RenderObject.h"
60 #include "platform/weborigin/KURL.h" 61 #include "platform/weborigin/KURL.h"
61 #include "wtf/StdLibExtras.h" 62 #include "wtf/StdLibExtras.h"
62 #include "wtf/text/StringBuilder.h" 63 #include "wtf/text/StringBuilder.h"
63 64
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 if (text.isEmpty()) 848 if (text.isEmpty())
848 return fragment.release(); 849 return fragment.release();
849 850
850 String string = text; 851 String string = text;
851 string.replace("\r\n", "\n"); 852 string.replace("\r\n", "\n");
852 string.replace('\r', '\n'); 853 string.replace('\r', '\n');
853 854
854 if (shouldPreserveNewline(*context)) { 855 if (shouldPreserveNewline(*context)) {
855 fragment->appendChild(document.createTextNode(string)); 856 fragment->appendChild(document.createTextNode(string));
856 if (string.endsWith('\n')) { 857 if (string.endsWith('\n')) {
857 RefPtrWillBeRawPtr<Element> element = createBreakElement(document); 858 RefPtrWillBeRawPtr<HTMLBRElement> element = createBreakElement(docum ent);
858 element->setAttribute(classAttr, AppleInterchangeNewline); 859 element->setAttribute(classAttr, AppleInterchangeNewline);
859 fragment->appendChild(element.release()); 860 fragment->appendChild(element.release());
860 } 861 }
861 return fragment.release(); 862 return fragment.release();
862 } 863 }
863 864
864 // A string with no newlines gets added inline, rather than being put into a paragraph. 865 // A string with no newlines gets added inline, rather than being put into a paragraph.
865 if (string.find('\n') == kNotFound) { 866 if (string.find('\n') == kNotFound) {
866 fillContainerFromString(fragment.get(), string); 867 fillContainerFromString(fragment.get(), string);
867 return fragment.release(); 868 return fragment.release();
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 node->document().updateLayoutIgnorePendingStylesheets(); 1112 node->document().updateLayoutIgnorePendingStylesheets();
1112 1113
1113 StyledMarkupAccumulator accumulator(0, ResolveAllURLs, AnnotateForNavigation Transition, nullptr, 0); 1114 StyledMarkupAccumulator accumulator(0, ResolveAllURLs, AnnotateForNavigation Transition, nullptr, 0);
1114 accumulator.serializeNodes(node, NodeTraversal::nextSkippingChildren(*node)) ; 1115 accumulator.serializeNodes(node, NodeTraversal::nextSkippingChildren(*node)) ;
1115 1116
1116 static const char* documentMarkup = "<!DOCTYPE html><meta name=\"viewport\" content=\"width=device-width, user-scalable=0\">"; 1117 static const char* documentMarkup = "<!DOCTYPE html><meta name=\"viewport\" content=\"width=device-width, user-scalable=0\">";
1117 return documentMarkup + accumulator.takeResults(); 1118 return documentMarkup + accumulator.takeResults();
1118 } 1119 }
1119 1120
1120 } 1121 }
OLDNEW
« no previous file with comments | « Source/core/editing/htmlediting.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698