| OLD | NEW |
| 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 12 matching lines...) Expand all Loading... |
| 23 #include "core/paint/DeprecatedPaintLayer.h" | 23 #include "core/paint/DeprecatedPaintLayer.h" |
| 24 #include "core/paint/LayoutObjectDrawingRecorder.h" | 24 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 25 #include "core/paint/PaintInfo.h" | 25 #include "core/paint/PaintInfo.h" |
| 26 #include "core/paint/RoundedInnerRectClipper.h" | 26 #include "core/paint/RoundedInnerRectClipper.h" |
| 27 #include "core/paint/ThemePainter.h" | 27 #include "core/paint/ThemePainter.h" |
| 28 #include "platform/LengthFunctions.h" | 28 #include "platform/LengthFunctions.h" |
| 29 #include "platform/geometry/LayoutPoint.h" | 29 #include "platform/geometry/LayoutPoint.h" |
| 30 #include "platform/geometry/LayoutRectOutsets.h" | 30 #include "platform/geometry/LayoutRectOutsets.h" |
| 31 #include "platform/graphics/GraphicsContextStateSaver.h" | 31 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 32 #include "platform/graphics/paint/CompositingDisplayItem.h" | 32 #include "platform/graphics/paint/CompositingDisplayItem.h" |
| 33 #include "wtf/Optional.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 | 36 |
| 36 void BoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffse
t) | 37 void BoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffse
t) |
| 37 { | 38 { |
| 38 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBox.location(); | 39 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBox.location(); |
| 39 // default implementation. Just pass paint through to the children | 40 // default implementation. Just pass paint through to the children |
| 40 PaintInfo childInfo(paintInfo); | 41 PaintInfo childInfo(paintInfo); |
| 41 childInfo.updatePaintingRootForChildren(&m_layoutBox); | 42 childInfo.updatePaintingRootForChildren(&m_layoutBox); |
| 42 for (LayoutObject* child = m_layoutBox.slowFirstChild(); child; child = chil
d->nextSibling()) | 43 for (LayoutObject* child = m_layoutBox.slowFirstChild(); child; child = chil
d->nextSibling()) |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 } | 387 } |
| 387 } else { | 388 } else { |
| 388 context->fillRect(pixelSnappedIntRect(rect), bgColor); | 389 context->fillRect(pixelSnappedIntRect(rect), bgColor); |
| 389 } | 390 } |
| 390 | 391 |
| 391 return; | 392 return; |
| 392 } | 393 } |
| 393 | 394 |
| 394 // BorderFillBox radius clipping is taken care of by BackgroundBleedClip{Onl
y,Layer} | 395 // BorderFillBox radius clipping is taken care of by BackgroundBleedClip{Onl
y,Layer} |
| 395 bool clipToBorderRadius = hasRoundedBorder && !(isBorderFill && bleedAvoidan
ceIsClipping(bleedAvoidance)); | 396 bool clipToBorderRadius = hasRoundedBorder && !(isBorderFill && bleedAvoidan
ceIsClipping(bleedAvoidance)); |
| 396 OwnPtr<RoundedInnerRectClipper> clipToBorder; | 397 Optional<RoundedInnerRectClipper> clipToBorder; |
| 397 if (clipToBorderRadius) { | 398 if (clipToBorderRadius) { |
| 398 FloatRoundedRect border = isBorderFill | 399 FloatRoundedRect border = isBorderFill |
| 399 ? backgroundRoundedRectAdjustedForBleedAvoidance(obj, rect, bleedAvo
idance, box, boxSize, includeLeftEdge, includeRightEdge) | 400 ? backgroundRoundedRectAdjustedForBleedAvoidance(obj, rect, bleedAvo
idance, box, boxSize, includeLeftEdge, includeRightEdge) |
| 400 : getBackgroundRoundedRect(obj, rect, box, boxSize.width(), boxSize.
height(), includeLeftEdge, includeRightEdge); | 401 : getBackgroundRoundedRect(obj, rect, box, boxSize.width(), boxSize.
height(), includeLeftEdge, includeRightEdge); |
| 401 | 402 |
| 402 // Clip to the padding or content boxes as necessary. | 403 // Clip to the padding or content boxes as necessary. |
| 403 if (bgLayer.clip() == ContentFillBox) { | 404 if (bgLayer.clip() == ContentFillBox) { |
| 404 border = obj.style()->getRoundedInnerBorderFor(LayoutRect(border.rec
t()), | 405 border = obj.style()->getRoundedInnerBorderFor(LayoutRect(border.rec
t()), |
| 405 LayoutRectOutsets( | 406 LayoutRectOutsets( |
| 406 -(obj.paddingTop() + obj.borderTop()), | 407 -(obj.paddingTop() + obj.borderTop()), |
| 407 -(obj.paddingRight() + obj.borderRight()), | 408 -(obj.paddingRight() + obj.borderRight()), |
| 408 -(obj.paddingBottom() + obj.borderBottom()), | 409 -(obj.paddingBottom() + obj.borderBottom()), |
| 409 -(obj.paddingLeft() + obj.borderLeft())), | 410 -(obj.paddingLeft() + obj.borderLeft())), |
| 410 includeLeftEdge, includeRightEdge); | 411 includeLeftEdge, includeRightEdge); |
| 411 } else if (bgLayer.clip() == PaddingFillBox) { | 412 } else if (bgLayer.clip() == PaddingFillBox) { |
| 412 border = obj.style()->getRoundedInnerBorderFor(LayoutRect(border.rec
t()), includeLeftEdge, includeRightEdge); | 413 border = obj.style()->getRoundedInnerBorderFor(LayoutRect(border.rec
t()), includeLeftEdge, includeRightEdge); |
| 413 } | 414 } |
| 414 | 415 |
| 415 clipToBorder = adoptPtr(new RoundedInnerRectClipper(obj, paintInfo, rect
, border, ApplyToContext)); | 416 clipToBorder.emplace(obj, paintInfo, rect, border, ApplyToContext); |
| 416 } | 417 } |
| 417 | 418 |
| 418 int bLeft = includeLeftEdge ? obj.borderLeft() : 0; | 419 int bLeft = includeLeftEdge ? obj.borderLeft() : 0; |
| 419 int bRight = includeRightEdge ? obj.borderRight() : 0; | 420 int bRight = includeRightEdge ? obj.borderRight() : 0; |
| 420 LayoutUnit pLeft = includeLeftEdge ? obj.paddingLeft() : LayoutUnit(); | 421 LayoutUnit pLeft = includeLeftEdge ? obj.paddingLeft() : LayoutUnit(); |
| 421 LayoutUnit pRight = includeRightEdge ? obj.paddingRight() : LayoutUnit(); | 422 LayoutUnit pRight = includeRightEdge ? obj.paddingRight() : LayoutUnit(); |
| 422 | 423 |
| 423 GraphicsContextStateSaver clipWithScrollingStateSaver(*context, clippedWithL
ocalScrolling); | 424 GraphicsContextStateSaver clipWithScrollingStateSaver(*context, clippedWithL
ocalScrolling); |
| 424 LayoutRect scrolledPaintRect = rect; | 425 LayoutRect scrolledPaintRect = rect; |
| 425 if (clippedWithLocalScrolling) { | 426 if (clippedWithLocalScrolling) { |
| (...skipping 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2297 | 2298 |
| 2298 FloatPoint secondQuad[4]; | 2299 FloatPoint secondQuad[4]; |
| 2299 secondQuad[0] = quad[0]; | 2300 secondQuad[0] = quad[0]; |
| 2300 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); | 2301 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); |
| 2301 secondQuad[2] = quad[2]; | 2302 secondQuad[2] = quad[2]; |
| 2302 secondQuad[3] = quad[3]; | 2303 secondQuad[3] = quad[3]; |
| 2303 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); | 2304 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); |
| 2304 } | 2305 } |
| 2305 | 2306 |
| 2306 } // namespace blink | 2307 } // namespace blink |
| OLD | NEW |