| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // For WinDDK ATL compatibility, these ATL headers must come first. | 5 // For WinDDK ATL compatibility, these ATL headers must come first. |
| 6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <atlbase.h> // NOLINT | 8 #include <atlbase.h> // NOLINT |
| 9 #include <atlwin.h> // NOLINT | 9 #include <atlwin.h> // NOLINT |
| 10 #endif | 10 #endif |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 const ResultViewState state = GetState(); | 389 const ResultViewState state = GetState(); |
| 390 if (style & ACMatchClassification::URL) | 390 if (style & ACMatchClassification::URL) |
| 391 current_data->color = GetColor(state, URL); | 391 current_data->color = GetColor(state, URL); |
| 392 else if (style & ACMatchClassification::DIM) | 392 else if (style & ACMatchClassification::DIM) |
| 393 current_data->color = GetColor(state, DIMMED_TEXT); | 393 current_data->color = GetColor(state, DIMMED_TEXT); |
| 394 else | 394 else |
| 395 current_data->color = GetColor(state, force_dim ? DIMMED_TEXT : TEXT); | 395 current_data->color = GetColor(state, force_dim ? DIMMED_TEXT : TEXT); |
| 396 | 396 |
| 397 render_texts.push_back(gfx::RenderText::CreateInstance()); | 397 render_texts.push_back(gfx::RenderText::CreateInstance()); |
| 398 current_data->render_text = render_texts.back(); | 398 current_data->render_text = render_texts.back(); |
| 399 current_data->render_text->SetFontList( | 399 current_data->render_text->SetFont(*current_data->font); |
| 400 gfx::FontList(*current_data->font)); | |
| 401 current_data->render_text->SetText(current_data->text); | 400 current_data->render_text->SetText(current_data->text); |
| 402 | 401 |
| 403 gfx::StyleRange style_range; | 402 gfx::StyleRange style_range; |
| 404 style_range.foreground = current_data->color; | 403 style_range.foreground = current_data->color; |
| 405 style_range.font_style = current_data->font->GetStyle(); | 404 style_range.font_style = current_data->font->GetStyle(); |
| 406 current_data->render_text->set_default_style(style_range); | 405 current_data->render_text->set_default_style(style_range); |
| 407 current_data->render_text->ApplyDefaultStyle(); | 406 current_data->render_text->ApplyDefaultStyle(); |
| 408 | 407 |
| 409 current_data->pixel_size = current_data->render_text->GetStringSize(); | 408 current_data->pixel_size = current_data->render_text->GetStringSize(); |
| 410 current_run->pixel_width += current_data->pixel_size.width(); | 409 current_run->pixel_width += current_data->pixel_size.width(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 // Success. Elide this classification and stop. | 524 // Success. Elide this classification and stop. |
| 526 j->text = elided_text; | 525 j->text = elided_text; |
| 527 | 526 |
| 528 // If we could only fit an ellipsis, then only make it bold if there was | 527 // If we could only fit an ellipsis, then only make it bold if there was |
| 529 // an immediate prior classification in this run that was also bold, or | 528 // an immediate prior classification in this run that was also bold, or |
| 530 // it will look orphaned. | 529 // it will look orphaned. |
| 531 if ((j->font != &normal_font_) && (elided_text.length() == 1) && | 530 if ((j->font != &normal_font_) && (elided_text.length() == 1) && |
| 532 (on_first_classification || | 531 (on_first_classification || |
| 533 (prior_classification->font == &normal_font_))) { | 532 (prior_classification->font == &normal_font_))) { |
| 534 j->font = &normal_font_; | 533 j->font = &normal_font_; |
| 535 j->render_text->SetFontList(gfx::FontList(*j->font)); | 534 j->render_text->SetFont(*j->font); |
| 536 } | 535 } |
| 537 | 536 |
| 538 j->render_text->SetText(elided_text); | 537 j->render_text->SetText(elided_text); |
| 539 j->pixel_size = j->render_text->GetStringSize(); | 538 j->pixel_size = j->render_text->GetStringSize(); |
| 540 | 539 |
| 541 // Erase any other classifications that come after the elided one. | 540 // Erase any other classifications that come after the elided one. |
| 542 i->classifications.erase(j.base(), i->classifications.end()); | 541 i->classifications.erase(j.base(), i->classifications.end()); |
| 543 runs->erase(i.base(), runs->end()); | 542 runs->erase(i.base(), runs->end()); |
| 544 return; | 543 return; |
| 545 } | 544 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 int x = GetMirroredXForRect(keyword_text_bounds_); | 618 int x = GetMirroredXForRect(keyword_text_bounds_); |
| 620 mirroring_context_->Initialize(x, keyword_text_bounds_.width()); | 619 mirroring_context_->Initialize(x, keyword_text_bounds_.width()); |
| 621 PaintMatch(canvas, *match_.associated_keyword.get(), x); | 620 PaintMatch(canvas, *match_.associated_keyword.get(), x); |
| 622 } | 621 } |
| 623 } | 622 } |
| 624 | 623 |
| 625 void OmniboxResultView::AnimationProgressed(const ui::Animation* animation) { | 624 void OmniboxResultView::AnimationProgressed(const ui::Animation* animation) { |
| 626 Layout(); | 625 Layout(); |
| 627 SchedulePaint(); | 626 SchedulePaint(); |
| 628 } | 627 } |
| OLD | NEW |