| Index: Source/core/editing/EditingStyle.cpp
|
| diff --git a/Source/core/editing/EditingStyle.cpp b/Source/core/editing/EditingStyle.cpp
|
| index 59edb027d905e0a286144de7c353ae4ed2bd59eb..82e5cd2352f5b2ca3b55eb150369922558b0388d 100644
|
| --- a/Source/core/editing/EditingStyle.cpp
|
| +++ b/Source/core/editing/EditingStyle.cpp
|
| @@ -261,7 +261,7 @@ bool HTMLAttributeEquivalent::valueIsPresentInStyle(Element* element, StylePrope
|
| {
|
| RefPtr<CSSValue> value = attributeValueAsCSSValue(element);
|
| RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(m_propertyID);
|
| -
|
| +
|
| return compareCSSValuePtr(value, styleValue);
|
| }
|
|
|
| @@ -276,7 +276,7 @@ PassRefPtr<CSSValue> HTMLAttributeEquivalent::attributeValueAsCSSValue(Element*
|
| ASSERT(element);
|
| if (!element->hasAttribute(m_attrName))
|
| return 0;
|
| -
|
| +
|
| RefPtr<MutableStylePropertySet> dummyStyle;
|
| dummyStyle = MutableStylePropertySet::create();
|
| dummyStyle->setProperty(m_propertyID, element->getAttribute(m_attrName));
|
| @@ -365,11 +365,11 @@ static RGBA32 cssValueToRGBA(CSSValue* colorValue)
|
| {
|
| if (!colorValue || !colorValue->isPrimitiveValue())
|
| return Color::transparent;
|
| -
|
| +
|
| CSSPrimitiveValue* primitiveColor = static_cast<CSSPrimitiveValue*>(colorValue);
|
| if (primitiveColor->isRGBColor())
|
| return primitiveColor->getRGBA32Value();
|
| -
|
| +
|
| RGBA32 rgba = 0;
|
| CSSParser::parseColor(rgba, colorValue->cssText());
|
| return rgba;
|
| @@ -457,7 +457,7 @@ void EditingStyle::init(Node* node, PropertiesToInclude propertiesToInclude)
|
|
|
| void EditingStyle::removeTextFillAndStrokeColorsIfNeeded(RenderStyle* renderStyle)
|
| {
|
| - // If a node's text fill color is invalid, then its children use
|
| + // If a node's text fill color is invalid, then its children use
|
| // their font-color as their text fill color (they don't
|
| // inherit it). Likewise for stroke color.
|
| if (!renderStyle->textFillColor().isValid())
|
| @@ -901,7 +901,7 @@ bool EditingStyle::elementIsStyledSpanOrHTMLEquivalent(const HTMLElement* elemen
|
|
|
| if (!elementIsSpanOrElementEquivalent && !matchedAttributes)
|
| return false; // element is not a span, a html element equivalent, or font element.
|
| -
|
| +
|
| if (element->getAttribute(HTMLNames::classAttr) == AppleStyleSpanClass)
|
| matchedAttributes++;
|
|
|
| @@ -1032,7 +1032,7 @@ PassRefPtr<EditingStyle> EditingStyle::wrappingStyleForSerialization(Node* conte
|
|
|
| // Call collapseTextDecorationProperties first or otherwise it'll copy the value over from in-effect to text-decorations.
|
| wrappingStyle->collapseTextDecorationProperties();
|
| -
|
| +
|
| return wrappingStyle.release();
|
| }
|
|
|
| @@ -1101,7 +1101,7 @@ static PassRefPtr<MutableStylePropertySet> styleFromMatchedRulesForElement(Eleme
|
| style->mergeAndOverrideOnConflict(static_cast<CSSStyleRule*>(matchedRules->item(i))->styleRule()->properties());
|
| }
|
| }
|
| -
|
| +
|
| return style.release();
|
| }
|
|
|
| @@ -1109,7 +1109,7 @@ void EditingStyle::mergeStyleFromRules(Element* element)
|
| {
|
| RefPtr<MutableStylePropertySet> styleFromMatchedRules = styleFromMatchedRulesForElement(element,
|
| StyleResolver::AuthorCSSRules | StyleResolver::CrossOriginCSSRules);
|
| - // Styles from the inline style declaration, held in the variable "style", take precedence
|
| + // Styles from the inline style declaration, held in the variable "style", take precedence
|
| // over those from matched rules.
|
| if (m_mutableStyle)
|
| styleFromMatchedRules->mergeAndOverrideOnConflict(m_mutableStyle.get());
|
| @@ -1122,7 +1122,7 @@ void EditingStyle::mergeStyleFromRulesForSerialization(Element* element)
|
| {
|
| mergeStyleFromRules(element);
|
|
|
| - // The property value, if it's a percentage, may not reflect the actual computed value.
|
| + // The property value, if it's a percentage, may not reflect the actual computed value.
|
| // For example: style="height: 1%; overflow: visible;" in quirksmode
|
| // FIXME: There are others like this, see <rdar://problem/5195123> Slashdot copy/paste fidelity problem
|
| RefPtr<CSSComputedStyleDeclaration> computedStyleForElement = CSSComputedStyleDeclaration::create(element);
|
| @@ -1218,13 +1218,13 @@ PassRefPtr<EditingStyle> EditingStyle::styleAtSelectionStart(const VisibleSelect
|
|
|
| Position position = adjustedSelectionStartForStyleComputation(selection);
|
|
|
| - // If the pos is at the end of a text node, then this node is not fully selected.
|
| - // Move it to the next deep equivalent position to avoid removing the style from this node.
|
| - // e.g. if pos was at Position("hello", 5) in <b>hello<div>world</div></b>, we want Position("world", 0) instead.
|
| - // We only do this for range because caret at Position("hello", 5) in <b>hello</b>world should give you font-weight: bold.
|
| - Node* positionNode = position.containerNode();
|
| - if (selection.isRange() && positionNode && positionNode->isTextNode() && position.computeOffsetInContainerNode() == positionNode->maxCharacterOffset())
|
| - position = nextVisuallyDistinctCandidate(position);
|
| + // If the pos is at the end of a text node, then this node is not fully selected.
|
| + // Move it to the next deep equivalent position to avoid removing the style from this node.
|
| + // e.g. if pos was at Position("hello", 5) in <b>hello<div>world</div></b>, we want Position("world", 0) instead.
|
| + // We only do this for range because caret at Position("hello", 5) in <b>hello</b>world should give you font-weight: bold.
|
| + Node* positionNode = position.containerNode();
|
| + if (selection.isRange() && positionNode && positionNode->isTextNode() && position.computeOffsetInContainerNode() == positionNode->maxCharacterOffset())
|
| + position = nextVisuallyDistinctCandidate(position);
|
|
|
| Element* element = position.element();
|
| if (!element)
|
| @@ -1323,7 +1323,7 @@ WritingDirection EditingStyle::textDirectionForSelection(const VisibleSelection&
|
| // In the range case, make sure that the embedding element persists until the end of the range.
|
| if (selection.isRange() && !end.deprecatedNode()->isDescendantOf(node))
|
| return NaturalWritingDirection;
|
| -
|
| +
|
| foundDirection = directionValue == CSSValueLtr ? LeftToRightWritingDirection : RightToLeftWritingDirection;
|
| }
|
| hasNestedOrMultipleEmbeddings = false;
|
| @@ -1331,7 +1331,7 @@ WritingDirection EditingStyle::textDirectionForSelection(const VisibleSelection&
|
| }
|
|
|
| static void reconcileTextDecorationProperties(MutableStylePropertySet* style)
|
| -{
|
| +{
|
| RefPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect);
|
| RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(CSSPropertyTextDecoration);
|
| // We shouldn't have both text-decoration and -webkit-text-decorations-in-effect because that wouldn't make sense.
|
| @@ -1605,7 +1605,7 @@ bool hasTransparentBackgroundColor(CSSStyleDeclaration* style)
|
| RefPtr<CSSValue> cssValue = style->getPropertyCSSValueInternal(CSSPropertyBackgroundColor);
|
| return isTransparentColorValue(cssValue.get());
|
| }
|
| -
|
| +
|
| bool hasTransparentBackgroundColor(StylePropertySet* style)
|
| {
|
| RefPtr<CSSValue> cssValue = style->getPropertyCSSValue(CSSPropertyBackgroundColor);
|
|
|