| 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/BlockPainter.h" | 6 #include "core/paint/BlockPainter.h" |
| 7 | 7 |
| 8 #include "core/editing/Caret.h" | 8 #include "core/editing/Caret.h" |
| 9 #include "core/editing/FrameSelection.h" | 9 #include "core/editing/FrameSelection.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 void BlockPainter::paintChildAsInlineBlock(LayoutBox& child, const PaintInfo& pa
intInfo, const LayoutPoint& paintOffset) | 119 void BlockPainter::paintChildAsInlineBlock(LayoutBox& child, const PaintInfo& pa
intInfo, const LayoutPoint& paintOffset) |
| 120 { | 120 { |
| 121 LayoutPoint childPoint = m_layoutBlock.flipForWritingModeForChild(&child, pa
intOffset); | 121 LayoutPoint childPoint = m_layoutBlock.flipForWritingModeForChild(&child, pa
intOffset); |
| 122 if (!child.hasSelfPaintingLayer() && !child.isFloating()) | 122 if (!child.hasSelfPaintingLayer() && !child.isFloating()) |
| 123 paintAsInlineBlock(child, paintInfo, childPoint); | 123 paintAsInlineBlock(child, paintInfo, childPoint); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void BlockPainter::paintInlineBox(InlineBox& inlineBox, const PaintInfo& paintIn
fo, const LayoutPoint& paintOffset) | 126 void BlockPainter::paintInlineBox(InlineBox& inlineBox, const PaintInfo& paintIn
fo, const LayoutPoint& paintOffset) |
| 127 { | 127 { |
| 128 if (!paintInfo.shouldPaintWithinRoot(&inlineBox.renderer()) || (paintInfo.ph
ase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)) | 128 if (!paintInfo.shouldPaintWithinRoot(&inlineBox.layoutObject()) || (paintInf
o.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)) |
| 129 return; | 129 return; |
| 130 | 130 |
| 131 LayoutPoint childPoint = paintOffset; | 131 LayoutPoint childPoint = paintOffset; |
| 132 if (inlineBox.parent()->renderer().style()->isFlippedBlocksWritingMode()) //
Faster than calling containingBlock(). | 132 if (inlineBox.parent()->layoutObject().style()->isFlippedBlocksWritingMode()
) // Faster than calling containingBlock(). |
| 133 childPoint = inlineBox.renderer().containingBlock()->flipForWritingModeF
orChild(&toLayoutBox(inlineBox.renderer()), childPoint); | 133 childPoint = inlineBox.layoutObject().containingBlock()->flipForWritingM
odeForChild(&toLayoutBox(inlineBox.layoutObject()), childPoint); |
| 134 | 134 |
| 135 paintAsInlineBlock(inlineBox.renderer(), paintInfo, childPoint); | 135 paintAsInlineBlock(inlineBox.layoutObject(), paintInfo, childPoint); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void BlockPainter::paintAsInlineBlock(LayoutObject& renderer, const PaintInfo& p
aintInfo, const LayoutPoint& childPoint) | 138 void BlockPainter::paintAsInlineBlock(LayoutObject& renderer, const PaintInfo& p
aintInfo, const LayoutPoint& childPoint) |
| 139 { | 139 { |
| 140 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) | 140 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) |
| 141 return; | 141 return; |
| 142 | 142 |
| 143 // Paint all phases atomically, as though the element established its own | 143 // Paint all phases atomically, as though the element established its own |
| 144 // stacking context. (See Appendix E.2, section 7.2.1.4 on | 144 // stacking context. (See Appendix E.2, section 7.2.1.4 on |
| 145 // inline block/table/replaced elements in the CSS2.1 specification.) | 145 // inline block/table/replaced elements in the CSS2.1 specification.) |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 paintInfoForChild.phase = newPhase; | 474 paintInfoForChild.phase = newPhase; |
| 475 paintInfoForChild.updatePaintingRootForChildren(&m_layoutBlock); | 475 paintInfoForChild.updatePaintingRootForChildren(&m_layoutBlock); |
| 476 m_layoutBlock.paintChildren(paintInfoForChild, paintOffset); | 476 m_layoutBlock.paintChildren(paintInfoForChild, paintOffset); |
| 477 } | 477 } |
| 478 } | 478 } |
| 479 | 479 |
| 480 void BlockPainter::paintContinuationOutlines(const PaintInfo& info, const Layout
Point& paintOffset) | 480 void BlockPainter::paintContinuationOutlines(const PaintInfo& info, const Layout
Point& paintOffset) |
| 481 { | 481 { |
| 482 LayoutInline* inlineCont = m_layoutBlock.inlineElementContinuation(); | 482 LayoutInline* inlineCont = m_layoutBlock.inlineElementContinuation(); |
| 483 if (inlineCont && inlineCont->style()->hasOutline() && inlineCont->style()->
visibility() == VISIBLE) { | 483 if (inlineCont && inlineCont->style()->hasOutline() && inlineCont->style()->
visibility() == VISIBLE) { |
| 484 LayoutInline* inlineRenderer = toLayoutInline(inlineCont->node()->render
er()); | 484 LayoutInline* inlineRenderer = toLayoutInline(inlineCont->node()->layout
Object()); |
| 485 LayoutBlock* cb = m_layoutBlock.containingBlock(); | 485 LayoutBlock* cb = m_layoutBlock.containingBlock(); |
| 486 | 486 |
| 487 bool inlineEnclosedInSelfPaintingLayer = false; | 487 bool inlineEnclosedInSelfPaintingLayer = false; |
| 488 for (LayoutBoxModelObject* box = inlineRenderer; box != cb; box = box->p
arent()->enclosingBoxModelObject()) { | 488 for (LayoutBoxModelObject* box = inlineRenderer; box != cb; box = box->p
arent()->enclosingBoxModelObject()) { |
| 489 if (box->hasSelfPaintingLayer()) { | 489 if (box->hasSelfPaintingLayer()) { |
| 490 inlineEnclosedInSelfPaintingLayer = true; | 490 inlineEnclosedInSelfPaintingLayer = true; |
| 491 break; | 491 break; |
| 492 } | 492 } |
| 493 } | 493 } |
| 494 | 494 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 518 LayoutBlock* block = flow->containingBlock(); | 518 LayoutBlock* block = flow->containingBlock(); |
| 519 for ( ; block && block != &m_layoutBlock; block = block->containingBlock
()) | 519 for ( ; block && block != &m_layoutBlock; block = block->containingBlock
()) |
| 520 accumulatedPaintOffset.moveBy(block->location()); | 520 accumulatedPaintOffset.moveBy(block->location()); |
| 521 ASSERT(block); | 521 ASSERT(block); |
| 522 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); | 522 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); |
| 523 } | 523 } |
| 524 } | 524 } |
| 525 | 525 |
| 526 | 526 |
| 527 } // namespace blink | 527 } // namespace blink |
| OLD | NEW |