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

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

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase Created 6 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008, 2009 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 119
120 ApplyStyleCommand::ApplyStyleCommand(Document& document, const EditingStyle* sty le, EditAction editingAction, EPropertyLevel propertyLevel) 120 ApplyStyleCommand::ApplyStyleCommand(Document& document, const EditingStyle* sty le, EditAction editingAction, EPropertyLevel propertyLevel)
121 : CompositeEditCommand(document) 121 : CompositeEditCommand(document)
122 , m_style(style->copy()) 122 , m_style(style->copy())
123 , m_editingAction(editingAction) 123 , m_editingAction(editingAction)
124 , m_propertyLevel(propertyLevel) 124 , m_propertyLevel(propertyLevel)
125 , m_start(endingSelection().start().downstream()) 125 , m_start(endingSelection().start().downstream())
126 , m_end(endingSelection().end().upstream()) 126 , m_end(endingSelection().end().upstream())
127 , m_useEndingSelection(true) 127 , m_useEndingSelection(true)
128 , m_styledInlineElement(0) 128 , m_styledInlineElement(nullptr)
129 , m_removeOnly(false) 129 , m_removeOnly(false)
130 , m_isInlineElementToRemoveFunction(0) 130 , m_isInlineElementToRemoveFunction(0)
131 { 131 {
132 } 132 }
133 133
134 ApplyStyleCommand::ApplyStyleCommand(Document& document, const EditingStyle* sty le, const Position& start, const Position& end, EditAction editingAction, EPrope rtyLevel propertyLevel) 134 ApplyStyleCommand::ApplyStyleCommand(Document& document, const EditingStyle* sty le, const Position& start, const Position& end, EditAction editingAction, EPrope rtyLevel propertyLevel)
135 : CompositeEditCommand(document) 135 : CompositeEditCommand(document)
136 , m_style(style->copy()) 136 , m_style(style->copy())
137 , m_editingAction(editingAction) 137 , m_editingAction(editingAction)
138 , m_propertyLevel(propertyLevel) 138 , m_propertyLevel(propertyLevel)
139 , m_start(start) 139 , m_start(start)
140 , m_end(end) 140 , m_end(end)
141 , m_useEndingSelection(false) 141 , m_useEndingSelection(false)
142 , m_styledInlineElement(0) 142 , m_styledInlineElement(nullptr)
143 , m_removeOnly(false) 143 , m_removeOnly(false)
144 , m_isInlineElementToRemoveFunction(0) 144 , m_isInlineElementToRemoveFunction(0)
145 { 145 {
146 } 146 }
147 147
148 ApplyStyleCommand::ApplyStyleCommand(PassRefPtr<Element> element, bool removeOnl y, EditAction editingAction) 148 ApplyStyleCommand::ApplyStyleCommand(PassRefPtr<Element> element, bool removeOnl y, EditAction editingAction)
149 : CompositeEditCommand(element->document()) 149 : CompositeEditCommand(element->document())
150 , m_style(EditingStyle::create()) 150 , m_style(EditingStyle::create())
151 , m_editingAction(editingAction) 151 , m_editingAction(editingAction)
152 , m_propertyLevel(PropertyDefault) 152 , m_propertyLevel(PropertyDefault)
153 , m_start(endingSelection().start().downstream()) 153 , m_start(endingSelection().start().downstream())
154 , m_end(endingSelection().end().upstream()) 154 , m_end(endingSelection().end().upstream())
155 , m_useEndingSelection(true) 155 , m_useEndingSelection(true)
156 , m_styledInlineElement(element) 156 , m_styledInlineElement(element)
157 , m_removeOnly(removeOnly) 157 , m_removeOnly(removeOnly)
158 , m_isInlineElementToRemoveFunction(0) 158 , m_isInlineElementToRemoveFunction(0)
159 { 159 {
160 } 160 }
161 161
162 ApplyStyleCommand::ApplyStyleCommand(Document& document, const EditingStyle* sty le, IsInlineElementToRemoveFunction isInlineElementToRemoveFunction, EditAction editingAction) 162 ApplyStyleCommand::ApplyStyleCommand(Document& document, const EditingStyle* sty le, IsInlineElementToRemoveFunction isInlineElementToRemoveFunction, EditAction editingAction)
163 : CompositeEditCommand(document) 163 : CompositeEditCommand(document)
164 , m_style(style->copy()) 164 , m_style(style->copy())
165 , m_editingAction(editingAction) 165 , m_editingAction(editingAction)
166 , m_propertyLevel(PropertyDefault) 166 , m_propertyLevel(PropertyDefault)
167 , m_start(endingSelection().start().downstream()) 167 , m_start(endingSelection().start().downstream())
168 , m_end(endingSelection().end().upstream()) 168 , m_end(endingSelection().end().upstream())
169 , m_useEndingSelection(true) 169 , m_useEndingSelection(true)
170 , m_styledInlineElement(0) 170 , m_styledInlineElement(nullptr)
171 , m_removeOnly(true) 171 , m_removeOnly(true)
172 , m_isInlineElementToRemoveFunction(isInlineElementToRemoveFunction) 172 , m_isInlineElementToRemoveFunction(isInlineElementToRemoveFunction)
173 { 173 {
174 } 174 }
175 175
176 void ApplyStyleCommand::updateStartEnd(const Position& newStart, const Position& newEnd) 176 void ApplyStyleCommand::updateStartEnd(const Position& newStart, const Position& newEnd)
177 { 177 {
178 ASSERT(comparePositions(newEnd, newStart) >= 0); 178 ASSERT(comparePositions(newEnd, newStart) >= 0);
179 179
180 if (!m_useEndingSelection && (newStart != m_start || newEnd != m_end)) 180 if (!m_useEndingSelection && (newStart != m_start || newEnd != m_end))
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 for (Node* n = startNode; n && n != enclosingNode; n = n->parentNode()) { 529 for (Node* n = startNode; n && n != enclosingNode; n = n->parentNode()) {
530 if (n->isHTMLElement() && getIdentifierValue(CSSComputedStyleDeclaration ::create(n).get(), CSSPropertyUnicodeBidi) == CSSValueEmbed) 530 if (n->isHTMLElement() && getIdentifierValue(CSSComputedStyleDeclaration ::create(n).get(), CSSPropertyUnicodeBidi) == CSSValueEmbed)
531 return n; 531 return n;
532 } 532 }
533 533
534 return 0; 534 return 0;
535 } 535 }
536 536
537 void ApplyStyleCommand::applyInlineStyle(EditingStyle* style) 537 void ApplyStyleCommand::applyInlineStyle(EditingStyle* style)
538 { 538 {
539 RefPtr<Node> startDummySpanAncestor = 0; 539 RefPtr<Node> startDummySpanAncestor = nullptr;
540 RefPtr<Node> endDummySpanAncestor = 0; 540 RefPtr<Node> endDummySpanAncestor = nullptr;
541 541
542 // update document layout once before removing styles 542 // update document layout once before removing styles
543 // so that we avoid the expense of updating before each and every call 543 // so that we avoid the expense of updating before each and every call
544 // to check a computed style 544 // to check a computed style
545 document().updateLayoutIgnorePendingStylesheets(); 545 document().updateLayoutIgnorePendingStylesheets();
546 546
547 // adjust to the positions we want to use for applying style 547 // adjust to the positions we want to use for applying style
548 Position start = startPosition(); 548 Position start = startPosition();
549 Position end = endPosition(); 549 Position end = endPosition();
550 550
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 String textToMove = nextText->data(); 1528 String textToMove = nextText->data();
1529 insertTextIntoNode(childText, childText->length(), textToMove); 1529 insertTextIntoNode(childText, childText->length(), textToMove);
1530 removeNode(next); 1530 removeNode(next);
1531 // don't move child node pointer. it may want to merge with more text no des. 1531 // don't move child node pointer. it may want to merge with more text no des.
1532 } 1532 }
1533 1533
1534 updateStartEnd(newStart, newEnd); 1534 updateStartEnd(newStart, newEnd);
1535 } 1535 }
1536 1536
1537 } 1537 }
OLDNEW
« no previous file with comments | « Source/core/editing/ApplyBlockElementCommand.cpp ('k') | Source/core/editing/CompositeEditCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698