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

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

Issue 878023002: Merge outline paint phases into the foreground phase. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase Created 5 years, 11 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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 526
527 // Our scrollbar widgets paint exactly when we tell them to, so that they wo rk properly with 527 // Our scrollbar widgets paint exactly when we tell them to, so that they wo rk properly with
528 // z-index. We paint after we painted the background/border, so that the sc rollbars will 528 // z-index. We paint after we painted the background/border, so that the sc rollbars will
529 // sit above the background/border. 529 // sit above the background/border.
530 if (hasOverflowClip() && phase == PaintPhaseForeground && paintInfo.shouldPa intWithinRoot(this)) 530 if (hasOverflowClip() && phase == PaintPhaseForeground && paintInfo.shouldPa intWithinRoot(this))
531 layer()->scrollableArea()->paintOverflowControls(paintInfo.context, roun dedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintingOverlayContro ls */); 531 layer()->scrollableArea()->paintOverflowControls(paintInfo.context, roun dedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintingOverlayContro ls */);
532 } 532 }
533 533
534 void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf fset) 534 void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf fset)
535 { 535 {
536 PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? PaintPh aseOutline : paintInfo.phase;
537
538 // We don't paint our own background, but we do let the kids paint their bac kgrounds. 536 // We don't paint our own background, but we do let the kids paint their bac kgrounds.
539 PaintInfo paintInfoForChild(paintInfo); 537 PaintInfo paintInfoForChild(paintInfo);
540 paintInfoForChild.phase = newPhase;
541 paintInfoForChild.updatePaintingRootForChildren(this); 538 paintInfoForChild.updatePaintingRootForChildren(this);
542 paintChildren(paintInfoForChild, paintOffset); 539 paintChildren(paintInfoForChild, paintOffset);
543 } 540 }
544 541
545 void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf fset) 542 void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf fset)
546 { 543 {
547 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) 544 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x())
548 paintChild(child, paintInfo, paintOffset); 545 paintChild(child, paintInfo, paintOffset);
549 } 546 }
550 547
(...skipping 18 matching lines...) Expand all
569 // stacking context. (See Appendix E.2, section 7.2.1.4 on 566 // stacking context. (See Appendix E.2, section 7.2.1.4 on
570 // inline block/table/replaced elements in the CSS2.1 specification.) 567 // inline block/table/replaced elements in the CSS2.1 specification.)
571 // This is also used by other elements (e.g. flex items). 568 // This is also used by other elements (e.g. flex items).
572 PaintInfo info(paintInfo); 569 PaintInfo info(paintInfo);
573 570
574 if (paintInfo.phase == PaintPhaseSelection) { 571 if (paintInfo.phase == PaintPhaseSelection) {
575 renderer->paint(info, childPoint); 572 renderer->paint(info, childPoint);
576 } else { 573 } else {
577 info.phase = PaintPhaseForeground; 574 info.phase = PaintPhaseForeground;
578 renderer->paint(info, childPoint); 575 renderer->paint(info, childPoint);
579 info.phase = PaintPhaseOutline;
580 renderer->paint(info, childPoint);
581 } 576 }
582 } 577 }
583 578
584 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB lock* block) 579 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB lock* block)
585 { 580 {
586 return selection.caretRenderer() == block && selection.hasEditableStyle(); 581 return selection.caretRenderer() == block && selection.hasEditableStyle();
587 } 582 }
588 583
589 static inline bool hasDragCaret(const DragCaretController& dragCaretController, const RenderBlock* block) 584 static inline bool hasDragCaret(const DragCaretController& dragCaretController, const RenderBlock* block)
590 { 585 {
(...skipping 30 matching lines...) Expand all
621 if (paintPhase == PaintPhaseForeground) { 616 if (paintPhase == PaintPhaseForeground) {
622 if (hasBoxDecorationBackground()) 617 if (hasBoxDecorationBackground())
623 paintBoxDecorationBackground(paintInfo, paintOffset); 618 paintBoxDecorationBackground(paintInfo, paintOffset);
624 } 619 }
625 620
626 if (paintPhase == PaintPhaseMask) { 621 if (paintPhase == PaintPhaseMask) {
627 paintMask(paintInfo, paintOffset); 622 paintMask(paintInfo, paintOffset);
628 return; 623 return;
629 } 624 }
630 625
631 if (paintPhase != PaintPhaseSelfOutline) 626 paintContents(paintInfo, scrolledOffset);
632 paintContents(paintInfo, scrolledOffset);
633
634 paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection on l ines and between blocks. 627 paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection on l ines and between blocks.
635 628
636 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) 629 if (paintPhase == PaintPhaseForeground) {
637 && style()->hasOutline() && !style()->outlineStyleIsAuto()) { 630 if (style()->hasOutline() && !style()->outlineStyleIsAuto())
esprehn 2015/01/28 01:22:26 I wonder what outline: auto is for.
638 paintOutline(paintInfo, LayoutRect(paintOffset, size())); 631 paintOutline(paintInfo, LayoutRect(paintOffset, size()));
632
633 // If the caret's node's render object's containing block is this block, and the paint action is PaintPhaseForeground,
634 // then paint the caret.
635 paintCarets(paintInfo, paintOffset);
639 } 636 }
640
641 // If the caret's node's render object's containing block is this block, and the paint action is PaintPhaseForeground,
642 // then paint the caret.
643 if (paintPhase == PaintPhaseForeground)
644 paintCarets(paintInfo, paintOffset);
645 } 637 }
646 638
647 bool RenderBlock::shouldPaintSelectionGaps() const 639 bool RenderBlock::shouldPaintSelectionGaps() const
648 { 640 {
649 return selectionState() != SelectionNone && isSelectionRoot(); 641 return selectionState() != SelectionNone && isSelectionRoot();
650 } 642 }
651 643
652 bool RenderBlock::isSelectionRoot() const 644 bool RenderBlock::isSelectionRoot() const
653 { 645 {
654 ASSERT(node() || isAnonymous()); 646 ASSERT(node() || isAnonymous());
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 1900 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
1909 { 1901 {
1910 showRenderObject(); 1902 showRenderObject();
1911 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 1903 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
1912 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 1904 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
1913 } 1905 }
1914 1906
1915 #endif 1907 #endif
1916 1908
1917 } // namespace blink 1909 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698