| 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/ObjectPainter.h" | 6 #include "core/paint/ObjectPainter.h" |
| 7 | 7 |
| 8 #include "core/layout/LayoutObject.h" | 8 #include "core/layout/LayoutObject.h" |
| 9 #include "core/layout/LayoutTheme.h" | 9 #include "core/layout/LayoutTheme.h" |
| 10 #include "core/paint/BoxBorderPainter.h" | 10 #include "core/paint/BoxBorderPainter.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 focusRingIntRects.append(pixelSnappedIntRect(focusRingRects[i])); | 24 focusRingIntRects.append(pixelSnappedIntRect(focusRingRects[i])); |
| 25 paintInfo.context->drawFocusRing(focusRingIntRects, style.outlineWidth(), st
yle.outlineOffset(), m_layoutObject.resolveColor(style, CSSPropertyOutlineColor)
); | 25 paintInfo.context->drawFocusRing(focusRingIntRects, style.outlineWidth(), st
yle.outlineOffset(), m_layoutObject.resolveColor(style, CSSPropertyOutlineColor)
); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void ObjectPainter::paintOutline(const PaintInfo& paintInfo, const LayoutRect& v
isualOverflowRect, const LayoutSize& objectSize, const LayoutPoint& paintOffset) | 28 void ObjectPainter::paintOutline(const PaintInfo& paintInfo, const LayoutRect& v
isualOverflowRect, const LayoutSize& objectSize, const LayoutPoint& paintOffset) |
| 29 { | 29 { |
| 30 const ComputedStyle& styleToUse = m_layoutObject.styleRef(); | 30 const ComputedStyle& styleToUse = m_layoutObject.styleRef(); |
| 31 if (!styleToUse.hasOutline()) | 31 if (!styleToUse.hasOutline()) |
| 32 return; | 32 return; |
| 33 | 33 |
| 34 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.conte
xt, m_layoutObject, paintInfo.phase)) | 34 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.conte
xt, m_layoutObject, paintInfo.phase, paintOffset)) |
| 35 return; | 35 return; |
| 36 | 36 |
| 37 LayoutRect visualOverflowBounds(visualOverflowRect); | 37 LayoutRect visualOverflowBounds(visualOverflowRect); |
| 38 visualOverflowBounds.moveBy(paintOffset); | 38 visualOverflowBounds.moveBy(paintOffset); |
| 39 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutObject, pai
ntInfo.phase, visualOverflowBounds); | 39 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutObject, pai
ntInfo.phase, visualOverflowBounds, paintOffset); |
| 40 | 40 |
| 41 if (styleToUse.outlineStyleIsAuto()) { | 41 if (styleToUse.outlineStyleIsAuto()) { |
| 42 if (LayoutTheme::theme().shouldDrawDefaultFocusRing(&m_layoutObject)) { | 42 if (LayoutTheme::theme().shouldDrawDefaultFocusRing(&m_layoutObject)) { |
| 43 // Only paint the focus ring by hand if the theme isn't able to draw
the focus ring. | 43 // Only paint the focus ring by hand if the theme isn't able to draw
the focus ring. |
| 44 Vector<LayoutRect> focusRingRects; | 44 Vector<LayoutRect> focusRingRects; |
| 45 m_layoutObject.addOutlineRects(focusRingRects, paintOffset); | 45 m_layoutObject.addOutlineRects(focusRingRects, paintOffset); |
| 46 paintFocusRing(paintInfo, styleToUse, focusRingRects); | 46 paintFocusRing(paintInfo, styleToUse, focusRingRects); |
| 47 } | 47 } |
| 48 return; | 48 return; |
| 49 } | 49 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 73 KURL url = toElement(m_layoutObject.node())->hrefURL(); | 73 KURL url = toElement(m_layoutObject.node())->hrefURL(); |
| 74 if (!url.isValid()) | 74 if (!url.isValid()) |
| 75 return; | 75 return; |
| 76 | 76 |
| 77 Vector<LayoutRect> outlineRects; | 77 Vector<LayoutRect> outlineRects; |
| 78 m_layoutObject.addOutlineRects(outlineRects, paintOffset); | 78 m_layoutObject.addOutlineRects(outlineRects, paintOffset); |
| 79 IntRect rect = pixelSnappedIntRect(unionRect(outlineRects)); | 79 IntRect rect = pixelSnappedIntRect(unionRect(outlineRects)); |
| 80 if (rect.isEmpty()) | 80 if (rect.isEmpty()) |
| 81 return; | 81 return; |
| 82 | 82 |
| 83 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.conte
xt, m_layoutObject, DisplayItem::PrintedContentPDFURLRect)) | 83 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.conte
xt, m_layoutObject, DisplayItem::PrintedContentPDFURLRect, paintOffset)) |
| 84 return; | 84 return; |
| 85 | 85 |
| 86 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutObject, Dis
playItem::PrintedContentPDFURLRect, rect); | 86 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutObject, Dis
playItem::PrintedContentPDFURLRect, rect, paintOffset); |
| 87 if (url.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(url, m_la
youtObject.document().baseURL())) { | 87 if (url.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(url, m_la
youtObject.document().baseURL())) { |
| 88 String fragmentName = url.fragmentIdentifier(); | 88 String fragmentName = url.fragmentIdentifier(); |
| 89 if (m_layoutObject.document().findAnchor(fragmentName)) | 89 if (m_layoutObject.document().findAnchor(fragmentName)) |
| 90 paintInfo.context->setURLFragmentForRect(fragmentName, rect); | 90 paintInfo.context->setURLFragmentForRect(fragmentName, rect); |
| 91 return; | 91 return; |
| 92 } | 92 } |
| 93 paintInfo.context->setURLForRect(url, rect); | 93 paintInfo.context->setURLForRect(url, rect); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void ObjectPainter::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1,
int y1, int x2, int y2, | 96 void ObjectPainter::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1,
int y1, int x2, int y2, |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0)); | 336 quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0)); |
| 337 quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0)); | 337 quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0)); |
| 338 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0)); | 338 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0)); |
| 339 break; | 339 break; |
| 340 } | 340 } |
| 341 | 341 |
| 342 graphicsContext->fillPolygon(4, quad, color, antialias); | 342 graphicsContext->fillPolygon(4, quad, color, antialias); |
| 343 } | 343 } |
| 344 | 344 |
| 345 } // namespace blink | 345 } // namespace blink |
| OLD | NEW |