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

Unified Diff: third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp

Issue 2171493003: [Editing][DOM][CodeHealth] Make Node::hasEditableStyle global functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
index 22ade9730ee377982b5d55d1a923b76addef657c..2772b6979110544ca0c1154c1f1a35f24efec7ad 100644
--- a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
@@ -172,12 +172,12 @@ ReplacementFragment::ReplacementFragment(Document* document, DocumentFragment* f
if (!editableRoot->getAttributeEventListener(EventTypeNames::webkitBeforeTextInserted)
// FIXME: Remove these checks once textareas and textfields actually register an event handler.
&& !(shadowAncestorElement && shadowAncestorElement->layoutObject() && shadowAncestorElement->layoutObject()->isTextControl())
- && editableRoot->layoutObjectIsRichlyEditable()) {
+ && layoutObjectIsRichlyEditable(*editableRoot)) {
removeInterchangeNodes(m_fragment.get());
return;
}
- if (!editableRoot->layoutObjectIsRichlyEditable()) {
+ if (!layoutObjectIsRichlyEditable(*editableRoot)) {
bool isPlainText = true;
for (Node& node : NodeTraversal::childrenOf(*m_fragment)) {
if (isInterchangeHTMLBRElement(&node) && &node == m_fragment->lastChild())
@@ -217,7 +217,7 @@ ReplacementFragment::ReplacementFragment(Document* document, DocumentFragment* f
// Give the root a chance to change the text.
BeforeTextInsertedEvent* evt = BeforeTextInsertedEvent::create(text);
editableRoot->dispatchEvent(evt);
- if (text != evt->text() || !editableRoot->layoutObjectIsRichlyEditable()) {
+ if (text != evt->text() || !layoutObjectIsRichlyEditable(*editableRoot)) {
restoreAndRemoveTestRenderingNodesToFragment(holder);
m_fragment = createFragmentFromText(selection.toNormalizedEphemeralRange(), evt->text());
@@ -581,7 +581,7 @@ void ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline(Insert
continue;
}
- if (element->parentNode() && element->parentNode()->layoutObjectIsRichlyEditable())
+ if (element->parentNode() && layoutObjectIsRichlyEditable(*element->parentNode()))
removeElementAttribute(element, contenteditableAttr);
// WebKit used to not add display: inline and float: none on copy.
@@ -701,7 +701,7 @@ void ReplaceSelectionCommand::makeInsertedContentRoundTrippableWithHTMLTreeBuild
void ReplaceSelectionCommand::moveElementOutOfAncestor(Element* element, Element* ancestor, EditingState* editingState)
{
- if (!ancestor->parentNode()->hasEditableStyle())
+ if (!hasEditableStyle(*ancestor->parentNode()))
return;
VisiblePosition positionAtEndOfNode = createVisiblePosition(lastPositionInOrAfterNode(element));
@@ -1227,7 +1227,7 @@ void ReplaceSelectionCommand::doApply(EditingState* editingState)
Element* blockStart = enclosingBlock(insertionPos.anchorNode());
if ((isHTMLListElement(refNode) || (isLegacyAppleHTMLSpanElement(refNode) && isHTMLListElement(refNode->firstChild())))
- && blockStart && blockStart->layoutObject()->isListItem() && blockStart->parentNode()->hasEditableStyle()) {
+ && blockStart && blockStart->layoutObject()->isListItem() && hasEditableStyle(*blockStart->parentNode())) {
refNode = insertAsListItems(toHTMLElement(refNode), blockStart, insertionPos, insertedNodes, editingState);
if (editingState->isAborted())
return;

Powered by Google App Engine
This is Rietveld 408576698