| 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 "core/paint/ObjectPainter.h" | 5 #include "core/paint/ObjectPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutBlock.h" | 7 #include "core/layout/LayoutBlock.h" |
| 8 #include "core/layout/LayoutInline.h" | 8 #include "core/layout/LayoutInline.h" |
| 9 #include "core/layout/LayoutObject.h" | 9 #include "core/layout/LayoutObject.h" |
| 10 #include "core/layout/LayoutTheme.h" | 10 #include "core/layout/LayoutTheme.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 context.drawPath(path, paint); | 199 context.drawPath(path, paint); |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace | 202 } // namespace |
| 203 | 203 |
| 204 void ObjectPainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) | 204 void ObjectPainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) |
| 205 { | 205 { |
| 206 ASSERT(shouldPaintSelfOutline(paintInfo.phase)); | 206 ASSERT(shouldPaintSelfOutline(paintInfo.phase)); |
| 207 | 207 |
| 208 const ComputedStyle& styleToUse = m_layoutObject.styleRef(); | 208 const ComputedStyle& styleToUse = m_layoutObject.styleRef(); |
| 209 if (!styleToUse.hasOutline() || styleToUse.visibility() != VISIBLE) | 209 if (!styleToUse.hasOutline() || styleToUse.visibility() != EVisibility::Visi
ble) |
| 210 return; | 210 return; |
| 211 | 211 |
| 212 // Only paint the focus ring by hand if the theme isn't able to draw the foc
us ring. | 212 // Only paint the focus ring by hand if the theme isn't able to draw the foc
us ring. |
| 213 if (styleToUse.outlineStyleIsAuto() && !LayoutTheme::theme().shouldDrawDefau
ltFocusRing(m_layoutObject)) | 213 if (styleToUse.outlineStyleIsAuto() && !LayoutTheme::theme().shouldDrawDefau
ltFocusRing(m_layoutObject)) |
| 214 return; | 214 return; |
| 215 | 215 |
| 216 Vector<LayoutRect> outlineRects; | 216 Vector<LayoutRect> outlineRects; |
| 217 m_layoutObject.addOutlineRects(outlineRects, paintOffset, m_layoutObject.out
lineRectsShouldIncludeBlockVisualOverflow()); | 217 m_layoutObject.addOutlineRects(outlineRects, paintOffset, m_layoutObject.out
lineRectsShouldIncludeBlockVisualOverflow()); |
| 218 if (outlineRects.isEmpty()) | 218 if (outlineRects.isEmpty()) |
| 219 return; | 219 return; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); | 261 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); |
| 262 for (LayoutObject* child = m_layoutObject.slowFirstChild(); child; child = c
hild->nextSibling()) { | 262 for (LayoutObject* child = m_layoutObject.slowFirstChild(); child; child = c
hild->nextSibling()) { |
| 263 if (child->isLayoutInline() && !toLayoutInline(child)->hasSelfPaintingLa
yer()) | 263 if (child->isLayoutInline() && !toLayoutInline(child)->hasSelfPaintingLa
yer()) |
| 264 child->paint(paintInfoForDescendants, paintOffset); | 264 child->paint(paintInfoForDescendants, paintOffset); |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 | 267 |
| 268 void ObjectPainter::addPDFURLRectIfNeeded(const PaintInfo& paintInfo, const Layo
utPoint& paintOffset) | 268 void ObjectPainter::addPDFURLRectIfNeeded(const PaintInfo& paintInfo, const Layo
utPoint& paintOffset) |
| 269 { | 269 { |
| 270 ASSERT(paintInfo.isPrinting()); | 270 ASSERT(paintInfo.isPrinting()); |
| 271 if (m_layoutObject.isElementContinuation() || !m_layoutObject.node() || !m_l
ayoutObject.node()->isLink() || m_layoutObject.styleRef().visibility() != VISIBL
E) | 271 if (m_layoutObject.isElementContinuation() || !m_layoutObject.node() || !m_l
ayoutObject.node()->isLink() || m_layoutObject.styleRef().visibility() != EVisib
ility::Visible) |
| 272 return; | 272 return; |
| 273 | 273 |
| 274 KURL url = toElement(m_layoutObject.node())->hrefURL(); | 274 KURL url = toElement(m_layoutObject.node())->hrefURL(); |
| 275 if (!url.isValid()) | 275 if (!url.isValid()) |
| 276 return; | 276 return; |
| 277 | 277 |
| 278 Vector<LayoutRect> visualOverflowRects; | 278 Vector<LayoutRect> visualOverflowRects; |
| 279 m_layoutObject.addElementVisualOverflowRects(visualOverflowRects, paintOffse
t); | 279 m_layoutObject.addElementVisualOverflowRects(visualOverflowRects, paintOffse
t); |
| 280 IntRect rect = pixelSnappedIntRect(unionRect(visualOverflowRects)); | 280 IntRect rect = pixelSnappedIntRect(unionRect(visualOverflowRects)); |
| 281 if (rect.isEmpty()) | 281 if (rect.isEmpty()) |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 m_layoutObject.paint(info, paintOffset); | 564 m_layoutObject.paint(info, paintOffset); |
| 565 info.phase = PaintPhaseFloat; | 565 info.phase = PaintPhaseFloat; |
| 566 m_layoutObject.paint(info, paintOffset); | 566 m_layoutObject.paint(info, paintOffset); |
| 567 info.phase = PaintPhaseForeground; | 567 info.phase = PaintPhaseForeground; |
| 568 m_layoutObject.paint(info, paintOffset); | 568 m_layoutObject.paint(info, paintOffset); |
| 569 info.phase = PaintPhaseOutline; | 569 info.phase = PaintPhaseOutline; |
| 570 m_layoutObject.paint(info, paintOffset); | 570 m_layoutObject.paint(info, paintOffset); |
| 571 } | 571 } |
| 572 | 572 |
| 573 } // namespace blink | 573 } // namespace blink |
| OLD | NEW |