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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/SplitTextNodeContainingElementCommand.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2008 Apple 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 29 matching lines...) Expand all
40 } 40 }
41 41
42 void SplitTextNodeContainingElementCommand::doApply(EditingState*) 42 void SplitTextNodeContainingElementCommand::doApply(EditingState*)
43 { 43 {
44 DCHECK(m_text); 44 DCHECK(m_text);
45 DCHECK_GT(m_offset, 0); 45 DCHECK_GT(m_offset, 0);
46 46
47 splitTextNode(m_text.get(), m_offset); 47 splitTextNode(m_text.get(), m_offset);
48 48
49 Element* parent = m_text->parentElement(); 49 Element* parent = m_text->parentElement();
50 if (!parent || !parent->parentElement() || !parent->parentElement()->hasEdit ableStyle()) 50 if (!parent || !parent->parentElement() || !hasEditableStyle(*parent->parent Element()))
51 return; 51 return;
52 52
53 LayoutObject* parentLayoutObject = parent->layoutObject(); 53 LayoutObject* parentLayoutObject = parent->layoutObject();
54 if (!parentLayoutObject || !parentLayoutObject->isInline()) { 54 if (!parentLayoutObject || !parentLayoutObject->isInline()) {
55 wrapContentsInDummySpan(parent); 55 wrapContentsInDummySpan(parent);
56 Node* firstChild = parent->firstChild(); 56 Node* firstChild = parent->firstChild();
57 if (!firstChild || !firstChild->isElementNode()) 57 if (!firstChild || !firstChild->isElementNode())
58 return; 58 return;
59 parent = toElement(firstChild); 59 parent = toElement(firstChild);
60 } 60 }
61 61
62 splitElement(parent, m_text.get()); 62 splitElement(parent, m_text.get());
63 } 63 }
64 64
65 DEFINE_TRACE(SplitTextNodeContainingElementCommand) 65 DEFINE_TRACE(SplitTextNodeContainingElementCommand)
66 { 66 {
67 visitor->trace(m_text); 67 visitor->trace(m_text);
68 CompositeEditCommand::trace(visitor); 68 CompositeEditCommand::trace(visitor);
69 } 69 }
70 70
71 } // namespace blink 71 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698