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

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

Issue 849763002: Get rid of the full invalidation bool on FrameView. (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/RenderObject.h ('k') | sky/engine/core/rendering/RenderView.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) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 } 641 }
642 642
643 bool RenderObject::canRenderBorderImage() const 643 bool RenderObject::canRenderBorderImage() const
644 { 644 {
645 ASSERT(style()->hasBorder()); 645 ASSERT(style()->hasBorder());
646 646
647 StyleImage* borderImage = style()->borderImage().image(); 647 StyleImage* borderImage = style()->borderImage().image();
648 return borderImage && borderImage->canRender(*this) && borderImage->isLoaded (); 648 return borderImage && borderImage->canRender(*this) && borderImage->isLoaded ();
649 } 649 }
650 650
651 bool RenderObject::mustInvalidateFillLayersPaintOnWidthChange(const FillLayer& l ayer) const
652 {
653 // Nobody will use multiple layers without wanting fancy positioning.
654 if (layer.next())
655 return true;
656
657 // Make sure we have a valid image.
658 StyleImage* img = layer.image();
659 if (!img || !img->canRender(*this))
660 return false;
661
662 if (layer.repeatX() != RepeatFill && layer.repeatX() != NoRepeatFill)
663 return true;
664
665 if (layer.xPosition().isPercent() && !layer.xPosition().isZero())
666 return true;
667
668 if (layer.backgroundXOrigin() != LeftEdge)
669 return true;
670
671 EFillSizeType sizeType = layer.sizeType();
672
673 if (sizeType == Contain || sizeType == Cover)
674 return true;
675
676 if (sizeType == SizeLength) {
677 if (layer.sizeLength().width().isPercent() && !layer.sizeLength().width( ).isZero())
678 return true;
679 if (img->isGeneratedImage() && layer.sizeLength().width().isAuto())
680 return true;
681 } else if (img->usesImageContainerSize()) {
682 return true;
683 }
684
685 return false;
686 }
687
688 bool RenderObject::mustInvalidateFillLayersPaintOnHeightChange(const FillLayer& layer) const
689 {
690 // Nobody will use multiple layers without wanting fancy positioning.
691 if (layer.next())
692 return true;
693
694 // Make sure we have a valid image.
695 StyleImage* img = layer.image();
696 if (!img || !img->canRender(*this))
697 return false;
698
699 if (layer.repeatY() != RepeatFill && layer.repeatY() != NoRepeatFill)
700 return true;
701
702 if (layer.yPosition().isPercent() && !layer.yPosition().isZero())
703 return true;
704
705 if (layer.backgroundYOrigin() != TopEdge)
706 return true;
707
708 EFillSizeType sizeType = layer.sizeType();
709
710 if (sizeType == Contain || sizeType == Cover)
711 return true;
712
713 if (sizeType == SizeLength) {
714 if (layer.sizeLength().height().isPercent() && !layer.sizeLength().heigh t().isZero())
715 return true;
716 if (img->isGeneratedImage() && layer.sizeLength().height().isAuto())
717 return true;
718 } else if (img->usesImageContainerSize()) {
719 return true;
720 }
721
722 return false;
723 }
724
725 bool RenderObject::mustInvalidateBackgroundOrBorderPaintOnWidthChange() const
726 {
727 if (hasMask() && mustInvalidateFillLayersPaintOnWidthChange(style()->maskLay ers()))
728 return true;
729
730 // If we don't have a background/border/mask, then nothing to do.
731 if (!hasBoxDecorationBackground())
732 return false;
733
734 if (mustInvalidateFillLayersPaintOnWidthChange(style()->backgroundLayers()))
735 return true;
736
737 // Our fill layers are ok. Let's check border.
738 if (style()->hasBorder() && canRenderBorderImage())
739 return true;
740
741 return false;
742 }
743
744 bool RenderObject::mustInvalidateBackgroundOrBorderPaintOnHeightChange() const
745 {
746 if (hasMask() && mustInvalidateFillLayersPaintOnHeightChange(style()->maskLa yers()))
747 return true;
748
749 // If we don't have a background/border/mask, then nothing to do.
750 if (!hasBoxDecorationBackground())
751 return false;
752
753 if (mustInvalidateFillLayersPaintOnHeightChange(style()->backgroundLayers()) )
754 return true;
755
756 // Our fill layers are ok. Let's check border.
757 if (style()->hasBorder() && canRenderBorderImage())
758 return true;
759
760 return false;
761 }
762
763 void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, int y1, int x2, int y2, 651 void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, int y1, int x2, int y2,
764 BoxSide side, Color color, EBorderStyle st yle, 652 BoxSide side, Color color, EBorderStyle st yle,
765 int adjacentWidth1, int adjacentWidth2, bo ol antialias) 653 int adjacentWidth1, int adjacentWidth2, bo ol antialias)
766 { 654 {
767 int thickness; 655 int thickness;
768 int length; 656 int length;
769 if (side == BSTop || side == BSBottom) { 657 if (side == BSTop || side == BSBottom) {
770 thickness = y2 - y1; 658 thickness = y2 - y1;
771 length = x2 - x1; 659 length = x2 - x1;
772 } else { 660 } else {
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2261 { 2149 {
2262 if (object1) { 2150 if (object1) {
2263 const blink::RenderObject* root = object1; 2151 const blink::RenderObject* root = object1;
2264 while (root->parent()) 2152 while (root->parent())
2265 root = root->parent(); 2153 root = root->parent();
2266 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 2154 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
2267 } 2155 }
2268 } 2156 }
2269 2157
2270 #endif 2158 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderObject.h ('k') | sky/engine/core/rendering/RenderView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698