OLD | NEW |
---|---|
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 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 * | 20 * |
21 */ | 21 */ |
22 | 22 |
23 #ifndef RenderBox_h | 23 #ifndef RenderBox_h |
24 #define RenderBox_h | 24 #define RenderBox_h |
25 | 25 |
26 #include "core/paint/BoxPainter.h" | |
26 #include "core/rendering/RenderBoxModelObject.h" | 27 #include "core/rendering/RenderBoxModelObject.h" |
27 #include "core/rendering/RenderOverflow.h" | 28 #include "core/rendering/RenderOverflow.h" |
28 #include "core/rendering/shapes/ShapeOutsideInfo.h" | 29 #include "core/rendering/shapes/ShapeOutsideInfo.h" |
29 #include "platform/scroll/ScrollTypes.h" | 30 #include "platform/scroll/ScrollTypes.h" |
30 | 31 |
31 namespace blink { | 32 namespace blink { |
32 | 33 |
34 class BoxPainter; | |
33 struct PaintInfo; | 35 struct PaintInfo; |
34 class RenderLayerScrollableArea; | 36 class RenderLayerScrollableArea; |
35 | 37 |
36 enum SizeType { MainOrPreferredSize, MinSize, MaxSize }; | 38 enum SizeType { MainOrPreferredSize, MinSize, MaxSize }; |
37 enum AvailableLogicalHeightType { ExcludeMarginBorderPadding, IncludeMarginBorde rPadding }; | 39 enum AvailableLogicalHeightType { ExcludeMarginBorderPadding, IncludeMarginBorde rPadding }; |
38 enum OverlayScrollbarSizeRelevancy { IgnoreOverlayScrollbarSize, IncludeOverlayS crollbarSize }; | 40 enum OverlayScrollbarSizeRelevancy { IgnoreOverlayScrollbarSize, IncludeOverlayS crollbarSize }; |
39 enum MarginDirection { BlockDirection, InlineDirection }; | 41 enum MarginDirection { BlockDirection, InlineDirection }; |
40 | 42 |
41 enum ShouldComputePreferred { ComputeActual, ComputePreferred }; | 43 enum ShouldComputePreferred { ComputeActual, ComputePreferred }; |
42 | 44 |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
616 { | 618 { |
617 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*t his) : 0; | 619 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*t his) : 0; |
618 } | 620 } |
619 | 621 |
620 void markShapeOutsideDependentsForLayout() | 622 void markShapeOutsideDependentsForLayout() |
621 { | 623 { |
622 if (isFloating()) | 624 if (isFloating()) |
623 removeFloatingOrPositionedChildFromBlockLists(); | 625 removeFloatingOrPositionedChildFromBlockLists(); |
624 } | 626 } |
625 | 627 |
628 bool backgroundHasOpaqueTopLayer() const; | |
629 | |
626 protected: | 630 protected: |
627 virtual void willBeDestroyed() OVERRIDE; | 631 virtual void willBeDestroyed() OVERRIDE; |
628 | 632 |
633 | |
pdr.
2014/09/09 20:45:42
Extra newline
chrishtr
2014/09/09 22:38:18
Done.
| |
629 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) O VERRIDE; | 634 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) O VERRIDE; |
630 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV ERRIDE; | 635 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV ERRIDE; |
631 virtual void updateFromStyle() OVERRIDE; | 636 virtual void updateFromStyle() OVERRIDE; |
632 | 637 |
633 // Returns false if it could not cheaply compute the extent (e.g. fixed back ground), in which case the returned rect may be incorrect. | 638 // 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 bool getBackgroundPaintedExtent(LayoutRect&) const; | 639 bool getBackgroundPaintedExtent(LayoutRect&) const; |
635 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const; | 640 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const; |
636 virtual bool computeBackgroundIsKnownToBeObscured() OVERRIDE; | 641 virtual bool computeBackgroundIsKnownToBeObscured() OVERRIDE; |
637 | 642 |
638 void paintBackground(const PaintInfo&, const LayoutRect&, const Color& backg roundColor, BackgroundBleedAvoidance = BackgroundBleedNone); | |
639 | |
640 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer&, const LayoutRect&, BackgroundBleedAvoidance, CompositeOperator, RenderObject* backgrou ndObject, bool skipBaseColor = false); | |
641 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer&, const LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0); | |
642 | |
643 void paintMaskImages(const PaintInfo&, const LayoutRect&); | |
644 void paintBoxDecorationBackgroundWithRect(PaintInfo&, const LayoutPoint&, co nst LayoutRect&); | |
645 | |
646 // Information extracted from RenderStyle for box painting. | |
647 // These are always needed during box painting and recomputing them takes ti me. | |
648 struct BoxDecorationData { | |
649 BoxDecorationData(const RenderStyle&); | |
650 | |
651 Color backgroundColor; | |
652 bool hasBackground; | |
653 bool hasBorder; | |
654 bool hasAppearance; | |
655 }; | |
656 | |
657 BackgroundBleedAvoidance determineBackgroundBleedAvoidance(GraphicsContext*, const BoxDecorationData&) const; | |
658 bool backgroundHasOpaqueTopLayer() const; | |
659 | |
660 void computePositionedLogicalWidth(LogicalExtentComputedValues&) const; | 643 void computePositionedLogicalWidth(LogicalExtentComputedValues&) const; |
661 | 644 |
662 LayoutUnit computeIntrinsicLogicalWidthUsing(const Length& logicalWidthLengt h, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const; | 645 LayoutUnit computeIntrinsicLogicalWidthUsing(const Length& logicalWidthLengt h, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const; |
663 LayoutUnit computeIntrinsicLogicalContentHeightUsing(const Length& logicalHe ightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPadding) cons t; | 646 LayoutUnit computeIntrinsicLogicalContentHeightUsing(const Length& logicalHe ightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPadding) cons t; |
664 | 647 |
665 virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !i sInlineBlockOrInlineTable(); } | 648 virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !i sInlineBlockOrInlineTable(); } |
666 | 649 |
667 virtual void mapLocalToContainer(const RenderLayerModelObject* paintInvalida tionContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0, const PaintInvalidationState* = 0) const OVERRIDE; | 650 virtual void mapLocalToContainer(const RenderLayerModelObject* paintInvalida tionContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0, const PaintInvalidationState* = 0) const OVERRIDE; |
668 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c onst OVERRIDE; | 651 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c onst OVERRIDE; |
669 | 652 |
670 void paintRootBoxFillLayers(const PaintInfo&); | |
671 | |
672 RenderObject* splitAnonymousBoxesAroundChild(RenderObject* beforeChild); | 653 RenderObject* splitAnonymousBoxesAroundChild(RenderObject* beforeChild); |
673 | 654 |
674 virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur rentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& container Rect) const OVERRIDE; | 655 virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur rentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& container Rect) const OVERRIDE; |
675 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const OVERRIDE; | 656 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const OVERRIDE; |
676 | 657 |
677 void updateIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalH eight) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight; } | 658 void updateIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalH eight) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight; } |
678 | 659 |
679 virtual InvalidationReason getPaintInvalidationReason(const RenderLayerModel Object& paintInvalidationContainer, | 660 virtual InvalidationReason getPaintInvalidationReason(const RenderLayerModel Object& paintInvalidationContainer, |
680 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInva lidationContainer, | 661 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInva lidationContainer, |
681 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInva lidationContainer) OVERRIDE; | 662 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInva lidationContainer) OVERRIDE; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
757 LayoutUnit m_minPreferredLogicalWidth; | 738 LayoutUnit m_minPreferredLogicalWidth; |
758 | 739 |
759 // The preferred logical width of the element if it never breaks any lines a t all. | 740 // The preferred logical width of the element if it never breaks any lines a t all. |
760 LayoutUnit m_maxPreferredLogicalWidth; | 741 LayoutUnit m_maxPreferredLogicalWidth; |
761 | 742 |
762 // Our overflow information. | 743 // Our overflow information. |
763 OwnPtr<RenderOverflow> m_overflow; | 744 OwnPtr<RenderOverflow> m_overflow; |
764 | 745 |
765 private: | 746 private: |
766 OwnPtr<RenderBoxRareData> m_rareData; | 747 OwnPtr<RenderBoxRareData> m_rareData; |
748 BoxPainter m_boxPainter; | |
767 }; | 749 }; |
768 | 750 |
769 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBox, isBox()); | 751 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBox, isBox()); |
770 | 752 |
771 inline RenderBox* RenderBox::previousSiblingBox() const | 753 inline RenderBox* RenderBox::previousSiblingBox() const |
772 { | 754 { |
773 return toRenderBox(previousSibling()); | 755 return toRenderBox(previousSibling()); |
774 } | 756 } |
775 | 757 |
776 inline RenderBox* RenderBox::nextSiblingBox() const | 758 inline RenderBox* RenderBox::nextSiblingBox() const |
(...skipping 27 matching lines...) Expand all Loading... | |
804 if (UNLIKELY(inlineBoxWrapper() != 0)) | 786 if (UNLIKELY(inlineBoxWrapper() != 0)) |
805 deleteLineBoxWrapper(); | 787 deleteLineBoxWrapper(); |
806 } | 788 } |
807 | 789 |
808 ensureRareData().m_inlineBoxWrapper = boxWrapper; | 790 ensureRareData().m_inlineBoxWrapper = boxWrapper; |
809 } | 791 } |
810 | 792 |
811 } // namespace blink | 793 } // namespace blink |
812 | 794 |
813 #endif // RenderBox_h | 795 #endif // RenderBox_h |
OLD | NEW |