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

Side by Side Diff: WebCore/editing/ApplyStyleCommand.cpp

Issue 3389031: Merge 67967 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/517/
Patch Set: Created 10 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/apply-style-text-decoration-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, 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 212 }
213 213
214 int fontStyle = getIdentifierValue(style, CSSPropertyFontStyle); 214 int fontStyle = getIdentifierValue(style, CSSPropertyFontStyle);
215 if (fontStyle == CSSValueItalic || fontStyle == CSSValueOblique) { 215 if (fontStyle == CSSValueItalic || fontStyle == CSSValueOblique) {
216 style->removeProperty(CSSPropertyFontStyle); 216 style->removeProperty(CSSPropertyFontStyle);
217 m_applyItalic = true; 217 m_applyItalic = true;
218 } 218 }
219 219
220 // Assuming reconcileTextDecorationProperties has been called, there should not be -webkit-text-decorations-in-effect 220 // Assuming reconcileTextDecorationProperties has been called, there should not be -webkit-text-decorations-in-effect
221 // Furthermore, text-decoration: none has been trimmed so that text-decorati on property is always a CSSValueList. 221 // Furthermore, text-decoration: none has been trimmed so that text-decorati on property is always a CSSValueList.
222 if (RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(CSSProperty TextDecoration)) { 222 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(CSSPropertyText Decoration);
223 ASSERT(textDecoration->isValueList()); 223 if (textDecoration && textDecoration->isValueList()) {
224 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, underline, (CSSPrimitiveV alue::createIdentifier(CSSValueUnderline))); 224 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, underline, (CSSPrimitiveV alue::createIdentifier(CSSValueUnderline)));
225 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, lineThrough, (CSSPrimitiv eValue::createIdentifier(CSSValueLineThrough))); 225 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, lineThrough, (CSSPrimitiv eValue::createIdentifier(CSSValueLineThrough)));
226 226
227 RefPtr<CSSValueList> newTextDecoration = static_cast<CSSValueList*>(text Decoration.get())->copy(); 227 RefPtr<CSSValueList> newTextDecoration = static_cast<CSSValueList*>(text Decoration.get())->copy();
228 if (newTextDecoration->removeAll(underline.get())) 228 if (newTextDecoration->removeAll(underline.get()))
229 m_applyUnderline = true; 229 m_applyUnderline = true;
230 if (newTextDecoration->removeAll(lineThrough.get())) 230 if (newTextDecoration->removeAll(lineThrough.get()))
231 m_applyLineThrough = true; 231 m_applyLineThrough = true;
232 232
233 // If trimTextDecorations, delete underline and line-through 233 // If trimTextDecorations, delete underline and line-through
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 // Avoid overriding existing styles of node 1380 // Avoid overriding existing styles of node
1381 if (existingInlineStyle) { 1381 if (existingInlineStyle) {
1382 newInlineStyle = existingInlineStyle->copy(); 1382 newInlineStyle = existingInlineStyle->copy();
1383 CSSMutableStyleDeclaration::const_iterator end = style->end(); 1383 CSSMutableStyleDeclaration::const_iterator end = style->end();
1384 for (CSSMutableStyleDeclaration::const_iterator it = style->begin(); it != end; ++it) { 1384 for (CSSMutableStyleDeclaration::const_iterator it = style->begin(); it != end; ++it) {
1385 ExceptionCode ec; 1385 ExceptionCode ec;
1386 if (!existingInlineStyle->getPropertyCSSValue(it->id())) 1386 if (!existingInlineStyle->getPropertyCSSValue(it->id()))
1387 newInlineStyle->setProperty(it->id(), it->value()->cssText() , it->isImportant(), ec); 1387 newInlineStyle->setProperty(it->id(), it->value()->cssText() , it->isImportant(), ec);
1388 1388
1389 // text-decorations adds up 1389 // text-decorations adds up
1390 if (it->id() == CSSPropertyTextDecoration) { 1390 if (it->id() == CSSPropertyTextDecoration && it->value()->isValu eList()) {
1391 ASSERT(it->value()->isValueList());
1392 RefPtr<CSSValue> textDecoration = newInlineStyle->getPropert yCSSValue(CSSPropertyTextDecoration); 1391 RefPtr<CSSValue> textDecoration = newInlineStyle->getPropert yCSSValue(CSSPropertyTextDecoration);
1393 if (textDecoration) { 1392 if (textDecoration && textDecoration->isValueList()) {
1394 ASSERT(textDecoration->isValueList());
1395 CSSValueList* textDecorationOfInlineStyle = static_cast< CSSValueList*>(textDecoration.get()); 1393 CSSValueList* textDecorationOfInlineStyle = static_cast< CSSValueList*>(textDecoration.get());
1396 CSSValueList* textDecorationOfStyleApplied = static_cast <CSSValueList*>(it->value()); 1394 CSSValueList* textDecorationOfStyleApplied = static_cast <CSSValueList*>(it->value());
1397 1395
1398 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, underline , (CSSPrimitiveValue::createIdentifier(CSSValueUnderline))); 1396 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, underline , (CSSPrimitiveValue::createIdentifier(CSSValueUnderline)));
1399 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, lineThrou gh, (CSSPrimitiveValue::createIdentifier(CSSValueLineThrough))); 1397 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, lineThrou gh, (CSSPrimitiveValue::createIdentifier(CSSValueLineThrough)));
1400 1398
1401 if (textDecorationOfStyleApplied->hasValue(underline.get ()) && !textDecorationOfInlineStyle->hasValue(underline.get())) 1399 if (textDecorationOfStyleApplied->hasValue(underline.get ()) && !textDecorationOfInlineStyle->hasValue(underline.get()))
1402 textDecorationOfInlineStyle->append(underline.get()) ; 1400 textDecorationOfInlineStyle->append(underline.get()) ;
1403 1401
1404 if (textDecorationOfStyleApplied->hasValue(lineThrough.g et()) && !textDecorationOfInlineStyle->hasValue(lineThrough.get())) 1402 if (textDecorationOfStyleApplied->hasValue(lineThrough.g et()) && !textDecorationOfInlineStyle->hasValue(lineThrough.get()))
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 } 1878 }
1881 else { 1879 else {
1882 child = child->nextSibling(); 1880 child = child->nextSibling();
1883 } 1881 }
1884 } 1882 }
1885 1883
1886 updateStartEnd(newStart, newEnd); 1884 updateStartEnd(newStart, newEnd);
1887 } 1885 }
1888 1886
1889 } 1887 }
OLDNEW
« no previous file with comments | « LayoutTests/editing/execCommand/apply-style-text-decoration-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698