| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009 Apple Computer, Inc. | 2 * Copyright (C) 2007, 2008, 2009 Apple Computer, Inc. |
| 3 * Copyright (C) 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 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 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 break; | 1133 break; |
| 1134 if (node.isStyledElement() && !isMailHTMLBlockquoteElement(&node)) { | 1134 if (node.isStyledElement() && !isMailHTMLBlockquoteElement(&node)) { |
| 1135 wrappingStyle->mergeInlineAndImplicitStyleOfElement(toElement(&node)
, EditingStyle::DoNotOverrideValues, | 1135 wrappingStyle->mergeInlineAndImplicitStyleOfElement(toElement(&node)
, EditingStyle::DoNotOverrideValues, |
| 1136 EditingStyle::EditingPropertiesInEffect); | 1136 EditingStyle::EditingPropertiesInEffect); |
| 1137 } | 1137 } |
| 1138 } | 1138 } |
| 1139 | 1139 |
| 1140 return wrappingStyle; | 1140 return wrappingStyle; |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 static CSSValueList* mergeTextDecorationValues(const CSSValueList& mergedValue,
const CSSValueList& valueToMerge) | 1143 static const CSSValueList& mergeTextDecorationValues(const CSSValueList& mergedV
alue, const CSSValueList& valueToMerge) |
| 1144 { | 1144 { |
| 1145 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, underline, (CSSPrimitiveValue::create
Identifier(CSSValueUnderline))); | 1145 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, underline, (CSSPrimitiveValue::create
Identifier(CSSValueUnderline))); |
| 1146 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, lineThrough, (CSSPrimitiveValue::crea
teIdentifier(CSSValueLineThrough))); | 1146 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, lineThrough, (CSSPrimitiveValue::crea
teIdentifier(CSSValueLineThrough))); |
| 1147 CSSValueList* result = mergedValue.copy(); | 1147 CSSValueList& result = *mergedValue.copy(); |
| 1148 if (valueToMerge.hasValue(underline) && !mergedValue.hasValue(underline)) | 1148 if (valueToMerge.hasValue(underline) && !mergedValue.hasValue(underline)) |
| 1149 result->append(underline); | 1149 result.append(underline); |
| 1150 | 1150 |
| 1151 if (valueToMerge.hasValue(lineThrough) && !mergedValue.hasValue(lineThrough)
) | 1151 if (valueToMerge.hasValue(lineThrough) && !mergedValue.hasValue(lineThrough)
) |
| 1152 result->append(lineThrough); | 1152 result.append(lineThrough); |
| 1153 | 1153 |
| 1154 return result; | 1154 return result; |
| 1155 } | 1155 } |
| 1156 | 1156 |
| 1157 void EditingStyle::mergeStyle(const StylePropertySet* style, CSSPropertyOverride
Mode mode) | 1157 void EditingStyle::mergeStyle(const StylePropertySet* style, CSSPropertyOverride
Mode mode) |
| 1158 { | 1158 { |
| 1159 if (!style) | 1159 if (!style) |
| 1160 return; | 1160 return; |
| 1161 | 1161 |
| 1162 if (!m_mutableStyle) { | 1162 if (!m_mutableStyle) { |
| 1163 m_mutableStyle = style->mutableCopy(); | 1163 m_mutableStyle = style->mutableCopy(); |
| 1164 return; | 1164 return; |
| 1165 } | 1165 } |
| 1166 | 1166 |
| 1167 unsigned propertyCount = style->propertyCount(); | 1167 unsigned propertyCount = style->propertyCount(); |
| 1168 for (unsigned i = 0; i < propertyCount; ++i) { | 1168 for (unsigned i = 0; i < propertyCount; ++i) { |
| 1169 StylePropertySet::PropertyReference property = style->propertyAt(i); | 1169 StylePropertySet::PropertyReference property = style->propertyAt(i); |
| 1170 const CSSValue* value = m_mutableStyle->getPropertyCSSValue(property.id(
)); | 1170 const CSSValue* value = m_mutableStyle->getPropertyCSSValue(property.id(
)); |
| 1171 | 1171 |
| 1172 // text decorations never override values | 1172 // text decorations never override values |
| 1173 if ((property.id() == textDecorationPropertyForEditing() || property.id(
) == CSSPropertyWebkitTextDecorationsInEffect) && property.value().isValueList()
&& value) { | 1173 if ((property.id() == textDecorationPropertyForEditing() || property.id(
) == CSSPropertyWebkitTextDecorationsInEffect) && property.value().isValueList()
&& value) { |
| 1174 if (value->isValueList()) { | 1174 if (value->isValueList()) { |
| 1175 CSSValueList* result = mergeTextDecorationValues(*toCSSValueList
(value), toCSSValueList(property.value())); | 1175 const CSSValueList& result = mergeTextDecorationValues(*toCSSVal
ueList(value), toCSSValueList(property.value())); |
| 1176 m_mutableStyle->setProperty(property.id(), result, property.isIm
portant()); | 1176 m_mutableStyle->setProperty(property.id(), result, property.isIm
portant()); |
| 1177 continue; | 1177 continue; |
| 1178 } | 1178 } |
| 1179 value = nullptr; // text-decoration: none is equivalent to not havin
g the property | 1179 value = nullptr; // text-decoration: none is equivalent to not havin
g the property |
| 1180 } | 1180 } |
| 1181 | 1181 |
| 1182 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) | 1182 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) |
| 1183 m_mutableStyle->setProperty(property.toCSSProperty()); | 1183 m_mutableStyle->setProperty(property.toCSSProperty()); |
| 1184 } | 1184 } |
| 1185 } | 1185 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1300 if (layoutObject && layoutObject->isBox()) { | 1300 if (layoutObject && layoutObject->isBox()) { |
| 1301 LayoutBox* layoutBox = toLayoutBox(layoutObject); | 1301 LayoutBox* layoutBox = toLayoutBox(layoutObject); |
| 1302 | 1302 |
| 1303 x -= layoutBox->marginLeft(); | 1303 x -= layoutBox->marginLeft(); |
| 1304 y -= layoutBox->marginTop(); | 1304 y -= layoutBox->marginTop(); |
| 1305 | 1305 |
| 1306 m_mutableStyle->setProperty(CSSPropertyBoxSizing, CSSValueBorderBox); | 1306 m_mutableStyle->setProperty(CSSPropertyBoxSizing, CSSValueBorderBox); |
| 1307 } | 1307 } |
| 1308 | 1308 |
| 1309 m_mutableStyle->setProperty(CSSPropertyPosition, CSSValueAbsolute); | 1309 m_mutableStyle->setProperty(CSSPropertyPosition, CSSValueAbsolute); |
| 1310 m_mutableStyle->setProperty(CSSPropertyLeft, CSSPrimitiveValue::create(x, CS
SPrimitiveValue::UnitType::Pixels)); | 1310 m_mutableStyle->setProperty(CSSPropertyLeft, *CSSPrimitiveValue::create(x, C
SSPrimitiveValue::UnitType::Pixels)); |
| 1311 m_mutableStyle->setProperty(CSSPropertyTop, CSSPrimitiveValue::create(y, CSS
PrimitiveValue::UnitType::Pixels)); | 1311 m_mutableStyle->setProperty(CSSPropertyTop, *CSSPrimitiveValue::create(y, CS
SPrimitiveValue::UnitType::Pixels)); |
| 1312 m_mutableStyle->setProperty(CSSPropertyWidth, CSSPrimitiveValue::create(widt
h, CSSPrimitiveValue::UnitType::Pixels)); | 1312 m_mutableStyle->setProperty(CSSPropertyWidth, *CSSPrimitiveValue::create(wid
th, CSSPrimitiveValue::UnitType::Pixels)); |
| 1313 m_mutableStyle->setProperty(CSSPropertyHeight, CSSPrimitiveValue::create(hei
ght, CSSPrimitiveValue::UnitType::Pixels)); | 1313 m_mutableStyle->setProperty(CSSPropertyHeight, *CSSPrimitiveValue::create(he
ight, CSSPrimitiveValue::UnitType::Pixels)); |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 void EditingStyle::forceInline() | 1316 void EditingStyle::forceInline() |
| 1317 { | 1317 { |
| 1318 if (!m_mutableStyle) | 1318 if (!m_mutableStyle) |
| 1319 m_mutableStyle = MutableStylePropertySet::create(HTMLQuirksMode); | 1319 m_mutableStyle = MutableStylePropertySet::create(HTMLQuirksMode); |
| 1320 const bool propertyIsImportant = true; | 1320 const bool propertyIsImportant = true; |
| 1321 m_mutableStyle->setProperty(CSSPropertyDisplay, CSSValueInline, propertyIsIm
portant); | 1321 m_mutableStyle->setProperty(CSSPropertyDisplay, CSSValueInline, propertyIsIm
portant); |
| 1322 } | 1322 } |
| 1323 | 1323 |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 { | 1757 { |
| 1758 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1758 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1759 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration
::create(ancestor); | 1759 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration
::create(ancestor); |
| 1760 if (!hasTransparentBackgroundColor(ancestorStyle)) | 1760 if (!hasTransparentBackgroundColor(ancestorStyle)) |
| 1761 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1761 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
| 1762 } | 1762 } |
| 1763 return nullptr; | 1763 return nullptr; |
| 1764 } | 1764 } |
| 1765 | 1765 |
| 1766 } // namespace blink | 1766 } // namespace blink |
| OLD | NEW |