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

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

Issue 23600068: ContentEditable plaintext-only crash fix. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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/crash-on-plaintext-createLink-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, 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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 continue; 752 continue;
753 753
754 if (!node->rendererIsRichlyEditable() && node->isHTMLElement()) { 754 if (!node->rendererIsRichlyEditable() && node->isHTMLElement()) {
755 // This is a plaintext-only region. Only proceed if it's fully selec ted. 755 // This is a plaintext-only region. Only proceed if it's fully selec ted.
756 // pastEndNode is the node after the last fully selected node, so if it's inside node then 756 // pastEndNode is the node after the last fully selected node, so if it's inside node then
757 // node isn't fully selected. 757 // node isn't fully selected.
758 if (pastEndNode && pastEndNode->isDescendantOf(node.get())) 758 if (pastEndNode && pastEndNode->isDescendantOf(node.get()))
759 break; 759 break;
760 // Add to this element's inline style and skip over its contents. 760 // Add to this element's inline style and skip over its contents.
761 HTMLElement* element = toHTMLElement(node.get()); 761 HTMLElement* element = toHTMLElement(node.get());
762 next = NodeTraversal::nextSkippingChildren(node.get());
763 if (!style->style())
764 continue;
762 RefPtr<MutableStylePropertySet> inlineStyle = copyStyleOrCreateEmpty (element->inlineStyle()); 765 RefPtr<MutableStylePropertySet> inlineStyle = copyStyleOrCreateEmpty (element->inlineStyle());
763 inlineStyle->mergeAndOverrideOnConflict(style->style()); 766 inlineStyle->mergeAndOverrideOnConflict(style->style());
764 setNodeAttribute(element, styleAttr, inlineStyle->asText()); 767 setNodeAttribute(element, styleAttr, inlineStyle->asText());
765 next = NodeTraversal::nextSkippingChildren(node.get());
766 continue; 768 continue;
767 } 769 }
768 770
769 if (isBlock(node.get())) 771 if (isBlock(node.get()))
770 continue; 772 continue;
771 773
772 if (node->childNodeCount()) { 774 if (node->childNodeCount()) {
773 if (node->contains(pastEndNode.get()) || containsNonEditableRegion(n ode.get()) || !node->parentNode()->rendererIsEditable()) 775 if (node->contains(pastEndNode.get()) || containsNonEditableRegion(n ode.get()) || !node->parentNode()->rendererIsEditable())
774 continue; 776 continue;
775 if (editingIgnoresContent(node.get())) { 777 if (editingIgnoresContent(node.get())) {
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 String textToMove = nextText->data(); 1543 String textToMove = nextText->data();
1542 insertTextIntoNode(childText, childText->length(), textToMove); 1544 insertTextIntoNode(childText, childText->length(), textToMove);
1543 removeNode(next); 1545 removeNode(next);
1544 // don't move child node pointer. it may want to merge with more text no des. 1546 // don't move child node pointer. it may want to merge with more text no des.
1545 } 1547 }
1546 1548
1547 updateStartEnd(newStart, newEnd); 1549 updateStartEnd(newStart, newEnd);
1548 } 1550 }
1549 1551
1550 } 1552 }
OLDNEW
« no previous file with comments | « LayoutTests/editing/execCommand/crash-on-plaintext-createLink-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698