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" |
11 #include "core/frame/Settings.h" | 11 #include "core/frame/Settings.h" |
12 #include "core/page/Page.h" | 12 #include "core/page/Page.h" |
13 #include "core/paint/BoxPainter.h" | 13 #include "core/paint/BoxPainter.h" |
| 14 #include "core/paint/InlinePainter.h" |
14 #include "core/rendering/GraphicsContextAnnotator.h" | 15 #include "core/rendering/GraphicsContextAnnotator.h" |
15 #include "core/rendering/PaintInfo.h" | 16 #include "core/rendering/PaintInfo.h" |
16 #include "core/rendering/RenderBlock.h" | 17 #include "core/rendering/RenderBlock.h" |
17 #include "core/rendering/RenderInline.h" | 18 #include "core/rendering/RenderInline.h" |
18 #include "core/rendering/RenderLayer.h" | 19 #include "core/rendering/RenderLayer.h" |
19 #include "platform/geometry/LayoutPoint.h" | 20 #include "platform/geometry/LayoutPoint.h" |
20 #include "platform/geometry/LayoutRect.h" | 21 #include "platform/geometry/LayoutRect.h" |
21 #include "platform/graphics/GraphicsContextCullSaver.h" | 22 #include "platform/graphics/GraphicsContextCullSaver.h" |
22 #include "platform/graphics/GraphicsContextStateSaver.h" | 23 #include "platform/graphics/GraphicsContextStateSaver.h" |
23 | 24 |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 break; | 441 break; |
441 } | 442 } |
442 } | 443 } |
443 | 444 |
444 // Do not add continuations for outline painting by our containing block
if we are a relative positioned | 445 // Do not add continuations for outline painting by our containing block
if we are a relative positioned |
445 // anonymous block (i.e. have our own layer), paint them straightaway in
stead. This is because a block depends on renderers in its continuation table be
ing | 446 // anonymous block (i.e. have our own layer), paint them straightaway in
stead. This is because a block depends on renderers in its continuation table be
ing |
446 // in the same layer. | 447 // in the same layer. |
447 if (!inlineEnclosedInSelfPaintingLayer && !m_renderBlock.hasLayer()) | 448 if (!inlineEnclosedInSelfPaintingLayer && !m_renderBlock.hasLayer()) |
448 cb->addContinuationWithOutline(inlineRenderer); | 449 cb->addContinuationWithOutline(inlineRenderer); |
449 else if (!inlineRenderer->firstLineBox() || (!inlineEnclosedInSelfPainti
ngLayer && m_renderBlock.hasLayer())) | 450 else if (!inlineRenderer->firstLineBox() || (!inlineEnclosedInSelfPainti
ngLayer && m_renderBlock.hasLayer())) |
450 inlineRenderer->paintOutline(info, paintOffset - m_renderBlock.locat
ionOffset() + inlineRenderer->containingBlock()->location()); | 451 InlinePainter(*inlineRenderer).paintOutline(info, paintOffset - m_re
nderBlock.locationOffset() + inlineRenderer->containingBlock()->location()); |
451 } | 452 } |
452 | 453 |
453 ContinuationOutlineTableMap* table = continuationOutlineTable(); | 454 ContinuationOutlineTableMap* table = continuationOutlineTable(); |
454 if (table->isEmpty()) | 455 if (table->isEmpty()) |
455 return; | 456 return; |
456 | 457 |
457 OwnPtr<ListHashSet<RenderInline*> > continuations = table->take(&m_renderBlo
ck); | 458 OwnPtr<ListHashSet<RenderInline*> > continuations = table->take(&m_renderBlo
ck); |
458 if (!continuations) | 459 if (!continuations) |
459 return; | 460 return; |
460 | 461 |
461 LayoutPoint accumulatedPaintOffset = paintOffset; | 462 LayoutPoint accumulatedPaintOffset = paintOffset; |
462 // Paint each continuation outline. | 463 // Paint each continuation outline. |
463 ListHashSet<RenderInline*>::iterator end = continuations->end(); | 464 ListHashSet<RenderInline*>::iterator end = continuations->end(); |
464 for (ListHashSet<RenderInline*>::iterator it = continuations->begin(); it !=
end; ++it) { | 465 for (ListHashSet<RenderInline*>::iterator it = continuations->begin(); it !=
end; ++it) { |
465 // Need to add in the coordinates of the intervening blocks. | 466 // Need to add in the coordinates of the intervening blocks. |
466 RenderInline* flow = *it; | 467 RenderInline* flow = *it; |
467 RenderBlock* block = flow->containingBlock(); | 468 RenderBlock* block = flow->containingBlock(); |
468 for ( ; block && block != &m_renderBlock; block = block->containingBlock
()) | 469 for ( ; block && block != &m_renderBlock; block = block->containingBlock
()) |
469 accumulatedPaintOffset.moveBy(block->location()); | 470 accumulatedPaintOffset.moveBy(block->location()); |
470 ASSERT(block); | 471 ASSERT(block); |
471 flow->paintOutline(info, accumulatedPaintOffset); | 472 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); |
472 } | 473 } |
473 } | 474 } |
474 | 475 |
475 | 476 |
476 } // namespace blink | 477 } // namespace blink |
OLD | NEW |