зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1689286 - Make the number input spinners look nicer with padding. r=spohl
If you add padding to the input on the inline-end, like some of the examples in bug 1674431, then the darker border looks off. Without it, the number input still looks nice, so I think we should do this. We might want to introduce the padding by default (see bug 1689286). Differential Revision: https://phabricator.services.mozilla.com/D103270
This commit is contained in:
Родитель
5d4a325c23
Коммит
cdd2c2e7a3
|
@ -768,24 +768,9 @@ void nsNativeBasicTheme::PaintSpinnerButton(nsIFrame* aFrame,
|
|||
DPIRatio aDpiRatio) {
|
||||
auto [backgroundColor, borderColor] = ComputeButtonColors(aState);
|
||||
|
||||
RefPtr<Path> pathRect = MakePathForRect(*aDrawTarget, aRect.ToUnknownRect());
|
||||
aDrawTarget->FillRect(aRect.ToUnknownRect(),
|
||||
ColorPattern(ToDeviceColor(backgroundColor)));
|
||||
|
||||
aDrawTarget->Fill(pathRect, ColorPattern(ToDeviceColor(backgroundColor)));
|
||||
|
||||
RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
|
||||
Point p;
|
||||
if (IsFrameRTL(aFrame)) {
|
||||
p = Point(aRect.x + aRect.width - 0.5f, aRect.y);
|
||||
} else {
|
||||
p = Point(aRect.x - 0.5f, aRect.y);
|
||||
}
|
||||
builder->MoveTo(p);
|
||||
p = Point(p.x, p.y + aRect.height);
|
||||
builder->LineTo(p);
|
||||
RefPtr<Path> path = builder->Finish();
|
||||
|
||||
aDrawTarget->Stroke(path, ColorPattern(ToDeviceColor(borderColor)),
|
||||
StrokeOptions(kSpinnerBorderWidth * aDpiRatio));
|
||||
const float arrowPolygonX[] = {-5.25f, -0.75f, 0.75f, 5.25f, 5.25f,
|
||||
4.5f, 0.75f, -0.75f, -4.5f, -5.25f};
|
||||
const float arrowPolygonY[] = {-1.875f, 2.625f, 2.625f, -1.875f, -4.125f,
|
||||
|
@ -795,15 +780,15 @@ void nsNativeBasicTheme::PaintSpinnerButton(nsIFrame* aFrame,
|
|||
const float scaleY =
|
||||
aAppearance == StyleAppearance::SpinnerDownbutton ? scaleX : -scaleX;
|
||||
|
||||
builder = aDrawTarget->CreatePathBuilder();
|
||||
RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
|
||||
auto center = aRect.Center().ToUnknownPoint();
|
||||
p = center + Point(arrowPolygonX[0] * scaleX, arrowPolygonY[0] * scaleY);
|
||||
Point p = center + Point(arrowPolygonX[0] * scaleX, arrowPolygonY[0] * scaleY);
|
||||
builder->MoveTo(p);
|
||||
for (int32_t i = 1; i < arrowNumPoints; i++) {
|
||||
p = center + Point(arrowPolygonX[i] * scaleX, arrowPolygonY[i] * scaleY);
|
||||
builder->LineTo(p);
|
||||
}
|
||||
path = builder->Finish();
|
||||
RefPtr<Path> path = builder->Finish();
|
||||
aDrawTarget->Fill(path, ColorPattern(ToDeviceColor(borderColor)));
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,6 @@ static const CSSCoord kMinimumSpinnerButtonHeight = 9.0f;
|
|||
static const CSSCoord kButtonBorderWidth = 1.0f;
|
||||
static const CSSCoord kMenulistBorderWidth = 1.0f;
|
||||
static const CSSCoord kTextFieldBorderWidth = 1.0f;
|
||||
static const CSSCoord kSpinnerBorderWidth = 1.0f;
|
||||
static const CSSCoord kRangeHeight = 6.0f;
|
||||
static const CSSCoord kProgressbarHeight = 6.0f;
|
||||
static const CSSCoord kMeterHeight = 12.0f;
|
||||
|
|
Загрузка…
Ссылка в новой задаче