Chromium Code Reviews| Index: Source/core/html/HTMLElement.cpp |
| diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp |
| index 7120402cb9b42b0a4b3579eb5dabe009acfc3a13..5fc898aab6f96aa12ba9ba09837b775a550848f1 100644 |
| --- a/Source/core/html/HTMLElement.cpp |
| +++ b/Source/core/html/HTMLElement.cpp |
| @@ -796,7 +796,7 @@ static void setHasDirAutoFlagRecursively(Node* firstNode, bool flag, Node* lastN |
| } |
| } |
| -void HTMLElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) |
| +void HTMLElement::childrenChanged(bool changedByParser, const Handle<Node>& beforeChange, const Handle<Node>& afterChange, int childCountDelta) |
| { |
| StyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); |
| @@ -844,14 +844,14 @@ TextDirection HTMLElement::directionalityIfhasDirAutoAttribute(bool& isAuto) con |
| return directionality(); |
| } |
| -TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) const |
| +TextDirection HTMLElement::directionality(Handle<Node>* strongDirectionalityTextNode) const |
|
haraken
2013/08/06 01:32:50
Could you change Handle<Node>* to Handle<Node>& ?
|
| { |
| if (isHTMLTextFormControlElement(this)) { |
| Handle<HTMLTextFormControlElement> textElement = toHTMLTextFormControlElement(const_cast<HTMLElement*>(this)); |
| bool hasStrongDirectionality; |
| Unicode::Direction textDirection = textElement->value().defaultWritingDirection(&hasStrongDirectionality); |
| if (strongDirectionalityTextNode) |
| - *strongDirectionalityTextNode = hasStrongDirectionality ? textElement.raw() : 0; |
| + *strongDirectionalityTextNode = hasStrongDirectionality ? textElement : nullptr; |
| return (textDirection == Unicode::LeftToRight) ? LTR : RTL; |
| } |
| @@ -878,14 +878,14 @@ TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) c |
| WTF::Unicode::Direction textDirection = node->textContent(true).defaultWritingDirection(&hasStrongDirectionality); |
| if (hasStrongDirectionality) { |
| if (strongDirectionalityTextNode) |
| - *strongDirectionalityTextNode = node; |
| + *strongDirectionalityTextNode = adoptRawResult(node); |
| return (textDirection == WTF::Unicode::LeftToRight) ? LTR : RTL; |
| } |
| } |
| node = NodeTraversal::next(node, this); |
| } |
| if (strongDirectionalityTextNode) |
| - *strongDirectionalityTextNode = 0; |
| + *strongDirectionalityTextNode = nullptr; |
| return LTR; |
| } |
| @@ -903,8 +903,7 @@ void HTMLElement::dirAttributeChanged(const AtomicString& value) |
| void HTMLElement::adjustDirectionalityIfNeededAfterChildAttributeChanged(Element* child) |
| { |
| ASSERT(selfOrAncestorHasDirAutoAttribute()); |
| - Node* strongDirectionalityTextNode; |
| - TextDirection textDirection = directionality(&strongDirectionalityTextNode); |
| + TextDirection textDirection = directionality(); |
| setHasDirAutoFlagRecursively(child, false); |
| if (renderer() && renderer()->style() && renderer()->style()->direction() != textDirection) { |
| Element* elementToAdjust = this; |
| @@ -919,9 +918,9 @@ void HTMLElement::adjustDirectionalityIfNeededAfterChildAttributeChanged(Element |
| void HTMLElement::calculateAndAdjustDirectionality() |
| { |
| - Node* strongDirectionalityTextNode; |
| + Handle<Node> strongDirectionalityTextNode; |
| TextDirection textDirection = directionality(&strongDirectionalityTextNode); |
| - setHasDirAutoFlagRecursively(this, true, strongDirectionalityTextNode); |
| + setHasDirAutoFlagRecursively(this, true, strongDirectionalityTextNode.raw()); |
| if (renderer() && renderer()->style() && renderer()->style()->direction() != textDirection) |
| setNeedsStyleRecalc(); |
| } |