| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/autocomplete/autocomplete_match.h" | 9 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 const string16& text, | 73 const string16& text, |
| 74 const ACMatchClassifications& classifications, | 74 const ACMatchClassifications& classifications, |
| 75 bool force_dim, | 75 bool force_dim, |
| 76 int x, | 76 int x, |
| 77 int y); | 77 int y); |
| 78 | 78 |
| 79 int icon_vertical_padding_; | 79 int icon_vertical_padding_; |
| 80 int text_vertical_padding_; | 80 int text_vertical_padding_; |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 // Precalculated data used to draw the portion of a match classification that | 83 struct ClassificationData; |
| 84 // fits entirely within one run. | |
| 85 struct ClassificationData { | |
| 86 string16 text; | |
| 87 const gfx::Font* font; | |
| 88 SkColor color; | |
| 89 int pixel_width; | |
| 90 }; | |
| 91 typedef std::vector<ClassificationData> Classifications; | 84 typedef std::vector<ClassificationData> Classifications; |
| 92 | 85 |
| 93 // Precalculated data used to draw a complete visual run within the match. | 86 struct RunData; |
| 94 // This will include all or part of at leasdt one, and possibly several, | |
| 95 // classifications. | |
| 96 struct RunData { | |
| 97 size_t run_start; // Offset within the match text where this run begins. | |
| 98 int visual_order; // Where this run occurs in visual order. The earliest | |
| 99 // run drawn is run 0. | |
| 100 bool is_rtl; | |
| 101 int pixel_width; | |
| 102 Classifications classifications; // Classification pieces within this run, | |
| 103 // in logical order. | |
| 104 }; | |
| 105 typedef std::vector<RunData> Runs; | 87 typedef std::vector<RunData> Runs; |
| 106 | 88 |
| 107 // Predicate functions for use when sorting the runs. | 89 // Predicate functions for use when sorting the runs. |
| 108 static bool SortRunsLogically(const RunData& lhs, const RunData& rhs); | 90 static bool SortRunsLogically(const RunData& lhs, const RunData& rhs); |
| 109 static bool SortRunsVisually(const RunData& lhs, const RunData& rhs); | 91 static bool SortRunsVisually(const RunData& lhs, const RunData& rhs); |
| 110 | 92 |
| 111 static int icon_size_; | 93 static int icon_size_; |
| 112 | 94 |
| 113 ResultViewState GetState() const; | 95 ResultViewState GetState() const; |
| 114 | 96 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // Layout rects for various sub-components of the view. | 129 // Layout rects for various sub-components of the view. |
| 148 gfx::Rect icon_bounds_; | 130 gfx::Rect icon_bounds_; |
| 149 gfx::Rect text_bounds_; | 131 gfx::Rect text_bounds_; |
| 150 | 132 |
| 151 AutocompleteMatch match_; | 133 AutocompleteMatch match_; |
| 152 | 134 |
| 153 DISALLOW_COPY_AND_ASSIGN(AutocompleteResultView); | 135 DISALLOW_COPY_AND_ASSIGN(AutocompleteResultView); |
| 154 }; | 136 }; |
| 155 | 137 |
| 156 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ | 138 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ |
| OLD | NEW |