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

Unified Diff: third_party/WebKit/Source/core/editing/FrameSelection.h

Issue 2001083002: Explicit management of FrameSelection availability (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-08T18:08:39 Created 4 years, 6 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/editing/FrameSelection.h
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.h b/third_party/WebKit/Source/core/editing/FrameSelection.h
index c42ffccd2a9c27dfead8acfa945598d4a8bc8194..3f559f5d8e23376525b5441fd06dca021b8ca0fc 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.h
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.h
@@ -93,6 +93,10 @@ public:
return static_cast<EUserTriggered>(options & UserTriggered);
}
+ bool isAvailable() const { return m_document; }
+ // You should not call |document()| when |!isAvailable()|.
+ const Document& document() const;
+ Document& document();
LocalFrame* frame() const { return m_frame; }
Element* rootEditableElement() const { return selection().rootEditableElement(); }
Element* rootEditableElementOrDocumentElement() const;
@@ -121,7 +125,6 @@ public:
bool setSelectedRange(const EphemeralRange&, TextAffinity, SelectionDirectionalMode = SelectionDirectionalMode::NonDirectional, FrameSelection::SetSelectionOptions = CloseTyping | ClearTypingStyle);
void selectAll();
void clear();
- void prepareForDestruction();
// Call this after doing user-triggered selections to make it easy to delete the frame you entirely selected.
void selectFrameElementInParentIfFullySelected();
@@ -168,6 +171,8 @@ public:
// the return value from underlying VisibleSelection's firstRange() is returned.
Range* firstRange() const;
+ void documentAttached(Document*);
+ void documentDetached(const Document&);
void nodeWillBeRemoved(Node&);
void dataWillChange(const CharacterData& node);
void didUpdateCharacterData(CharacterData*, unsigned offset, unsigned oldLength, unsigned newLength);
@@ -280,6 +285,7 @@ private:
bool shouldPaintCaretForTesting() const;
bool isPreviousCaretDirtyForTesting() const;
+ Member<Document> m_document;
Member<LocalFrame> m_frame;
const Member<PendingSelection> m_pendingSelection;
const Member<SelectionEditor> m_selectionEditor;
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameCaret.cpp ('k') | third_party/WebKit/Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698