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 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 // Fast path for drawing simple color backgrounds. | 530 // Fast path for drawing simple color backgrounds. |
531 if (!isRoot && !clippedWithLocalScrolling && !shouldPaintBackgroundImage &&
isBorderFill && !bgLayer->next()) { | 531 if (!isRoot && !clippedWithLocalScrolling && !shouldPaintBackgroundImage &&
isBorderFill && !bgLayer->next()) { |
532 if (!colorVisible) | 532 if (!colorVisible) |
533 return; | 533 return; |
534 | 534 |
535 bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppli
edToBackground(bleedAvoidance, box); | 535 bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppli
edToBackground(bleedAvoidance, box); |
536 GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShouldBeAp
pliedToBackground); | 536 GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShouldBeAp
pliedToBackground); |
537 if (boxShadowShouldBeAppliedToBackground) | 537 if (boxShadowShouldBeAppliedToBackground) |
538 applyBoxShadowForBackground(context, this); | 538 applyBoxShadowForBackground(context, this); |
539 | 539 |
540 if (hasRoundedBorder && bleedAvoidance != BackgroundBleedUseTransparency
Layer) { | 540 if (hasRoundedBorder && bleedAvoidance != BackgroundBleedClipBackground)
{ |
541 RoundedRect border = backgroundRoundedRectAdjustedForBleedAvoidance(
context, rect, bleedAvoidance, box, boxSize, includeLeftEdge, includeRightEdge); | 541 RoundedRect border = backgroundRoundedRectAdjustedForBleedAvoidance(
context, rect, bleedAvoidance, box, boxSize, includeLeftEdge, includeRightEdge); |
542 if (border.isRenderable()) | 542 if (border.isRenderable()) |
543 context->fillRoundedRect(border, bgColor); | 543 context->fillRoundedRect(border, bgColor); |
544 else { | 544 else { |
545 context->save(); | 545 context->save(); |
546 clipRoundedInnerRect(context, rect, border); | 546 clipRoundedInnerRect(context, rect, border); |
547 context->fillRect(border.rect(), bgColor); | 547 context->fillRect(border.rect(), bgColor); |
548 context->restore(); | 548 context->restore(); |
549 } | 549 } |
550 } else { | 550 } else { |
551 context->fillRect(pixelSnappedIntRect(rect), bgColor); | 551 context->fillRect(pixelSnappedIntRect(rect), bgColor); |
552 } | 552 } |
553 | 553 |
554 return; | 554 return; |
555 } | 555 } |
556 | 556 |
557 // BorderFillBox radius clipping is taken care of by BackgroundBleedUseTrans
parencyLayer | 557 // BorderFillBox radius clipping is taken care of by BackgroundBleedClipBack
ground |
558 bool clipToBorderRadius = hasRoundedBorder && !(isBorderFill && bleedAvoidan
ce == BackgroundBleedUseTransparencyLayer); | 558 bool clipToBorderRadius = hasRoundedBorder && !(isBorderFill && bleedAvoidan
ce == BackgroundBleedClipBackground); |
559 GraphicsContextStateSaver clipToBorderStateSaver(*context, clipToBorderRadiu
s); | 559 GraphicsContextStateSaver clipToBorderStateSaver(*context, clipToBorderRadiu
s); |
560 if (clipToBorderRadius) { | 560 if (clipToBorderRadius) { |
561 RoundedRect border = isBorderFill ? backgroundRoundedRectAdjustedForBlee
dAvoidance(context, rect, bleedAvoidance, box, boxSize, includeLeftEdge, include
RightEdge) : getBackgroundRoundedRect(rect, box, boxSize.width(), boxSize.height
(), includeLeftEdge, includeRightEdge); | 561 RoundedRect border = isBorderFill ? backgroundRoundedRectAdjustedForBlee
dAvoidance(context, rect, bleedAvoidance, box, boxSize, includeLeftEdge, include
RightEdge) : getBackgroundRoundedRect(rect, box, boxSize.width(), boxSize.height
(), includeLeftEdge, includeRightEdge); |
562 | 562 |
563 // Clip to the padding or content boxes as necessary. | 563 // Clip to the padding or content boxes as necessary. |
564 if (bgLayer->clip() == ContentFillBox) { | 564 if (bgLayer->clip() == ContentFillBox) { |
565 border = style()->getRoundedInnerBorderFor(border.rect(), | 565 border = style()->getRoundedInnerBorderFor(border.rect(), |
566 paddingTop() + borderTop(), paddingBottom() + borderBottom(), pa
ddingLeft() + borderLeft(), paddingRight() + borderRight(), includeLeftEdge, inc
ludeRightEdge); | 566 paddingTop() + borderTop(), paddingBottom() + borderBottom(), pa
ddingLeft() + borderLeft(), paddingRight() + borderRight(), includeLeftEdge, inc
ludeRightEdge); |
567 } else if (bgLayer->clip() == PaddingFillBox) | 567 } else if (bgLayer->clip() == PaddingFillBox) |
568 border = style()->getRoundedInnerBorderFor(border.rect(), includeLef
tEdge, includeRightEdge); | 568 border = style()->getRoundedInnerBorderFor(border.rect(), includeLef
tEdge, includeRightEdge); |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1755 if (haveAllSolidEdges && outerBorder.isRounded() && allCornersClippedOut(out
erBorder, info.rect)) | 1755 if (haveAllSolidEdges && outerBorder.isRounded() && allCornersClippedOut(out
erBorder, info.rect)) |
1756 outerBorder.setRadii(RoundedRect::Radii()); | 1756 outerBorder.setRadii(RoundedRect::Radii()); |
1757 | 1757 |
1758 // isRenderable() check avoids issue described in https://bugs.webkit.org/sh
ow_bug.cgi?id=38787 | 1758 // isRenderable() check avoids issue described in https://bugs.webkit.org/sh
ow_bug.cgi?id=38787 |
1759 if ((haveAllSolidEdges || haveAllDoubleEdges) && allEdgesShareColor && inner
Border.isRenderable()) { | 1759 if ((haveAllSolidEdges || haveAllDoubleEdges) && allEdgesShareColor && inner
Border.isRenderable()) { |
1760 // Fast path for drawing all solid edges and all unrounded double edges | 1760 // Fast path for drawing all solid edges and all unrounded double edges |
1761 if (numEdgesVisible == 4 && (outerBorder.isRounded() || haveAlphaColor) | 1761 if (numEdgesVisible == 4 && (outerBorder.isRounded() || haveAlphaColor) |
1762 && (haveAllSolidEdges || (!outerBorder.isRounded() && !innerBorder.i
sRounded()))) { | 1762 && (haveAllSolidEdges || (!outerBorder.isRounded() && !innerBorder.i
sRounded()))) { |
1763 Path path; | 1763 Path path; |
1764 | 1764 |
1765 if (outerBorder.isRounded() && bleedAvoidance != BackgroundBleedUseT
ransparencyLayer) | 1765 if (outerBorder.isRounded() && bleedAvoidance != BackgroundBleedClip
Background) |
1766 path.addRoundedRect(outerBorder); | 1766 path.addRoundedRect(outerBorder); |
1767 else | 1767 else |
1768 path.addRect(outerBorder.rect()); | 1768 path.addRect(outerBorder.rect()); |
1769 | 1769 |
1770 if (haveAllDoubleEdges) { | 1770 if (haveAllDoubleEdges) { |
1771 IntRect innerThirdRect = outerBorder.rect(); | 1771 IntRect innerThirdRect = outerBorder.rect(); |
1772 IntRect outerThirdRect = outerBorder.rect(); | 1772 IntRect outerThirdRect = outerBorder.rect(); |
1773 for (int side = BSTop; side <= BSLeft; ++side) { | 1773 for (int side = BSTop; side <= BSLeft; ++side) { |
1774 int outerWidth; | 1774 int outerWidth; |
1775 int innerWidth; | 1775 int innerWidth; |
(...skipping 12 matching lines...) Expand all Loading... |
1788 innerThirdRect.setWidth(innerThirdRect.width() - innerWi
dth); | 1788 innerThirdRect.setWidth(innerThirdRect.width() - innerWi
dth); |
1789 outerThirdRect.setWidth(outerThirdRect.width() - outerWi
dth); | 1789 outerThirdRect.setWidth(outerThirdRect.width() - outerWi
dth); |
1790 } | 1790 } |
1791 } | 1791 } |
1792 | 1792 |
1793 RoundedRect outerThird = outerBorder; | 1793 RoundedRect outerThird = outerBorder; |
1794 RoundedRect innerThird = innerBorder; | 1794 RoundedRect innerThird = innerBorder; |
1795 innerThird.setRect(innerThirdRect); | 1795 innerThird.setRect(innerThirdRect); |
1796 outerThird.setRect(outerThirdRect); | 1796 outerThird.setRect(outerThirdRect); |
1797 | 1797 |
1798 if (outerThird.isRounded() && bleedAvoidance != BackgroundBleedU
seTransparencyLayer) | 1798 if (outerThird.isRounded() && bleedAvoidance != BackgroundBleedC
lipBackground) |
1799 path.addRoundedRect(outerThird); | 1799 path.addRoundedRect(outerThird); |
1800 else | 1800 else |
1801 path.addRect(outerThird.rect()); | 1801 path.addRect(outerThird.rect()); |
1802 | 1802 |
1803 if (innerThird.isRounded() && bleedAvoidance != BackgroundBleedU
seTransparencyLayer) | 1803 if (innerThird.isRounded() && bleedAvoidance != BackgroundBleedC
lipBackground) |
1804 path.addRoundedRect(innerThird); | 1804 path.addRoundedRect(innerThird); |
1805 else | 1805 else |
1806 path.addRect(innerThird.rect()); | 1806 path.addRect(innerThird.rect()); |
1807 } | 1807 } |
1808 | 1808 |
1809 if (innerBorder.isRounded()) | 1809 if (innerBorder.isRounded()) |
1810 path.addRoundedRect(innerBorder); | 1810 path.addRoundedRect(innerBorder); |
1811 else | 1811 else |
1812 path.addRect(innerBorder.rect()); | 1812 path.addRect(innerBorder.rect()); |
1813 | 1813 |
(...skipping 18 matching lines...) Expand all Loading... |
1832 graphicsContext->setFillColor(edges[firstVisibleEdge].color); | 1832 graphicsContext->setFillColor(edges[firstVisibleEdge].color); |
1833 graphicsContext->fillPath(path); | 1833 graphicsContext->fillPath(path); |
1834 return; | 1834 return; |
1835 } | 1835 } |
1836 } | 1836 } |
1837 | 1837 |
1838 bool clipToOuterBorder = outerBorder.isRounded(); | 1838 bool clipToOuterBorder = outerBorder.isRounded(); |
1839 GraphicsContextStateSaver stateSaver(*graphicsContext, clipToOuterBorder); | 1839 GraphicsContextStateSaver stateSaver(*graphicsContext, clipToOuterBorder); |
1840 if (clipToOuterBorder) { | 1840 if (clipToOuterBorder) { |
1841 // Clip to the inner and outer radii rects. | 1841 // Clip to the inner and outer radii rects. |
1842 if (bleedAvoidance != BackgroundBleedUseTransparencyLayer) | 1842 if (bleedAvoidance != BackgroundBleedClipBackground) |
1843 graphicsContext->clipRoundedRect(outerBorder); | 1843 graphicsContext->clipRoundedRect(outerBorder); |
1844 // isRenderable() check avoids issue described in https://bugs.webkit.or
g/show_bug.cgi?id=38787 | 1844 // isRenderable() check avoids issue described in https://bugs.webkit.or
g/show_bug.cgi?id=38787 |
1845 // The inside will be clipped out later (in clipBorderSideForComplexInne
rPath) | 1845 // The inside will be clipped out later (in clipBorderSideForComplexInne
rPath) |
1846 if (innerBorder.isRenderable() && !innerBorder.isEmpty()) | 1846 if (innerBorder.isRenderable() && !innerBorder.isEmpty()) |
1847 graphicsContext->clipOutRoundedRect(innerBorder); | 1847 graphicsContext->clipOutRoundedRect(innerBorder); |
1848 } | 1848 } |
1849 | 1849 |
1850 // If only one edge visible antialiasing doesn't create seams | 1850 // If only one edge visible antialiasing doesn't create seams |
1851 bool antialias = shouldAntialiasLines(graphicsContext) || numEdgesVisible ==
1; | 1851 bool antialias = shouldAntialiasLines(graphicsContext) || numEdgesVisible ==
1; |
1852 RoundedRect unadjustedInnerBorder = (bleedAvoidance == BackgroundBleedBackgr
oundOverBorder) ? style->getRoundedInnerBorderFor(rect, includeLogicalLeftEdge,
includeLogicalRightEdge) : innerBorder; | 1852 RoundedRect unadjustedInnerBorder = (bleedAvoidance == BackgroundBleedBackgr
oundOverBorder) ? style->getRoundedInnerBorderFor(rect, includeLogicalLeftEdge,
includeLogicalRightEdge) : innerBorder; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1938 includeLogicalLeftEdge, includeLogicalRightEdge); | 1938 includeLogicalLeftEdge, includeLogicalRightEdge); |
1939 | 1939 |
1940 graphicsContext->clipRoundedRect(innerClip); | 1940 graphicsContext->clipRoundedRect(innerClip); |
1941 drawBoxSideFromPath(graphicsContext, borderRect, borderPath, edges,
thickness, drawThickness, side, style, color, SOLID, bleedAvoidance, includeLogi
calLeftEdge, includeLogicalRightEdge); | 1941 drawBoxSideFromPath(graphicsContext, borderRect, borderPath, edges,
thickness, drawThickness, side, style, color, SOLID, bleedAvoidance, includeLogi
calLeftEdge, includeLogicalRightEdge); |
1942 } | 1942 } |
1943 | 1943 |
1944 // Draw outer border line | 1944 // Draw outer border line |
1945 { | 1945 { |
1946 GraphicsContextStateSaver stateSaver(*graphicsContext); | 1946 GraphicsContextStateSaver stateSaver(*graphicsContext); |
1947 LayoutRect outerRect = borderRect; | 1947 LayoutRect outerRect = borderRect; |
1948 if (bleedAvoidance == BackgroundBleedUseTransparencyLayer) { | 1948 if (bleedAvoidance == BackgroundBleedClipBackground) { |
1949 outerRect.inflate(1); | 1949 outerRect.inflate(1); |
1950 ++outerBorderTopWidth; | 1950 ++outerBorderTopWidth; |
1951 ++outerBorderBottomWidth; | 1951 ++outerBorderBottomWidth; |
1952 ++outerBorderLeftWidth; | 1952 ++outerBorderLeftWidth; |
1953 ++outerBorderRightWidth; | 1953 ++outerBorderRightWidth; |
1954 } | 1954 } |
1955 | 1955 |
1956 RoundedRect outerClip = style->getRoundedInnerBorderFor(outerRect, | 1956 RoundedRect outerClip = style->getRoundedInnerBorderFor(outerRect, |
1957 outerBorderTopWidth, outerBorderBottomWidth, outerBorderLeftWidt
h, outerBorderRightWidth, | 1957 outerBorderTopWidth, outerBorderBottomWidth, outerBorderLeftWidt
h, outerBorderRightWidth, |
1958 includeLogicalLeftEdge, includeLogicalRightEdge); | 1958 includeLogicalLeftEdge, includeLogicalRightEdge); |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2787 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2787 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
2788 for (RenderObject* child = startChild; child && child != endChild; ) { | 2788 for (RenderObject* child = startChild; child && child != endChild; ) { |
2789 // Save our next sibling as moveChildTo will clear it. | 2789 // Save our next sibling as moveChildTo will clear it. |
2790 RenderObject* nextSibling = child->nextSibling(); | 2790 RenderObject* nextSibling = child->nextSibling(); |
2791 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2791 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
2792 child = nextSibling; | 2792 child = nextSibling; |
2793 } | 2793 } |
2794 } | 2794 } |
2795 | 2795 |
2796 } // namespace WebCore | 2796 } // namespace WebCore |
OLD | NEW |