Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolbar Styles #391

Merged
merged 4 commits into from
Sep 5, 2018
Merged

Toolbar Styles #391

merged 4 commits into from
Sep 5, 2018

Conversation

petemill
Copy link
Member

@petemill petemill commented Sep 4, 2018

  • 😎 Introduces Private Window theme (purple)
  • 🎨 Refines dark theme (deprioritized light theme for now since there are no releases which default to it)
  • 📐 Shapes for Tabs, LocationBar and Buttons

Fix brave/brave-browser#670 (needs follow-up for light theme at brave/brave-browser#961)
Fix brave/brave-browser#785
Fix brave/brave-browser#787 (needs follow-up for bottom corner via brave/brave-browser#962)
Fix brave/brave-browser#786

image

image

image

Architecture:

  • Introduces layout_constants override
  • Introduces omnibox_theme override
  • Theme Service now centralises getting the configured theme and the active theme (i.e. working out which theme is active based on a configured default value and the build channel - dark for dev channel)

Patching

Many things are tied to the static function LocationBarView::IsRounded(). Unfortunately, we want this to return false in some circumstances (e.g. drawing the border and the background), and not in others (e.g. drawing the omnibox popup).
Therefore, this PR adds a new static function: LocationBarView::ShouldOmniboxSurround().

We can't use a chromium_src override for omnibox_popup_contents_view.cc to define IsRounded as ShouldOmniboxSurround, since this includes the LocationBarView header file. We also need some, but not all calls from LocationBarView members to change which static function is called, so patching is the only method I've found so far...

TODO

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed.
  • Add appropriate QA labels (QA/Needed or QA/No-QA-Needed) to include the closed issue in milestone

Test Plan:

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

@petemill
Copy link
Member Author

petemill commented Sep 5, 2018

@bbondy @simonhong This is ready to begin review. I've updated the description and created follow-up issues, but I think this is a nice start. I'm doing a final cross-platform manual test now too.

chromium_src/chrome/browser/ui/layout_constants.cc Outdated Show resolved Hide resolved

class BraveNewTabButton : public NewTabButton {
public:
using NewTabButton::NewTabButton;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This can be removed.

#include "ui/views/view.h"
#include "ui/views/widget/widget_observer.h"

+class BraveNewTabButton;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This can be removed

@@ -6,15 +6,18 @@

#include <string>


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: new line

browser/themes/brave_theme_service.cc Show resolved Hide resolved

}

const SkColor kPrivateLocationBarBackground = SkColorSetRGB(0x1b, 0x0e, 0x2c);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about moving this constant to anonymous namespace?

}

template <class T>
constexpr T DarkPrivateLight(OmniboxTint tint,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This template is needed? I found that only SkColor is used as template argument.

@petemill petemill force-pushed the ui/toolbar-styles branch 2 times, most recently from ff8f664 to 0208911 Compare September 5, 2018 05:40
@petemill
Copy link
Member Author

petemill commented Sep 5, 2018

All feedback is now addressed - thanks @simonhong

simonhong
simonhong previously approved these changes Sep 5, 2018
Copy link
Member

@simonhong simonhong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Fallback dark and private themes to chromium incognito theme
Extend OmniboxTint to accept Private as well as Light and Dark
Note that the static LocationBarView::IsRounded is a misnomer since it
controls function (i.e. "Should Omnibox Wrap LocationBar"), and not just
the shape.

Similarly, NewTabButton confusingly uses border radius to infer Button width, so
some workarounds need to be employed to use content bounds width instead.

Tab height is also reduced in order to match a smaller border radius,
otherwise there is too much visual empty surface area.
@petemill petemill merged commit 2d32614 into master Sep 5, 2018
@petemill petemill deleted the ui/toolbar-styles branch September 7, 2018 18:35
@bbondy
Copy link
Member

bbondy commented Sep 8, 2018

0.55.x 2d32614

@bbondy bbondy added the 0.55.x label Sep 8, 2018
@bbondy bbondy added this to the 0.55.x - Release milestone Jan 14, 2019
petemill pushed a commit to petemill/brave-core that referenced this pull request Jul 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants