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

Side by Side Diff: sky/engine/core/rendering/RenderBlock.cpp

Issue 899753003: Walk render tree instead of render layers for paint. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: address review comments Created 5 years, 10 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
« no previous file with comments | « sky/engine/core/rendering/RenderBlock.h ('k') | sky/engine/core/rendering/RenderBox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 void RenderBlock::markPositionedObjectsForLayout() 440 void RenderBlock::markPositionedObjectsForLayout()
441 { 441 {
442 if (TrackedRendererListHashSet* positionedDescendants = positionedObjects()) { 442 if (TrackedRendererListHashSet* positionedDescendants = positionedObjects()) {
443 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); 443 TrackedRendererListHashSet::iterator end = positionedDescendants->end();
444 for (TrackedRendererListHashSet::iterator it = positionedDescendants->be gin(); it != end; ++it) 444 for (TrackedRendererListHashSet::iterator it = positionedDescendants->be gin(); it != end; ++it)
445 (*it)->setChildNeedsLayout(); 445 (*it)->setChildNeedsLayout();
446 } 446 }
447 } 447 }
448 448
449 void RenderBlock::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 449 void RenderBlock::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, Ve ctor<RenderBox*>& layers)
450 { 450 {
451 LayoutPoint adjustedPaintOffset = paintOffset + location(); 451 LayoutPoint adjustedPaintOffset = paintOffset + location();
452 452
453 LayoutRect overflowBox; 453 LayoutRect overflowBox;
454 // Check if we need to do anything at all. 454 // Check if we need to do anything at all.
455 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the RenderView 455 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the RenderView
456 // paints the root's background. 456 // paints the root's background.
457 if (!isDocumentElement()) { 457 if (!isDocumentElement()) {
458 overflowBox = visualOverflowRect(); 458 overflowBox = visualOverflowRect();
459 overflowBox.moveBy(adjustedPaintOffset); 459 overflowBox.moveBy(adjustedPaintOffset);
460 if (!overflowBox.intersects(paintInfo.rect)) 460 if (!overflowBox.intersects(paintInfo.rect))
461 return; 461 return;
462 } 462 }
463 463
464 // There are some cases where not all clipped visual overflow is accounted f or. 464 // There are some cases where not all clipped visual overflow is accounted f or.
465 // FIXME: reduce the number of such cases. 465 // FIXME: reduce the number of such cases.
466 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; 466 ContentsClipBehavior contentsClipBehavior = ForceContentsClip;
467 if (hasOverflowClip() && !shouldPaintSelectionGaps() && !hasCaret()) 467 if (hasOverflowClip() && !shouldPaintSelectionGaps() && !hasCaret())
468 contentsClipBehavior = SkipContentsClipIfPossible; 468 contentsClipBehavior = SkipContentsClipIfPossible;
469 469
470 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsC lipBehavior); 470 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsC lipBehavior);
471 paintObject(paintInfo, adjustedPaintOffset); 471 paintObject(paintInfo, adjustedPaintOffset, layers);
472 if (pushedClip) 472 if (pushedClip)
473 popContentsClip(paintInfo, adjustedPaintOffset); 473 popContentsClip(paintInfo, adjustedPaintOffset);
474 } 474 }
475 475
476 void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf fset) 476 void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf fset, Vector<RenderBox*>& layers)
477 { 477 {
478 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { 478 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) {
479 if (!child->hasSelfPaintingLayer()) 479 if (child->hasSelfPaintingLayer())
480 child->paint(paintInfo, paintOffset); 480 layers.append(child);
481 else
482 child->paint(paintInfo, paintOffset, layers);
481 } 483 }
482 } 484 }
483 485
484 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB lock* block) 486 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB lock* block)
485 { 487 {
486 return selection.caretRenderer() == block && selection.hasEditableStyle(); 488 return selection.caretRenderer() == block && selection.hasEditableStyle();
487 } 489 }
488 490
489 static inline bool hasDragCaret(const DragCaretController& dragCaretController, const RenderBlock* block) 491 static inline bool hasDragCaret(const DragCaretController& dragCaretController, const RenderBlock* block)
490 { 492 {
(...skipping 12 matching lines...) Expand all
503 if (hasCursorCaret(selection, this)) { 505 if (hasCursorCaret(selection, this)) {
504 selection.paintCaret(paintInfo.context, paintOffset, paintInfo.rect); 506 selection.paintCaret(paintInfo.context, paintOffset, paintInfo.rect);
505 } 507 }
506 508
507 DragCaretController& dragCaretController = frame()->page()->dragCaretControl ler(); 509 DragCaretController& dragCaretController = frame()->page()->dragCaretControl ler();
508 if (hasDragCaret(dragCaretController, this)) { 510 if (hasDragCaret(dragCaretController, this)) {
509 dragCaretController.paintDragCaret(frame(), paintInfo.context, paintOffs et, paintInfo.rect); 511 dragCaretController.paintDragCaret(frame(), paintInfo.context, paintOffs et, paintInfo.rect);
510 } 512 }
511 } 513 }
512 514
513 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs et) 515 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs et, Vector<RenderBox*>& layers)
514 { 516 {
515 if (hasBoxDecorationBackground()) 517 if (hasBoxDecorationBackground())
516 paintBoxDecorationBackground(paintInfo, paintOffset); 518 paintBoxDecorationBackground(paintInfo, paintOffset);
517 519
518 paintChildren(paintInfo, paintOffset); 520 paintChildren(paintInfo, paintOffset, layers);
519 paintSelection(paintInfo, paintOffset); // Fill in gaps in selection on line s and between blocks. 521 paintSelection(paintInfo, paintOffset); // Fill in gaps in selection on line s and between blocks.
520 522
521 if (style()->hasOutline() && !style()->outlineStyleIsAuto()) 523 if (style()->hasOutline() && !style()->outlineStyleIsAuto())
522 paintOutline(paintInfo, LayoutRect(paintOffset, size())); 524 paintOutline(paintInfo, LayoutRect(paintOffset, size()));
523 525
524 paintCarets(paintInfo, paintOffset); 526 paintCarets(paintInfo, paintOffset);
525 } 527 }
526 528
527 bool RenderBlock::shouldPaintSelectionGaps() const 529 bool RenderBlock::shouldPaintSelectionGaps() const
528 { 530 {
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 1771 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
1770 { 1772 {
1771 showRenderObject(); 1773 showRenderObject();
1772 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 1774 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
1773 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 1775 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
1774 } 1776 }
1775 1777
1776 #endif 1778 #endif
1777 1779
1778 } // namespace blink 1780 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBlock.h ('k') | sky/engine/core/rendering/RenderBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698