| Index: Source/core/editing/ApplyStyleCommand.cpp
|
| diff --git a/Source/core/editing/ApplyStyleCommand.cpp b/Source/core/editing/ApplyStyleCommand.cpp
|
| index 2d257d52a670673105928dcce42b9f599ee2b1d2..6ea072b3bd45824bdef1e5b4c12dbb4f119bf71c 100644
|
| --- a/Source/core/editing/ApplyStyleCommand.cpp
|
| +++ b/Source/core/editing/ApplyStyleCommand.cpp
|
| @@ -20,7 +20,7 @@
|
| * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
| * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| #include "config.h"
|
| @@ -188,7 +188,7 @@ Position ApplyStyleCommand::startPosition()
|
| {
|
| if (m_useEndingSelection)
|
| return endingSelection().start();
|
| -
|
| +
|
| return m_start;
|
| }
|
|
|
| @@ -196,7 +196,7 @@ Position ApplyStyleCommand::endPosition()
|
| {
|
| if (m_useEndingSelection)
|
| return endingSelection().end();
|
| -
|
| +
|
| return m_end;
|
| }
|
|
|
| @@ -284,7 +284,7 @@ void ApplyStyleCommand::applyBlockStyle(EditingStyle *style)
|
| paragraphStart = nextParagraphStart;
|
| nextParagraphStart = endOfParagraph(paragraphStart).next();
|
| }
|
| -
|
| +
|
| startRange = TextIterator::rangeFromLocationAndLength(toContainerNode(scope), startIndex, 0, true);
|
| endRange = TextIterator::rangeFromLocationAndLength(toContainerNode(scope), endIndex, 0, true);
|
| if (startRange && endRange)
|
| @@ -319,7 +319,7 @@ void ApplyStyleCommand::applyRelativeFontStyleChange(EditingStyle* style)
|
| start = startPosition();
|
| end = endPosition();
|
| }
|
| -
|
| +
|
| if (start.isNull() || end.isNull())
|
| return;
|
|
|
| @@ -353,7 +353,7 @@ void ApplyStyleCommand::applyRelativeFontStyleChange(EditingStyle* style)
|
| beyondEnd = NodeTraversal::nextSkippingChildren(end.deprecatedNode());
|
| else
|
| beyondEnd = NodeTraversal::next(end.deprecatedNode());
|
| -
|
| +
|
| start = start.upstream(); // Move upstream to ensure we do not add redundant spans.
|
| Node* startNode = start.deprecatedNode();
|
| if (startNode->isTextNode() && start.deprecatedEditingOffset() >= caretMaxOffset(startNode)) // Move out of text node if range does not include its characters.
|
| @@ -367,7 +367,7 @@ void ApplyStyleCommand::applyRelativeFontStyleChange(EditingStyle* style)
|
|
|
| // These spans were added by us. If empty after font size changes, they can be removed.
|
| Vector<RefPtr<HTMLElement> > unstyledSpans;
|
| -
|
| +
|
| Node* lastStyledNode = 0;
|
| for (Node* node = startNode; node != beyondEnd; node = NodeTraversal::next(node)) {
|
| RefPtr<HTMLElement> element;
|
| @@ -416,7 +416,7 @@ static Node* dummySpanAncestorForNode(const Node* node)
|
| {
|
| while (node && (!node->isElementNode() || !isStyleSpanOrSpanWithOnlyStyleAttribute(toElement(node))))
|
| node = node->parentNode();
|
| -
|
| +
|
| return node ? node->parentNode() : 0;
|
| }
|
|
|
| @@ -750,7 +750,7 @@ void ApplyStyleCommand::applyInlineStyleToNodeRange(EditingStyle* style, PassRef
|
|
|
| if (!node->renderer() || !node->rendererIsEditable())
|
| continue;
|
| -
|
| +
|
| if (!node->rendererIsRichlyEditable() && node->isHTMLElement()) {
|
| // This is a plaintext-only region. Only proceed if it's fully selected.
|
| // pastEndNode is the node after the last fully selected node, so if it's inside node then
|
| @@ -765,10 +765,10 @@ void ApplyStyleCommand::applyInlineStyleToNodeRange(EditingStyle* style, PassRef
|
| next = NodeTraversal::nextSkippingChildren(node.get());
|
| continue;
|
| }
|
| -
|
| +
|
| if (isBlock(node.get()))
|
| continue;
|
| -
|
| +
|
| if (node->childNodeCount()) {
|
| if (node->contains(pastEndNode.get()) || containsNonEditableRegion(node.get()) || !node->parentNode()->rendererIsEditable())
|
| continue;
|
| @@ -894,7 +894,7 @@ bool ApplyStyleCommand::removeInlineStyleFromElement(EditingStyle* style, PassRe
|
|
|
| return removed;
|
| }
|
| -
|
| +
|
| void ApplyStyleCommand::replaceWithSpanOrRemoveIfWithoutAttributes(HTMLElement*& elem)
|
| {
|
| if (hasNoAttributeOrOnlyStyleAttribute(elem, StyleAttributeShouldBeEmpty))
|
| @@ -905,7 +905,7 @@ void ApplyStyleCommand::replaceWithSpanOrRemoveIfWithoutAttributes(HTMLElement*&
|
| elem = newSpanElement;
|
| }
|
| }
|
| -
|
| +
|
| bool ApplyStyleCommand::removeImplicitlyStyledElement(EditingStyle* style, HTMLElement* element, InlineStyleRemovalMode mode, EditingStyle* extractedStyle)
|
| {
|
| ASSERT(style);
|
| @@ -1283,7 +1283,7 @@ bool ApplyStyleCommand::mergeStartWithPreviousIfIdentical(const Position& start,
|
| int startOffsetAdjustment = startChild->nodeIndex();
|
| int endOffsetAdjustment = startNode == end.deprecatedNode() ? startOffsetAdjustment : 0;
|
| updateStartEnd(Position(startNode, startOffsetAdjustment, Position::PositionIsOffsetInAnchor),
|
| - Position(end.deprecatedNode(), end.deprecatedEditingOffset() + endOffsetAdjustment, Position::PositionIsOffsetInAnchor));
|
| + Position(end.deprecatedNode(), end.deprecatedEditingOffset() + endOffsetAdjustment, Position::PositionIsOffsetInAnchor));
|
| return true;
|
| }
|
|
|
| @@ -1372,7 +1372,7 @@ void ApplyStyleCommand::addBlockStyle(const StyleChange& styleChange, HTMLElemen
|
| // inline content.
|
| if (!block)
|
| return;
|
| -
|
| +
|
| String cssStyle = styleChange.cssStyle();
|
| StringBuilder cssText;
|
| cssText.append(cssStyle);
|
| @@ -1523,7 +1523,7 @@ void ApplyStyleCommand::joinChildTextNodes(Node* node, const Position& start, co
|
| for (Node* curr = node->firstChild(); curr; curr = curr->nextSibling()) {
|
| if (!curr->isTextNode())
|
| continue;
|
| -
|
| +
|
| textNodes.append(toText(curr));
|
| }
|
|
|
| @@ -1532,7 +1532,7 @@ void ApplyStyleCommand::joinChildTextNodes(Node* node, const Position& start, co
|
| Node* next = childText->nextSibling();
|
| if (!next || !next->isTextNode())
|
| continue;
|
| -
|
| +
|
| Text* nextText = toText(next);
|
| if (start.anchorType() == Position::PositionIsOffsetInAnchor && next == start.containerNode())
|
| newStart = Position(childText, childText->length() + start.offsetInContainerNode());
|
|
|