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

Side by Side Diff: Source/core/paint/BoxPainter.cpp

Issue 1088613002: CTM-independent BackgroundBleedBackgroundOverBorder implementation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review comments Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/BoxPainter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/BoxPainter.h" 6 #include "core/paint/BoxPainter.h"
7 7
8 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/html/HTMLFrameOwnerElement.h" 10 #include "core/html/HTMLFrameOwnerElement.h"
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 context->setStrokeColor(color); 1481 context->setStrokeColor(color);
1482 context->strokeRect(strokeRect, borderWidth); 1482 context->strokeRect(strokeRect, borderWidth);
1483 1483
1484 if (antialias != wasAntialias) 1484 if (antialias != wasAntialias)
1485 context->setShouldAntialias(wasAntialias); 1485 context->setShouldAntialias(wasAntialias);
1486 } 1486 }
1487 1487
1488 void drawBleedAdjustedDRRect(GraphicsContext* context, BackgroundBleedAvoidance bleedAvoidance, 1488 void drawBleedAdjustedDRRect(GraphicsContext* context, BackgroundBleedAvoidance bleedAvoidance,
1489 const FloatRoundedRect& outer, const FloatRoundedRect& inner, Color color) 1489 const FloatRoundedRect& outer, const FloatRoundedRect& inner, Color color)
1490 { 1490 {
1491 if (bleedAvoidance != BackgroundBleedClipBackground || !outer.isRounded()) { 1491 switch (bleedAvoidance) {
1492 case BackgroundBleedBackgroundOverBorder:
1493 // BackgroundBleedBackgroundOverBorder draws an opaque background over t he inner rrect,
1494 // so we can simply fill the outer rect here to avoid backdrop bleeding.
1495 context->fillRoundedRect(outer, color);
1496 break;
1497 case BackgroundBleedClipBackground:
1498 if (outer.isRounded()) {
1499 // BackgroundBleedClipBackground clips the outer rrect corners for u s.
1500 FloatRoundedRect adjustedOuter = outer;
1501 adjustedOuter.setRadii(FloatRoundedRect::Radii());
1502 context->fillDRRect(adjustedOuter, inner, color);
1503 break;
1504 }
1505 // fall through
1506 default:
1492 context->fillDRRect(outer, inner, color); 1507 context->fillDRRect(outer, inner, color);
1493 return; 1508 break;
1494 } 1509 }
1495
1496 // BackgroundBleedClipBackground clips the outer rrect corners for us.
1497 FloatRoundedRect adjustedOuter = outer;
1498 adjustedOuter.setRadii(FloatRoundedRect::Radii());
1499 context->fillDRRect(adjustedOuter, inner, color);
1500 } 1510 }
1501 1511
1502 void drawDoubleBorder(GraphicsContext* context, const BoxBorderInfo& borderInfo, const LayoutRect& borderRect, 1512 void drawDoubleBorder(GraphicsContext* context, const BoxBorderInfo& borderInfo, const LayoutRect& borderRect,
1503 const FloatRoundedRect& outerBorder, const FloatRoundedRect& innerBorder) 1513 const FloatRoundedRect& outerBorder, const FloatRoundedRect& innerBorder)
1504 { 1514 {
1505 ASSERT(borderInfo.isUniformColor); 1515 ASSERT(borderInfo.isUniformColor);
1506 ASSERT(borderInfo.isUniformStyle); 1516 ASSERT(borderInfo.isUniformStyle);
1507 ASSERT(borderInfo.edges[borderInfo.firstVisibleEdge].borderStyle() == DOUBLE ); 1517 ASSERT(borderInfo.edges[borderInfo.firstVisibleEdge].borderStyle() == DOUBLE );
1508 ASSERT(borderInfo.visibleEdgeSet == AllBorderEdges); 1518 ASSERT(borderInfo.visibleEdgeSet == AllBorderEdges);
1509 1519
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 1589
1580 void BoxPainter::paintBorder(LayoutBoxModelObject& obj, const PaintInfo& info, c onst LayoutRect& rect, const ComputedStyle& style, BackgroundBleedAvoidance blee dAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) 1590 void BoxPainter::paintBorder(LayoutBoxModelObject& obj, const PaintInfo& info, c onst LayoutRect& rect, const ComputedStyle& style, BackgroundBleedAvoidance blee dAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
1581 { 1591 {
1582 GraphicsContext* graphicsContext = info.context; 1592 GraphicsContext* graphicsContext = info.context;
1583 // border-image is not affected by border-radius. 1593 // border-image is not affected by border-radius.
1584 if (paintNinePieceImage(obj, graphicsContext, rect, style, style.borderImage ())) 1594 if (paintNinePieceImage(obj, graphicsContext, rect, style, style.borderImage ()))
1585 return; 1595 return;
1586 1596
1587 const BoxBorderInfo borderInfo(style, bleedAvoidance, includeLogicalLeftEdge , includeLogicalRightEdge); 1597 const BoxBorderInfo borderInfo(style, bleedAvoidance, includeLogicalLeftEdge , includeLogicalRightEdge);
1588 FloatRoundedRect outerBorder = style.getRoundedBorderFor(rect, includeLogica lLeftEdge, includeLogicalRightEdge); 1598 FloatRoundedRect outerBorder = style.getRoundedBorderFor(rect, includeLogica lLeftEdge, includeLogicalRightEdge);
1589 FloatRoundedRect innerBorder = style.getRoundedInnerBorderFor(borderInnerRec tAdjustedForBleedAvoidance(graphicsContext, rect, bleedAvoidance), includeLogica lLeftEdge, includeLogicalRightEdge); 1599 FloatRoundedRect innerBorder = style.getRoundedInnerBorderFor(rect, includeL ogicalLeftEdge, includeLogicalRightEdge);
1590 1600
1591 if (outerBorder.rect().isEmpty() || !borderInfo.visibleEdgeCount) 1601 if (outerBorder.rect().isEmpty() || !borderInfo.visibleEdgeCount)
1592 return; 1602 return;
1593 1603
1594 const BorderEdge& firstEdge = borderInfo.edges[borderInfo.firstVisibleEdge]; 1604 const BorderEdge& firstEdge = borderInfo.edges[borderInfo.firstVisibleEdge];
1595 bool haveAllSolidEdges = borderInfo.isUniformStyle && firstEdge.borderStyle( ) == SOLID; 1605 bool haveAllSolidEdges = borderInfo.isUniformStyle && firstEdge.borderStyle( ) == SOLID;
1596 1606
1597 // If no corner intersects the clip region, we can pretend outerBorder is 1607 // If no corner intersects the clip region, we can pretend outerBorder is
1598 // rectangular to improve performance. 1608 // rectangular to improve performance.
1599 if (haveAllSolidEdges && outerBorder.isRounded() && allCornersClippedOut(out erBorder, info.rect)) 1609 if (haveAllSolidEdges && outerBorder.isRounded() && allCornersClippedOut(out erBorder, info.rect))
1600 outerBorder.setRadii(FloatRoundedRect::Radii()); 1610 outerBorder.setRadii(FloatRoundedRect::Radii());
1601 1611
1602 if (paintBorderFastPath(graphicsContext, borderInfo, rect, outerBorder, inne rBorder)) 1612 if (paintBorderFastPath(graphicsContext, borderInfo, rect, outerBorder, inne rBorder))
1603 return; 1613 return;
1604 1614
1605 bool clipToOuterBorder = outerBorder.isRounded(); 1615 bool clipToOuterBorder = outerBorder.isRounded();
1606 GraphicsContextStateSaver stateSaver(*graphicsContext, clipToOuterBorder); 1616 GraphicsContextStateSaver stateSaver(*graphicsContext, clipToOuterBorder);
1607 if (clipToOuterBorder) { 1617 if (clipToOuterBorder) {
1608 // Clip to the inner and outer radii rects. 1618 // For BackgroundBleedClipBackground, the outer rrect clip is already ap plied.
1609 if (bleedAvoidance != BackgroundBleedClipBackground) 1619 if (bleedAvoidance != BackgroundBleedClipBackground)
1610 graphicsContext->clipRoundedRect(outerBorder); 1620 graphicsContext->clipRoundedRect(outerBorder);
1611 // isRenderable() check avoids issue described in https://bugs.webkit.or g/show_bug.cgi?id=38787 1621
1612 // The inside will be clipped out later (in clipBorderSideForComplexInne rPath) 1622 // For BackgroundBleedBackgroundOverBorder, we're going to draw an opaqu e background over
1613 if (innerBorder.isRenderable() && !innerBorder.isEmpty()) 1623 // the inner rrect - so clipping is not needed (nor desirable due to bac kdrop bleeding).
1624 if (bleedAvoidance != BackgroundBleedBackgroundOverBorder && innerBorder .isRenderable() && !innerBorder.isEmpty())
1614 graphicsContext->clipOutRoundedRect(innerBorder); 1625 graphicsContext->clipOutRoundedRect(innerBorder);
1615 } 1626 }
1616 1627
1617 // If only one edge visible antialiasing doesn't create seams 1628 // If only one edge visible antialiasing doesn't create seams
1618 bool antialias = shouldAntialiasLines(graphicsContext) || borderInfo.visible EdgeCount == 1; 1629 bool antialias = shouldAntialiasLines(graphicsContext) || borderInfo.visible EdgeCount == 1;
1619 FloatRoundedRect unadjustedInnerBorder = (bleedAvoidance == BackgroundBleedB ackgroundOverBorder) ? style.getRoundedInnerBorderFor(rect, includeLogicalLeftEd ge, includeLogicalRightEdge) : innerBorder;
1620 IntPoint innerBorderAdjustment(innerBorder.rect().x() - unadjustedInnerBorde r.rect().x(), innerBorder.rect().y() - unadjustedInnerBorder.rect().y());
1621 if (borderInfo.hasAlpha) { 1630 if (borderInfo.hasAlpha) {
1622 paintTranslucentBorderSides(graphicsContext, style, outerBorder, unadjus tedInnerBorder, innerBorderAdjustment, 1631 paintTranslucentBorderSides(graphicsContext, style, outerBorder, innerBo rder, borderInfo.edges,
1623 borderInfo.edges, borderInfo.visibleEdgeSet, bleedAvoidance, include LogicalLeftEdge, includeLogicalRightEdge, antialias); 1632 borderInfo.visibleEdgeSet, bleedAvoidance, includeLogicalLeftEdge, inclu deLogicalRightEdge, antialias);
1624 } else { 1633 } else {
1625 paintBorderSides(graphicsContext, style, outerBorder, unadjustedInnerBor der, innerBorderAdjustment, 1634 paintBorderSides(graphicsContext, style, outerBorder, innerBorder, borde rInfo.edges,
1626 borderInfo.edges, borderInfo.visibleEdgeSet, bleedAvoidance, include LogicalLeftEdge, includeLogicalRightEdge, antialias); 1635 borderInfo.visibleEdgeSet, bleedAvoidance, includeLogicalLeftEdge, inclu deLogicalRightEdge, antialias);
1627 } 1636 }
1628 } 1637 }
1629 1638
1630 static inline bool includesAdjacentEdges(BorderEdgeFlags flags) 1639 static inline bool includesAdjacentEdges(BorderEdgeFlags flags)
1631 { 1640 {
1632 return (flags & (TopBorderEdge | RightBorderEdge)) == (TopBorderEdge | Right BorderEdge) 1641 return (flags & (TopBorderEdge | RightBorderEdge)) == (TopBorderEdge | Right BorderEdge)
1633 || (flags & (RightBorderEdge | BottomBorderEdge)) == (RightBorderEdge | BottomBorderEdge) 1642 || (flags & (RightBorderEdge | BottomBorderEdge)) == (RightBorderEdge | BottomBorderEdge)
1634 || (flags & (BottomBorderEdge | LeftBorderEdge)) == (BottomBorderEdge | LeftBorderEdge) 1643 || (flags & (BottomBorderEdge | LeftBorderEdge)) == (BottomBorderEdge | LeftBorderEdge)
1635 || (flags & (LeftBorderEdge | TopBorderEdge)) == (LeftBorderEdge | TopBo rderEdge); 1644 || (flags & (LeftBorderEdge | TopBorderEdge)) == (LeftBorderEdge | TopBo rderEdge);
1636 } 1645 }
1637 1646
1638 void BoxPainter::paintTranslucentBorderSides(GraphicsContext* graphicsContext, c onst ComputedStyle& style, const FloatRoundedRect& outerBorder, const FloatRound edRect& innerBorder, const IntPoint& innerBorderAdjustment, 1647 void BoxPainter::paintTranslucentBorderSides(GraphicsContext* graphicsContext, c onst ComputedStyle& style,
1639 const BorderEdge edges[], BorderEdgeFlags edgesToDraw, BackgroundBleedAvoida nce bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, b ool antialias) 1648 const FloatRoundedRect& outerBorder, const FloatRoundedRect& innerBorder, co nst BorderEdge edges[],
1649 BorderEdgeFlags edgesToDraw, BackgroundBleedAvoidance bleedAvoidance, bool i ncludeLogicalLeftEdge,
1650 bool includeLogicalRightEdge, bool antialias)
1640 { 1651 {
1641 // willBeOverdrawn assumes that we draw in order: top, bottom, left, right. 1652 // willBeOverdrawn assumes that we draw in order: top, bottom, left, right.
1642 // This is different from BoxSide enum order. 1653 // This is different from BoxSide enum order.
1643 static const BoxSide paintOrder[] = { BSTop, BSBottom, BSLeft, BSRight }; 1654 static const BoxSide paintOrder[] = { BSTop, BSBottom, BSLeft, BSRight };
1644 1655
1645 while (edgesToDraw) { 1656 while (edgesToDraw) {
1646 // Find undrawn edges sharing a color. 1657 // Find undrawn edges sharing a color.
1647 Color commonColor; 1658 Color commonColor;
1648 1659
1649 BorderEdgeFlags commonColorEdgeSet = 0; 1660 BorderEdgeFlags commonColorEdgeSet = 0;
(...skipping 13 matching lines...) Expand all
1663 if (includeEdge) 1674 if (includeEdge)
1664 commonColorEdgeSet |= edgeFlagForSide(currSide); 1675 commonColorEdgeSet |= edgeFlagForSide(currSide);
1665 } 1676 }
1666 1677
1667 bool useTransparencyLayer = includesAdjacentEdges(commonColorEdgeSet) && commonColor.hasAlpha(); 1678 bool useTransparencyLayer = includesAdjacentEdges(commonColorEdgeSet) && commonColor.hasAlpha();
1668 if (useTransparencyLayer) { 1679 if (useTransparencyLayer) {
1669 graphicsContext->beginLayer(static_cast<float>(commonColor.alpha()) / 255); 1680 graphicsContext->beginLayer(static_cast<float>(commonColor.alpha()) / 255);
1670 commonColor = Color(commonColor.red(), commonColor.green(), commonCo lor.blue()); 1681 commonColor = Color(commonColor.red(), commonColor.green(), commonCo lor.blue());
1671 } 1682 }
1672 1683
1673 paintBorderSides(graphicsContext, style, outerBorder, innerBorder, inner BorderAdjustment, edges, commonColorEdgeSet, bleedAvoidance, includeLogicalLeftE dge, includeLogicalRightEdge, antialias, &commonColor); 1684 paintBorderSides(graphicsContext, style, outerBorder, innerBorder, edges , commonColorEdgeSet,
1685 bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, ant ialias, &commonColor);
1674 1686
1675 if (useTransparencyLayer) 1687 if (useTransparencyLayer)
1676 graphicsContext->endLayer(); 1688 graphicsContext->endLayer();
1677 1689
1678 edgesToDraw &= ~commonColorEdgeSet; 1690 edgesToDraw &= ~commonColorEdgeSet;
1679 } 1691 }
1680 } 1692 }
1681 1693
1682 LayoutRect BoxPainter::borderInnerRectAdjustedForBleedAvoidance(GraphicsContext* context, const LayoutRect& rect, BackgroundBleedAvoidance bleedAvoidance)
1683 {
1684 // We shrink the rectangle by one pixel on each side to make it fully overla p the anti-aliased background border
1685 return (bleedAvoidance == BackgroundBleedBackgroundOverBorder) ? shrinkRectB yOnePixel(context, rect) : rect;
1686 }
1687
1688 void BoxPainter::paintOneBorderSide(GraphicsContext* graphicsContext, const Comp utedStyle& style, const FloatRoundedRect& outerBorder, const FloatRoundedRect& i nnerBorder, 1694 void BoxPainter::paintOneBorderSide(GraphicsContext* graphicsContext, const Comp utedStyle& style, const FloatRoundedRect& outerBorder, const FloatRoundedRect& i nnerBorder,
1689 const FloatRect& sideRect, BoxSide side, BoxSide adjacentSide1, BoxSide adja centSide2, const BorderEdge edges[], const Path* path, 1695 const FloatRect& sideRect, BoxSide side, BoxSide adjacentSide1, BoxSide adja centSide2, const BorderEdge edges[], const Path* path,
1690 BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool i ncludeLogicalRightEdge, bool antialias, const Color* overrideColor) 1696 BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool i ncludeLogicalRightEdge, bool antialias, const Color* overrideColor)
1691 { 1697 {
1692 const BorderEdge& edgeToRender = edges[side]; 1698 const BorderEdge& edgeToRender = edges[side];
1693 ASSERT(edgeToRender.width); 1699 ASSERT(edgeToRender.width);
1694 const BorderEdge& adjacentEdge1 = edges[adjacentSide1]; 1700 const BorderEdge& adjacentEdge1 = edges[adjacentSide1];
1695 const BorderEdge& adjacentEdge2 = edges[adjacentSide2]; 1701 const BorderEdge& adjacentEdge2 = edges[adjacentSide2];
1696 1702
1697 bool mitreAdjacentSide1 = joinRequiresMitre(side, adjacentSide1, edges, !ant ialias); 1703 bool mitreAdjacentSide1 = joinRequiresMitre(side, adjacentSide1, edges, !ant ialias);
(...skipping 28 matching lines...) Expand all
1726 mitreAdjacentSide1 = false; 1732 mitreAdjacentSide1 = false;
1727 mitreAdjacentSide2 = false; 1733 mitreAdjacentSide2 = false;
1728 } 1734 }
1729 1735
1730 ObjectPainter::drawLineForBoxSide(graphicsContext, sideRect.x(), sideRec t.y(), sideRect.maxX(), sideRect.maxY(), side, colorToPaint, edgeToRender.border Style(), 1736 ObjectPainter::drawLineForBoxSide(graphicsContext, sideRect.x(), sideRec t.y(), sideRect.maxX(), sideRect.maxY(), side, colorToPaint, edgeToRender.border Style(),
1731 mitreAdjacentSide1 ? adjacentEdge1.width : 0, mitreAdjacentSide2 ? a djacentEdge2.width : 0, antialias); 1737 mitreAdjacentSide1 ? adjacentEdge1.width : 0, mitreAdjacentSide2 ? a djacentEdge2.width : 0, antialias);
1732 } 1738 }
1733 } 1739 }
1734 1740
1735 void BoxPainter::paintBorderSides(GraphicsContext* graphicsContext, const Comput edStyle& style, const FloatRoundedRect& outerBorder, const FloatRoundedRect& inn erBorder, 1741 void BoxPainter::paintBorderSides(GraphicsContext* graphicsContext, const Comput edStyle& style, const FloatRoundedRect& outerBorder, const FloatRoundedRect& inn erBorder,
1736 const IntPoint& innerBorderAdjustment, const BorderEdge edges[], BorderEdgeF lags edgeSet, BackgroundBleedAvoidance bleedAvoidance, 1742 const BorderEdge edges[], BorderEdgeFlags edgeSet, BackgroundBleedAvoidance bleedAvoidance,
1737 bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, c onst Color* overrideColor) 1743 bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, c onst Color* overrideColor)
1738 { 1744 {
1739 bool renderRadii = outerBorder.isRounded(); 1745 bool renderRadii = outerBorder.isRounded();
1740 1746
1741 Path roundedPath; 1747 Path roundedPath;
1742 if (renderRadii) 1748 if (renderRadii)
1743 roundedPath.addRoundedRect(outerBorder); 1749 roundedPath.addRoundedRect(outerBorder);
1744 1750
1745 // The inner border adjustment for bleed avoidance mode BackgroundBleedBackg roundOverBorder 1751 // The inner border adjustment for bleed avoidance mode BackgroundBleedBackg roundOverBorder
1746 // is only applied to sideRect, which is okay since BackgroundBleedBackgroun dOverBorder 1752 // is only applied to sideRect, which is okay since BackgroundBleedBackgroun dOverBorder
1747 // is only to be used for solid borders and the shape of the border painted by drawBoxSideFromPath 1753 // is only to be used for solid borders and the shape of the border painted by drawBoxSideFromPath
1748 // only depends on sideRect when painting solid borders. 1754 // only depends on sideRect when painting solid borders.
1749 1755
1750 if (edges[BSTop].shouldRender() && includesEdge(edgeSet, BSTop)) { 1756 if (edges[BSTop].shouldRender() && includesEdge(edgeSet, BSTop)) {
1751 FloatRect sideRect = outerBorder.rect(); 1757 FloatRect sideRect = outerBorder.rect();
1752 sideRect.setHeight(edges[BSTop].width + innerBorderAdjustment.y()); 1758 sideRect.setHeight(edges[BSTop].width);
1753 1759
1754 bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSTop].bo rderStyle()) || borderWillArcInnerEdge(innerBorder.radii().topLeft(), innerBorde r.radii().topRight())); 1760 bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSTop].bo rderStyle()) || borderWillArcInnerEdge(innerBorder.radii().topLeft(), innerBorde r.radii().topRight()));
1755 paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sid eRect, BSTop, BSLeft, BSRight, edges, usePath ? &roundedPath : 0, bleedAvoidance , includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor); 1761 paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sid eRect, BSTop, BSLeft, BSRight, edges, usePath ? &roundedPath : 0, bleedAvoidance , includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor);
1756 } 1762 }
1757 1763
1758 if (edges[BSBottom].shouldRender() && includesEdge(edgeSet, BSBottom)) { 1764 if (edges[BSBottom].shouldRender() && includesEdge(edgeSet, BSBottom)) {
1759 FloatRect sideRect = outerBorder.rect(); 1765 FloatRect sideRect = outerBorder.rect();
1760 sideRect.shiftYEdgeTo(sideRect.maxY() - edges[BSBottom].width - innerBor derAdjustment.y()); 1766 sideRect.shiftYEdgeTo(sideRect.maxY() - edges[BSBottom].width);
1761 1767
1762 bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSBottom] .borderStyle()) || borderWillArcInnerEdge(innerBorder.radii().bottomLeft(), inne rBorder.radii().bottomRight())); 1768 bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSBottom] .borderStyle()) || borderWillArcInnerEdge(innerBorder.radii().bottomLeft(), inne rBorder.radii().bottomRight()));
1763 paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sid eRect, BSBottom, BSLeft, BSRight, edges, usePath ? &roundedPath : 0, bleedAvoida nce, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor); 1769 paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sid eRect, BSBottom, BSLeft, BSRight, edges, usePath ? &roundedPath : 0, bleedAvoida nce, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor);
1764 } 1770 }
1765 1771
1766 if (edges[BSLeft].shouldRender() && includesEdge(edgeSet, BSLeft)) { 1772 if (edges[BSLeft].shouldRender() && includesEdge(edgeSet, BSLeft)) {
1767 FloatRect sideRect = outerBorder.rect(); 1773 FloatRect sideRect = outerBorder.rect();
1768 sideRect.setWidth(edges[BSLeft].width + innerBorderAdjustment.x()); 1774 sideRect.setWidth(edges[BSLeft].width);
1769 1775
1770 bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSLeft].b orderStyle()) || borderWillArcInnerEdge(innerBorder.radii().bottomLeft(), innerB order.radii().topLeft())); 1776 bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSLeft].b orderStyle()) || borderWillArcInnerEdge(innerBorder.radii().bottomLeft(), innerB order.radii().topLeft()));
1771 paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sid eRect, BSLeft, BSTop, BSBottom, edges, usePath ? &roundedPath : 0, bleedAvoidanc e, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor); 1777 paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sid eRect, BSLeft, BSTop, BSBottom, edges, usePath ? &roundedPath : 0, bleedAvoidanc e, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor);
1772 } 1778 }
1773 1779
1774 if (edges[BSRight].shouldRender() && includesEdge(edgeSet, BSRight)) { 1780 if (edges[BSRight].shouldRender() && includesEdge(edgeSet, BSRight)) {
1775 FloatRect sideRect = outerBorder.rect(); 1781 FloatRect sideRect = outerBorder.rect();
1776 sideRect.shiftXEdgeTo(sideRect.maxX() - edges[BSRight].width - innerBord erAdjustment.x()); 1782 sideRect.shiftXEdgeTo(sideRect.maxX() - edges[BSRight].width);
1777 1783
1778 bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSRight]. borderStyle()) || borderWillArcInnerEdge(innerBorder.radii().bottomRight(), inne rBorder.radii().topRight())); 1784 bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSRight]. borderStyle()) || borderWillArcInnerEdge(innerBorder.radii().bottomRight(), inne rBorder.radii().topRight()));
1779 paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sid eRect, BSRight, BSTop, BSBottom, edges, usePath ? &roundedPath : 0, bleedAvoidan ce, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor); 1785 paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sid eRect, BSRight, BSTop, BSBottom, edges, usePath ? &roundedPath : 0, bleedAvoidan ce, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor);
1780 } 1786 }
1781 } 1787 }
1782 1788
1783 void BoxPainter::drawBoxSideFromPath(GraphicsContext* graphicsContext, const Lay outRect& borderRect, const Path& borderPath, const BorderEdge edges[], 1789 void BoxPainter::drawBoxSideFromPath(GraphicsContext* graphicsContext, const Lay outRect& borderRect, const Path& borderPath, const BorderEdge edges[],
1784 float thickness, float drawThickness, BoxSide side, const ComputedStyle& sty le, Color color, EBorderStyle borderStyle, BackgroundBleedAvoidance bleedAvoidan ce, 1790 float thickness, float drawThickness, BoxSide side, const ComputedStyle& sty le, Color color, EBorderStyle borderStyle, BackgroundBleedAvoidance bleedAvoidan ce,
1785 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) 1791 bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
1786 { 1792 {
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 2235
2230 FloatPoint secondQuad[4]; 2236 FloatPoint secondQuad[4];
2231 secondQuad[0] = quad[0]; 2237 secondQuad[0] = quad[0];
2232 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); 2238 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy);
2233 secondQuad[2] = quad[2]; 2239 secondQuad[2] = quad[2];
2234 secondQuad[3] = quad[3]; 2240 secondQuad[3] = quad[3];
2235 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); 2241 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches);
2236 } 2242 }
2237 2243
2238 } // namespace blink 2244 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/BoxPainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698