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

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

Issue 892033003: Consolidate and delete a bunch of paint methods. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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
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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; 468 ContentsClipBehavior contentsClipBehavior = ForceContentsClip;
469 if (hasOverflowClip() && !(shouldPaintSelectionGaps() && phase == PaintPhase Foreground) && !hasCaret()) 469 if (hasOverflowClip() && !(shouldPaintSelectionGaps() && phase == PaintPhase Foreground) && !hasCaret())
470 contentsClipBehavior = SkipContentsClipIfPossible; 470 contentsClipBehavior = SkipContentsClipIfPossible;
471 471
472 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsC lipBehavior); 472 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsC lipBehavior);
473 paintObject(paintInfo, adjustedPaintOffset); 473 paintObject(paintInfo, adjustedPaintOffset);
474 if (pushedClip) 474 if (pushedClip)
475 popContentsClip(paintInfo, phase, adjustedPaintOffset); 475 popContentsClip(paintInfo, phase, adjustedPaintOffset);
476 } 476 }
477 477
478 void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf fset)
479 {
480 // FIXME(sky): Can we remove paintContents and just keep paintChildren?
481 paintChildren(paintInfo, paintOffset);
482 }
483
484 void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf fset) 478 void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf fset)
485 { 479 {
486 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) 480 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) {
487 paintChild(child, paintInfo, paintOffset); 481 if (!child->hasSelfPaintingLayer())
488 } 482 child->paint(paintInfo, paintOffset);
489 483 }
490 void RenderBlock::paintChild(RenderBox* child, PaintInfo& paintInfo, const Layou tPoint& paintOffset)
491 {
492 if (!child->hasSelfPaintingLayer())
493 child->paint(paintInfo, paintOffset);
494 }
495
496 void RenderBlock::paintChildAsInlineBlock(RenderBox* child, PaintInfo& paintInfo , const LayoutPoint& paintOffset)
497 {
498 if (!child->hasSelfPaintingLayer())
499 paintAsInlineBlock(child, paintInfo, paintOffset);
500 }
501
502 void RenderBlock::paintAsInlineBlock(RenderObject* renderer, PaintInfo& paintInf o, const LayoutPoint& childPoint)
503 {
504 // FIXME(sky): Remove this function.
505 renderer->paint(paintInfo, childPoint);
506 } 484 }
507 485
508 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB lock* block) 486 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB lock* block)
509 { 487 {
510 return selection.caretRenderer() == block && selection.hasEditableStyle(); 488 return selection.caretRenderer() == block && selection.hasEditableStyle();
511 } 489 }
512 490
513 static inline bool hasDragCaret(const DragCaretController& dragCaretController, const RenderBlock* block) 491 static inline bool hasDragCaret(const DragCaretController& dragCaretController, const RenderBlock* block)
514 { 492 {
515 return dragCaretController.caretRenderer() == block && dragCaretController.i sContentEditable(); 493 return dragCaretController.caretRenderer() == block && dragCaretController.i sContentEditable();
(...skipping 16 matching lines...) Expand all
532 if (hasDragCaret(dragCaretController, this)) { 510 if (hasDragCaret(dragCaretController, this)) {
533 dragCaretController.paintDragCaret(frame(), paintInfo.context, paintOffs et, paintInfo.rect); 511 dragCaretController.paintDragCaret(frame(), paintInfo.context, paintOffs et, paintInfo.rect);
534 } 512 }
535 } 513 }
536 514
537 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs et) 515 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs et)
538 { 516 {
539 if (hasBoxDecorationBackground()) 517 if (hasBoxDecorationBackground())
540 paintBoxDecorationBackground(paintInfo, paintOffset); 518 paintBoxDecorationBackground(paintInfo, paintOffset);
541 519
542 paintContents(paintInfo, paintOffset); 520 paintChildren(paintInfo, paintOffset);
543 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.
544 522
545 if (style()->hasOutline() && !style()->outlineStyleIsAuto()) 523 if (style()->hasOutline() && !style()->outlineStyleIsAuto())
546 paintOutline(paintInfo, LayoutRect(paintOffset, size())); 524 paintOutline(paintInfo, LayoutRect(paintOffset, size()));
547 525
548 paintCarets(paintInfo, paintOffset); 526 paintCarets(paintInfo, paintOffset);
549 } 527 }
550 528
551 bool RenderBlock::shouldPaintSelectionGaps() const 529 bool RenderBlock::shouldPaintSelectionGaps() const
552 { 530 {
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 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
1794 { 1772 {
1795 showRenderObject(); 1773 showRenderObject();
1796 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 1774 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
1797 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 1775 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
1798 } 1776 }
1799 1777
1800 #endif 1778 #endif
1801 1779
1802 } // namespace blink 1780 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBlock.h ('k') | sky/engine/core/rendering/RenderFlexibleBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698