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

Side by Side Diff: Source/core/rendering/RenderBox.h

Issue 550363004: Factor painting code out of RenderBox into a new class called BoxPainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/BoxPainter.cpp ('k') | Source/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 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // For inline replaced elements, the inline box that owns us. 61 // For inline replaced elements, the inline box that owns us.
62 InlineBox* m_inlineBoxWrapper; 62 InlineBox* m_inlineBoxWrapper;
63 63
64 LayoutUnit m_overrideLogicalContentHeight; 64 LayoutUnit m_overrideLogicalContentHeight;
65 LayoutUnit m_overrideLogicalContentWidth; 65 LayoutUnit m_overrideLogicalContentWidth;
66 66
67 // Set by RenderBox::updatePreviousBorderBoxSizeIfNeeded(). 67 // Set by RenderBox::updatePreviousBorderBoxSizeIfNeeded().
68 LayoutSize m_previousBorderBoxSize; 68 LayoutSize m_previousBorderBoxSize;
69 }; 69 };
70 70
71
72 class RenderBox : public RenderBoxModelObject { 71 class RenderBox : public RenderBoxModelObject {
73 public: 72 public:
74 explicit RenderBox(ContainerNode*); 73 explicit RenderBox(ContainerNode*);
75 74
76 // hasAutoZIndex only returns true if the element is positioned or a flex-it em since 75 // hasAutoZIndex only returns true if the element is positioned or a flex-it em since
77 // position:static elements that are not flex-items get their z-index coerce d to auto. 76 // position:static elements that are not flex-items get their z-index coerce d to auto.
78 virtual LayerType layerTypeRequired() const OVERRIDE 77 virtual LayerType layerTypeRequired() const OVERRIDE
79 { 78 {
80 if (isPositioned() || createsGroup() || hasClipPath() || hasTransform() || hasHiddenBackface() || hasReflection() || style()->specifiesColumns() || !sty le()->hasAutoZIndex() || style()->shouldCompositeForCurrentAnimations()) 79 if (isPositioned() || createsGroup() || hasClipPath() || hasTransform() || hasHiddenBackface() || hasReflection() || style()->specifiesColumns() || !sty le()->hasAutoZIndex() || style()->shouldCompositeForCurrentAnimations())
81 return NormalLayer; 80 return NormalLayer;
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 { 614 {
616 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*t his) : 0; 615 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*t his) : 0;
617 } 616 }
618 617
619 void markShapeOutsideDependentsForLayout() 618 void markShapeOutsideDependentsForLayout()
620 { 619 {
621 if (isFloating()) 620 if (isFloating())
622 removeFloatingOrPositionedChildFromBlockLists(); 621 removeFloatingOrPositionedChildFromBlockLists();
623 } 622 }
624 623
624 bool backgroundHasOpaqueTopLayer() const;
625
625 protected: 626 protected:
626 virtual void willBeDestroyed() OVERRIDE; 627 virtual void willBeDestroyed() OVERRIDE;
627 628
629
628 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) O VERRIDE; 630 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) O VERRIDE;
629 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV ERRIDE; 631 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV ERRIDE;
630 virtual void updateFromStyle() OVERRIDE; 632 virtual void updateFromStyle() OVERRIDE;
631 633
632 // Returns false if it could not cheaply compute the extent (e.g. fixed back ground), in which case the returned rect may be incorrect. 634 // Returns false if it could not cheaply compute the extent (e.g. fixed back ground), in which case the returned rect may be incorrect.
633 bool getBackgroundPaintedExtent(LayoutRect&) const; 635 bool getBackgroundPaintedExtent(LayoutRect&) const;
634 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const; 636 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const;
635 virtual bool computeBackgroundIsKnownToBeObscured() OVERRIDE; 637 virtual bool computeBackgroundIsKnownToBeObscured() OVERRIDE;
636 638
637 void paintBackground(const PaintInfo&, const LayoutRect&, const Color& backg roundColor, BackgroundBleedAvoidance = BackgroundBleedNone);
638
639 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer&, const LayoutRect&, BackgroundBleedAvoidance, CompositeOperator, RenderObject* backgrou ndObject, bool skipBaseColor = false);
640 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer&, const LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
641
642 void paintMaskImages(const PaintInfo&, const LayoutRect&);
643 void paintBoxDecorationBackgroundWithRect(PaintInfo&, const LayoutPoint&, co nst LayoutRect&);
644
645 // Information extracted from RenderStyle for box painting.
646 // These are always needed during box painting and recomputing them takes ti me.
647 struct BoxDecorationData {
648 BoxDecorationData(const RenderStyle&);
649
650 Color backgroundColor;
651 bool hasBackground;
652 bool hasBorder;
653 bool hasAppearance;
654 };
655
656 BackgroundBleedAvoidance determineBackgroundBleedAvoidance(GraphicsContext*, const BoxDecorationData&) const;
657 bool backgroundHasOpaqueTopLayer() const;
658
659 void computePositionedLogicalWidth(LogicalExtentComputedValues&) const; 639 void computePositionedLogicalWidth(LogicalExtentComputedValues&) const;
660 640
661 LayoutUnit computeIntrinsicLogicalWidthUsing(const Length& logicalWidthLengt h, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const; 641 LayoutUnit computeIntrinsicLogicalWidthUsing(const Length& logicalWidthLengt h, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const;
662 LayoutUnit computeIntrinsicLogicalContentHeightUsing(const Length& logicalHe ightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPadding) cons t; 642 LayoutUnit computeIntrinsicLogicalContentHeightUsing(const Length& logicalHe ightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPadding) cons t;
663 643
664 virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !i sInlineBlockOrInlineTable(); } 644 virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !i sInlineBlockOrInlineTable(); }
665 645
666 virtual void mapLocalToContainer(const RenderLayerModelObject* paintInvalida tionContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0, const PaintInvalidationState* = 0) const OVERRIDE; 646 virtual void mapLocalToContainer(const RenderLayerModelObject* paintInvalida tionContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0, const PaintInvalidationState* = 0) const OVERRIDE;
667 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c onst OVERRIDE; 647 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c onst OVERRIDE;
668 648
669 void paintRootBoxFillLayers(const PaintInfo&);
670
671 RenderObject* splitAnonymousBoxesAroundChild(RenderObject* beforeChild); 649 RenderObject* splitAnonymousBoxesAroundChild(RenderObject* beforeChild);
672 650
673 virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur rentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& container Rect) const OVERRIDE; 651 virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur rentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& container Rect) const OVERRIDE;
674 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const OVERRIDE; 652 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const OVERRIDE;
675 653
676 void updateIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalH eight) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight; } 654 void updateIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalH eight) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight; }
677 655
678 virtual InvalidationReason getPaintInvalidationReason(const RenderLayerModel Object& paintInvalidationContainer, 656 virtual InvalidationReason getPaintInvalidationReason(const RenderLayerModel Object& paintInvalidationContainer,
679 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInva lidationContainer, 657 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInva lidationContainer,
680 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInva lidationContainer) OVERRIDE; 658 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInva lidationContainer) OVERRIDE;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 if (UNLIKELY(inlineBoxWrapper() != 0)) 781 if (UNLIKELY(inlineBoxWrapper() != 0))
804 deleteLineBoxWrapper(); 782 deleteLineBoxWrapper();
805 } 783 }
806 784
807 ensureRareData().m_inlineBoxWrapper = boxWrapper; 785 ensureRareData().m_inlineBoxWrapper = boxWrapper;
808 } 786 }
809 787
810 } // namespace blink 788 } // namespace blink
811 789
812 #endif // RenderBox_h 790 #endif // RenderBox_h
OLDNEW
« no previous file with comments | « Source/core/paint/BoxPainter.cpp ('k') | Source/core/rendering/RenderBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698