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

Side by Side Diff: Source/core/dom/DocumentMarker.h

Issue 23728006: addMarker() optimizations. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Compilation fix Created 7 years, 3 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
« no previous file with comments | « no previous file | Source/core/dom/DocumentMarkerController.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of the DOM implementation for WebCore. 2 * This file is part of the DOM implementation for WebCore.
3 * 3 *
4 * Copyright (C) 2006 Apple Computer, Inc. 4 * Copyright (C) 2006 Apple Computer, Inc.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 20 matching lines...) Expand all
31 namespace WebCore { 31 namespace WebCore {
32 32
33 class DocumentMarkerDetails; 33 class DocumentMarkerDetails;
34 34
35 // A range of a node within a document that is "marked", such as the range of a misspelled word. 35 // A range of a node within a document that is "marked", such as the range of a misspelled word.
36 // It optionally includes a description that could be displayed in the user inte rface. 36 // It optionally includes a description that could be displayed in the user inte rface.
37 // It also optionally includes a flag specifying whether the match is active, wh ich is ignored 37 // It also optionally includes a flag specifying whether the match is active, wh ich is ignored
38 // for all types other than type TextMatch. 38 // for all types other than type TextMatch.
39 class DocumentMarker { 39 class DocumentMarker {
40 public: 40 public:
41 enum MarkerTypeIndex {
42 SpellingMarkerIndex = 0,
43 GramarMarkerIndex,
44 TextMatchMarkerIndex,
45 MarkerTypeIndexesCount
46 };
47
41 enum MarkerType { 48 enum MarkerType {
42 Spelling = 1 << 0, 49 Spelling = 1 << SpellingMarkerIndex,
43 Grammar = 1 << 1, 50 Grammar = 1 << GramarMarkerIndex,
44 TextMatch = 1 << 2 51 TextMatch = 1 << TextMatchMarkerIndex
45 }; 52 };
46 53
47 class MarkerTypes { 54 class MarkerTypes {
48 public: 55 public:
49 // The constructor is intentionally implicit to allow conversion from th e bit-wise sum of above types 56 // The constructor is intentionally implicit to allow conversion from th e bit-wise sum of above types
50 MarkerTypes(unsigned mask) : m_mask(mask) { } 57 MarkerTypes(unsigned mask) : m_mask(mask) { }
51 58
52 bool contains(MarkerType type) const { return m_mask & type; } 59 bool contains(MarkerType type) const { return m_mask & type; }
53 bool intersects(const MarkerTypes& types) const { return (m_mask & types .m_mask); } 60 bool intersects(const MarkerTypes& types) const { return (m_mask & types .m_mask); }
54 bool operator==(const MarkerTypes& other) const { return m_mask == other .m_mask; } 61 bool operator==(const MarkerTypes& other) const { return m_mask == other .m_mask; }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 public: 128 public:
122 DocumentMarkerDetails() { } 129 DocumentMarkerDetails() { }
123 virtual ~DocumentMarkerDetails(); 130 virtual ~DocumentMarkerDetails();
124 virtual bool isDescription() const { return false; } 131 virtual bool isDescription() const { return false; }
125 virtual bool isTextMatch() const { return false; } 132 virtual bool isTextMatch() const { return false; }
126 }; 133 };
127 134
128 } // namespace WebCore 135 } // namespace WebCore
129 136
130 #endif // DocumentMarker_h 137 #endif // DocumentMarker_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/DocumentMarkerController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698