Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 #include "core/editing/TextAffinity.h" | 33 #include "core/editing/TextAffinity.h" |
| 34 #include "core/editing/TextGranularity.h" | 34 #include "core/editing/TextGranularity.h" |
| 35 #include "core/editing/VisiblePosition.h" | 35 #include "core/editing/VisiblePosition.h" |
| 36 #include "core/editing/VisibleUnits.h" | 36 #include "core/editing/VisibleUnits.h" |
| 37 #include "wtf/Allocator.h" | 37 #include "wtf/Allocator.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 class LayoutPoint; | 41 class LayoutPoint; |
| 42 | 42 |
| 43 // TODO(yosin) We should use capitalized name instead of |SEL_DEFAULT_AFFINITY|. | 43 const TextAffinity SelDefaultAffinity = TextAffinity::Downstream; // NOLINT |
|
pdr.
2016/01/23 00:59:45
Should this be kSelDefaultAffinity?
pdr.
2016/01/23 01:01:22
Can we remove NOLINT too, and the //?
danakj
2016/01/23 01:10:50
It's complicated.. :) Current style is FooBar. Chr
| |
| 44 const TextAffinity SEL_DEFAULT_AFFINITY = TextAffinity::Downstream; // NOLINT | |
| 45 enum SelectionDirection { DirectionForward, DirectionBackward, DirectionRight, D irectionLeft }; | 44 enum SelectionDirection { DirectionForward, DirectionBackward, DirectionRight, D irectionLeft }; |
| 46 | 45 |
| 47 // Listener of |VisibleSelection| modification. |didChangeVisibleSelection()| | 46 // Listener of |VisibleSelection| modification. |didChangeVisibleSelection()| |
| 48 // will be invoked when base, extent, start or end is moved to a different | 47 // will be invoked when base, extent, start or end is moved to a different |
| 49 // position. | 48 // position. |
| 50 // | 49 // |
| 51 // Objects implementing |VisibleSelectionChangeObserver| interface must outlive | 50 // Objects implementing |VisibleSelectionChangeObserver| interface must outlive |
| 52 // the |VisibleSelection| object. | 51 // the |VisibleSelection| object. |
| 53 class CORE_EXPORT VisibleSelectionChangeObserver : public WillBeGarbageCollected Mixin { | 52 class CORE_EXPORT VisibleSelectionChangeObserver : public WillBeGarbageCollected Mixin { |
| 54 WTF_MAKE_NONCOPYABLE(VisibleSelectionChangeObserver); | 53 WTF_MAKE_NONCOPYABLE(VisibleSelectionChangeObserver); |
| 55 public: | 54 public: |
| 56 VisibleSelectionChangeObserver(); | 55 VisibleSelectionChangeObserver(); |
| 57 virtual ~VisibleSelectionChangeObserver(); | 56 virtual ~VisibleSelectionChangeObserver(); |
| 58 virtual void didChangeVisibleSelection() = 0; | 57 virtual void didChangeVisibleSelection() = 0; |
| 59 DEFINE_INLINE_VIRTUAL_TRACE() { } | 58 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 60 }; | 59 }; |
| 61 | 60 |
| 62 template <typename Strategy> | 61 template <typename Strategy> |
| 63 class CORE_TEMPLATE_CLASS_EXPORT VisibleSelectionTemplate { | 62 class CORE_TEMPLATE_CLASS_EXPORT VisibleSelectionTemplate { |
| 64 DISALLOW_NEW(); | 63 DISALLOW_NEW(); |
| 65 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(VisibleSelectionTemplate); | 64 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(VisibleSelectionTemplate); |
| 66 public: | 65 public: |
| 67 VisibleSelectionTemplate(); | 66 VisibleSelectionTemplate(); |
| 68 VisibleSelectionTemplate(const PositionTemplate<Strategy>&, TextAffinity, bo ol isDirectional = false); | 67 VisibleSelectionTemplate(const PositionTemplate<Strategy>&, TextAffinity, bo ol isDirectional = false); |
| 69 VisibleSelectionTemplate(const PositionTemplate<Strategy>& base, const Posit ionTemplate<Strategy>& extent, TextAffinity = SEL_DEFAULT_AFFINITY, bool isDirec tional = false); | 68 VisibleSelectionTemplate(const PositionTemplate<Strategy>& base, const Posit ionTemplate<Strategy>& extent, TextAffinity = SelDefaultAffinity, bool isDirecti onal = false); |
| 70 explicit VisibleSelectionTemplate(const EphemeralRangeTemplate<Strategy>&, T extAffinity = SEL_DEFAULT_AFFINITY, bool isDirectional = false); | 69 explicit VisibleSelectionTemplate(const EphemeralRangeTemplate<Strategy>&, T extAffinity = SelDefaultAffinity, bool isDirectional = false); |
| 71 | 70 |
| 72 explicit VisibleSelectionTemplate(const VisiblePositionTemplate<Strategy>&, bool isDirectional = false); | 71 explicit VisibleSelectionTemplate(const VisiblePositionTemplate<Strategy>&, bool isDirectional = false); |
| 73 VisibleSelectionTemplate(const VisiblePositionTemplate<Strategy>&, const Vis iblePositionTemplate<Strategy>&, bool isDirectional = false); | 72 VisibleSelectionTemplate(const VisiblePositionTemplate<Strategy>&, const Vis iblePositionTemplate<Strategy>&, bool isDirectional = false); |
| 74 | 73 |
| 75 explicit VisibleSelectionTemplate(const PositionWithAffinityTemplate<Strateg y>&, bool isDirectional = false); | 74 explicit VisibleSelectionTemplate(const PositionWithAffinityTemplate<Strateg y>&, bool isDirectional = false); |
| 76 | 75 |
| 77 static VisibleSelectionTemplate<Strategy> createWithoutValidation(const Posi tionTemplate<Strategy>& base, const PositionTemplate<Strategy>& extent, const Po sitionTemplate<Strategy>& start, const PositionTemplate<Strategy>& end, TextAffi nity, bool isDirectional); | 76 static VisibleSelectionTemplate<Strategy> createWithoutValidation(const Posi tionTemplate<Strategy>& base, const PositionTemplate<Strategy>& extent, const Po sitionTemplate<Strategy>& start, const PositionTemplate<Strategy>& end, TextAffi nity, bool isDirectional); |
| 78 | 77 |
| 79 VisibleSelectionTemplate(const VisibleSelectionTemplate&); | 78 VisibleSelectionTemplate(const VisibleSelectionTemplate&); |
| 80 VisibleSelectionTemplate& operator=(const VisibleSelectionTemplate&); | 79 VisibleSelectionTemplate& operator=(const VisibleSelectionTemplate&); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 | 221 |
| 223 #ifndef NDEBUG | 222 #ifndef NDEBUG |
| 224 // Outside the WebCore namespace for ease of invocation from gdb. | 223 // Outside the WebCore namespace for ease of invocation from gdb. |
| 225 void showTree(const blink::VisibleSelection&); | 224 void showTree(const blink::VisibleSelection&); |
| 226 void showTree(const blink::VisibleSelection*); | 225 void showTree(const blink::VisibleSelection*); |
| 227 void showTree(const blink::VisibleSelectionInComposedTree&); | 226 void showTree(const blink::VisibleSelectionInComposedTree&); |
| 228 void showTree(const blink::VisibleSelectionInComposedTree*); | 227 void showTree(const blink::VisibleSelectionInComposedTree*); |
| 229 #endif | 228 #endif |
| 230 | 229 |
| 231 #endif // VisibleSelection_h | 230 #endif // VisibleSelection_h |
| OLD | NEW |