OLD | NEW |
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 Loading... |
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 isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer(); | 801 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer(); |
802 if (!isOverflowClip) | 802 if (!isOverflowClip) |
803 return false; | 803 return false; |
804 | 804 |
805 LayoutRect clipRect = overflowClipRect(accumulatedOffset); | 805 LayoutRect clipRect = overflowClipRect(accumulatedOffset); |
806 RoundedRect clipRoundedRect(0, 0, 0, 0); | 806 RoundedRect clipRoundedRect(0, 0, 0, 0); |
807 bool hasBorderRadius = style()->hasBorderRadius(); | 807 bool hasBorderRadius = style()->hasBorderRadius(); |
808 if (hasBorderRadius) | 808 if (hasBorderRadius) |
809 clipRoundedRect = style()->getRoundedInnerBorderFor(LayoutRect(accumulat
edOffset, size())); | 809 clipRoundedRect = style()->getRoundedInnerBorderFor(LayoutRect(accumulat
edOffset, size())); |
810 | 810 |
811 if (contentsClipBehavior == SkipContentsClipIfPossible) { | 811 if (contentsClipBehavior == SkipContentsClipIfPossible) { |
812 LayoutRect contentsVisualOverflow = contentsVisualOverflowRect(); | 812 LayoutRect contentsVisualOverflow = contentsVisualOverflowRect(); |
813 if (contentsVisualOverflow.isEmpty()) | 813 if (contentsVisualOverflow.isEmpty()) |
814 return false; | 814 return false; |
815 | 815 |
816 LayoutRect conservativeClipRect = clipRect; | 816 LayoutRect conservativeClipRect = clipRect; |
817 if (hasBorderRadius) | 817 if (hasBorderRadius) |
818 conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect()); | 818 conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect()); |
819 conservativeClipRect.moveBy(-accumulatedOffset); | 819 conservativeClipRect.moveBy(-accumulatedOffset); |
820 if (hasLayer()) | 820 if (hasLayer()) |
821 conservativeClipRect.move(scrolledContentOffset()); | 821 conservativeClipRect.move(scrolledContentOffset()); |
822 if (conservativeClipRect.contains(contentsVisualOverflow)) | 822 if (conservativeClipRect.contains(contentsVisualOverflow)) |
823 return false; | 823 return false; |
824 } | 824 } |
825 | 825 |
826 if (paintInfo.phase == PaintPhaseOutline) | |
827 paintInfo.phase = PaintPhaseChildOutlines; | |
828 paintInfo.context->save(); | 826 paintInfo.context->save(); |
829 if (hasBorderRadius) | 827 if (hasBorderRadius) |
830 paintInfo.context->clipRoundedRect(clipRoundedRect); | 828 paintInfo.context->clipRoundedRect(clipRoundedRect); |
831 paintInfo.context->clip(pixelSnappedIntRect(clipRect)); | 829 paintInfo.context->clip(pixelSnappedIntRect(clipRect)); |
832 return true; | 830 return true; |
833 } | 831 } |
834 | 832 |
835 void RenderBox::popContentsClip(PaintInfo& paintInfo, PaintPhase originalPhase,
const LayoutPoint& accumulatedOffset) | 833 void RenderBox::popContentsClip(PaintInfo& paintInfo, PaintPhase originalPhase,
const LayoutPoint& accumulatedOffset) |
836 { | 834 { |
837 ASSERT(hasOverflowClip() && !layer()->isSelfPaintingLayer()); | 835 ASSERT(hasOverflowClip() && !layer()->isSelfPaintingLayer()); |
838 | |
839 paintInfo.context->restore(); | 836 paintInfo.context->restore(); |
840 if (originalPhase == PaintPhaseOutline) { | |
841 paintInfo.phase = PaintPhaseSelfOutline; | |
842 paintObject(paintInfo, accumulatedOffset); | |
843 paintInfo.phase = originalPhase; | |
844 } | |
845 } | 837 } |
846 | 838 |
847 LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location) | 839 LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location) |
848 { | 840 { |
849 LayoutRect clipRect = borderBoxRect(); | 841 LayoutRect clipRect = borderBoxRect(); |
850 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft(
), borderTop())); | 842 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft(
), borderTop())); |
851 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(),
borderTop() + borderBottom())); | 843 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(),
borderTop() + borderBottom())); |
852 return clipRect; | 844 return clipRect; |
853 } | 845 } |
854 | 846 |
(...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2938 | 2930 |
2939 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) | 2931 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) |
2940 { | 2932 { |
2941 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); | 2933 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); |
2942 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); | 2934 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); |
2943 ASSERT(hasBackground == style.hasBackground()); | 2935 ASSERT(hasBackground == style.hasBackground()); |
2944 hasBorder = style.hasBorder(); | 2936 hasBorder = style.hasBorder(); |
2945 } | 2937 } |
2946 | 2938 |
2947 } // namespace blink | 2939 } // namespace blink |
OLD | NEW |