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

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

Issue 878023002: Merge outline paint phases into the foreground phase. (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 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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 } 788 }
789 789
790 void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer& fillLayer, const LayoutRect& rect, 790 void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer& fillLayer, const LayoutRect& rect,
791 BackgroundBleedAvoidance bleedAvoidance, RenderObject* backgroundObject, boo l skipBaseColor) 791 BackgroundBleedAvoidance bleedAvoidance, RenderObject* backgroundObject, boo l skipBaseColor)
792 { 792 {
793 paintFillLayerExtended(paintInfo, c, fillLayer, rect, bleedAvoidance, 0, Lay outSize(), backgroundObject, skipBaseColor); 793 paintFillLayerExtended(paintInfo, c, fillLayer, rect, bleedAvoidance, 0, Lay outSize(), backgroundObject, skipBaseColor);
794 } 794 }
795 795
796 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu latedOffset, ContentsClipBehavior contentsClipBehavior) 796 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu latedOffset, ContentsClipBehavior contentsClipBehavior)
797 { 797 {
798 if (paintInfo.phase == PaintPhaseSelfOutline || paintInfo.phase == PaintPhas eMask) 798 if (paintInfo.phase == PaintPhaseMask)
799 return false; 799 return false;
800 800
801 bool isControlClip = hasControlClip(); 801 bool isControlClip = hasControlClip();
802 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer(); 802 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer();
803 803
804 if (!isControlClip && !isOverflowClip) 804 if (!isControlClip && !isOverflowClip)
805 return false; 805 return false;
806 806
807 LayoutRect clipRect = isControlClip ? controlClipRect(accumulatedOffset) : o verflowClipRect(accumulatedOffset); 807 LayoutRect clipRect = isControlClip ? controlClipRect(accumulatedOffset) : o verflowClipRect(accumulatedOffset);
808 RoundedRect clipRoundedRect(0, 0, 0, 0); 808 RoundedRect clipRoundedRect(0, 0, 0, 0);
809 bool hasBorderRadius = style()->hasBorderRadius(); 809 bool hasBorderRadius = style()->hasBorderRadius();
810 if (hasBorderRadius) 810 if (hasBorderRadius)
811 clipRoundedRect = style()->getRoundedInnerBorderFor(LayoutRect(accumulat edOffset, size())); 811 clipRoundedRect = style()->getRoundedInnerBorderFor(LayoutRect(accumulat edOffset, size()));
812 812
813 if (contentsClipBehavior == SkipContentsClipIfPossible) { 813 if (contentsClipBehavior == SkipContentsClipIfPossible) {
814 LayoutRect contentsVisualOverflow = contentsVisualOverflowRect(); 814 LayoutRect contentsVisualOverflow = contentsVisualOverflowRect();
815 if (contentsVisualOverflow.isEmpty()) 815 if (contentsVisualOverflow.isEmpty())
816 return false; 816 return false;
817 817
818 LayoutRect conservativeClipRect = clipRect; 818 LayoutRect conservativeClipRect = clipRect;
819 if (hasBorderRadius) 819 if (hasBorderRadius)
820 conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect()); 820 conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect());
821 conservativeClipRect.moveBy(-accumulatedOffset); 821 conservativeClipRect.moveBy(-accumulatedOffset);
822 if (hasLayer()) 822 if (hasLayer())
823 conservativeClipRect.move(scrolledContentOffset()); 823 conservativeClipRect.move(scrolledContentOffset());
824 if (conservativeClipRect.contains(contentsVisualOverflow)) 824 if (conservativeClipRect.contains(contentsVisualOverflow))
825 return false; 825 return false;
826 } 826 }
827 827
828 if (paintInfo.phase == PaintPhaseOutline)
829 paintInfo.phase = PaintPhaseChildOutlines;
830 paintInfo.context->save(); 828 paintInfo.context->save();
831 if (hasBorderRadius) 829 if (hasBorderRadius)
832 paintInfo.context->clipRoundedRect(clipRoundedRect); 830 paintInfo.context->clipRoundedRect(clipRoundedRect);
833 paintInfo.context->clip(pixelSnappedIntRect(clipRect)); 831 paintInfo.context->clip(pixelSnappedIntRect(clipRect));
834 return true; 832 return true;
835 } 833 }
836 834
837 void RenderBox::popContentsClip(PaintInfo& paintInfo, PaintPhase originalPhase, const LayoutPoint& accumulatedOffset) 835 void RenderBox::popContentsClip(PaintInfo& paintInfo, PaintPhase originalPhase, const LayoutPoint& accumulatedOffset)
838 { 836 {
839 ASSERT(hasControlClip() || (hasOverflowClip() && !layer()->isSelfPaintingLay er())); 837 ASSERT(hasControlClip() || (hasOverflowClip() && !layer()->isSelfPaintingLay er()));
840
841 paintInfo.context->restore(); 838 paintInfo.context->restore();
842 if (originalPhase == PaintPhaseOutline) {
843 paintInfo.phase = PaintPhaseSelfOutline;
844 paintObject(paintInfo, accumulatedOffset);
845 paintInfo.phase = originalPhase;
846 }
847 } 839 }
848 840
849 LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location) 841 LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location)
850 { 842 {
851 LayoutRect clipRect = borderBoxRect(); 843 LayoutRect clipRect = borderBoxRect();
852 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft( ), borderTop())); 844 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft( ), borderTop()));
853 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom())); 845 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
854 return clipRect; 846 return clipRect;
855 } 847 }
856 848
(...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after
2940 2932
2941 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 2933 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
2942 { 2934 {
2943 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); 2935 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor);
2944 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 2936 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
2945 ASSERT(hasBackground == style.hasBackground()); 2937 ASSERT(hasBackground == style.hasBackground());
2946 hasBorder = style.hasBorder(); 2938 hasBorder = style.hasBorder();
2947 } 2939 }
2948 2940
2949 } // namespace blink 2941 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698