summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.cc4
-rw-r--r--chrome/browser/views/infobars/infobars.cc7
-rw-r--r--views/controls/label.cc3
-rw-r--r--views/controls/link.cc124
-rw-r--r--views/controls/link.h6
-rw-r--r--views/controls/textfield/textfield.h4
6 files changed, 66 insertions, 82 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index e6643f3..1fc89f4 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -2006,15 +2006,13 @@ void AutocompleteEditViewWin::EmphasizeURLComponents() {
// Set the baseline emphasis.
CHARFORMAT cf = {0};
cf.dwMask = CFM_COLOR;
- cf.dwEffects = 0;
const bool is_secure = (scheme_security_level_ == ToolbarModel::SECURE);
// If we're going to emphasize parts of the text, then the baseline state
// should be "de-emphasized". If not, then everything should be rendered in
// the standard text color.
cf.crTextColor = skia::SkColorToCOLORREF(LocationBarView::GetColor(is_secure,
emphasize ? LocationBarView::DEEMPHASIZED_TEXT : LocationBarView::TEXT));
- SelectAll(false);
- SetSelectionCharFormat(cf);
+ SetDefaultCharFormat(cf);
if (emphasize) {
// We've found a host name, give it more emphasis.
diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc
index 1bf1290..c2fc041 100644
--- a/chrome/browser/views/infobars/infobars.cc
+++ b/chrome/browser/views/infobars/infobars.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -28,7 +28,6 @@ static const int kVerticalPadding = 3;
static const int kHorizontalPadding = 3;
static const int kIconLabelSpacing = 5;
static const int kButtonSpacing = 5;
-static const int kWordSpacing = 2;
static const SkColor kInfoBackgroundColorTop = SkColorSetRGB(170, 214, 112);
static const SkColor kInfoBackgroundColorBottom = SkColorSetRGB(146, 205, 114);
@@ -386,7 +385,7 @@ void LinkInfoBar::Layout() {
bool has_second_label = !label_2_->GetText().empty();
if (has_second_label) {
// Embed the link in the text string between the two labels.
- link_->SetBounds(label_1_->bounds().right() + kWordSpacing,
+ link_->SetBounds(label_1_->bounds().right(),
OffsetY(this, link_ps), link_ps.width(), link_ps.height());
} else {
// Right-align the link toward the edge of the InfoBar.
@@ -397,7 +396,7 @@ void LinkInfoBar::Layout() {
// Layout the right label (we do this regardless of whether or not it has
// text).
gfx::Size label_2_ps = label_2_->GetPreferredSize();
- label_2_->SetBounds(link_->bounds().right() + kWordSpacing,
+ label_2_->SetBounds(link_->bounds().right(),
OffsetY(this, label_2_ps), label_2_ps.width(),
label_2_ps.height());
}
diff --git a/views/controls/label.cc b/views/controls/label.cc
index 3d2304f..8bda393 100644
--- a/views/controls/label.cc
+++ b/views/controls/label.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,6 +18,7 @@
namespace views {
+// static
const char Label::kViewClassName[] = "views/Label";
static const SkColor kEnabledColor = SK_ColorBLACK;
diff --git a/views/controls/link.cc b/views/controls/link.cc
index 34a9e46..c9bd256 100644
--- a/views/controls/link.cc
+++ b/views/controls/link.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -61,25 +61,6 @@ const LinkController* Link::GetController() {
return controller_;
}
-std::string Link::GetClassName() const {
- return kViewClassName;
-}
-
-void Link::SetHighlightedColor(const SkColor& color) {
- normal_color_ = color;
- ValidateStyle();
-}
-
-void Link::SetDisabledColor(const SkColor& color) {
- disabled_color_ = color;
- ValidateStyle();
-}
-
-void Link::SetNormalColor(const SkColor& color) {
- normal_color_ = color;
- ValidateStyle();
-}
-
bool Link::OnMousePressed(const MouseEvent& e) {
if (!enabled_ || (!e.IsLeftMouseButton() && !e.IsMiddleMouseButton()))
return false;
@@ -117,18 +98,18 @@ bool Link::OnKeyPressed(const KeyEvent& e) {
bool activate = false;
NOTIMPLEMENTED();
#endif
- if (activate) {
- SetHighlighted(false);
+ if (!activate)
+ return false;
- // Focus the link on key pressed.
- RequestFocus();
+ SetHighlighted(false);
- if (controller_)
- controller_->LinkActivated(this, e.GetFlags());
+ // Focus the link on key pressed.
+ RequestFocus();
- return true;
- }
- return false;
+ if (controller_)
+ controller_->LinkActivated(this, e.GetFlags());
+
+ return true;
}
bool Link::SkipDefaultKeyEventProcessing(const KeyEvent& e) {
@@ -141,40 +122,6 @@ bool Link::SkipDefaultKeyEventProcessing(const KeyEvent& e) {
#endif
}
-void Link::SetHighlighted(bool f) {
- if (f != highlighted_) {
- highlighted_ = f;
- ValidateStyle();
- SchedulePaint();
- }
-}
-
-void Link::ValidateStyle() {
- gfx::Font font = GetFont();
-
- if (enabled_) {
- if ((font.style() & gfx::Font::UNDERLINED) == 0) {
- Label::SetFont(font.DeriveFont(0, font.style() |
- gfx::Font::UNDERLINED));
- }
- } else {
- if ((font.style() & gfx::Font::UNDERLINED) != 0) {
- Label::SetFont(font.DeriveFont(0, font.style() &
- ~gfx::Font::UNDERLINED));
- }
- }
-
- if (enabled_) {
- if (highlighted_) {
- Label::SetColor(highlighted_color_);
- } else {
- Label::SetColor(normal_color_);
- }
- } else {
- Label::SetColor(disabled_color_);
- }
-}
-
void Link::SetFont(const gfx::Font& font) {
Label::SetFont(font);
ValidateStyle();
@@ -190,16 +137,55 @@ void Link::SetEnabled(bool f) {
gfx::NativeCursor Link::GetCursorForPoint(Event::EventType event_type, int x,
int y) {
- if (enabled_) {
+ if (!enabled_)
+ return NULL;
#if defined(OS_WIN)
- if (!g_hand_cursor)
- g_hand_cursor = LoadCursor(NULL, IDC_HAND);
- return g_hand_cursor;
+ if (!g_hand_cursor)
+ g_hand_cursor = LoadCursor(NULL, IDC_HAND);
+ return g_hand_cursor;
#elif defined(OS_LINUX)
- return gdk_cursor_new(GDK_HAND2);
+ return gdk_cursor_new(GDK_HAND2);
#endif
+}
+
+std::string Link::GetClassName() const {
+ return kViewClassName;
+}
+
+void Link::SetHighlightedColor(const SkColor& color) {
+ normal_color_ = color;
+ ValidateStyle();
+}
+
+void Link::SetDisabledColor(const SkColor& color) {
+ disabled_color_ = color;
+ ValidateStyle();
+}
+
+void Link::SetNormalColor(const SkColor& color) {
+ normal_color_ = color;
+ ValidateStyle();
+}
+
+void Link::SetHighlighted(bool f) {
+ if (f != highlighted_) {
+ highlighted_ = f;
+ ValidateStyle();
+ SchedulePaint();
+ }
+}
+
+void Link::ValidateStyle() {
+ gfx::Font font = GetFont();
+
+ if (enabled_) {
+ if ((font.style() & gfx::Font::UNDERLINED) == 0)
+ Label::SetFont(font.DeriveFont(0, font.style() | gfx::Font::UNDERLINED));
+ Label::SetColor(highlighted_ ? highlighted_color_ : normal_color_);
} else {
- return NULL;
+ if ((font.style() & gfx::Font::UNDERLINED) != 0)
+ Label::SetFont(font.DeriveFont(0, font.style() & ~gfx::Font::UNDERLINED));
+ Label::SetColor(disabled_color_);
}
}
diff --git a/views/controls/link.h b/views/controls/link.h
index c574b6e..30b2bdb7 100644
--- a/views/controls/link.h
+++ b/views/controls/link.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -32,8 +32,6 @@ class LinkController {
////////////////////////////////////////////////////////////////////////////////
class Link : public Label {
public:
- static const char kViewClassName[];
-
Link();
Link(const std::wstring& title);
virtual ~Link();
@@ -63,6 +61,8 @@ class Link : public Label {
void SetDisabledColor(const SkColor& color);
void SetNormalColor(const SkColor& color);
+ static const char kViewClassName[];
+
private:
// A highlighted link is clicked.
diff --git a/views/controls/textfield/textfield.h b/views/controls/textfield/textfield.h
index fd01cef..7bc5f68 100644
--- a/views/controls/textfield/textfield.h
+++ b/views/controls/textfield/textfield.h
@@ -231,8 +231,8 @@ class Textfield : public View {
// |use_default_background_color_| is set to false.
SkColor background_color_;
- // When true, the system colors for Textfields are used when painting this
- // Textfield. When false, the value of |background_color_| determines the
+ // When true, the system background color for Textfields is used when painting
+ // this Textfield. When false, the value of |background_color_| determines the
// Textfield's background color.
bool use_default_background_color_;