| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 216 } |
| 217 | 217 |
| 218 } // namespace | 218 } // namespace |
| 219 | 219 |
| 220 void ObjectPainter::paintOutline(const PaintInfo& paintInfo, | 220 void ObjectPainter::paintOutline(const PaintInfo& paintInfo, |
| 221 const LayoutPoint& paintOffset) { | 221 const LayoutPoint& paintOffset) { |
| 222 DCHECK(shouldPaintSelfOutline(paintInfo.phase)); | 222 DCHECK(shouldPaintSelfOutline(paintInfo.phase)); |
| 223 | 223 |
| 224 const ComputedStyle& styleToUse = m_layoutObject.styleRef(); | 224 const ComputedStyle& styleToUse = m_layoutObject.styleRef(); |
| 225 if (!styleToUse.hasOutline() || | 225 if (!styleToUse.hasOutline() || |
| 226 styleToUse.visibility() != EVisibility::Visible) | 226 styleToUse.visibility() != EVisibility::kVisible) |
| 227 return; | 227 return; |
| 228 | 228 |
| 229 // Only paint the focus ring by hand if the theme isn't able to draw the focus | 229 // Only paint the focus ring by hand if the theme isn't able to draw the focus |
| 230 // ring. | 230 // ring. |
| 231 if (styleToUse.outlineStyleIsAuto() && | 231 if (styleToUse.outlineStyleIsAuto() && |
| 232 !LayoutTheme::theme().shouldDrawDefaultFocusRing(m_layoutObject)) | 232 !LayoutTheme::theme().shouldDrawDefaultFocusRing(m_layoutObject)) |
| 233 return; | 233 return; |
| 234 | 234 |
| 235 Vector<LayoutRect> outlineRects; | 235 Vector<LayoutRect> outlineRects; |
| 236 m_layoutObject.addOutlineRects( | 236 m_layoutObject.addOutlineRects( |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 !toLayoutInline(child)->hasSelfPaintingLayer()) | 297 !toLayoutInline(child)->hasSelfPaintingLayer()) |
| 298 child->paint(paintInfoForDescendants, paintOffset); | 298 child->paint(paintInfoForDescendants, paintOffset); |
| 299 } | 299 } |
| 300 } | 300 } |
| 301 | 301 |
| 302 void ObjectPainter::addPDFURLRectIfNeeded(const PaintInfo& paintInfo, | 302 void ObjectPainter::addPDFURLRectIfNeeded(const PaintInfo& paintInfo, |
| 303 const LayoutPoint& paintOffset) { | 303 const LayoutPoint& paintOffset) { |
| 304 DCHECK(paintInfo.isPrinting()); | 304 DCHECK(paintInfo.isPrinting()); |
| 305 if (m_layoutObject.isElementContinuation() || !m_layoutObject.node() || | 305 if (m_layoutObject.isElementContinuation() || !m_layoutObject.node() || |
| 306 !m_layoutObject.node()->isLink() || | 306 !m_layoutObject.node()->isLink() || |
| 307 m_layoutObject.styleRef().visibility() != EVisibility::Visible) | 307 m_layoutObject.styleRef().visibility() != EVisibility::kVisible) |
| 308 return; | 308 return; |
| 309 | 309 |
| 310 KURL url = toElement(m_layoutObject.node())->hrefURL(); | 310 KURL url = toElement(m_layoutObject.node())->hrefURL(); |
| 311 if (!url.isValid()) | 311 if (!url.isValid()) |
| 312 return; | 312 return; |
| 313 | 313 |
| 314 Vector<LayoutRect> visualOverflowRects; | 314 Vector<LayoutRect> visualOverflowRects; |
| 315 m_layoutObject.addElementVisualOverflowRects(visualOverflowRects, | 315 m_layoutObject.addElementVisualOverflowRects(visualOverflowRects, |
| 316 paintOffset); | 316 paintOffset); |
| 317 IntRect rect = pixelSnappedIntRect(unionRect(visualOverflowRects)); | 317 IntRect rect = pixelSnappedIntRect(unionRect(visualOverflowRects)); |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 adjustedPaintOffset += toLayoutBox(m_layoutObject).location(); | 709 adjustedPaintOffset += toLayoutBox(m_layoutObject).location(); |
| 710 DCHECK(m_layoutObject.previousPaintOffset() == adjustedPaintOffset) | 710 DCHECK(m_layoutObject.previousPaintOffset() == adjustedPaintOffset) |
| 711 << " Paint offset mismatch: " << m_layoutObject.debugName() | 711 << " Paint offset mismatch: " << m_layoutObject.debugName() |
| 712 << " from PaintPropertyTreeBuilder: " | 712 << " from PaintPropertyTreeBuilder: " |
| 713 << m_layoutObject.previousPaintOffset().toString() | 713 << m_layoutObject.previousPaintOffset().toString() |
| 714 << " from painter: " << adjustedPaintOffset.toString(); | 714 << " from painter: " << adjustedPaintOffset.toString(); |
| 715 } | 715 } |
| 716 #endif | 716 #endif |
| 717 | 717 |
| 718 } // namespace blink | 718 } // namespace blink |
| OLD | NEW |