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

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

Issue 2800813006: Move layouet/LayoutView::setSelection() to editing/LayoutSelection (Closed)
Patch Set: nit Created 3 years, 8 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/LayoutSelection.h
diff --git a/third_party/WebKit/Source/core/editing/LayoutSelection.h b/third_party/WebKit/Source/core/editing/LayoutSelection.h
index 18de59f5fdf7d88ee2883906bf561c9df2e22177..db981e09b0ed081b14676c869abf101c14952cfc 100644
--- a/third_party/WebKit/Source/core/editing/LayoutSelection.h
+++ b/third_party/WebKit/Source/core/editing/LayoutSelection.h
@@ -41,6 +41,22 @@ class LayoutSelection final : public GarbageCollected<LayoutSelection> {
void SetHasPendingSelection() { has_pending_selection_ = true; }
void Commit(LayoutView&);
+ IntRect SelectionBounds();
+ void InvalidatePaintForSelection();
+ enum SelectionPaintInvalidationMode {
+ kPaintInvalidationNewXOROld,
+ kPaintInvalidationNewMinusOld
+ };
+ void SetSelection(
+ LayoutObject* start,
+ int start_pos,
+ LayoutObject*,
+ int end_pos,
+ SelectionPaintInvalidationMode = kPaintInvalidationNewXOROld);
+ void ClearSelection();
+ void SelectionStartEnd(int& start_pos, int& end_pos);
+ void OnDocumentShutdown();
+
DECLARE_TRACE();
private:
@@ -53,6 +69,25 @@ class LayoutSelection final : public GarbageCollected<LayoutSelection> {
Member<FrameSelection> frame_selection_;
bool has_pending_selection_ : 1;
+
+ // The current selection represented as 2 boundaries.
+ // Selection boundaries are represented in LayoutView by a tuple
+ // (LayoutObject, DOM node offset).
+ // See http://www.w3.org/TR/dom/#range for more information.
+ //
+ // |m_selectionStartPos| and |m_selectionEndPos| are only valid for
hugoh_UTC2 2017/04/13 06:53:04 Post-merge nit: we should update the comment, now
+ // |Text| node without 'transform' or 'first-letter'.
+ //
+ // Those are used for selection painting and paint invalidation upon
+ // selection change.
+ LayoutObject* selection_start_;
+ LayoutObject* selection_end_;
+
+ // TODO(yosin): Clarify the meaning of these variables. editing/ passes
+ // them as offsets in the DOM tree but layout uses them as offset in the
+ // layout tree.
+ int selection_start_pos_;
+ int selection_end_pos_;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.cpp ('k') | third_party/WebKit/Source/core/editing/LayoutSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698