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

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

Issue 867463005: Merge the background paint phase into the foreground phase. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « sky/engine/core/rendering/RenderBlock.cpp ('k') | sky/engine/core/rendering/RenderLayer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 } 793 }
794 794
795 void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer& fillLayer, const LayoutRect& rect, 795 void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer& fillLayer, const LayoutRect& rect,
796 BackgroundBleedAvoidance bleedAvoidance, RenderObject* backgroundObject, boo l skipBaseColor) 796 BackgroundBleedAvoidance bleedAvoidance, RenderObject* backgroundObject, boo l skipBaseColor)
797 { 797 {
798 paintFillLayerExtended(paintInfo, c, fillLayer, rect, bleedAvoidance, 0, Lay outSize(), backgroundObject, skipBaseColor); 798 paintFillLayerExtended(paintInfo, c, fillLayer, rect, bleedAvoidance, 0, Lay outSize(), backgroundObject, skipBaseColor);
799 } 799 }
800 800
801 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu latedOffset, ContentsClipBehavior contentsClipBehavior) 801 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu latedOffset, ContentsClipBehavior contentsClipBehavior)
802 { 802 {
803 if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == Paint PhaseSelfOutline || paintInfo.phase == PaintPhaseMask) 803 if (paintInfo.phase == PaintPhaseSelfOutline || paintInfo.phase == PaintPhas eMask)
804 return false; 804 return false;
805 805
806 bool isControlClip = hasControlClip(); 806 bool isControlClip = hasControlClip();
807 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer(); 807 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer();
808 808
809 if (!isControlClip && !isOverflowClip) 809 if (!isControlClip && !isOverflowClip)
810 return false; 810 return false;
811 811
812 LayoutRect clipRect = isControlClip ? controlClipRect(accumulatedOffset) : o verflowClipRect(accumulatedOffset); 812 LayoutRect clipRect = isControlClip ? controlClipRect(accumulatedOffset) : o verflowClipRect(accumulatedOffset);
813 RoundedRect clipRoundedRect(0, 0, 0, 0); 813 RoundedRect clipRoundedRect(0, 0, 0, 0);
(...skipping 11 matching lines...) Expand all
825 conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect()); 825 conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect());
826 conservativeClipRect.moveBy(-accumulatedOffset); 826 conservativeClipRect.moveBy(-accumulatedOffset);
827 if (hasLayer()) 827 if (hasLayer())
828 conservativeClipRect.move(scrolledContentOffset()); 828 conservativeClipRect.move(scrolledContentOffset());
829 if (conservativeClipRect.contains(contentsVisualOverflow)) 829 if (conservativeClipRect.contains(contentsVisualOverflow))
830 return false; 830 return false;
831 } 831 }
832 832
833 if (paintInfo.phase == PaintPhaseOutline) 833 if (paintInfo.phase == PaintPhaseOutline)
834 paintInfo.phase = PaintPhaseChildOutlines; 834 paintInfo.phase = PaintPhaseChildOutlines;
835 else if (paintInfo.phase == PaintPhaseChildBlockBackground) {
836 paintInfo.phase = PaintPhaseBlockBackground;
837 paintObject(paintInfo, accumulatedOffset);
838 paintInfo.phase = PaintPhaseChildBlockBackgrounds;
839 }
840 paintInfo.context->save(); 835 paintInfo.context->save();
841 if (hasBorderRadius) 836 if (hasBorderRadius)
842 paintInfo.context->clipRoundedRect(clipRoundedRect); 837 paintInfo.context->clipRoundedRect(clipRoundedRect);
843 paintInfo.context->clip(pixelSnappedIntRect(clipRect)); 838 paintInfo.context->clip(pixelSnappedIntRect(clipRect));
844 return true; 839 return true;
845 } 840 }
846 841
847 void RenderBox::popContentsClip(PaintInfo& paintInfo, PaintPhase originalPhase, const LayoutPoint& accumulatedOffset) 842 void RenderBox::popContentsClip(PaintInfo& paintInfo, PaintPhase originalPhase, const LayoutPoint& accumulatedOffset)
848 { 843 {
849 ASSERT(hasControlClip() || (hasOverflowClip() && !layer()->isSelfPaintingLay er())); 844 ASSERT(hasControlClip() || (hasOverflowClip() && !layer()->isSelfPaintingLay er()));
850 845
851 paintInfo.context->restore(); 846 paintInfo.context->restore();
852 if (originalPhase == PaintPhaseOutline) { 847 if (originalPhase == PaintPhaseOutline) {
853 paintInfo.phase = PaintPhaseSelfOutline; 848 paintInfo.phase = PaintPhaseSelfOutline;
854 paintObject(paintInfo, accumulatedOffset); 849 paintObject(paintInfo, accumulatedOffset);
855 paintInfo.phase = originalPhase; 850 paintInfo.phase = originalPhase;
856 } else if (originalPhase == PaintPhaseChildBlockBackground) 851 }
857 paintInfo.phase = originalPhase;
858 } 852 }
859 853
860 LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location) 854 LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location)
861 { 855 {
862 LayoutRect clipRect = borderBoxRect(); 856 LayoutRect clipRect = borderBoxRect();
863 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft( ), borderTop())); 857 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft( ), borderTop()));
864 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom())); 858 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
865 return clipRect; 859 return clipRect;
866 } 860 }
867 861
(...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after
2951 2945
2952 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 2946 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
2953 { 2947 {
2954 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); 2948 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor);
2955 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 2949 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
2956 ASSERT(hasBackground == style.hasBackground()); 2950 ASSERT(hasBackground == style.hasBackground());
2957 hasBorder = style.hasBorder(); 2951 hasBorder = style.hasBorder();
2958 } 2952 }
2959 2953
2960 } // namespace blink 2954 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBlock.cpp ('k') | sky/engine/core/rendering/RenderLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698