Bug 1592739 - Ignore the background-color CSS value on the window document's root element if that element has a -moz-appearance. r=tnikkel

For regular elements, whenever -moz-appearance is used, the CSS background is
ignored. Root elements were behaving specially, and the background color also
needed to be adjusted.
For example, for Windows 7, we have the following CSS rule;

```
    :root {
      background-color: transparent;
      -moz-appearance: -moz-win-borderless-glass;
    }
```

This change makes the root element more consistent with other elements, so the
extra `background-color: transparent` declaration is no longer necessary.

This change does not let content documents opt out of forced opaqueness:
Root content documents still get an opaque background color from an existing
check further down in this method.

Differential Revision: https://phabricator.services.mozilla.com/D51459

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Markus Stange 2019-11-05 18:47:30 +00:00
Родитель 4c8859d2b4
Коммит a3e9f03c73
1 изменённых файлов: 10 добавлений и 5 удалений

Просмотреть файл

@ -5111,11 +5111,16 @@ void PresShell::UpdateCanvasBackground() {
// style frame but we don't have access to the canvasframe here. It isn't
// a problem because only a few frames can return something other than true
// and none of them would be a canvas frame or root element style frame.
bool drawBackgroundImage;
bool drawBackgroundColor;
mCanvasBackgroundColor = nsCSSRendering::DetermineBackgroundColor(
mPresContext, bgStyle, rootStyleFrame, drawBackgroundImage,
drawBackgroundColor);
bool drawBackgroundImage = false;
bool drawBackgroundColor = false;
if (rootStyleFrame->IsThemed()) {
// Ignore the CSS background-color if -moz-appearance is used.
mCanvasBackgroundColor = NS_RGBA(0, 0, 0, 0);
} else {
mCanvasBackgroundColor = nsCSSRendering::DetermineBackgroundColor(
mPresContext, bgStyle, rootStyleFrame, drawBackgroundImage,
drawBackgroundColor);
}
mHasCSSBackgroundColor = drawBackgroundColor;
if (mPresContext->IsRootContentDocumentCrossProcess() &&
!IsTransparentContainerElement(mPresContext)) {