Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Unified Diff: sky/engine/core/rendering/RenderBoxModelObject.cpp

Issue 928393003: Remove the concept of document.documentElement (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/rendering/RenderBoxModelObject.h ('k') | sky/engine/core/rendering/RenderFlexibleBox.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/rendering/RenderBoxModelObject.cpp
diff --git a/sky/engine/core/rendering/RenderBoxModelObject.cpp b/sky/engine/core/rendering/RenderBoxModelObject.cpp
index a0322779efeda802034b534e0daa452ed0ba75b8..bfa618e6b6a26455bb09e22fcd6e4ae15180a570 100644
--- a/sky/engine/core/rendering/RenderBoxModelObject.cpp
+++ b/sky/engine/core/rendering/RenderBoxModelObject.cpp
@@ -119,47 +119,6 @@ bool RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight() const
return cb->hasAutoHeightOrContainingBlockWithAutoHeight();
}
-bool RenderBoxModelObject::isDocumentElementWithOpaqueBackground() const
-{
- if (!isDocumentElement())
- return false;
-
- // The background is opaque only if we're the root document, since iframes with
- // no background in the child document should show the parent's background.
- // FIXME(sky): This used to check the <body> element and is now probably wrong.
- if (view()->frameView())
- return !view()->frameView()->isTransparent();
-
- return true;
-}
-
-void RenderBoxModelObject::paintRootBackgroundColor(const PaintInfo& paintInfo, const LayoutRect& rect, const Color& bgColor)
-{
- GraphicsContext* context = paintInfo.context;
- if (rect.isEmpty())
- return;
-
- ASSERT(isDocumentElement());
-
- IntRect backgroundRect(pixelSnappedIntRect(rect));
- backgroundRect.intersect(paintInfo.rect);
-
- Color baseColor = view()->frameView()->baseBackgroundColor();
- bool shouldClearDocumentBackground = document().settings() && document().settings()->shouldClearDocumentBackground();
- CompositeOperator operation = shouldClearDocumentBackground ? CompositeCopy : context->compositeOperation();
-
- // If we have an alpha go ahead and blend with the base background color.
- if (baseColor.alpha()) {
- if (bgColor.alpha())
- baseColor = baseColor.blend(bgColor);
- context->fillRect(backgroundRect, baseColor, operation);
- } else if (bgColor.alpha()) {
- context->fillRect(backgroundRect, bgColor, operation);
- } else if (shouldClearDocumentBackground) {
- context->clearRect(backgroundRect);
- }
-}
-
LayoutSize RenderBoxModelObject::relativePositionOffset() const
{
LayoutSize offset;
@@ -371,7 +330,6 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
bool hasRoundedBorder = style()->hasBorderRadius() && (includeLeftEdge || includeRightEdge);
bool clippedWithLocalScrolling = hasOverflowClip() && bgLayer.attachment() == LocalBackgroundAttachment;
bool isBorderFill = bgLayer.clip() == BorderFillBox;
- bool isDocumentElementRenderer = this->isDocumentElement();
bool isBottomLayer = !bgLayer.next();
Color bgColor = color;
@@ -381,7 +339,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
bool colorVisible = bgColor.alpha();
// Fast path for drawing simple color backgrounds.
- if (!isDocumentElementRenderer && !clippedWithLocalScrolling && !shouldPaintBackgroundImage && isBorderFill && isBottomLayer) {
+ if (!clippedWithLocalScrolling && !shouldPaintBackgroundImage && isBorderFill && isBottomLayer) {
if (!colorVisible)
return;
@@ -472,8 +430,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
if (isBottomLayer) {
IntRect backgroundRect(pixelSnappedIntRect(scrolledPaintRect));
bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppliedToBackground(bleedAvoidance, box);
- bool isOpaqueRoot = (isDocumentElementRenderer && !bgColor.hasAlpha()) || isDocumentElementWithOpaqueBackground();
- if (boxShadowShouldBeAppliedToBackground || !shouldPaintBackgroundImage || !bgLayer.hasOpaqueImage(this) || !bgLayer.hasRepeatXY() || (isOpaqueRoot && !toRenderBox(this)->height())) {
+ if (boxShadowShouldBeAppliedToBackground || !shouldPaintBackgroundImage || !bgLayer.hasOpaqueImage(this) || !bgLayer.hasRepeatXY()) {
if (!boxShadowShouldBeAppliedToBackground)
backgroundRect.intersect(paintInfo.rect);
@@ -481,11 +438,8 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
if (boxShadowShouldBeAppliedToBackground)
applyBoxShadowForBackground(context, this);
- if (isOpaqueRoot && !skipBaseColor) {
- paintRootBackgroundColor(paintInfo, rect, bgColor);
- } else if (bgColor.alpha()) {
+ if (bgColor.alpha())
context->fillRect(backgroundRect, bgColor, context->compositeOperation());
- }
}
}
@@ -740,15 +694,7 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const RenderLayerMod
}
}
- // The background of the box generated by the root element covers the entire canvas including
- // its margins. Since those were added in already, we have to factor them out when computing
- // the background positioning area.
- if (isDocumentElement()) {
- positioningAreaSize = pixelSnappedIntSize(toRenderBox(this)->size() - LayoutSize(left + right, top + bottom), toRenderBox(this)->location());
- left += marginLeft();
- top += marginTop();
- } else
- positioningAreaSize = pixelSnappedIntSize(paintRect.size() - LayoutSize(left + right, top + bottom), paintRect.location());
+ positioningAreaSize = pixelSnappedIntSize(paintRect.size() - LayoutSize(left + right, top + bottom), paintRect.location());
} else {
geometry.setHasNonLocalGeometry();
« no previous file with comments | « sky/engine/core/rendering/RenderBoxModelObject.h ('k') | sky/engine/core/rendering/RenderFlexibleBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698