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

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

Issue 181103004: Fixing crash when executing ApplyStyle command. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix for crash Created 6 years, 9 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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 805
806 Node* pastEndNode = NodeTraversal::nextSkippingChildren(*runEnd); 806 Node* pastEndNode = NodeTraversal::nextSkippingChildren(*runEnd);
807 if (!shouldApplyInlineStyleToRun(style, runStart, pastEndNode)) 807 if (!shouldApplyInlineStyleToRun(style, runStart, pastEndNode))
808 continue; 808 continue;
809 809
810 runs.append(InlineRunToApplyStyle(runStart, runEnd, pastEndNode)); 810 runs.append(InlineRunToApplyStyle(runStart, runEnd, pastEndNode));
811 } 811 }
812 812
813 for (size_t i = 0; i < runs.size(); i++) { 813 for (size_t i = 0; i < runs.size(); i++) {
814 removeConflictingInlineStyleFromRun(style, runs[i].start, runs[i].end, r uns[i].pastEndNode); 814 removeConflictingInlineStyleFromRun(style, runs[i].start, runs[i].end, r uns[i].pastEndNode);
815 runs[i].positionForStyleComputation = positionToComputeInlineStyleChange (runs[i].start, runs[i].dummyElement); 815 if (runs[i].startAndEndAreStillInDocument())
816 runs[i].positionForStyleComputation = positionToComputeInlineStyleCh ange(runs[i].start, runs[i].dummyElement);
816 } 817 }
817 818
818 document().updateLayoutIgnorePendingStylesheets(); 819 document().updateLayoutIgnorePendingStylesheets();
819 820
820 for (size_t i = 0; i < runs.size(); i++) 821 for (size_t i = 0; i < runs.size(); i++) {
821 runs[i].change = StyleChange(style, runs[i].positionForStyleComputation) ; 822 if (!runs[i].positionForStyleComputation.isNull())
yosin_UTC9 2014/03/03 02:06:45 nit: We can use |Position::isNotNull()| here.
arpitab_ 2014/03/03 06:00:00 Done.
823 runs[i].change = StyleChange(style, runs[i].positionForStyleComputat ion);
824 }
822 825
823 for (size_t i = 0; i < runs.size(); i++) { 826 for (size_t i = 0; i < runs.size(); i++) {
824 InlineRunToApplyStyle& run = runs[i]; 827 InlineRunToApplyStyle& run = runs[i];
825 if (run.dummyElement) 828 if (run.dummyElement)
826 removeNode(run.dummyElement); 829 removeNode(run.dummyElement);
827 if (run.startAndEndAreStillInDocument()) 830 if (run.startAndEndAreStillInDocument())
828 applyInlineStyleChange(run.start.release(), run.end.release(), run.c hange, AddStyledElement); 831 applyInlineStyleChange(run.start.release(), run.end.release(), run.c hange, AddStyledElement);
829 } 832 }
830 } 833 }
831 834
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 String textToMove = nextText->data(); 1542 String textToMove = nextText->data();
1540 insertTextIntoNode(childText, childText->length(), textToMove); 1543 insertTextIntoNode(childText, childText->length(), textToMove);
1541 removeNode(next); 1544 removeNode(next);
1542 // don't move child node pointer. it may want to merge with more text no des. 1545 // don't move child node pointer. it may want to merge with more text no des.
1543 } 1546 }
1544 1547
1545 updateStartEnd(newStart, newEnd); 1548 updateStartEnd(newStart, newEnd);
1546 } 1549 }
1547 1550
1548 } 1551 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698