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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp

Issue 2932643003: Move InSameBlock() to InsertParagraphSeparatorCommand.cpp (Closed)
Patch Set: 2017-06-08T17:36:13 Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleUnits.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) 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 while (!cur_block->nextSibling() && 54 while (!cur_block->nextSibling() &&
55 isHTMLDivElement(*cur_block->parentElement()) && 55 isHTMLDivElement(*cur_block->parentElement()) &&
56 cur_block->parentElement()->parentElement()) { 56 cur_block->parentElement()->parentElement()) {
57 if (cur_block->parentElement()->hasAttributes()) 57 if (cur_block->parentElement()->hasAttributes())
58 break; 58 break;
59 cur_block = cur_block->parentElement(); 59 cur_block = cur_block->parentElement();
60 } 60 }
61 return cur_block; 61 return cur_block;
62 } 62 }
63 63
64 static bool InSameBlock(const VisiblePosition& a, const VisiblePosition& b) {
65 DCHECK(a.IsValid()) << a;
66 DCHECK(b.IsValid()) << b;
67 return !a.IsNull() &&
68 EnclosingBlock(a.DeepEquivalent().ComputeContainerNode()) ==
69 EnclosingBlock(b.DeepEquivalent().ComputeContainerNode());
70 }
71
64 InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand( 72 InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand(
65 Document& document, 73 Document& document,
66 bool must_use_default_paragraph_element, 74 bool must_use_default_paragraph_element,
67 bool paste_blockquote_into_unquoted_area) 75 bool paste_blockquote_into_unquoted_area)
68 : CompositeEditCommand(document), 76 : CompositeEditCommand(document),
69 must_use_default_paragraph_element_(must_use_default_paragraph_element), 77 must_use_default_paragraph_element_(must_use_default_paragraph_element),
70 paste_blockquote_into_unquoted_area_( 78 paste_blockquote_into_unquoted_area_(
71 paste_blockquote_into_unquoted_area) {} 79 paste_blockquote_into_unquoted_area) {}
72 80
73 bool InsertParagraphSeparatorCommand::PreservesTypingStyle() const { 81 bool InsertParagraphSeparatorCommand::PreservesTypingStyle() const {
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 .Build()); 595 .Build());
588 ApplyStyleAfterInsertion(start_block, editing_state); 596 ApplyStyleAfterInsertion(start_block, editing_state);
589 } 597 }
590 598
591 DEFINE_TRACE(InsertParagraphSeparatorCommand) { 599 DEFINE_TRACE(InsertParagraphSeparatorCommand) {
592 visitor->Trace(style_); 600 visitor->Trace(style_);
593 CompositeEditCommand::Trace(visitor); 601 CompositeEditCommand::Trace(visitor);
594 } 602 }
595 603
596 } // namespace blink 604 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698