summaryrefslogtreecommitdiffstats
path: root/WebCore/dom/Range.cpp
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-05 14:34:32 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-05 14:34:32 -0800
commit635860845790a19bf50bbc51ba8fb66a96dde068 (patch)
treeef6ad9ff73a5b57f65249d4232a202fa77e6a140 /WebCore/dom/Range.cpp
parent8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2 (diff)
downloadexternal_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.zip
external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.gz
external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.bz2
auto import from //depot/cupcake/@136594
Diffstat (limited to 'WebCore/dom/Range.cpp')
-rw-r--r--WebCore/dom/Range.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/WebCore/dom/Range.cpp b/WebCore/dom/Range.cpp
index afd563e..b5afdd1 100644
--- a/WebCore/dom/Range.cpp
+++ b/WebCore/dom/Range.cpp
@@ -26,16 +26,12 @@
#include "RangeException.h"
#include "CString.h"
-#include "Document.h"
#include "DocumentFragment.h"
-#include "ExceptionCode.h"
-#include "HTMLElement.h"
-#include "HTMLNames.h"
#include "NodeWithIndex.h"
#include "ProcessingInstruction.h"
-#include "RenderBlock.h"
#include "Text.h"
#include "TextIterator.h"
+#include "VisiblePosition.h"
#include "markup.h"
#include "visible_units.h"
#include <stdio.h>
@@ -44,7 +40,6 @@
namespace WebCore {
using namespace std;
-using namespace HTMLNames;
#ifndef NDEBUG
static WTF::RefCountedLeakCounter rangeCounter("Range");
@@ -1425,18 +1420,16 @@ void Range::surroundContents(PassRefPtr<Node> passNewParent, ExceptionCode& ec)
// allowed by the type of node?
// BAD_BOUNDARYPOINTS_ERR: Raised if the Range partially selects a non-Text node.
- if (m_start.container()->nodeType() != Node::TEXT_NODE) {
- if (m_start.offset() > 0 && m_start.offset() < maxStartOffset()) {
- ec = RangeException::BAD_BOUNDARYPOINTS_ERR;
- return;
- }
+ Node* startNonTextContainer = m_start.container();
+ if (startNonTextContainer->nodeType() == Node::TEXT_NODE)
+ startNonTextContainer = startNonTextContainer->parentNode();
+ Node* endNonTextContainer = m_end.container();
+ if (endNonTextContainer->nodeType() == Node::TEXT_NODE)
+ endNonTextContainer = endNonTextContainer->parentNode();
+ if (startNonTextContainer != endNonTextContainer) {
+ ec = RangeException::BAD_BOUNDARYPOINTS_ERR;
+ return;
}
- if (m_end.container()->nodeType() != Node::TEXT_NODE) {
- if (m_end.offset() > 0 && m_end.offset() < maxEndOffset()) {
- ec = RangeException::BAD_BOUNDARYPOINTS_ERR;
- return;
- }
- }
ec = 0;
while (Node* n = newParent->firstChild()) {