From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- .../WebCore/editing/DeleteFromTextNodeCommand.cpp | 35 ++++++++-------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'Source/WebCore/editing/DeleteFromTextNodeCommand.cpp') diff --git a/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp b/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp index a9bcfbcf9..7aaac39ca 100644 --- a/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp +++ b/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2008, 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -25,16 +25,15 @@ #include "config.h" #include "DeleteFromTextNodeCommand.h" -#include "Document.h" -#include "ExceptionCodePlaceholder.h" -#include "AXObjectCache.h" +#include "Document.h" #include "Text.h" +#include "htmlediting.h" namespace WebCore { -DeleteFromTextNodeCommand::DeleteFromTextNodeCommand(PassRefPtr node, unsigned offset, unsigned count) - : SimpleEditCommand(node->document()) +DeleteFromTextNodeCommand::DeleteFromTextNodeCommand(RefPtr&& node, unsigned offset, unsigned count, EditAction editingAction) + : SimpleEditCommand(node->document(), editingAction) , m_node(node) , m_offset(offset) , m_count(count) @@ -48,19 +47,14 @@ void DeleteFromTextNodeCommand::doApply() { ASSERT(m_node); - if (!m_node->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable)) + if (!isEditableNode(*m_node)) return; - ExceptionCode ec = 0; - m_text = m_node->substringData(m_offset, m_count, ec); - if (ec) + auto result = m_node->substringData(m_offset, m_count); + if (result.hasException()) return; - - // Need to notify this before actually deleting the text - if (AXObjectCache* cache = document().existingAXObjectCache()) - cache->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextDeleted, m_offset, m_text); - - m_node->deleteData(m_offset, m_count, ec); + m_text = result.releaseReturnValue(); + m_node->deleteData(m_offset, m_count); } void DeleteFromTextNodeCommand::doUnapply() @@ -70,10 +64,7 @@ void DeleteFromTextNodeCommand::doUnapply() if (!m_node->hasEditableStyle()) return; - m_node->insertData(m_offset, m_text, IGNORE_EXCEPTION); - - if (AXObjectCache* cache = document().existingAXObjectCache()) - cache->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextInserted, m_offset, m_text); + m_node->insertData(m_offset, m_text); } #ifndef NDEBUG -- cgit v1.2.1