Chromium Code Reviews| 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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 571 extractFontSizeDelta(); | 571 extractFontSizeDelta(); |
| 572 } | 572 } |
| 573 | 573 |
| 574 void EditingStyle::clear() | 574 void EditingStyle::clear() |
| 575 { | 575 { |
| 576 m_mutableStyle.clear(); | 576 m_mutableStyle.clear(); |
| 577 m_shouldUseFixedDefaultFontSize = false; | 577 m_shouldUseFixedDefaultFontSize = false; |
| 578 m_fontSizeDelta = NoFontDelta; | 578 m_fontSizeDelta = NoFontDelta; |
| 579 } | 579 } |
| 580 | 580 |
| 581 PassRefPtr<EditingStyle> EditingStyle::copy() const | 581 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::copy() const |
| 582 { | 582 { |
| 583 RefPtr<EditingStyle> copy = EditingStyle::create(); | 583 RefPtrWillBeRawPtr<EditingStyle> copy = EditingStyle::create(); |
| 584 if (m_mutableStyle) | 584 if (m_mutableStyle) |
| 585 copy->m_mutableStyle = m_mutableStyle->mutableCopy(); | 585 copy->m_mutableStyle = m_mutableStyle->mutableCopy(); |
| 586 copy->m_shouldUseFixedDefaultFontSize = m_shouldUseFixedDefaultFontSize; | 586 copy->m_shouldUseFixedDefaultFontSize = m_shouldUseFixedDefaultFontSize; |
| 587 copy->m_fontSizeDelta = m_fontSizeDelta; | 587 copy->m_fontSizeDelta = m_fontSizeDelta; |
| 588 return copy; | 588 return copy; |
| 589 } | 589 } |
| 590 | 590 |
| 591 PassRefPtr<EditingStyle> EditingStyle::extractAndRemoveBlockProperties() | 591 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::extractAndRemoveBlockProperti es() |
| 592 { | 592 { |
| 593 RefPtr<EditingStyle> blockProperties = EditingStyle::create(); | 593 RefPtrWillBeRawPtr<EditingStyle> blockProperties = EditingStyle::create(); |
| 594 if (!m_mutableStyle) | 594 if (!m_mutableStyle) |
| 595 return blockProperties; | 595 return blockProperties; |
| 596 | 596 |
| 597 blockProperties->m_mutableStyle = m_mutableStyle->copyBlockProperties(); | 597 blockProperties->m_mutableStyle = m_mutableStyle->copyBlockProperties(); |
| 598 m_mutableStyle->removeBlockProperties(); | 598 m_mutableStyle->removeBlockProperties(); |
| 599 | 599 |
| 600 return blockProperties; | 600 return blockProperties; |
| 601 } | 601 } |
| 602 | 602 |
| 603 PassRefPtr<EditingStyle> EditingStyle::extractAndRemoveTextDirection() | 603 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::extractAndRemoveTextDirection () |
| 604 { | 604 { |
| 605 RefPtr<EditingStyle> textDirection = EditingStyle::create(); | 605 RefPtrWillBeRawPtr<EditingStyle> textDirection = EditingStyle::create(); |
| 606 textDirection->m_mutableStyle = MutableStylePropertySet::create(); | 606 textDirection->m_mutableStyle = MutableStylePropertySet::create(); |
| 607 textDirection->m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueE mbed, m_mutableStyle->propertyIsImportant(CSSPropertyUnicodeBidi)); | 607 textDirection->m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueE mbed, m_mutableStyle->propertyIsImportant(CSSPropertyUnicodeBidi)); |
| 608 textDirection->m_mutableStyle->setProperty(CSSPropertyDirection, m_mutableSt yle->getPropertyValue(CSSPropertyDirection), | 608 textDirection->m_mutableStyle->setProperty(CSSPropertyDirection, m_mutableSt yle->getPropertyValue(CSSPropertyDirection), |
| 609 m_mutableStyle->propertyIsImportant(CSSPropertyDirection)); | 609 m_mutableStyle->propertyIsImportant(CSSPropertyDirection)); |
| 610 | 610 |
| 611 m_mutableStyle->removeProperty(CSSPropertyUnicodeBidi); | 611 m_mutableStyle->removeProperty(CSSPropertyUnicodeBidi); |
| 612 m_mutableStyle->removeProperty(CSSPropertyDirection); | 612 m_mutableStyle->removeProperty(CSSPropertyDirection); |
| 613 | 613 |
| 614 return textDirection; | 614 return textDirection; |
| 615 } | 615 } |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 937 } | 937 } |
| 938 | 938 |
| 939 void EditingStyle::prepareToApplyAt(const Position& position, ShouldPreserveWrit ingDirection shouldPreserveWritingDirection) | 939 void EditingStyle::prepareToApplyAt(const Position& position, ShouldPreserveWrit ingDirection shouldPreserveWritingDirection) |
| 940 { | 940 { |
| 941 if (!m_mutableStyle) | 941 if (!m_mutableStyle) |
| 942 return; | 942 return; |
| 943 | 943 |
| 944 // ReplaceSelectionCommand::handleStyleSpans() requires that this function o nly removes the editing style. | 944 // ReplaceSelectionCommand::handleStyleSpans() requires that this function o nly removes the editing style. |
| 945 // If this function was modified in the future to delete all redundant prope rties, then add a boolean value to indicate | 945 // If this function was modified in the future to delete all redundant prope rties, then add a boolean value to indicate |
| 946 // which one of editingStyleAtPosition or computedStyle is called. | 946 // which one of editingStyleAtPosition or computedStyle is called. |
| 947 RefPtr<EditingStyle> editingStyleAtPosition = EditingStyle::create(position, EditingPropertiesInEffect); | 947 RefPtrWillBeRawPtr<EditingStyle> editingStyleAtPosition = EditingStyle::crea te(position, EditingPropertiesInEffect); |
| 948 StylePropertySet* styleAtPosition = editingStyleAtPosition->m_mutableStyle.g et(); | 948 StylePropertySet* styleAtPosition = editingStyleAtPosition->m_mutableStyle.g et(); |
| 949 | 949 |
| 950 RefPtrWillBeRawPtr<CSSValue> unicodeBidi = nullptr; | 950 RefPtrWillBeRawPtr<CSSValue> unicodeBidi = nullptr; |
| 951 RefPtrWillBeRawPtr<CSSValue> direction = nullptr; | 951 RefPtrWillBeRawPtr<CSSValue> direction = nullptr; |
| 952 if (shouldPreserveWritingDirection == PreserveWritingDirection) { | 952 if (shouldPreserveWritingDirection == PreserveWritingDirection) { |
| 953 unicodeBidi = m_mutableStyle->getPropertyCSSValue(CSSPropertyUnicodeBidi ); | 953 unicodeBidi = m_mutableStyle->getPropertyCSSValue(CSSPropertyUnicodeBidi ); |
| 954 direction = m_mutableStyle->getPropertyCSSValue(CSSPropertyDirection); | 954 direction = m_mutableStyle->getPropertyCSSValue(CSSPropertyDirection); |
| 955 } | 955 } |
| 956 | 956 |
| 957 m_mutableStyle->removeEquivalentProperties(styleAtPosition); | 957 m_mutableStyle->removeEquivalentProperties(styleAtPosition); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 970 m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, toCSSPrimitiveValue( unicodeBidi.get())->getValueID()); | 970 m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, toCSSPrimitiveValue( unicodeBidi.get())->getValueID()); |
| 971 if (direction && direction->isPrimitiveValue()) | 971 if (direction && direction->isPrimitiveValue()) |
| 972 m_mutableStyle->setProperty(CSSPropertyDirection, toCSSPrimitiveValu e(direction.get())->getValueID()); | 972 m_mutableStyle->setProperty(CSSPropertyDirection, toCSSPrimitiveValu e(direction.get())->getValueID()); |
| 973 } | 973 } |
| 974 } | 974 } |
| 975 | 975 |
| 976 void EditingStyle::mergeTypingStyle(Document* document) | 976 void EditingStyle::mergeTypingStyle(Document* document) |
| 977 { | 977 { |
| 978 ASSERT(document); | 978 ASSERT(document); |
| 979 | 979 |
| 980 RefPtr<EditingStyle> typingStyle = document->frame()->selection().typingStyl e(); | 980 RefPtrWillBeRawPtr<EditingStyle> typingStyle = document->frame()->selection( ).typingStyle(); |
| 981 if (!typingStyle || typingStyle == this) | 981 if (!typingStyle || typingStyle == this) |
| 982 return; | 982 return; |
| 983 | 983 |
| 984 mergeStyle(typingStyle->style(), OverrideValues); | 984 mergeStyle(typingStyle->style(), OverrideValues); |
| 985 } | 985 } |
| 986 | 986 |
| 987 void EditingStyle::mergeInlineStyleOfElement(Element* element, CSSPropertyOverri deMode mode, PropertiesToInclude propertiesToInclude) | 987 void EditingStyle::mergeInlineStyleOfElement(Element* element, CSSPropertyOverri deMode mode, PropertiesToInclude propertiesToInclude) |
| 988 { | 988 { |
| 989 ASSERT(element); | 989 ASSERT(element); |
| 990 if (!element->inlineStyle()) | 990 if (!element->inlineStyle()) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1022 case EditingStyle::OnlyEditingInheritableProperties: | 1022 case EditingStyle::OnlyEditingInheritableProperties: |
| 1023 return copyEditingProperties(style, OnlyInheritableEditingProperties); | 1023 return copyEditingProperties(style, OnlyInheritableEditingProperties); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 ASSERT_NOT_REACHED(); | 1026 ASSERT_NOT_REACHED(); |
| 1027 return nullptr; | 1027 return nullptr; |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 void EditingStyle::mergeInlineAndImplicitStyleOfElement(Element* element, CSSPro pertyOverrideMode mode, PropertiesToInclude propertiesToInclude) | 1030 void EditingStyle::mergeInlineAndImplicitStyleOfElement(Element* element, CSSPro pertyOverrideMode mode, PropertiesToInclude propertiesToInclude) |
| 1031 { | 1031 { |
| 1032 RefPtr<EditingStyle> styleFromRules = EditingStyle::create(); | 1032 RefPtrWillBeRawPtr<EditingStyle> styleFromRules = EditingStyle::create(); |
| 1033 styleFromRules->mergeStyleFromRulesForSerialization(element); | 1033 styleFromRules->mergeStyleFromRulesForSerialization(element); |
| 1034 styleFromRules->m_mutableStyle = extractEditingProperties(styleFromRules->m_ mutableStyle.get(), propertiesToInclude); | 1034 styleFromRules->m_mutableStyle = extractEditingProperties(styleFromRules->m_ mutableStyle.get(), propertiesToInclude); |
| 1035 mergeStyle(styleFromRules->m_mutableStyle.get(), mode); | 1035 mergeStyle(styleFromRules->m_mutableStyle.get(), mode); |
| 1036 | 1036 |
| 1037 mergeInlineStyleOfElement(element, mode, propertiesToInclude); | 1037 mergeInlineStyleOfElement(element, mode, propertiesToInclude); |
| 1038 | 1038 |
| 1039 const WillBeHeapVector<OwnPtrWillBeMember<HTMLElementEquivalent> >& elementE quivalents = htmlElementEquivalents(); | 1039 const WillBeHeapVector<OwnPtrWillBeMember<HTMLElementEquivalent> >& elementE quivalents = htmlElementEquivalents(); |
| 1040 for (size_t i = 0; i < elementEquivalents.size(); ++i) { | 1040 for (size_t i = 0; i < elementEquivalents.size(); ++i) { |
| 1041 if (elementMatchesAndPropertyIsNotInInlineStyleDecl(elementEquivalents[i ].get(), element, mode, m_mutableStyle.get())) | 1041 if (elementMatchesAndPropertyIsNotInInlineStyleDecl(elementEquivalents[i ].get(), element, mode, m_mutableStyle.get())) |
| 1042 elementEquivalents[i]->addToStyle(element, this); | 1042 elementEquivalents[i]->addToStyle(element, this); |
| 1043 } | 1043 } |
| 1044 | 1044 |
| 1045 const WillBeHeapVector<OwnPtrWillBeMember<HTMLAttributeEquivalent> >& attrib uteEquivalents = htmlAttributeEquivalents(); | 1045 const WillBeHeapVector<OwnPtrWillBeMember<HTMLAttributeEquivalent> >& attrib uteEquivalents = htmlAttributeEquivalents(); |
| 1046 for (size_t i = 0; i < attributeEquivalents.size(); ++i) { | 1046 for (size_t i = 0; i < attributeEquivalents.size(); ++i) { |
| 1047 if (attributeEquivalents[i]->attributeName() == HTMLNames::dirAttr) | 1047 if (attributeEquivalents[i]->attributeName() == HTMLNames::dirAttr) |
| 1048 continue; // We don't want to include directionality | 1048 continue; // We don't want to include directionality |
| 1049 if (elementMatchesAndPropertyIsNotInInlineStyleDecl(attributeEquivalents [i].get(), element, mode, m_mutableStyle.get())) | 1049 if (elementMatchesAndPropertyIsNotInInlineStyleDecl(attributeEquivalents [i].get(), element, mode, m_mutableStyle.get())) |
| 1050 attributeEquivalents[i]->addToStyle(element, this); | 1050 attributeEquivalents[i]->addToStyle(element, this); |
| 1051 } | 1051 } |
| 1052 } | 1052 } |
| 1053 | 1053 |
| 1054 PassRefPtr<EditingStyle> EditingStyle::wrappingStyleForSerialization(Node* conte xt, bool shouldAnnotate) | 1054 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::wrappingStyleForSerialization (Node* context, bool shouldAnnotate) |
| 1055 { | 1055 { |
| 1056 RefPtr<EditingStyle> wrappingStyle; | 1056 RefPtrWillBeRawPtr<EditingStyle> wrappingStyle; |
|
haraken
2014/05/26 02:36:12
= nullptr;
sof
2014/05/28 08:31:35
Done.
| |
| 1057 if (shouldAnnotate) { | 1057 if (shouldAnnotate) { |
| 1058 wrappingStyle = EditingStyle::create(context, EditingStyle::EditingPrope rtiesInEffect); | 1058 wrappingStyle = EditingStyle::create(context, EditingStyle::EditingPrope rtiesInEffect); |
| 1059 | 1059 |
| 1060 // Styles that Mail blockquotes contribute should only be placed on the Mail blockquote, | 1060 // Styles that Mail blockquotes contribute should only be placed on the Mail blockquote, |
| 1061 // to help us differentiate those styles from ones that the user has app lied. | 1061 // to help us differentiate those styles from ones that the user has app lied. |
| 1062 // This helps us get the color of content pasted into blockquotes right. | 1062 // This helps us get the color of content pasted into blockquotes right. |
| 1063 wrappingStyle->removeStyleAddedByNode(enclosingNodeOfType(firstPositionI nOrBeforeNode(context), isMailBlockquote, CanCrossEditingBoundary)); | 1063 wrappingStyle->removeStyleAddedByNode(enclosingNodeOfType(firstPositionI nOrBeforeNode(context), isMailBlockquote, CanCrossEditingBoundary)); |
| 1064 | 1064 |
| 1065 // Call collapseTextDecorationProperties first or otherwise it'll copy t he value over from in-effect to text-decorations. | 1065 // Call collapseTextDecorationProperties first or otherwise it'll copy t he value over from in-effect to text-decorations. |
| 1066 wrappingStyle->collapseTextDecorationProperties(); | 1066 wrappingStyle->collapseTextDecorationProperties(); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1196 ASSERT(element); | 1196 ASSERT(element); |
| 1197 if (!m_mutableStyle) | 1197 if (!m_mutableStyle) |
| 1198 return; | 1198 return; |
| 1199 | 1199 |
| 1200 // 1. Remove style from matched rules because style remain without repeating it in inline style declaration | 1200 // 1. Remove style from matched rules because style remain without repeating it in inline style declaration |
| 1201 RefPtrWillBeRawPtr<MutableStylePropertySet> styleFromMatchedRules = styleFro mMatchedRulesForElement(element, StyleResolver::AllButEmptyCSSRules); | 1201 RefPtrWillBeRawPtr<MutableStylePropertySet> styleFromMatchedRules = styleFro mMatchedRulesForElement(element, StyleResolver::AllButEmptyCSSRules); |
| 1202 if (styleFromMatchedRules && !styleFromMatchedRules->isEmpty()) | 1202 if (styleFromMatchedRules && !styleFromMatchedRules->isEmpty()) |
| 1203 m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), styleFromMatch edRules->ensureCSSStyleDeclaration()); | 1203 m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), styleFromMatch edRules->ensureCSSStyleDeclaration()); |
| 1204 | 1204 |
| 1205 // 2. Remove style present in context and not overriden by matched rules. | 1205 // 2. Remove style present in context and not overriden by matched rules. |
| 1206 RefPtr<EditingStyle> computedStyle = EditingStyle::create(context, EditingPr opertiesInEffect); | 1206 RefPtrWillBeRawPtr<EditingStyle> computedStyle = EditingStyle::create(contex t, EditingPropertiesInEffect); |
| 1207 if (computedStyle->m_mutableStyle) { | 1207 if (computedStyle->m_mutableStyle) { |
| 1208 if (!computedStyle->m_mutableStyle->getPropertyCSSValue(CSSPropertyBackg roundColor)) | 1208 if (!computedStyle->m_mutableStyle->getPropertyCSSValue(CSSPropertyBackg roundColor)) |
| 1209 computedStyle->m_mutableStyle->setProperty(CSSPropertyBackgroundColo r, CSSValueTransparent); | 1209 computedStyle->m_mutableStyle->setProperty(CSSPropertyBackgroundColo r, CSSValueTransparent); |
| 1210 | 1210 |
| 1211 removePropertiesInStyle(computedStyle->m_mutableStyle.get(), styleFromMa tchedRules.get()); | 1211 removePropertiesInStyle(computedStyle->m_mutableStyle.get(), styleFromMa tchedRules.get()); |
| 1212 m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), computedStyle- >m_mutableStyle->ensureCSSStyleDeclaration()); | 1212 m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), computedStyle- >m_mutableStyle->ensureCSSStyleDeclaration()); |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 // 3. If this element is a span and has display: inline or float: none, remo ve them unless they are overriden by rules. | 1215 // 3. If this element is a span and has display: inline or float: none, remo ve them unless they are overriden by rules. |
| 1216 // These rules are added by serialization code to wrap text nodes. | 1216 // These rules are added by serialization code to wrap text nodes. |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 1242 | 1242 |
| 1243 int EditingStyle::legacyFontSize(Document* document) const | 1243 int EditingStyle::legacyFontSize(Document* document) const |
| 1244 { | 1244 { |
| 1245 RefPtrWillBeRawPtr<CSSValue> cssValue = m_mutableStyle->getPropertyCSSValue( CSSPropertyFontSize); | 1245 RefPtrWillBeRawPtr<CSSValue> cssValue = m_mutableStyle->getPropertyCSSValue( CSSPropertyFontSize); |
| 1246 if (!cssValue || !cssValue->isPrimitiveValue()) | 1246 if (!cssValue || !cssValue->isPrimitiveValue()) |
| 1247 return 0; | 1247 return 0; |
| 1248 return legacyFontSizeFromCSSValue(document, toCSSPrimitiveValue(cssValue.get ()), | 1248 return legacyFontSizeFromCSSValue(document, toCSSPrimitiveValue(cssValue.get ()), |
| 1249 m_shouldUseFixedDefaultFontSize, AlwaysUseLegacyFontSize); | 1249 m_shouldUseFixedDefaultFontSize, AlwaysUseLegacyFontSize); |
| 1250 } | 1250 } |
| 1251 | 1251 |
| 1252 PassRefPtr<EditingStyle> EditingStyle::styleAtSelectionStart(const VisibleSelect ion& selection, bool shouldUseBackgroundColorInEffect) | 1252 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::styleAtSelectionStart(const V isibleSelection& selection, bool shouldUseBackgroundColorInEffect) |
| 1253 { | 1253 { |
| 1254 if (selection.isNone()) | 1254 if (selection.isNone()) |
| 1255 return nullptr; | 1255 return nullptr; |
| 1256 | 1256 |
| 1257 Position position = adjustedSelectionStartForStyleComputation(selection); | 1257 Position position = adjustedSelectionStartForStyleComputation(selection); |
| 1258 | 1258 |
| 1259 // If the pos is at the end of a text node, then this node is not fully sele cted. | 1259 // If the pos is at the end of a text node, then this node is not fully sele cted. |
| 1260 // Move it to the next deep equivalent position to avoid removing the style from this node. | 1260 // Move it to the next deep equivalent position to avoid removing the style from this node. |
| 1261 // e.g. if pos was at Position("hello", 5) in <b>hello<div>world</div></b>, we want Position("world", 0) instead. | 1261 // e.g. if pos was at Position("hello", 5) in <b>hello<div>world</div></b>, we want Position("world", 0) instead. |
| 1262 // We only do this for range because caret at Position("hello", 5) in <b>hel lo</b>world should give you font-weight: bold. | 1262 // We only do this for range because caret at Position("hello", 5) in <b>hel lo</b>world should give you font-weight: bold. |
| 1263 Node* positionNode = position.containerNode(); | 1263 Node* positionNode = position.containerNode(); |
| 1264 if (selection.isRange() && positionNode && positionNode->isTextNode() && pos ition.computeOffsetInContainerNode() == positionNode->maxCharacterOffset()) | 1264 if (selection.isRange() && positionNode && positionNode->isTextNode() && pos ition.computeOffsetInContainerNode() == positionNode->maxCharacterOffset()) |
| 1265 position = nextVisuallyDistinctCandidate(position); | 1265 position = nextVisuallyDistinctCandidate(position); |
| 1266 | 1266 |
| 1267 Element* element = position.element(); | 1267 Element* element = position.element(); |
| 1268 if (!element) | 1268 if (!element) |
| 1269 return nullptr; | 1269 return nullptr; |
| 1270 | 1270 |
| 1271 RefPtr<EditingStyle> style = EditingStyle::create(element, EditingStyle::All Properties); | 1271 RefPtrWillBeRawPtr<EditingStyle> style = EditingStyle::create(element, Editi ngStyle::AllProperties); |
| 1272 style->mergeTypingStyle(&element->document()); | 1272 style->mergeTypingStyle(&element->document()); |
| 1273 | 1273 |
| 1274 // If background color is transparent, traverse parent nodes until we hit a different value or document root | 1274 // If background color is transparent, traverse parent nodes until we hit a different value or document root |
| 1275 // Also, if the selection is a range, ignore the background color at the sta rt of selection, | 1275 // Also, if the selection is a range, ignore the background color at the sta rt of selection, |
| 1276 // and find the background color of the common ancestor. | 1276 // and find the background color of the common ancestor. |
| 1277 if (shouldUseBackgroundColorInEffect && (selection.isRange() || hasTranspare ntBackgroundColor(style->m_mutableStyle.get()))) { | 1277 if (shouldUseBackgroundColorInEffect && (selection.isRange() || hasTranspare ntBackgroundColor(style->m_mutableStyle.get()))) { |
| 1278 RefPtrWillBeRawPtr<Range> range(selection.toNormalizedRange()); | 1278 RefPtrWillBeRawPtr<Range> range(selection.toNormalizedRange()); |
| 1279 if (PassRefPtrWillBeRawPtr<CSSValue> value = backgroundColorInEffect(ran ge->commonAncestorContainer())) | 1279 if (PassRefPtrWillBeRawPtr<CSSValue> value = backgroundColorInEffect(ran ge->commonAncestorContainer())) |
| 1280 style->setProperty(CSSPropertyBackgroundColor, value->cssText()); | 1280 style->setProperty(CSSPropertyBackgroundColor, value->cssText()); |
| 1281 } | 1281 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1362 // In the range case, make sure that the embedding element persists unti l the end of the range. | 1362 // In the range case, make sure that the embedding element persists unti l the end of the range. |
| 1363 if (selection.isRange() && !end.deprecatedNode()->isDescendantOf(node)) | 1363 if (selection.isRange() && !end.deprecatedNode()->isDescendantOf(node)) |
| 1364 return NaturalWritingDirection; | 1364 return NaturalWritingDirection; |
| 1365 | 1365 |
| 1366 foundDirection = directionValue == CSSValueLtr ? LeftToRightWritingDirec tion : RightToLeftWritingDirection; | 1366 foundDirection = directionValue == CSSValueLtr ? LeftToRightWritingDirec tion : RightToLeftWritingDirection; |
| 1367 } | 1367 } |
| 1368 hasNestedOrMultipleEmbeddings = false; | 1368 hasNestedOrMultipleEmbeddings = false; |
| 1369 return foundDirection; | 1369 return foundDirection; |
| 1370 } | 1370 } |
| 1371 | 1371 |
| 1372 void EditingStyle::trace(Visitor* visitor) | |
| 1373 { | |
| 1374 visitor->trace(m_mutableStyle); | |
| 1375 } | |
| 1376 | |
| 1372 static void reconcileTextDecorationProperties(MutableStylePropertySet* style) | 1377 static void reconcileTextDecorationProperties(MutableStylePropertySet* style) |
| 1373 { | 1378 { |
| 1374 RefPtrWillBeRawPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSS Value(CSSPropertyWebkitTextDecorationsInEffect); | 1379 RefPtrWillBeRawPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSS Value(CSSPropertyWebkitTextDecorationsInEffect); |
| 1375 RefPtrWillBeRawPtr<CSSValue> textDecoration = style->getPropertyCSSValue(tex tDecorationPropertyForEditing()); | 1380 RefPtrWillBeRawPtr<CSSValue> textDecoration = style->getPropertyCSSValue(tex tDecorationPropertyForEditing()); |
| 1376 // We shouldn't have both text-decoration and -webkit-text-decorations-in-ef fect because that wouldn't make sense. | 1381 // We shouldn't have both text-decoration and -webkit-text-decorations-in-ef fect because that wouldn't make sense. |
| 1377 ASSERT(!textDecorationsInEffect || !textDecoration); | 1382 ASSERT(!textDecorationsInEffect || !textDecoration); |
| 1378 if (textDecorationsInEffect) { | 1383 if (textDecorationsInEffect) { |
| 1379 style->setProperty(textDecorationPropertyForEditing(), textDecorationsIn Effect->cssText()); | 1384 style->setProperty(textDecorationPropertyForEditing(), textDecorationsIn Effect->cssText()); |
| 1380 style->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); | 1385 style->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); |
| 1381 textDecoration = textDecorationsInEffect; | 1386 textDecoration = textDecorationsInEffect; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1655 { | 1660 { |
| 1656 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1661 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1657 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu tedStyleDeclaration::create(ancestor); | 1662 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu tedStyleDeclaration::create(ancestor); |
| 1658 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1663 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
| 1659 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); | 1664 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); |
| 1660 } | 1665 } |
| 1661 return nullptr; | 1666 return nullptr; |
| 1662 } | 1667 } |
| 1663 | 1668 |
| 1664 } | 1669 } |
| OLD | NEW |