Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: Source/core/paint/BlockPainter.cpp

Issue 1197443003: SP: add a scope recorder for painting inline continuation outlines. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/paint/inline/self-painting-continuation-outline-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/FrameSelection.h" 8 #include "core/editing/FrameSelection.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/layout/LayoutFlexibleBox.h" 10 #include "core/layout/LayoutFlexibleBox.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 for (LayoutBoxModelObject* box = inlineLayoutObject; box != cb; box = bo x->parent()->enclosingBoxModelObject()) { 316 for (LayoutBoxModelObject* box = inlineLayoutObject; box != cb; box = bo x->parent()->enclosingBoxModelObject()) {
317 if (box->hasSelfPaintingLayer()) { 317 if (box->hasSelfPaintingLayer()) {
318 inlineEnclosedInSelfPaintingLayer = true; 318 inlineEnclosedInSelfPaintingLayer = true;
319 break; 319 break;
320 } 320 }
321 } 321 }
322 322
323 // Do not add continuations for outline painting by our containing block if we are a relative positioned 323 // Do not add continuations for outline painting by our containing block if we are a relative positioned
324 // anonymous block (i.e. have our own layer), paint them straightaway in stead. This is because a block depends on layoutObjects in its continuation tabl e being 324 // anonymous block (i.e. have our own layer), paint them straightaway in stead. This is because a block depends on layoutObjects in its continuation tabl e being
325 // in the same layer. 325 // in the same layer.
326 if (!inlineEnclosedInSelfPaintingLayer && !m_layoutBlock.hasLayer()) 326 if (!inlineEnclosedInSelfPaintingLayer && !m_layoutBlock.hasLayer()) {
327 cb->addContinuationWithOutline(inlineLayoutObject); 327 cb->addContinuationWithOutline(inlineLayoutObject);
328 else if (!inlineLayoutObject->firstLineBox() || (!inlineEnclosedInSelfPa intingLayer && m_layoutBlock.hasLayer())) 328 } else if (!inlineLayoutObject->firstLineBox() || (!inlineEnclosedInSelf PaintingLayer && m_layoutBlock.hasLayer())) {
329 // The outline might be painted multiple times if multiple blocks ha ve the same inline element continuation, and the inline has a self-painting laye r.
330 ScopeRecorder scopeRecorder(*info.context, *inlineLayoutObject);
329 InlinePainter(*inlineLayoutObject).paintOutline(info, paintOffset - m_layoutBlock.locationOffset() + inlineLayoutObject->containingBlock()->location ()); 331 InlinePainter(*inlineLayoutObject).paintOutline(info, paintOffset - m_layoutBlock.locationOffset() + inlineLayoutObject->containingBlock()->location ());
332 }
330 } 333 }
331 334
332 ContinuationOutlineTableMap* table = continuationOutlineTable(); 335 ContinuationOutlineTableMap* table = continuationOutlineTable();
333 if (table->isEmpty()) 336 if (table->isEmpty())
334 return; 337 return;
335 338
336 OwnPtr<ListHashSet<LayoutInline*>> continuations = table->take(&m_layoutBloc k); 339 OwnPtr<ListHashSet<LayoutInline*>> continuations = table->take(&m_layoutBloc k);
337 if (!continuations) 340 if (!continuations)
338 return; 341 return;
339 342
340 LayoutPoint accumulatedPaintOffset = paintOffset; 343 LayoutPoint accumulatedPaintOffset = paintOffset;
341 // Paint each continuation outline. 344 // Paint each continuation outline.
342 ListHashSet<LayoutInline*>::iterator end = continuations->end(); 345 ListHashSet<LayoutInline*>::iterator end = continuations->end();
343 for (ListHashSet<LayoutInline*>::iterator it = continuations->begin(); it != end; ++it) { 346 for (ListHashSet<LayoutInline*>::iterator it = continuations->begin(); it != end; ++it) {
344 // Need to add in the coordinates of the intervening blocks. 347 // Need to add in the coordinates of the intervening blocks.
345 LayoutInline* flow = *it; 348 LayoutInline* flow = *it;
346 LayoutBlock* block = flow->containingBlock(); 349 LayoutBlock* block = flow->containingBlock();
347 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ()) 350 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ())
348 accumulatedPaintOffset.moveBy(block->location()); 351 accumulatedPaintOffset.moveBy(block->location());
349 ASSERT(block); 352 ASSERT(block);
350 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); 353 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset);
351 } 354 }
352 } 355 }
353 356
354 357
355 } // namespace blink 358 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/paint/inline/self-painting-continuation-outline-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698