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

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

Issue 867463005: Merge the background paint phase into the foreground phase. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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
« no previous file with comments | « sky/engine/core/rendering/PaintPhase.h ('k') | sky/engine/core/rendering/RenderBox.cpp » ('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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsC lipBehavior); 538 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsC lipBehavior);
539 { 539 {
540 paintObject(paintInfo, adjustedPaintOffset); 540 paintObject(paintInfo, adjustedPaintOffset);
541 } 541 }
542 if (pushedClip) 542 if (pushedClip)
543 popContentsClip(paintInfo, phase, adjustedPaintOffset); 543 popContentsClip(paintInfo, phase, adjustedPaintOffset);
544 544
545 // Our scrollbar widgets paint exactly when we tell them to, so that they wo rk properly with 545 // Our scrollbar widgets paint exactly when we tell them to, so that they wo rk properly with
546 // z-index. We paint after we painted the background/border, so that the sc rollbars will 546 // z-index. We paint after we painted the background/border, so that the sc rollbars will
547 // sit above the background/border. 547 // sit above the background/border.
548 if (hasOverflowClip() && (phase == PaintPhaseBlockBackground || phase == Pai ntPhaseChildBlockBackground) && paintInfo.shouldPaintWithinRoot(this)) 548 if (hasOverflowClip() && phase == PaintPhaseForeground && paintInfo.shouldPa intWithinRoot(this))
549 layer()->scrollableArea()->paintOverflowControls(paintInfo.context, roun dedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintingOverlayContro ls */); 549 layer()->scrollableArea()->paintOverflowControls(paintInfo.context, roun dedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintingOverlayContro ls */);
550 } 550 }
551 551
552 void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf fset) 552 void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf fset)
553 { 553 {
554 PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? PaintPh aseOutline : paintInfo.phase; 554 PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? PaintPh aseOutline : paintInfo.phase;
555 newPhase = (newPhase == PaintPhaseChildBlockBackgrounds) ? PaintPhaseChildBl ockBackground : newPhase;
556 555
557 // We don't paint our own background, but we do let the kids paint their bac kgrounds. 556 // We don't paint our own background, but we do let the kids paint their bac kgrounds.
558 PaintInfo paintInfoForChild(paintInfo); 557 PaintInfo paintInfoForChild(paintInfo);
559 paintInfoForChild.phase = newPhase; 558 paintInfoForChild.phase = newPhase;
560 paintInfoForChild.updatePaintingRootForChildren(this); 559 paintInfoForChild.updatePaintingRootForChildren(this);
561 paintChildren(paintInfoForChild, paintOffset); 560 paintChildren(paintInfoForChild, paintOffset);
562 } 561 }
563 562
564 void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf fset) 563 void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf fset)
565 { 564 {
(...skipping 15 matching lines...) Expand all
581 580
582 void RenderBlock::paintAsInlineBlock(RenderObject* renderer, PaintInfo& paintInf o, const LayoutPoint& childPoint) 581 void RenderBlock::paintAsInlineBlock(RenderObject* renderer, PaintInfo& paintInf o, const LayoutPoint& childPoint)
583 { 582 {
584 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection) 583 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection)
585 return; 584 return;
586 585
587 // Paint all phases atomically, as though the element established its own 586 // Paint all phases atomically, as though the element established its own
588 // stacking context. (See Appendix E.2, section 7.2.1.4 on 587 // stacking context. (See Appendix E.2, section 7.2.1.4 on
589 // inline block/table/replaced elements in the CSS2.1 specification.) 588 // inline block/table/replaced elements in the CSS2.1 specification.)
590 // This is also used by other elements (e.g. flex items). 589 // This is also used by other elements (e.g. flex items).
591 bool preservePhase = paintInfo.phase == PaintPhaseSelection;
592 PaintInfo info(paintInfo); 590 PaintInfo info(paintInfo);
593 info.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground; 591
594 renderer->paint(info, childPoint); 592 if (paintInfo.phase == PaintPhaseSelection) {
595 if (!preservePhase) {
596 info.phase = PaintPhaseChildBlockBackgrounds;
597 renderer->paint(info, childPoint); 593 renderer->paint(info, childPoint);
594 } else {
598 info.phase = PaintPhaseForeground; 595 info.phase = PaintPhaseForeground;
599 renderer->paint(info, childPoint); 596 renderer->paint(info, childPoint);
600 info.phase = PaintPhaseOutline; 597 info.phase = PaintPhaseOutline;
601 renderer->paint(info, childPoint); 598 renderer->paint(info, childPoint);
602 } 599 }
603 } 600 }
604 601
605 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB lock* block) 602 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB lock* block)
606 { 603 {
607 return selection.caretRenderer() == block && selection.hasEditableStyle(); 604 return selection.caretRenderer() == block && selection.hasEditableStyle();
(...skipping 24 matching lines...) Expand all
632 } 629 }
633 630
634 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs et) 631 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs et)
635 { 632 {
636 PaintPhase paintPhase = paintInfo.phase; 633 PaintPhase paintPhase = paintInfo.phase;
637 634
638 LayoutPoint scrolledOffset = paintOffset; 635 LayoutPoint scrolledOffset = paintOffset;
639 if (hasOverflowClip()) 636 if (hasOverflowClip())
640 scrolledOffset.move(-scrolledContentOffset()); 637 scrolledOffset.move(-scrolledContentOffset());
641 638
642 if (paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChild BlockBackground) { 639 if (paintPhase == PaintPhaseForeground) {
643 if (hasBoxDecorationBackground()) 640 if (hasBoxDecorationBackground())
644 paintBoxDecorationBackground(paintInfo, paintOffset); 641 paintBoxDecorationBackground(paintInfo, paintOffset);
645 } 642 }
646 643
647 if (paintPhase == PaintPhaseMask) { 644 if (paintPhase == PaintPhaseMask) {
648 paintMask(paintInfo, paintOffset); 645 paintMask(paintInfo, paintOffset);
649 return; 646 return;
650 } 647 }
651 648
652 // We're done. We don't bother painting any children.
653 if (paintPhase == PaintPhaseBlockBackground)
654 return;
655
656 if (paintPhase != PaintPhaseSelfOutline) 649 if (paintPhase != PaintPhaseSelfOutline)
657 paintContents(paintInfo, scrolledOffset); 650 paintContents(paintInfo, scrolledOffset);
658 651
659 paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection on l ines and between blocks. 652 paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection on l ines and between blocks.
660 653
661 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) 654 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline)
662 && style()->hasOutline() && !style()->outlineStyleIsAuto()) { 655 && style()->hasOutline() && !style()->outlineStyleIsAuto()) {
663 paintOutline(paintInfo, LayoutRect(paintOffset, size())); 656 paintOutline(paintInfo, LayoutRect(paintOffset, size()));
664 } 657 }
665 658
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 1936 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
1944 { 1937 {
1945 showRenderObject(); 1938 showRenderObject();
1946 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 1939 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
1947 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 1940 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
1948 } 1941 }
1949 1942
1950 #endif 1943 #endif
1951 1944
1952 } // namespace blink 1945 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/PaintPhase.h ('k') | sky/engine/core/rendering/RenderBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698