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

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

Issue 1017593005: Add a basic custom painting facility to Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add missing files Created 5 years, 9 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 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 return BackgroundBleedBackgroundOverBorder; 982 return BackgroundBleedBackgroundOverBorder;
983 983
984 return BackgroundBleedClipBackground; 984 return BackgroundBleedClipBackground;
985 } 985 }
986 986
987 void RenderBox::paintBoxDecorationBackground(PaintInfo& paintInfo, const LayoutP oint& paintOffset) 987 void RenderBox::paintBoxDecorationBackground(PaintInfo& paintInfo, const LayoutP oint& paintOffset)
988 { 988 {
989 LayoutRect paintRect = borderBoxRect(); 989 LayoutRect paintRect = borderBoxRect();
990 paintRect.moveBy(paintOffset); 990 paintRect.moveBy(paintOffset);
991 paintBoxDecorationBackgroundWithRect(paintInfo, paintOffset, paintRect); 991 paintBoxDecorationBackgroundWithRect(paintInfo, paintOffset, paintRect);
992 // TODO(abarth): Currently we only draw m_customPainting if we happen to
ojan 2015/03/19 22:30:04 I think we want to do this before we do any other
abarth-chromium 2015/03/19 22:34:27 Yeah, the main design question is whether these pa
993 // have a box decoration or a background. Instead, we should probably have
994 // another function like paintBoxDecorationBackground that subclasses can
995 // call to draw m_customPainting.
996 if (m_customPainting)
997 paintInfo.context->drawDisplayList(m_customPainting.get(), paintRect.loc ation());
992 } 998 }
993 999
994 void RenderBox::paintBoxDecorationBackgroundWithRect(PaintInfo& paintInfo, const LayoutPoint& paintOffset, const LayoutRect& paintRect) 1000 void RenderBox::paintBoxDecorationBackgroundWithRect(PaintInfo& paintInfo, const LayoutPoint& paintOffset, const LayoutRect& paintRect)
995 { 1001 {
996 RenderStyle* style = this->style(); 1002 RenderStyle* style = this->style();
997 BoxDecorationData boxDecorationData(*style); 1003 BoxDecorationData boxDecorationData(*style);
998 BackgroundBleedAvoidance bleedAvoidance = determineBackgroundBleedAvoidance( paintInfo.context, boxDecorationData); 1004 BackgroundBleedAvoidance bleedAvoidance = determineBackgroundBleedAvoidance( paintInfo.context, boxDecorationData);
999 1005
1000 // FIXME: Should eventually give the theme control over whether the box shad ow should paint, since controls could have 1006 // FIXME: Should eventually give the theme control over whether the box shad ow should paint, since controls could have
1001 // custom shadows of their own. 1007 // custom shadows of their own.
(...skipping 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after
3072 3078
3073 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 3079 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
3074 { 3080 {
3075 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); 3081 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor);
3076 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 3082 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
3077 ASSERT(hasBackground == style.hasBackground()); 3083 ASSERT(hasBackground == style.hasBackground());
3078 hasBorder = style.hasBorder(); 3084 hasBorder = style.hasBorder();
3079 } 3085 }
3080 3086
3081 } // namespace blink 3087 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698