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

Side by Side Diff: Source/core/editing/ApplyStyleCommand.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/dom/Node.cpp ('k') | Source/core/editing/CompositeEditCommand.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, 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 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 return false; 1302 return false;
1303 1303
1304 endNode = end.deprecatedNode()->parentNode(); 1304 endNode = end.deprecatedNode()->parentNode();
1305 } 1305 }
1306 1306
1307 if (!endNode->isElementNode() || endNode->hasTagName(brTag)) 1307 if (!endNode->isElementNode() || endNode->hasTagName(brTag))
1308 return false; 1308 return false;
1309 1309
1310 Node* nextSibling = endNode->nextSibling(); 1310 Node* nextSibling = endNode->nextSibling();
1311 if (nextSibling && areIdenticalElements(endNode, nextSibling)) { 1311 if (nextSibling && areIdenticalElements(endNode, nextSibling)) {
1312 Element* nextElement = static_cast<Element *>(nextSibling); 1312 Element* nextElement = toElement(nextSibling);
1313 Element* element = static_cast<Element *>(endNode); 1313 Element* element = toElement(endNode);
1314 Node* nextChild = nextElement->firstChild(); 1314 Node* nextChild = nextElement->firstChild();
1315 1315
1316 mergeIdenticalElements(element, nextElement); 1316 mergeIdenticalElements(element, nextElement);
1317 1317
1318 bool shouldUpdateStart = start.containerNode() == endNode; 1318 bool shouldUpdateStart = start.containerNode() == endNode;
1319 int endOffset = nextChild ? nextChild->nodeIndex() : nextElement->childN odes()->length(); 1319 int endOffset = nextChild ? nextChild->nodeIndex() : nextElement->childN odes()->length();
1320 updateStartEnd(shouldUpdateStart ? Position(nextElement, start.offsetInC ontainerNode(), Position::PositionIsOffsetInAnchor) : start, 1320 updateStartEnd(shouldUpdateStart ? Position(nextElement, start.offsetInC ontainerNode(), Position::PositionIsOffsetInAnchor) : start,
1321 Position(nextElement, endOffset, Position::PositionIsOffs etInAnchor)); 1321 Position(nextElement, endOffset, Position::PositionIsOffs etInAnchor));
1322 return true; 1322 return true;
1323 } 1323 }
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 String textToMove = nextText->data(); 1540 String textToMove = nextText->data();
1541 insertTextIntoNode(childText, childText->length(), textToMove); 1541 insertTextIntoNode(childText, childText->length(), textToMove);
1542 removeNode(next); 1542 removeNode(next);
1543 // don't move child node pointer. it may want to merge with more text no des. 1543 // don't move child node pointer. it may want to merge with more text no des.
1544 } 1544 }
1545 1545
1546 updateStartEnd(newStart, newEnd); 1546 updateStartEnd(newStart, newEnd);
1547 } 1547 }
1548 1548
1549 } 1549 }
OLDNEW
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/editing/CompositeEditCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698