зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1592739 - Ignore the background-color CSS value on the window document's root element if that element has a non-glass -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, if non-glass -moz-appearance values are used. For example, for platforms where `-moz-appearance: dialog` has (partially) transparent rendering, the extra `background-color: transparent` declaration is now no longer necessary. This patch preserves the behavior for Windows 7 glass because there are several other things that would need to be adjusted for the glass case (see bug 1601183 and bug 1599366). Maybe we can just wait until we drop Windows 7 entirely, to clean this up. 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
This commit is contained in:
Родитель
04a1969fa4
Коммит
b1f429577f
|
@ -5294,11 +5294,21 @@ 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;
|
||||
const nsStyleDisplay* disp = rootStyleFrame->StyleDisplay();
|
||||
if (rootStyleFrame->IsThemed(disp) &&
|
||||
disp->mAppearance != StyleAppearance::MozWinGlass &&
|
||||
disp->mAppearance != StyleAppearance::MozWinBorderlessGlass) {
|
||||
// Ignore the CSS background-color if -moz-appearance is used and it is
|
||||
// not one of the glass values. (Windows 7 Glass has traditionally not
|
||||
// overridden background colors, so we preserve that behavior for now.)
|
||||
mCanvasBackgroundColor = NS_RGBA(0, 0, 0, 0);
|
||||
} else {
|
||||
mCanvasBackgroundColor = nsCSSRendering::DetermineBackgroundColor(
|
||||
mPresContext, bgStyle, rootStyleFrame, drawBackgroundImage,
|
||||
drawBackgroundColor);
|
||||
}
|
||||
mHasCSSBackgroundColor = drawBackgroundColor;
|
||||
if (mPresContext->IsRootContentDocumentCrossProcess() &&
|
||||
!IsTransparentContainerElement(mPresContext)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче