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

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

Issue 434393003: Use tighter typing in editing: VisiblePosition & VisibleSelection (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/DeleteSelectionCommand.cpp ('k') | Source/core/editing/TextIterator.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 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005, 2006 Apple Computer, 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // FIXME: The parentAnchoredEquivalent conversion needs to be moved into enc losingBlock. 168 // FIXME: The parentAnchoredEquivalent conversion needs to be moved into enc losingBlock.
169 RefPtrWillBeRawPtr<Element> startBlock = enclosingBlock(insertionPosition.pa rentAnchoredEquivalent().containerNode()); 169 RefPtrWillBeRawPtr<Element> startBlock = enclosingBlock(insertionPosition.pa rentAnchoredEquivalent().containerNode());
170 Node* listChildNode = enclosingListChild(insertionPosition.parentAnchoredEqu ivalent().containerNode()); 170 Node* listChildNode = enclosingListChild(insertionPosition.parentAnchoredEqu ivalent().containerNode());
171 RefPtrWillBeRawPtr<HTMLElement> listChild = listChildNode && listChildNode-> isHTMLElement() ? toHTMLElement(listChildNode) : 0; 171 RefPtrWillBeRawPtr<HTMLElement> listChild = listChildNode && listChildNode-> isHTMLElement() ? toHTMLElement(listChildNode) : 0;
172 Position canonicalPos = VisiblePosition(insertionPosition).deepEquivalent(); 172 Position canonicalPos = VisiblePosition(insertionPosition).deepEquivalent();
173 if (!startBlock 173 if (!startBlock
174 || !startBlock->nonShadowBoundaryParentNode() 174 || !startBlock->nonShadowBoundaryParentNode()
175 || isTableCell(startBlock.get()) 175 || isTableCell(startBlock.get())
176 || isHTMLFormElement(*startBlock) 176 || isHTMLFormElement(*startBlock)
177 // FIXME: If the node is hidden, we don't have a canonical position so w e will do the wrong thing for tables and <hr>. https://bugs.webkit.org/show_bug. cgi?id=40342 177 // FIXME: If the node is hidden, we don't have a canonical position so w e will do the wrong thing for tables and <hr>. https://bugs.webkit.org/show_bug. cgi?id=40342
178 || (!canonicalPos.isNull() && isRenderedTable(canonicalPos.deprecatedNod e())) 178 || (!canonicalPos.isNull() && isRenderedTableElement(canonicalPos.deprec atedNode()))
179 || (!canonicalPos.isNull() && isHTMLHRElement(*canonicalPos.deprecatedNo de()))) { 179 || (!canonicalPos.isNull() && isHTMLHRElement(*canonicalPos.deprecatedNo de()))) {
180 applyCommandToComposite(InsertLineBreakCommand::create(document())); 180 applyCommandToComposite(InsertLineBreakCommand::create(document()));
181 return; 181 return;
182 } 182 }
183 183
184 // Use the leftmost candidate. 184 // Use the leftmost candidate.
185 insertionPosition = insertionPosition.upstream(); 185 insertionPosition = insertionPosition.upstream();
186 if (!insertionPosition.isCandidate()) 186 if (!insertionPosition.isCandidate())
187 insertionPosition = insertionPosition.downstream(); 187 insertionPosition = insertionPosition.downstream();
188 188
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 } 429 }
430 430
431 void InsertParagraphSeparatorCommand::trace(Visitor *visitor) 431 void InsertParagraphSeparatorCommand::trace(Visitor *visitor)
432 { 432 {
433 visitor->trace(m_style); 433 visitor->trace(m_style);
434 CompositeEditCommand::trace(visitor); 434 CompositeEditCommand::trace(visitor);
435 } 435 }
436 436
437 437
438 } // namespace blink 438 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/DeleteSelectionCommand.cpp ('k') | Source/core/editing/TextIterator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698