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

Customize tab shape #21

Closed
bbondy opened this issue Dec 5, 2017 · 8 comments
Closed

Customize tab shape #21

bbondy opened this issue Dec 5, 2017 · 8 comments
Assignees
Labels

Comments

@bbondy
Copy link
Member

bbondy commented Dec 5, 2017

No description provided.

@bbondy bbondy added this to the Milestone 2: To offer Installable and updatable builds milestone Dec 5, 2017
@bbondy
Copy link
Member Author

bbondy commented Dec 31, 2017

@petemill would you want to drive this?

@petemill
Copy link
Member

petemill commented Jan 3, 2018

I'd be happy to take a look, whilst balancing other commitments. Though I'm not an expert on the brave / chromium code, the language and the UI frameworks (yet) so there will be a learning curve. Is there a target date for this milestone @bbondy ?

@bbondy
Copy link
Member Author

bbondy commented Jan 3, 2018

no target date, I don't want to side track any browser-laptop based deadlines, so just on the side is fine. Sync up with @kevinlawler though because he's found the tool and is starting to look at this too.

@bbondy
Copy link
Member Author

bbondy commented Jan 14, 2018

moved to @AlexeyBarabash from @kevinlawler

@AlexeyBarabash
Copy link
Contributor

PR brave/brave-core#22 .

@AlexeyBarabash
Copy link
Contributor

As I mentioned in PR, I have tuned parameters to make rectangles from from trapezoid.
It is possible to draw the shape of the tab in own way. But parameters still will require to be tuned to make beautiful intervals and new tab button.

Here is the direct solution, curved corners supposed to be made by path.rCubicTo are not used here:

// src/chrome/browser/ui/views/tabs/tab.cc
gfx::Path GetFillPath(float scale, const gfx::Size& size, float endcap_width) {
  const float right = size.width() * scale;
  const float bottom = std::ceil(size.height() * scale);

  gfx::Path fill;
  fill.moveTo(right - 1 - endcap_width*0.5*scale, bottom);
  fill.lineTo(right - 1 - endcap_width*0.5*scale, 2.5 * scale);

  fill.lineTo(1 + endcap_width*0.5*scale, 2.5 * scale);
  fill.lineTo(1 + endcap_width*0.5*scale, bottom);

  fill.close();
  return fill;
}
gfx::Path GetBorderPath(float scale,
                        bool unscale_at_end,
                        bool extend_to_top,
                        float endcap_width,
                        const gfx::Size& size) {
  const float right = size.width() * scale;
  const float bottom = size.height() * scale;

  gfx::Path path;
  path.moveTo(0, bottom);
  path.lineTo(0 + endcap_width*0.5*scale, bottom);
  path.lineTo(0 + endcap_width*0.5*scale, 0);
  path.lineTo(right - endcap_width*0.5*scale, 0);
  path.lineTo(right - endcap_width*0.5*scale, bottom);
  path.lineTo(right, bottom);

  path.close();

  if (unscale_at_end && (scale != 1))
    path.transform(SkMatrix::MakeScale(1.f / scale));

  return path;
}

@AlexeyBarabash
Copy link
Contributor

Created a PR for this issue on macOS brave/brave-core#24 .

@bbondy
Copy link
Member Author

bbondy commented Feb 6, 2018

Closing this since it's landed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants