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

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

Issue 2140733003: [Editing][CodeHealth] Make Node::rootEditableElement static (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, 2006, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008, 2009 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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 756
757 // FIXME: Callers should perform this operation on a Range that includes the br 757 // FIXME: Callers should perform this operation on a Range that includes the br
758 // if they want style applied to the empty line. 758 // if they want style applied to the empty line.
759 if (start == end && isHTMLBRElement(*start.anchorNode())) 759 if (start == end && isHTMLBRElement(*start.anchorNode()))
760 pastEndNode = NodeTraversal::next(*start.anchorNode()); 760 pastEndNode = NodeTraversal::next(*start.anchorNode());
761 761
762 // Start from the highest fully selected ancestor so that we can modify the fully selected node. 762 // Start from the highest fully selected ancestor so that we can modify the fully selected node.
763 // e.g. When applying font-size: large on <font color="blue">hello</font>, w e need to include the font element in our run 763 // e.g. When applying font-size: large on <font color="blue">hello</font>, w e need to include the font element in our run
764 // to generate <font color="blue" size="4">hello</font> instead of <font col or="blue"><font size="4">hello</font></font> 764 // to generate <font color="blue" size="4">hello</font> instead of <font col or="blue"><font size="4">hello</font></font>
765 Range* range = Range::create(startNode->document(), start, end); 765 Range* range = Range::create(startNode->document(), start, end);
766 Element* editableRoot = startNode->rootEditableElement(); 766 Element* editableRoot = rootEditableElement(*startNode);
767 if (startNode != editableRoot) { 767 if (startNode != editableRoot) {
768 while (editableRoot && startNode->parentNode() != editableRoot && isNode VisiblyContainedWithin(*startNode->parentNode(), *range)) 768 while (editableRoot && startNode->parentNode() != editableRoot && isNode VisiblyContainedWithin(*startNode->parentNode(), *range))
769 startNode = startNode->parentNode(); 769 startNode = startNode->parentNode();
770 } 770 }
771 771
772 applyInlineStyleToNodeRange(style, startNode, pastEndNode, editingState); 772 applyInlineStyleToNodeRange(style, startNode, pastEndNode, editingState);
773 } 773 }
774 774
775 static bool containsNonEditableRegion(Node& node) 775 static bool containsNonEditableRegion(Node& node)
776 { 776 {
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 DEFINE_TRACE(ApplyStyleCommand) 1726 DEFINE_TRACE(ApplyStyleCommand)
1727 { 1727 {
1728 visitor->trace(m_style); 1728 visitor->trace(m_style);
1729 visitor->trace(m_start); 1729 visitor->trace(m_start);
1730 visitor->trace(m_end); 1730 visitor->trace(m_end);
1731 visitor->trace(m_styledInlineElement); 1731 visitor->trace(m_styledInlineElement);
1732 CompositeEditCommand::trace(visitor); 1732 CompositeEditCommand::trace(visitor);
1733 } 1733 }
1734 1734
1735 } // namespace blink 1735 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698