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

Side by Side Diff: Source/core/editing/ReplaceSelectionCommand.cpp

Issue 16879016: Use toElement instead of static_cast<Element*> and static_cast<const Element*> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 6 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
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | Source/core/editing/htmlediting.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2009, 2010, 2011 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 RefPtr<Document> m_document; 92 RefPtr<Document> m_document;
93 RefPtr<DocumentFragment> m_fragment; 93 RefPtr<DocumentFragment> m_fragment;
94 bool m_hasInterchangeNewlineAtStart; 94 bool m_hasInterchangeNewlineAtStart;
95 bool m_hasInterchangeNewlineAtEnd; 95 bool m_hasInterchangeNewlineAtEnd;
96 }; 96 };
97 97
98 static bool isInterchangeNewlineNode(const Node *node) 98 static bool isInterchangeNewlineNode(const Node *node)
99 { 99 {
100 DEFINE_STATIC_LOCAL(String, interchangeNewlineClassString, (AppleInterchange Newline)); 100 DEFINE_STATIC_LOCAL(String, interchangeNewlineClassString, (AppleInterchange Newline));
101 return node && node->hasTagName(brTag) && 101 return node && node->hasTagName(brTag) && toElement(node)->getAttribute(clas sAttr) == interchangeNewlineClassString;
102 static_cast<const Element *>(node)->getAttribute(classAttr) == interc hangeNewlineClassString;
103 } 102 }
104 103
105 static bool isInterchangeConvertedSpaceSpan(const Node *node) 104 static bool isInterchangeConvertedSpaceSpan(const Node *node)
106 { 105 {
107 DEFINE_STATIC_LOCAL(String, convertedSpaceSpanClassString, (AppleConvertedSp ace)); 106 DEFINE_STATIC_LOCAL(String, convertedSpaceSpanClassString, (AppleConvertedSp ace));
108 return node->isHTMLElement() && 107 return node->isHTMLElement() &&
109 static_cast<const HTMLElement *>(node)->getAttribute(classAttr) == co nvertedSpaceSpanClassString; 108 static_cast<const HTMLElement *>(node)->getAttribute(classAttr) == co nvertedSpaceSpanClassString;
110 } 109 }
111 110
112 static Position positionAvoidingPrecedingNodes(Position pos) 111 static Position positionAvoidingPrecedingNodes(Position pos)
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); 1483 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get());
1485 1484
1486 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d); 1485 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d);
1487 1486
1488 setEndingSelection(selectionAfterReplace); 1487 setEndingSelection(selectionAfterReplace);
1489 1488
1490 return true; 1489 return true;
1491 } 1490 }
1492 1491
1493 } // namespace WebCore 1492 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | Source/core/editing/htmlediting.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698