Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Unified Diff: third_party/WebKit/Source/core/dom/StaticRange.h

Issue 2731393004: Use EphemeralRange to construct StaticRange (Closed)
Patch Set: yosin's review: Fix nits Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/EditingUtilities.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/StaticRange.h
diff --git a/third_party/WebKit/Source/core/dom/StaticRange.h b/third_party/WebKit/Source/core/dom/StaticRange.h
index 551efd9afb53f7dea7ef2ac9f880cdbc998ee6f6..fa007e37a04387fdcd4be052af2e3f9b3b15174a 100644
--- a/third_party/WebKit/Source/core/dom/StaticRange.h
+++ b/third_party/WebKit/Source/core/dom/StaticRange.h
@@ -10,6 +10,7 @@
#include "bindings/core/v8/ScriptWrappable.h"
#include "core/CoreExport.h"
#include "core/dom/Range.h"
+#include "core/editing/EphemeralRange.h"
#include "platform/heap/Handle.h"
namespace blink {
@@ -38,6 +39,14 @@ class CORE_EXPORT StaticRange final : public GarbageCollected<StaticRange>,
range->startOffset(), range->endContainer(),
range->endOffset());
}
+ static StaticRange* create(const EphemeralRange& range) {
+ DCHECK(!range.isNull());
+ return new StaticRange(range.document(),
+ range.startPosition().computeContainerNode(),
+ range.startPosition().computeOffsetInContainerNode(),
+ range.endPosition().computeContainerNode(),
+ range.endPosition().computeOffsetInContainerNode());
+ }
Node* startContainer() const { return m_startContainer.get(); }
void setStartContainer(Node* startContainer) {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/EditingUtilities.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698