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

Side by Side Diff: third_party/WebKit/Source/core/editing/LayoutSelection.h

Issue 2616623002: Do not send redundant selectionchange-events (decouple focus) (Closed)
Patch Set: Add comment 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2006 Apple Computer, Inc. 3 * Copyright (C) 2006 Apple Computer, Inc.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 15 matching lines...) Expand all
26 #include "core/editing/VisibleSelection.h" 26 #include "core/editing/VisibleSelection.h"
27 #include "platform/heap/Handle.h" 27 #include "platform/heap/Handle.h"
28 28
29 namespace blink { 29 namespace blink {
30 30
31 class FrameSelection; 31 class FrameSelection;
32 class LayoutView; 32 class LayoutView;
33 33
34 class LayoutSelection final : public GarbageCollected<LayoutSelection> { 34 class LayoutSelection final : public GarbageCollected<LayoutSelection> {
35 public: 35 public:
36 enum PaintHint { kHide, kKeep, kPaint };
yosin_UTC9 2017/04/13 09:31:50 nit: s/enum/enum class/
hugoh_UTC2 2017/04/14 01:34:47 Done.
37
36 static LayoutSelection* Create(FrameSelection& frame_selection) { 38 static LayoutSelection* Create(FrameSelection& frame_selection) {
37 return new LayoutSelection(frame_selection); 39 return new LayoutSelection(frame_selection);
38 } 40 }
39 41
40 bool HasPendingSelection() const { return has_pending_selection_; } 42 bool HasPendingSelection() const { return has_pending_selection_; }
41 void SetHasPendingSelection() { has_pending_selection_ = true; } 43 void SetHasPendingSelection(PaintHint);
42 void Commit(LayoutView&); 44 void Commit(LayoutView&);
43 45
44 IntRect SelectionBounds(); 46 IntRect SelectionBounds();
45 void InvalidatePaintForSelection(); 47 void InvalidatePaintForSelection();
46 enum SelectionPaintInvalidationMode { 48 enum SelectionPaintInvalidationMode {
47 kPaintInvalidationNewXOROld, 49 kPaintInvalidationNewXOROld,
48 kPaintInvalidationNewMinusOld 50 kPaintInvalidationNewMinusOld
49 }; 51 };
50 void SetSelection( 52 void SetSelection(
51 LayoutObject* start, 53 LayoutObject* start,
(...skipping 10 matching lines...) Expand all
62 private: 64 private:
63 LayoutSelection(FrameSelection&); 65 LayoutSelection(FrameSelection&);
64 66
65 const VisibleSelection& GetVisibleSelection() const; 67 const VisibleSelection& GetVisibleSelection() const;
66 68
67 SelectionInFlatTree CalcVisibleSelection( 69 SelectionInFlatTree CalcVisibleSelection(
68 const VisibleSelectionInFlatTree&) const; 70 const VisibleSelectionInFlatTree&) const;
69 71
70 Member<FrameSelection> frame_selection_; 72 Member<FrameSelection> frame_selection_;
71 bool has_pending_selection_ : 1; 73 bool has_pending_selection_ : 1;
74 bool force_hide_ : 1;
72 75
73 // The current selection represented as 2 boundaries. 76 // The current selection represented as 2 boundaries.
74 // Selection boundaries are represented in LayoutView by a tuple 77 // Selection boundaries are represented in LayoutView by a tuple
75 // (LayoutObject, DOM node offset). 78 // (LayoutObject, DOM node offset).
76 // See http://www.w3.org/TR/dom/#range for more information. 79 // See http://www.w3.org/TR/dom/#range for more information.
77 // 80 //
78 // |m_selectionStartPos| and |m_selectionEndPos| are only valid for 81 // |m_selectionStartPos| and |m_selectionEndPos| are only valid for
79 // |Text| node without 'transform' or 'first-letter'. 82 // |Text| node without 'transform' or 'first-letter'.
80 // 83 //
81 // Those are used for selection painting and paint invalidation upon 84 // Those are used for selection painting and paint invalidation upon
82 // selection change. 85 // selection change.
83 LayoutObject* selection_start_; 86 LayoutObject* selection_start_;
84 LayoutObject* selection_end_; 87 LayoutObject* selection_end_;
85 88
86 // TODO(yosin): Clarify the meaning of these variables. editing/ passes 89 // TODO(yosin): Clarify the meaning of these variables. editing/ passes
87 // them as offsets in the DOM tree but layout uses them as offset in the 90 // them as offsets in the DOM tree but layout uses them as offset in the
88 // layout tree. 91 // layout tree.
89 int selection_start_pos_; 92 int selection_start_pos_;
90 int selection_end_pos_; 93 int selection_end_pos_;
91 }; 94 };
92 95
93 } // namespace blink 96 } // namespace blink
94 97
95 #endif 98 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698