| Index: third_party/WebKit/Source/core/dom/Text.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/Text.cpp b/third_party/WebKit/Source/core/dom/Text.cpp
|
| index d589ac79c748bb512a2eab3a7b2c1df923df6a2d..be2d847be5126ca138a2ad9e51db4a8f2965841e 100644
|
| --- a/third_party/WebKit/Source/core/dom/Text.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/Text.cpp
|
| @@ -1,7 +1,8 @@
|
| /*
|
| * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
|
| * (C) 1999 Antti Koivisto (koivisto@kde.org)
|
| - * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
|
| + * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
|
| + * reserved.
|
| *
|
| * This library is free software; you can redistribute it and/or
|
| * modify it under the terms of the GNU Library General Public
|
| @@ -191,12 +192,13 @@ String Text::wholeText() const {
|
| Text* Text::replaceWholeText(const String& newText) {
|
| // Remove all adjacent text nodes, and replace the contents of this one.
|
|
|
| - // Protect startText and endText against mutation event handlers removing the last ref
|
| + // Protect startText and endText against mutation event handlers removing the
|
| + // last ref
|
| Text* startText = const_cast<Text*>(earliestLogicallyAdjacentTextNode(this));
|
| Text* endText = const_cast<Text*>(latestLogicallyAdjacentTextNode(this));
|
|
|
| - ContainerNode* parent =
|
| - parentNode(); // Protect against mutation handlers moving this node during traversal
|
| + ContainerNode* parent = parentNode(); // Protect against mutation handlers
|
| + // moving this node during traversal
|
| for (Node* n = startText;
|
| n && n != this && n->isTextNode() && n->parentNode() == parent;) {
|
| Node* nodeToRemove = n;
|
| @@ -279,7 +281,8 @@ bool Text::textLayoutObjectIsNeeded(const ComputedStyle& style,
|
| if (style.preserveNewline())
|
| return true;
|
|
|
| - // childNeedsDistributionRecalc() here is rare, only happens JS calling surroundContents() etc. from DOMNodeInsertedIntoDocument etc.
|
| + // childNeedsDistributionRecalc() here is rare, only happens JS calling
|
| + // surroundContents() etc. from DOMNodeInsertedIntoDocument etc.
|
| if (document().childNeedsDistributionRecalc())
|
| return true;
|
|
|
| @@ -297,8 +300,9 @@ bool Text::textLayoutObjectIsNeeded(const ComputedStyle& style,
|
| (!prev || !prev->isInline()))
|
| return false;
|
|
|
| - // Avoiding creation of a layoutObject for the text node is a non-essential memory optimization.
|
| - // So to avoid blowing up on very wide DOMs, we limit the number of siblings to visit.
|
| + // Avoiding creation of a layoutObject for the text node is a non-essential
|
| + // memory optimization. So to avoid blowing up on very wide DOMs, we limit
|
| + // the number of siblings to visit.
|
| unsigned maxSiblingsToVisit = 50;
|
|
|
| LayoutObject* first = parent.slowFirstChild();
|
| @@ -307,8 +311,9 @@ bool Text::textLayoutObjectIsNeeded(const ComputedStyle& style,
|
| first = first->nextSibling();
|
| if (!first || first == layoutObject() ||
|
| LayoutTreeBuilderTraversal::nextSiblingLayoutObject(*this) == first) {
|
| - // If we're adding children to this flow our previous siblings are not in the layout tree yet so we
|
| - // cannot know if we will be the first child in the line and collapse away. We have to assume we need a layout object.
|
| + // If we're adding children to this flow our previous siblings are not in
|
| + // the layout tree yet so we cannot know if we will be the first child in
|
| + // the line and collapse away. We have to assume we need a layout object.
|
| Node* firstChildNode =
|
| parent.node() ? LayoutTreeBuilderTraversal::firstChild(*parent.node())
|
| : nullptr;
|
| @@ -367,8 +372,9 @@ void Text::reattachLayoutTreeIfNeeded(const AttachContext& context) {
|
| if (layoutObjectIsNeeded == !!layoutObject())
|
| return;
|
|
|
| - // The following is almost the same as Node::reattachLayoutTree() except that we create a layoutObject only if needed.
|
| - // Not calling reattachLayoutTree() to avoid repeated calls to Text::textLayoutObjectIsNeeded().
|
| + // The following is almost the same as Node::reattachLayoutTree() except that
|
| + // we create a layoutObject only if needed. Not calling reattachLayoutTree()
|
| + // to avoid repeated calls to Text::textLayoutObjectIsNeeded().
|
| AttachContext reattachContext(context);
|
| reattachContext.performingReattach = true;
|
|
|
| @@ -394,8 +400,8 @@ void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling) {
|
| }
|
| }
|
|
|
| -// If a whitespace node had no layoutObject and goes through a recalcStyle it may
|
| -// need to create one if the parent style now has white-space: pre.
|
| +// If a whitespace node had no layoutObject and goes through a recalcStyle it
|
| +// may need to create one if the parent style now has white-space: pre.
|
| bool Text::needsWhitespaceLayoutObject() {
|
| DCHECK(!layoutObject());
|
| if (const ComputedStyle* style = parentComputedStyle())
|
|
|