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

Side by Side Diff: sky/engine/core/rendering/RenderBox.cpp

Issue 1122423009: Make it possible to custom-paint without an Element. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Comment tweak Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 contextScaling.setHeight(1); 987 contextScaling.setHeight(1);
988 988
989 if (borderObscuresBackgroundEdge(contextScaling)) 989 if (borderObscuresBackgroundEdge(contextScaling))
990 return BackgroundBleedShrinkBackground; 990 return BackgroundBleedShrinkBackground;
991 if (borderObscuresBackground() && backgroundHasOpaqueTopLayer()) 991 if (borderObscuresBackground() && backgroundHasOpaqueTopLayer())
992 return BackgroundBleedBackgroundOverBorder; 992 return BackgroundBleedBackgroundOverBorder;
993 993
994 return BackgroundBleedClipBackground; 994 return BackgroundBleedClipBackground;
995 } 995 }
996 996
997 void RenderBox::paintCustomPainting(PaintInfo& paintInfo, const LayoutPoint& pai ntOffset)
998 {
999 LayoutRect paintRect = borderBoxRect();
1000 paintRect.moveBy(paintOffset);
1001 // TODO(abarth): Currently we only draw m_customPainting if we happen to
1002 // have a box decoration or a background.
1003 if (m_customPainting)
1004 paintInfo.context->drawDisplayList(m_customPainting.get(), paintRect.loc ation());
1005 }
1006
997 void RenderBox::paintBoxDecorationBackground(PaintInfo& paintInfo, const LayoutP oint& paintOffset) 1007 void RenderBox::paintBoxDecorationBackground(PaintInfo& paintInfo, const LayoutP oint& paintOffset)
998 { 1008 {
999 LayoutRect paintRect = borderBoxRect(); 1009 LayoutRect paintRect = borderBoxRect();
1000 paintRect.moveBy(paintOffset); 1010 paintRect.moveBy(paintOffset);
1001 paintBoxDecorationBackgroundWithRect(paintInfo, paintOffset, paintRect); 1011 paintBoxDecorationBackgroundWithRect(paintInfo, paintOffset, paintRect);
1002 // TODO(abarth): Currently we only draw m_customPainting if we happen to 1012 paintCustomPainting(paintInfo, paintOffset);
1003 // have a box decoration or a background. Instead, we should probably have
1004 // another function like paintBoxDecorationBackground that subclasses can
1005 // call to draw m_customPainting.
1006 if (m_customPainting)
1007 paintInfo.context->drawDisplayList(m_customPainting.get(), paintRect.loc ation());
1008 } 1013 }
1009 1014
1010 void RenderBox::paintBoxDecorationBackgroundWithRect(PaintInfo& paintInfo, const LayoutPoint& paintOffset, const LayoutRect& paintRect) 1015 void RenderBox::paintBoxDecorationBackgroundWithRect(PaintInfo& paintInfo, const LayoutPoint& paintOffset, const LayoutRect& paintRect)
1011 { 1016 {
1012 RenderStyle* style = this->style(); 1017 RenderStyle* style = this->style();
1013 BoxDecorationData boxDecorationData(*style); 1018 BoxDecorationData boxDecorationData(*style);
1014 BackgroundBleedAvoidance bleedAvoidance = determineBackgroundBleedAvoidance( paintInfo.context, boxDecorationData); 1019 BackgroundBleedAvoidance bleedAvoidance = determineBackgroundBleedAvoidance( paintInfo.context, boxDecorationData);
1015 1020
1016 // FIXME: Should eventually give the theme control over whether the box shad ow should paint, since controls could have 1021 // FIXME: Should eventually give the theme control over whether the box shad ow should paint, since controls could have
1017 // custom shadows of their own. 1022 // custom shadows of their own.
(...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after
3065 3070
3066 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 3071 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
3067 { 3072 {
3068 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); 3073 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor);
3069 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 3074 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
3070 ASSERT(hasBackground == style.hasBackground()); 3075 ASSERT(hasBackground == style.hasBackground());
3071 hasBorder = style.hasBorder(); 3076 hasBorder = style.hasBorder();
3072 } 3077 }
3073 3078
3074 } // namespace blink 3079 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698