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

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

Issue 2731393004: Use EphemeralRange to construct StaticRange (Closed)
Patch Set: 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
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..4fc26dff45dca8b9d952d8b0094ac603bd86782a 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,13 @@ class CORE_EXPORT StaticRange final : public GarbageCollected<StaticRange>,
range->startOffset(), range->endContainer(),
range->endOffset());
}
+ static StaticRange* create(const EphemeralRange& range) {
+ return new StaticRange(range.document(),
yosin_UTC9 2017/03/08 07:35:51 Let's add |DCHECK(!range.isNull());| since creatin
chongz 2017/03/08 18:31:09 Done.
+ range.startPosition().computeContainerNode(),
+ range.startPosition().computeOffsetInContainerNode(),
+ range.endPosition().computeContainerNode(),
+ range.endPosition().computeOffsetInContainerNode());
+ }
Node* startContainer() const { return m_startContainer.get(); }
void setStartContainer(Node* startContainer) {

Powered by Google App Engine
This is Rietveld 408576698