| Index: Source/core/dom/Document.cpp
|
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
|
| index 605ea63164fcc2ab7bfcf6708ce12dada440908a..ef81ab9a617b8402cfc9ac56d8e6b1f4049a4cf9 100644
|
| --- a/Source/core/dom/Document.cpp
|
| +++ b/Source/core/dom/Document.cpp
|
| @@ -1627,16 +1627,28 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
|
| rootDirection = bodyStyle->direction();
|
| }
|
|
|
| - RefPtr<ComputedStyle> overflowStyle;
|
| + const ComputedStyle* overflowStyle = nullptr;
|
| if (Element* element = viewportDefiningElement(documentElementStyle.get())) {
|
| if (element == body) {
|
| - overflowStyle = bodyStyle;
|
| + overflowStyle = bodyStyle.get();
|
| } else {
|
| ASSERT(element == documentElement());
|
| - overflowStyle = documentElementStyle;
|
| + overflowStyle = documentElementStyle.get();
|
| }
|
| }
|
|
|
| + const ComputedStyle* backgroundStyle = documentElementStyle.get();
|
| + if (isHTMLHtmlElement(documentElement()) && isHTMLBodyElement(body) && !backgroundStyle->hasBackground())
|
| + backgroundStyle = bodyStyle.get();
|
| + Color backgroundColor = backgroundStyle->visitedDependentColor(CSSPropertyBackgroundColor);
|
| + FillLayer backgroundLayers = backgroundStyle->backgroundLayers();
|
| + for (auto currentLayer = &backgroundLayers; currentLayer; currentLayer = currentLayer->next()) {
|
| + // http://www.w3.org/TR/css3-background/#root-background
|
| + // The root element background always have painting area of the whole canvas.
|
| + currentLayer->setClip(BorderFillBox);
|
| + }
|
| + EImageRendering imageRendering = backgroundStyle->imageRendering();
|
| +
|
| // Resolved rem units are stored in the matched properties cache so we need to make sure to
|
| // invalidate the cache if the documentElement needed to reattach or the font size changed
|
| // and then trigger a full document recalc. We also need to clear it here since the
|
| @@ -1670,9 +1682,12 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
|
| RefPtr<ComputedStyle> documentStyle = layoutView()->mutableStyle();
|
| if (documentStyle->writingMode() != rootWritingMode
|
| || documentStyle->direction() != rootDirection
|
| + || documentStyle->columnGap() != columnGap
|
| || documentStyle->overflowX() != overflowX
|
| || documentStyle->overflowY() != overflowY
|
| - || documentStyle->columnGap() != columnGap
|
| + || documentStyle->visitedDependentColor(CSSPropertyBackgroundColor) != backgroundColor
|
| + || documentStyle->backgroundLayers() != backgroundLayers
|
| + || documentStyle->imageRendering() != imageRendering
|
| || documentStyle->scrollBlocksOn() != scrollBlocksOn) {
|
| RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*documentStyle);
|
| newStyle->setWritingMode(rootWritingMode);
|
| @@ -1680,6 +1695,9 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
|
| newStyle->setColumnGap(columnGap);
|
| newStyle->setOverflowX(overflowX);
|
| newStyle->setOverflowY(overflowY);
|
| + newStyle->setBackgroundColor(backgroundColor);
|
| + newStyle->accessBackgroundLayers() = backgroundLayers;
|
| + newStyle->setImageRendering(imageRendering);
|
| newStyle->setScrollBlocksOn(scrollBlocksOn);
|
| layoutView()->setStyle(newStyle);
|
| setupFontBuilder(*newStyle);
|
|
|