Index: third_party/WebKit/Source/core/editing/Editor.cpp |
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp |
index b176a7320d4ec1276022ca6631b52b2e9aeb972d..125c6421f2290cb7d7815d858980e883572146f7 100644 |
--- a/third_party/WebKit/Source/core/editing/Editor.cpp |
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp |
@@ -164,8 +164,8 @@ VisibleSelection Editor::selectionForCommand(Event* event) { |
VisibleSelection selection = frame().selection().selection(); |
if (!event) |
return selection; |
- // If the target is a text control, and the current selection is outside of its shadow tree, |
- // then use the saved selection for that text control. |
+ // If the target is a text control, and the current selection is outside of |
+ // its shadow tree, then use the saved selection for that text control. |
HTMLTextFormControlElement* textFormControlOfSelectionStart = |
enclosingTextFormControl(selection.start()); |
HTMLTextFormControlElement* textFromControlOfTarget = |
@@ -184,7 +184,8 @@ VisibleSelection Editor::selectionForCommand(Event* event) { |
return selection; |
} |
-// Function considers Mac editing behavior a fallback when Page or Settings is not available. |
+// Function considers Mac editing behavior a fallback when Page or Settings is |
+// not available. |
EditingBehavior Editor::behavior() const { |
if (!frame().settings()) |
return EditingBehavior(EditingMacBehavior); |
@@ -242,10 +243,11 @@ bool Editor::canEditRichly() const { |
return frame().selection().isContentRichlyEditable(); |
} |
-// WinIE uses onbeforecut and onbeforepaste to enables the cut and paste menu items. They |
-// also send onbeforecopy, apparently for symmetry, but it doesn't affect the menu items. |
-// We need to use onbeforecopy as a real menu enabler because we allow elements that are not |
-// normally selectable to implement copy/paste (like divs, or a document body). |
+// WinIE uses onbeforecut and onbeforepaste to enables the cut and paste menu |
+// items. They also send onbeforecopy, apparently for symmetry, but it doesn't |
+// affect the menu items. We need to use onbeforecopy as a real menu enabler |
+// because we allow elements that are not normally selectable to implement |
+// copy/paste (like divs, or a document body). |
bool Editor::canDHTMLCut() { |
return !frame().selection().isInPasswordField() && |
@@ -357,8 +359,8 @@ bool Editor::deleteWithDirection(DeleteDirection direction, |
} |
// FIXME: We should to move this down into deleteKeyPressed. |
- // clear the "start new kill ring sequence" setting, because it was set to true |
- // when the selection was updated by deleting the range |
+ // clear the "start new kill ring sequence" setting, because it was set to |
+ // true when the selection was updated by deleting the range |
if (killRing) |
setStartNewKillRingSequence(false); |
@@ -500,7 +502,8 @@ static void writeImageNodeToPasteboard(Pasteboard* pasteboard, |
if (!image.get()) |
return; |
- // FIXME: This should probably be reconciled with HitTestResult::absoluteImageURL. |
+ // FIXME: This should probably be reconciled with |
+ // HitTestResult::absoluteImageURL. |
AtomicString urlString; |
if (isHTMLImageElement(*node) || isHTMLInputElement(*node)) |
urlString = toHTMLElement(node)->getAttribute(srcAttr); |
@@ -517,8 +520,8 @@ static void writeImageNodeToPasteboard(Pasteboard* pasteboard, |
pasteboard->writeImage(image.get(), url, title); |
} |
-// Returns whether caller should continue with "the default processing", which is the same as |
-// the event handler NOT setting the return value to false |
+// Returns whether caller should continue with "the default processing", which |
+// is the same as the event handler NOT setting the return value to false |
bool Editor::dispatchCPPEvent(const AtomicString& eventType, |
DataTransferAccessPolicy policy, |
PasteMode pasteMode) { |
@@ -610,7 +613,8 @@ bool Editor::deleteSelectionAfterDraggingWithEvents( |
dragSource, InputEvent::InputType::DeleteByDrag, |
nullptr) == DispatchEventResult::NotCanceled; |
- // 'beforeinput' event handler may destroy frame, return false to cancel remaining actions; |
+ // 'beforeinput' event handler may destroy frame, return false to cancel |
+ // remaining actions; |
if (m_frame->document()->frame() != m_frame) |
return false; |
@@ -642,7 +646,8 @@ bool Editor::replaceSelectionAfterDraggingWithEvents( |
dropTarget, InputEvent::InputType::InsertFromDrop, dataTransfer, |
nullptr) == DispatchEventResult::NotCanceled; |
- // 'beforeinput' event handler may destroy frame, return false to cancel remaining actions; |
+ // 'beforeinput' event handler may destroy frame, return false to cancel |
+ // remaining actions; |
if (m_frame->document()->frame() != m_frame) |
return false; |
@@ -814,7 +819,8 @@ void Editor::appliedEditing(CompositeEditCommand* cmd) { |
cmd->textDataForInputEvent(), isComposingFromCommand(cmd)); |
VisibleSelection newSelection(cmd->endingSelection()); |
- // Don't clear the typing style with this selection change. We do those things elsewhere if necessary. |
+ // Don't clear the typing style with this selection change. We do those things |
+ // elsewhere if necessary. |
changeSelectionAfterCommand(newSelection, 0); |
if (!cmd->preservesTypingStyle()) |
@@ -900,7 +906,8 @@ Editor::Editor(LocalFrame& frame) |
m_undoStack(UndoStack::create()), |
m_preventRevealSelection(0), |
m_shouldStartNewKillRingSequence(false), |
- // This is off by default, since most editors want this behavior (this matches IE but not FF). |
+ // This is off by default, since most editors want this behavior (this |
+ // matches IE but not FF). |
m_shouldStyleWithCSS(false), |
m_killRing(wrapUnique(new KillRing)), |
m_areMarkedTextMatchesHighlighted(false), |
@@ -947,7 +954,8 @@ bool Editor::insertTextWithoutSendingTextEvent(const String& text, |
LocalFrame* focusedOrMainFrame = |
toLocalFrame(page->focusController().focusedOrMainFrame()); |
- // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
+ // TODO(xiaochengh): The use of |
+ // updateStyleAndLayoutIgnorePendingStylesheets |
// needs to be audited. See http://crbug.com/590369 for more details. |
focusedOrMainFrame->document() |
->updateStyleAndLayoutIgnorePendingStylesheets(); |
@@ -1104,8 +1112,8 @@ void Editor::performDelete() { |
canSmartCopyOrDelete() ? DeleteMode::Smart : DeleteMode::Simple, |
InputEvent::InputType::DeleteContentBackward); |
- // clear the "start new kill ring sequence" setting, because it was set to true |
- // when the selection was updated by deleting the range |
+ // clear the "start new kill ring sequence" setting, because it was set to |
+ // true when the selection was updated by deleting the range |
setStartNewKillRingSequence(false); |
} |
@@ -1291,18 +1299,22 @@ void Editor::changeSelectionAfterCommand( |
if (newSelection.start().isOrphan() || newSelection.end().isOrphan()) |
return; |
- // See <rdar://problem/5729315> Some shouldChangeSelectedDOMRange contain Ranges for selections that are no longer valid |
+ // See <rdar://problem/5729315> Some shouldChangeSelectedDOMRange contain |
+ // Ranges for selections that are no longer valid |
bool selectionDidNotChangeDOMPosition = |
newSelection == frame().selection().selection(); |
frame().selection().setSelection(newSelection, options); |
- // Some editing operations change the selection visually without affecting its position within the DOM. |
- // For example when you press return in the following (the caret is marked by ^): |
+ // Some editing operations change the selection visually without affecting its |
+ // position within the DOM. For example when you press return in the following |
+ // (the caret is marked by ^): |
// <div contentEditable="true"><div>^Hello</div></div> |
- // WebCore inserts <div><br></div> *before* the current block, which correctly moves the paragraph down but which doesn't |
- // change the caret's DOM position (["hello", 0]). In these situations the above FrameSelection::setSelection call |
- // does not call EditorClient::respondToChangedSelection(), which, on the Mac, sends selection change notifications and |
- // starts a new kill ring sequence, but we want to do these things (matches AppKit). |
+ // WebCore inserts <div><br></div> *before* the current block, which correctly |
+ // moves the paragraph down but which doesn't change the caret's DOM position |
+ // (["hello", 0]). In these situations the above FrameSelection::setSelection |
+ // call does not call EditorClient::respondToChangedSelection(), which, on the |
+ // Mac, sends selection change notifications and starts a new kill ring |
+ // sequence, but we want to do these things (matches AppKit). |
if (selectionDidNotChangeDOMPosition) |
client().respondToChangedSelection(m_frame, |
frame().selection().getSelectionType()); |
@@ -1340,7 +1352,8 @@ IntRect Editor::firstRectForRange(const EphemeralRange& range) const { |
std::max(startCaretRect.height(), endCaretRect.height())); |
} |
- // start and end aren't on the same line, so go from start to the end of its line |
+ // start and end aren't on the same line, so go from start to the end of its |
+ // line |
return IntRect(startCaretRect.x(), startCaretRect.y(), |
(startCaretRect.width() + extraWidthToEndOfLine).toInt(), |
startCaretRect.height()); |