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, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 if (inlineFlow->style().hasInFlowPosition() && inlineFlow->hasLayer()) | 838 if (inlineFlow->style().hasInFlowPosition() && inlineFlow->hasLayer()) |
839 repaintRect.move(downcast<RenderInline>(*inlineFlow).layer()->offset
ForInFlowPosition()); | 839 repaintRect.move(downcast<RenderInline>(*inlineFlow).layer()->offset
ForInFlowPosition()); |
840 } | 840 } |
841 | 841 |
842 LayoutUnit outlineSize = style().outlineSize(); | 842 LayoutUnit outlineSize = style().outlineSize(); |
843 repaintRect.inflate(outlineSize); | 843 repaintRect.inflate(outlineSize); |
844 | 844 |
845 if (hitRepaintContainer || !containingBlock) | 845 if (hitRepaintContainer || !containingBlock) |
846 return repaintRect; | 846 return repaintRect; |
847 | 847 |
848 if (containingBlock->hasOverflowClip() && containingBlock->shouldApplyClipAn
dScrollPositionForRepaint(repaintContainer)) | 848 if (containingBlock->hasOverflowClip()) |
849 containingBlock->applyCachedClipAndScrollPositionForRepaint(repaintRect)
; | 849 containingBlock->applyCachedClipAndScrollPosition(repaintRect, repaintCo
ntainer, false /* applyCompositedClips */, shouldApplyCompositedContainerScrolls
ForRepaint(), false /* useEdgeInclusiveIntersection */); |
850 | 850 |
851 repaintRect = containingBlock->computeRectForRepaint(repaintRect, repaintCon
tainer); | 851 repaintRect = containingBlock->computeRectForRepaint(repaintRect, repaintCon
tainer); |
852 | 852 |
853 if (outlineSize) { | 853 if (outlineSize) { |
854 for (auto& child : childrenOfType<RenderElement>(*this)) | 854 for (auto& child : childrenOfType<RenderElement>(*this)) |
855 repaintRect.unite(child.rectWithOutlineForRepaint(repaintContainer,
outlineSize)); | 855 repaintRect.unite(child.rectWithOutlineForRepaint(repaintContainer,
outlineSize)); |
856 | 856 |
857 if (RenderBoxModelObject* continuation = this->continuation()) { | 857 if (RenderBoxModelObject* continuation = this->continuation()) { |
858 if (!continuation->isInline() && continuation->parent()) | 858 if (!continuation->isInline() && continuation->parent()) |
859 repaintRect.unite(continuation->rectWithOutlineForRepaint(repain
tContainer, outlineSize)); | 859 repaintRect.unite(continuation->rectWithOutlineForRepaint(repain
tContainer, outlineSize)); |
860 } | 860 } |
861 } | 861 } |
862 | 862 |
863 return repaintRect; | 863 return repaintRect; |
864 } | 864 } |
865 | 865 |
866 LayoutRect RenderInline::rectWithOutlineForRepaint(const RenderLayerModelObject*
repaintContainer, LayoutUnit outlineWidth) const | 866 LayoutRect RenderInline::rectWithOutlineForRepaint(const RenderLayerModelObject*
repaintContainer, LayoutUnit outlineWidth) const |
867 { | 867 { |
868 LayoutRect r(RenderBoxModelObject::rectWithOutlineForRepaint(repaintContaine
r, outlineWidth)); | 868 LayoutRect r(RenderBoxModelObject::rectWithOutlineForRepaint(repaintContaine
r, outlineWidth)); |
869 for (auto& child : childrenOfType<RenderElement>(*this)) | 869 for (auto& child : childrenOfType<RenderElement>(*this)) |
870 r.unite(child.rectWithOutlineForRepaint(repaintContainer, outlineWidth))
; | 870 r.unite(child.rectWithOutlineForRepaint(repaintContainer, outlineWidth))
; |
871 return r; | 871 return r; |
872 } | 872 } |
873 | 873 |
874 LayoutRect RenderInline::computeRectForRepaint(const LayoutRect& rect, const Ren
derLayerModelObject* repaintContainer, RepaintContext context) const | 874 LayoutRect RenderInline::computeAbsoluteVisibleRectUsingPaintOffsetCache(const L
ayoutRect& rect) const |
| 875 { |
| 876 LayoutRect adjustedRect = rect; |
| 877 auto* layoutState = view().frameView().layoutContext().layoutState(); |
| 878 if (style().hasInFlowPosition() && layer()) |
| 879 adjustedRect.move(layer()->offsetForInFlowPosition()); |
| 880 adjustedRect.move(layoutState->paintOffset()); |
| 881 if (layoutState->isClipped()) |
| 882 adjustedRect.intersect(layoutState->clipRect()); |
| 883 return adjustedRect; |
| 884 } |
| 885 |
| 886 std::optional<LayoutRect> RenderInline::computeVisibleRectInContainer(const Layo
utRect& rect, const RenderLayerModelObject* container, VisibleRectContext contex
t) const |
875 { | 887 { |
876 // Repaint offset cache is only valid for root-relative repainting | 888 // Repaint offset cache is only valid for root-relative repainting |
877 LayoutRect adjustedRect = rect; | 889 if (view().frameView().layoutContext().isPaintOffsetCacheEnabled() && !conta
iner && !context.m_useEdgeInclusiveIntersection) |
878 if (view().frameView().layoutContext().isPaintOffsetCacheEnabled() && !repai
ntContainer) { | 890 return computeAbsoluteVisibleRectUsingPaintOffsetCache(rect); |
879 auto* layoutState = view().frameView().layoutContext().layoutState(); | |
880 if (style().hasInFlowPosition() && layer()) | |
881 adjustedRect.move(layer()->offsetForInFlowPosition()); | |
882 adjustedRect.move(layoutState->paintOffset()); | |
883 if (layoutState->isClipped()) | |
884 adjustedRect.intersect(layoutState->clipRect()); | |
885 return adjustedRect; | |
886 } | |
887 | 891 |
888 if (repaintContainer == this) | 892 if (container == this) |
889 return adjustedRect; | 893 return rect; |
890 | 894 |
891 bool containerSkipped; | 895 bool containerSkipped; |
892 RenderElement* container = this->container(repaintContainer, containerSkippe
d); | 896 RenderElement* localContainer = this->container(container, containerSkipped)
; |
893 if (!container) | 897 if (!localContainer) |
894 return adjustedRect; | 898 return rect; |
895 | 899 |
| 900 LayoutRect adjustedRect = rect; |
896 LayoutPoint topLeft = adjustedRect.location(); | 901 LayoutPoint topLeft = adjustedRect.location(); |
897 | 902 |
898 if (style().hasInFlowPosition() && layer()) { | 903 if (style().hasInFlowPosition() && layer()) { |
899 // Apply the in-flow position offset when invalidating a rectangle. The
layer | 904 // Apply the in-flow position offset when invalidating a rectangle. The
layer |
900 // is translated, but the render box isn't, so we need to do this to get
the | 905 // is translated, but the render box isn't, so we need to do this to get
the |
901 // right dirty rect. Since this is called from RenderObject::setStyle, t
he relative or sticky position | 906 // right dirty rect. Since this is called from RenderObject::setStyle, t
he relative or sticky position |
902 // flag on the RenderObject has been cleared, so use the one on the styl
e(). | 907 // flag on the RenderObject has been cleared, so use the one on the styl
e(). |
903 topLeft += layer()->offsetForInFlowPosition(); | 908 topLeft += layer()->offsetForInFlowPosition(); |
904 } | 909 } |
905 ···· | 910 ···· |
906 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, | 911 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, |
907 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. | 912 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. |
908 adjustedRect.setLocation(topLeft); | 913 adjustedRect.setLocation(topLeft); |
909 if (container->hasOverflowClip()) { | 914 if (localContainer->hasOverflowClip()) { |
910 downcast<RenderBox>(*container).applyCachedClipAndScrollPositionForRepai
nt(adjustedRect); | 915 // FIXME: Respect the value of context.m_applyCompositedContainerScrolls
. |
911 if (adjustedRect.isEmpty()) | 916 bool isEmpty = !downcast<RenderBox>(*localContainer).applyCachedClipAndS
crollPosition(adjustedRect, container, context.m_applyCompositedClips, true /* a
pplyCompositedContainerScrolls */, context.m_useEdgeInclusiveIntersection); |
| 917 if (isEmpty) { |
| 918 if (context.m_useEdgeInclusiveIntersection) |
| 919 return std::nullopt; |
912 return adjustedRect; | 920 return adjustedRect; |
| 921 } |
913 } | 922 } |
914 | 923 |
915 if (containerSkipped) { | 924 if (containerSkipped) { |
916 // If the repaintContainer is below o, then we need to map the rect into
repaintContainer's coordinates. | 925 // If the repaintContainer is below o, then we need to map the rect into
repaintContainer's coordinates. |
917 LayoutSize containerOffset = repaintContainer->offsetFromAncestorContain
er(*container); | 926 LayoutSize containerOffset = container->offsetFromAncestorContainer(*loc
alContainer); |
918 adjustedRect.move(-containerOffset); | 927 adjustedRect.move(-containerOffset); |
919 return adjustedRect; | 928 return adjustedRect; |
920 } | 929 } |
921 return container->computeRectForRepaint(adjustedRect, repaintContainer, cont
ext); | 930 return localContainer->computeVisibleRectInContainer(adjustedRect, container
, context); |
922 } | 931 } |
923 | 932 |
924 LayoutSize RenderInline::offsetFromContainer(RenderElement& container, const Lay
outPoint&, bool* offsetDependsOnPoint) const | 933 LayoutSize RenderInline::offsetFromContainer(RenderElement& container, const Lay
outPoint&, bool* offsetDependsOnPoint) const |
925 { | 934 { |
926 ASSERT(&container == this->container()); | 935 ASSERT(&container == this->container()); |
927 ···· | 936 ···· |
928 LayoutSize offset;···· | 937 LayoutSize offset;···· |
929 if (isInFlowPositioned()) | 938 if (isInFlowPositioned()) |
930 offset += offsetForInFlowPosition(); | 939 offset += offsetForInFlowPosition(); |
931 | 940 |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1420 FloatPoint absPos = container->localToAbsolute(); | 1429 FloatPoint absPos = container->localToAbsolute(); |
1421 region.bounds.setX(absPos.x() + region.bounds.x()); | 1430 region.bounds.setX(absPos.x() + region.bounds.x()); |
1422 region.bounds.setY(absPos.y() + region.bounds.y()); | 1431 region.bounds.setY(absPos.y() + region.bounds.y()); |
1423 | 1432 |
1424 regions.append(region); | 1433 regions.append(region); |
1425 } | 1434 } |
1426 } | 1435 } |
1427 #endif | 1436 #endif |
1428 | 1437 |
1429 } // namespace WebCore | 1438 } // namespace WebCore |
OLD | NEW |