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

Unified Diff: third_party/WebKit/public/web/WebRange.h

Issue 2199523002: Convert WebRange to be a simple pair of numbers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moar cleanup. Created 4 years, 4 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/public/web/WebRange.h
diff --git a/third_party/WebKit/public/web/WebRange.h b/third_party/WebKit/public/web/WebRange.h
index fd5ca00e1b9df079c70462bbc9e05f03d5012cf9..9276a7a999d0dbd900967ff3e14ee6a9961d7c5b 100644
--- a/third_party/WebKit/public/web/WebRange.h
+++ b/third_party/WebKit/public/web/WebRange.h
@@ -31,47 +31,33 @@
#ifndef WebRange_h
#define WebRange_h
-#include "WebFrame.h"
#include "public/platform/WebCommon.h"
-#include "public/platform/WebPrivatePtr.h"
-#include "public/platform/WebVector.h"
namespace blink {
class Range;
class WebString;
+class LocalFrame;
-// Provides readonly access to some properties of a DOM range.
-class WebRange {
+class WebRange final {
public:
- ~WebRange() { reset(); }
+ WebRange(int start, int length);
- WebRange() { }
- WebRange(const WebRange& r) { assign(r); }
- WebRange& operator=(const WebRange& r)
- {
- assign(r);
- return *this;
- }
+ int startOffset() const { return m_start; }
+ int length() const { return m_end - m_start; }
+ int endOffset() const { return m_end; }
esprehn 2016/08/10 04:12:06 I'd probs order this startOffset() endOffset() le
dglazkov 2016/08/10 05:12:13 Done.
- BLINK_EXPORT void reset();
- BLINK_EXPORT void assign(const WebRange&);
-
- bool isNull() const { return m_private.isNull(); }
-
- BLINK_EXPORT int startOffset() const;
- BLINK_EXPORT int endOffset() const;
- BLINK_EXPORT WebString toPlainText() const;
-
- BLINK_EXPORT static WebRange fromDocumentRange(WebLocalFrame*, int start, int length);
+ bool isNull() const { return m_start == -1 && m_end == -1; }
#if BLINK_IMPLEMENTATION
WebRange(Range*);
- operator Range*() const;
+
+ Range* createRange(LocalFrame*) const;
#endif
private:
- WebPrivatePtr<Range> m_private;
+ int m_start = -1;
+ int m_end = -1;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698