FrameSvg: Draw corners only if both borders in both directions are enabled

Summary:
FrameSVG documentation states

> ... topleft and topright will be ignored if top does not exist,
> and similarly for bottomleft and bottomright ...

Someone would assume that the same behaviour applies to the case
when left(or right) does not exist.

This change makes FrameSVG to comply with such expected behaviour.

### Before

{F5878439, layout=center, size=full}

The bottom border doesn't exist so the bottom-right corner should not
be drawn.

### After

{F5878440, layout=center, size=full}

Reviewers: #plasma, #frameworks, mart

Reviewed By: #plasma, mart

Subscribers: mart, kde-frameworks-devel

Tags: #frameworks, #plasma

Differential Revision: https://phabricator.kde.org/D13218
This commit is contained in:
Vlad Zagorodniy 2018-05-30 19:22:32 +03:00
parent e108d7e90e
commit a46cd14553

View File

@ -774,8 +774,12 @@ void FrameSvgPrivate::paintBorder(QPainter& p, FrameData* frame, const FrameSvg:
void FrameSvgPrivate::paintCorner(QPainter& p, FrameData* frame, Plasma::FrameSvg::EnabledBorders border, const QRect& contentRect) const
{
QString corner = frame->prefix % FrameSvgHelpers::borderToElementId(border);
if (frame->enabledBorders & border && q->hasElement(corner)) {
// Draw the corner only if both borders in both directions are enabled.
if ((frame->enabledBorders & border) != border) {
return;
}
const QString corner = frame->prefix % FrameSvgHelpers::borderToElementId(border);
if (q->hasElement(corner)) {
q->paint(&p, FrameSvgHelpers::sectionRect(border, contentRect, frame->frameSize * q->devicePixelRatio()), corner);
}
}