| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 if (m_renderBlock.hasColumns()) | 189 if (m_renderBlock.hasColumns()) |
| 190 paintColumnContents(paintInfo, scrolledOffset); | 190 paintColumnContents(paintInfo, scrolledOffset); |
| 191 else | 191 else |
| 192 paintContents(paintInfo, scrolledOffset); | 192 paintContents(paintInfo, scrolledOffset); |
| 193 } | 193 } |
| 194 | 194 |
| 195 // 3. paint selection | 195 // 3. paint selection |
| 196 // FIXME: Make this work with multi column layouts. For now don't fill gaps. | 196 // FIXME: Make this work with multi column layouts. For now don't fill gaps. |
| 197 bool isPrinting = m_renderBlock.document().printing(); | 197 bool isPrinting = m_renderBlock.document().printing(); |
| 198 if (!isPrinting && !m_renderBlock.hasColumns()) | 198 if (!isPrinting && !m_renderBlock.hasColumns()) |
| 199 paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection
on lines and between blocks. | 199 m_renderBlock.paintSelection(paintInfo, scrolledOffset); // Fill in gaps
in selection on lines and between blocks. |
| 200 | 200 |
| 201 // 4. paint floats. | 201 // 4. paint floats. |
| 202 if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection || pa
intPhase == PaintPhaseTextClip) { | 202 if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection || pa
intPhase == PaintPhaseTextClip) { |
| 203 if (m_renderBlock.hasColumns()) | 203 if (m_renderBlock.hasColumns()) |
| 204 paintColumnContents(paintInfo, scrolledOffset, true); | 204 paintColumnContents(paintInfo, scrolledOffset, true); |
| 205 else | 205 else |
| 206 m_renderBlock.paintFloats(paintInfo, scrolledOffset, paintPhase == P
aintPhaseSelection || paintPhase == PaintPhaseTextClip); | 206 m_renderBlock.paintFloats(paintInfo, scrolledOffset, paintPhase == P
aintPhaseSelection || paintPhase == PaintPhaseTextClip); |
| 207 } | 207 } |
| 208 | 208 |
| 209 // 5. paint outline. | 209 // 5. paint outline. |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 newPhase = (newPhase == PaintPhaseChildBlockBackgrounds) ? PaintPhaseChi
ldBlockBackground : newPhase; | 434 newPhase = (newPhase == PaintPhaseChildBlockBackgrounds) ? PaintPhaseChi
ldBlockBackground : newPhase; |
| 435 | 435 |
| 436 // We don't paint our own background, but we do let the kids paint their
backgrounds. | 436 // We don't paint our own background, but we do let the kids paint their
backgrounds. |
| 437 PaintInfo paintInfoForChild(paintInfo); | 437 PaintInfo paintInfoForChild(paintInfo); |
| 438 paintInfoForChild.phase = newPhase; | 438 paintInfoForChild.phase = newPhase; |
| 439 paintInfoForChild.updatePaintingRootForChildren(&m_renderBlock); | 439 paintInfoForChild.updatePaintingRootForChildren(&m_renderBlock); |
| 440 m_renderBlock.paintChildren(paintInfoForChild, paintOffset); | 440 m_renderBlock.paintChildren(paintInfoForChild, paintOffset); |
| 441 } | 441 } |
| 442 } | 442 } |
| 443 | 443 |
| 444 void BlockPainter::paintSelection(PaintInfo& paintInfo, const LayoutPoint& paint
Offset) | |
| 445 { | |
| 446 if (m_renderBlock.shouldPaintSelectionGaps() && paintInfo.phase == PaintPhas
eForeground) { | |
| 447 LayoutUnit lastTop = 0; | |
| 448 LayoutUnit lastLeft = m_renderBlock.logicalLeftSelectionOffset(&m_render
Block, lastTop); | |
| 449 LayoutUnit lastRight = m_renderBlock.logicalRightSelectionOffset(&m_rend
erBlock, lastTop); | |
| 450 GraphicsContextStateSaver stateSaver(*paintInfo.context); | |
| 451 | |
| 452 LayoutRect gapRectsBounds = m_renderBlock.selectionGaps(&m_renderBlock,
paintOffset, LayoutSize(), lastTop, lastLeft, lastRight, &paintInfo); | |
| 453 if (!gapRectsBounds.isEmpty()) { | |
| 454 RenderLayer* layer = m_renderBlock.enclosingLayer(); | |
| 455 gapRectsBounds.moveBy(-paintOffset); | |
| 456 if (!m_renderBlock.hasLayer()) { | |
| 457 LayoutRect localBounds(gapRectsBounds); | |
| 458 m_renderBlock.flipForWritingMode(localBounds); | |
| 459 gapRectsBounds = m_renderBlock.localToContainerQuad(FloatRect(lo
calBounds), layer->renderer()).enclosingBoundingBox(); | |
| 460 if (layer->renderer()->hasOverflowClip()) | |
| 461 gapRectsBounds.move(layer->renderBox()->scrolledContentOffse
t()); | |
| 462 } | |
| 463 layer->addBlockSelectionGapsBounds(gapRectsBounds); | |
| 464 } | |
| 465 } | |
| 466 } | |
| 467 | |
| 468 void BlockPainter::paintContinuationOutlines(PaintInfo& info, const LayoutPoint&
paintOffset) | 444 void BlockPainter::paintContinuationOutlines(PaintInfo& info, const LayoutPoint&
paintOffset) |
| 469 { | 445 { |
| 470 RenderInline* inlineCont = m_renderBlock.inlineElementContinuation(); | 446 RenderInline* inlineCont = m_renderBlock.inlineElementContinuation(); |
| 471 if (inlineCont && inlineCont->style()->hasOutline() && inlineCont->style()->
visibility() == VISIBLE) { | 447 if (inlineCont && inlineCont->style()->hasOutline() && inlineCont->style()->
visibility() == VISIBLE) { |
| 472 RenderInline* inlineRenderer = toRenderInline(inlineCont->node()->render
er()); | 448 RenderInline* inlineRenderer = toRenderInline(inlineCont->node()->render
er()); |
| 473 RenderBlock* cb = m_renderBlock.containingBlock(); | 449 RenderBlock* cb = m_renderBlock.containingBlock(); |
| 474 | 450 |
| 475 bool inlineEnclosedInSelfPaintingLayer = false; | 451 bool inlineEnclosedInSelfPaintingLayer = false; |
| 476 for (RenderBoxModelObject* box = inlineRenderer; box != cb; box = box->p
arent()->enclosingBoxModelObject()) { | 452 for (RenderBoxModelObject* box = inlineRenderer; box != cb; box = box->p
arent()->enclosingBoxModelObject()) { |
| 477 if (box->hasSelfPaintingLayer()) { | 453 if (box->hasSelfPaintingLayer()) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 506 RenderBlock* block = flow->containingBlock(); | 482 RenderBlock* block = flow->containingBlock(); |
| 507 for ( ; block && block != &m_renderBlock; block = block->containingBlock
()) | 483 for ( ; block && block != &m_renderBlock; block = block->containingBlock
()) |
| 508 accumulatedPaintOffset.moveBy(block->location()); | 484 accumulatedPaintOffset.moveBy(block->location()); |
| 509 ASSERT(block); | 485 ASSERT(block); |
| 510 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); | 486 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); |
| 511 } | 487 } |
| 512 } | 488 } |
| 513 | 489 |
| 514 | 490 |
| 515 } // namespace blink | 491 } // namespace blink |
| OLD | NEW |