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

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

Issue 2370253002: Mark calls of visible{Start,End} with dirty layout deprecated (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 : CompositeEditCommand(document) 52 : CompositeEditCommand(document)
53 , m_tagName(tagName) 53 , m_tagName(tagName)
54 { 54 {
55 } 55 }
56 56
57 void ApplyBlockElementCommand::doApply(EditingState* editingState) 57 void ApplyBlockElementCommand::doApply(EditingState* editingState)
58 { 58 {
59 if (!endingSelection().rootEditableElement()) 59 if (!endingSelection().rootEditableElement())
60 return; 60 return;
61 61
62 VisiblePosition visibleEnd = endingSelection().visibleEnd(); 62 VisiblePosition visibleEnd = endingSelection().visibleEndDeprecated();
63 VisiblePosition visibleStart = endingSelection().visibleStart(); 63 VisiblePosition visibleStart = endingSelection().visibleStartDeprecated();
64 if (visibleStart.isNull() || visibleStart.isOrphan() || visibleEnd.isNull() || visibleEnd.isOrphan()) 64 if (visibleStart.isNull() || visibleStart.isOrphan() || visibleEnd.isNull() || visibleEnd.isOrphan())
65 return; 65 return;
66 66
67 // When a selection ends at the start of a paragraph, we rarely paint 67 // When a selection ends at the start of a paragraph, we rarely paint
68 // the selection gap before that paragraph, because there often is no gap. 68 // the selection gap before that paragraph, because there often is no gap.
69 // In a case like this, it's not obvious to the user that the selection 69 // In a case like this, it's not obvious to the user that the selection
70 // ends "inside" that paragraph, so it would be confusing if Indent/Outdent 70 // ends "inside" that paragraph, so it would be confusing if Indent/Outdent
71 // operated on that paragraph. 71 // operated on that paragraph.
72 // FIXME: We paint the gap before some paragraphs that are indented with lef t 72 // FIXME: We paint the gap before some paragraphs that are indented with lef t
73 // margin/padding, but not others. We should make the gap painting more 73 // margin/padding, but not others. We should make the gap painting more
74 // consistent and then use a left margin/padding rule here. 74 // consistent and then use a left margin/padding rule here.
75 if (visibleEnd.deepEquivalent() != visibleStart.deepEquivalent() && isStartO fParagraphDeprecated(visibleEnd)) { 75 if (visibleEnd.deepEquivalent() != visibleStart.deepEquivalent() && isStartO fParagraphDeprecated(visibleEnd)) {
76 VisibleSelection newSelection(visibleStart, previousPositionOf(visibleEn d, CannotCrossEditingBoundary), endingSelection().isDirectional()); 76 VisibleSelection newSelection(visibleStart, previousPositionOf(visibleEn d, CannotCrossEditingBoundary), endingSelection().isDirectional());
77 if (newSelection.isNone()) 77 if (newSelection.isNone())
78 return; 78 return;
79 setEndingSelection(newSelection); 79 setEndingSelection(newSelection);
80 } 80 }
81 81
82 VisibleSelection selection = selectionForParagraphIteration(endingSelection( )); 82 VisibleSelection selection = selectionForParagraphIteration(endingSelection( ));
83 VisiblePosition startOfSelection = selection.visibleStart(); 83 VisiblePosition startOfSelection = selection.visibleStartDeprecated();
84 VisiblePosition endOfSelection = selection.visibleEnd(); 84 VisiblePosition endOfSelection = selection.visibleEndDeprecated();
85 DCHECK(!startOfSelection.isNull()); 85 DCHECK(!startOfSelection.isNull());
86 DCHECK(!endOfSelection.isNull()); 86 DCHECK(!endOfSelection.isNull());
87 ContainerNode* startScope = nullptr; 87 ContainerNode* startScope = nullptr;
88 int startIndex = indexForVisiblePosition(startOfSelection, startScope); 88 int startIndex = indexForVisiblePosition(startOfSelection, startScope);
89 ContainerNode* endScope = nullptr; 89 ContainerNode* endScope = nullptr;
90 int endIndex = indexForVisiblePosition(endOfSelection, endScope); 90 int endIndex = indexForVisiblePosition(endOfSelection, endScope);
91 91
92 formatSelection(startOfSelection, endOfSelection, editingState); 92 formatSelection(startOfSelection, endOfSelection, editingState);
93 if (editingState->isAborted()) 93 if (editingState->isAborted())
94 return; 94 return;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 return element; 306 return element;
307 } 307 }
308 308
309 DEFINE_TRACE(ApplyBlockElementCommand) 309 DEFINE_TRACE(ApplyBlockElementCommand)
310 { 310 {
311 visitor->trace(m_endOfLastParagraph); 311 visitor->trace(m_endOfLastParagraph);
312 CompositeEditCommand::trace(visitor); 312 CompositeEditCommand::trace(visitor);
313 } 313 }
314 314
315 } // namespace blink 315 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698