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

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

Issue 300143012: Check nullable value before using it in ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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 | « LayoutTests/editing/execCommand/insert-html-to-document-element-crash-expected.txt ('k') | no next file » | 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 insertedNodes.willRemoveNodePreservingChildren(*element); 511 insertedNodes.willRemoveNodePreservingChildren(*element);
512 removeNodePreservingChildren(element); 512 removeNodePreservingChildren(element);
513 continue; 513 continue;
514 } 514 }
515 removeNodeAttribute(element, styleAttr); 515 removeNodeAttribute(element, styleAttr);
516 } else if (newInlineStyle->style()->propertyCount() != inlineStyle->prop ertyCount()) { 516 } else if (newInlineStyle->style()->propertyCount() != inlineStyle->prop ertyCount()) {
517 setNodeAttribute(element, styleAttr, AtomicString(newInlineStyle->st yle()->asText())); 517 setNodeAttribute(element, styleAttr, AtomicString(newInlineStyle->st yle()->asText()));
518 } 518 }
519 519
520 // FIXME: Tolerate differences in id, class, and style attributes. 520 // FIXME: Tolerate differences in id, class, and style attributes.
521 if (isNonTableCellHTMLBlockElement(element) && areIdenticalElements(elem ent, element->parentNode()) 521 if (element->parentNode() && isNonTableCellHTMLBlockElement(element) && areIdenticalElements(element, element->parentNode())
522 && VisiblePosition(firstPositionInNode(element->parentNode())) == Vi siblePosition(firstPositionInNode(element)) 522 && VisiblePosition(firstPositionInNode(element->parentNode())) == Vi siblePosition(firstPositionInNode(element))
523 && VisiblePosition(lastPositionInNode(element->parentNode())) == Vis iblePosition(lastPositionInNode(element))) { 523 && VisiblePosition(lastPositionInNode(element->parentNode())) == Vis iblePosition(lastPositionInNode(element))) {
524 insertedNodes.willRemoveNodePreservingChildren(*element); 524 insertedNodes.willRemoveNodePreservingChildren(*element);
525 removeNodePreservingChildren(element); 525 removeNodePreservingChildren(element);
526 continue; 526 continue;
527 } 527 }
528 528
529 if (element->parentNode() && element->parentNode()->rendererIsRichlyEdit able()) 529 if (element->parentNode() && element->parentNode()->rendererIsRichlyEdit able())
530 removeNodeAttribute(element, contenteditableAttr); 530 removeNodeAttribute(element, contenteditableAttr);
531 531
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); 1497 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get());
1498 1498
1499 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d); 1499 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d);
1500 1500
1501 setEndingSelection(selectionAfterReplace); 1501 setEndingSelection(selectionAfterReplace);
1502 1502
1503 return true; 1503 return true;
1504 } 1504 }
1505 1505
1506 } // namespace WebCore 1506 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/execCommand/insert-html-to-document-element-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698