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

Side by Side Diff: Source/core/rendering/RenderInline.cpp

Issue 360833002: Divorce PaintInvalidationState from LayoutState (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ToT-ed Created 6 years, 5 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
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, 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 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 LayoutUnit logicalTop = firstLineBox()->logicalTopVisualOverflow(firstRootBo x.lineTop()); 981 LayoutUnit logicalTop = firstLineBox()->logicalTopVisualOverflow(firstRootBo x.lineTop());
982 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; 982 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide;
983 LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRo otBox.lineBottom()) - logicalTop; 983 LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRo otBox.lineBottom()) - logicalTop;
984 984
985 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); 985 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight);
986 if (!style()->isHorizontalWritingMode()) 986 if (!style()->isHorizontalWritingMode())
987 rect = rect.transposedRect(); 987 rect = rect.transposedRect();
988 return rect; 988 return rect;
989 } 989 }
990 990
991 LayoutRect RenderInline::clippedOverflowRectForPaintInvalidation(const RenderLay erModelObject* paintInvalidationContainer) const 991 LayoutRect RenderInline::clippedOverflowRectForPaintInvalidation(const RenderLay erModelObject* paintInvalidationContainer, const InvalidationTreeWalkState* inva lidationTreeWalkState) const
992 { 992 {
993 ASSERT(!view() || !view()->layoutStateCachedOffsetsEnabled());
994
995 if (!firstLineBoxIncludingCulling() && !continuation()) 993 if (!firstLineBoxIncludingCulling() && !continuation())
996 return LayoutRect(); 994 return LayoutRect();
997 995
998 LayoutRect repaintRect(linesVisualOverflowBoundingBox()); 996 LayoutRect repaintRect(linesVisualOverflowBoundingBox());
999 bool hitRepaintContainer = false; 997 bool hitRepaintContainer = false;
1000 998
1001 // We need to add in the in-flow position offsets of any inlines (including us) up to our 999 // We need to add in the in-flow position offsets of any inlines (including us) up to our
1002 // containing block. 1000 // containing block.
1003 RenderBlock* cb = containingBlock(); 1001 RenderBlock* cb = containingBlock();
1004 for (const RenderObject* inlineFlow = this; inlineFlow && inlineFlow->isRend erInline() && inlineFlow != cb; 1002 for (const RenderObject* inlineFlow = this; inlineFlow && inlineFlow->isRend erInline() && inlineFlow != cb;
(...skipping 11 matching lines...) Expand all
1016 1014
1017 if (hitRepaintContainer || !cb) 1015 if (hitRepaintContainer || !cb)
1018 return repaintRect; 1016 return repaintRect;
1019 1017
1020 if (cb->hasColumns()) 1018 if (cb->hasColumns())
1021 cb->adjustRectForColumns(repaintRect); 1019 cb->adjustRectForColumns(repaintRect);
1022 1020
1023 if (cb->hasOverflowClip()) 1021 if (cb->hasOverflowClip())
1024 cb->applyCachedClipAndScrollOffsetForRepaint(repaintRect); 1022 cb->applyCachedClipAndScrollOffsetForRepaint(repaintRect);
1025 1023
1026 cb->mapRectToPaintInvalidationBacking(paintInvalidationContainer, repaintRec t); 1024 cb->mapRectToPaintInvalidationBacking(paintInvalidationContainer, repaintRec t, invalidationTreeWalkState);
1027 1025
1028 if (outlineSize) { 1026 if (outlineSize) {
1029 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling() ) { 1027 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling() ) {
1030 if (!curr->isText()) 1028 if (!curr->isText())
1031 repaintRect.unite(curr->rectWithOutlineForPaintInvalidation(pain tInvalidationContainer, outlineSize)); 1029 repaintRect.unite(curr->rectWithOutlineForPaintInvalidation(pain tInvalidationContainer, outlineSize));
1032 } 1030 }
1033 1031
1034 if (continuation() && !continuation()->isInline() && continuation()->par ent()) 1032 if (continuation() && !continuation()->isInline() && continuation()->par ent())
1035 repaintRect.unite(continuation()->rectWithOutlineForPaintInvalidatio n(paintInvalidationContainer, outlineSize)); 1033 repaintRect.unite(continuation()->rectWithOutlineForPaintInvalidatio n(paintInvalidationContainer, outlineSize));
1036 } 1034 }
1037 1035
1038 return repaintRect; 1036 return repaintRect;
1039 } 1037 }
1040 1038
1041 LayoutRect RenderInline::rectWithOutlineForPaintInvalidation(const RenderLayerMo delObject* paintInvalidationContainer, LayoutUnit outlineWidth) const 1039 LayoutRect RenderInline::rectWithOutlineForPaintInvalidation(const RenderLayerMo delObject* paintInvalidationContainer, LayoutUnit outlineWidth, const Invalidati onTreeWalkState* invalidationTreeWalkState) const
1042 { 1040 {
1043 LayoutRect r(RenderBoxModelObject::rectWithOutlineForPaintInvalidation(paint InvalidationContainer, outlineWidth)); 1041 LayoutRect r(RenderBoxModelObject::rectWithOutlineForPaintInvalidation(paint InvalidationContainer, outlineWidth, invalidationTreeWalkState));
1044 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { 1042 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) {
1045 if (!curr->isText()) 1043 if (!curr->isText())
1046 r.unite(curr->rectWithOutlineForPaintInvalidation(paintInvalidationC ontainer, outlineWidth)); 1044 r.unite(curr->rectWithOutlineForPaintInvalidation(paintInvalidationC ontainer, outlineWidth, invalidationTreeWalkState));
1047 } 1045 }
1048 return r; 1046 return r;
1049 } 1047 }
1050 1048
1051 void RenderInline::mapRectToPaintInvalidationBacking(const RenderLayerModelObjec t* paintInvalidationContainer, LayoutRect& rect, bool fixed) const 1049 void RenderInline::mapRectToPaintInvalidationBacking(const RenderLayerModelObjec t* paintInvalidationContainer, LayoutRect& rect, bool fixed, const InvalidationT reeWalkState* invalidationTreeWalkState) const
1052 { 1050 {
1053 if (RenderView* v = view()) { 1051 if (invalidationTreeWalkState && invalidationTreeWalkState->canMapToContaine r(paintInvalidationContainer)) {
1054 // LayoutState is only valid for root-relative repainting 1052 if (style()->hasInFlowPosition() && layer())
1055 if (v->canMapUsingLayoutStateForContainer(paintInvalidationContainer)) { 1053 rect.move(layer()->offsetForInFlowPosition());
1056 LayoutState* layoutState = v->layoutState(); 1054 rect.move(invalidationTreeWalkState->paintOffset());
1057 if (style()->hasInFlowPosition() && layer()) 1055 if (invalidationTreeWalkState->isClipped())
1058 rect.move(layer()->offsetForInFlowPosition()); 1056 rect.intersect(invalidationTreeWalkState->clipRect());
1059 rect.move(layoutState->paintOffset()); 1057 return;
1060 if (layoutState->isClipped())
1061 rect.intersect(layoutState->clipRect());
1062 return;
1063 }
1064 } 1058 }
1065 1059
1066 if (paintInvalidationContainer == this) 1060 if (paintInvalidationContainer == this)
1067 return; 1061 return;
1068 1062
1069 bool containerSkipped; 1063 bool containerSkipped;
1070 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); 1064 RenderObject* o = container(paintInvalidationContainer, &containerSkipped);
1071 if (!o) 1065 if (!o)
1072 return; 1066 return;
1073 1067
(...skipping 27 matching lines...) Expand all
1101 return; 1095 return;
1102 } 1096 }
1103 1097
1104 if (containerSkipped) { 1098 if (containerSkipped) {
1105 // If the paintInvalidationContainer is below o, then we need to map the rect into paintInvalidationContainer's coordinates. 1099 // If the paintInvalidationContainer is below o, then we need to map the rect into paintInvalidationContainer's coordinates.
1106 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces torContainer(o); 1100 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces torContainer(o);
1107 rect.move(-containerOffset); 1101 rect.move(-containerOffset);
1108 return; 1102 return;
1109 } 1103 }
1110 1104
1111 o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, fixed ); 1105 o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, fixed , invalidationTreeWalkState);
1112 } 1106 }
1113 1107
1114 LayoutSize RenderInline::offsetFromContainer(const RenderObject* container, cons t LayoutPoint& point, bool* offsetDependsOnPoint) const 1108 LayoutSize RenderInline::offsetFromContainer(const RenderObject* container, cons t LayoutPoint& point, bool* offsetDependsOnPoint) const
1115 { 1109 {
1116 ASSERT(container == this->container()); 1110 ASSERT(container == this->container());
1117 1111
1118 LayoutSize offset; 1112 LayoutSize offset;
1119 if (isRelPositioned()) 1113 if (isRelPositioned())
1120 offset += offsetForInFlowPosition(); 1114 offset += offsetForInFlowPosition();
1121 1115
1122 offset += container->columnOffset(point); 1116 offset += container->columnOffset(point);
1123 1117
1124 if (container->hasOverflowClip()) 1118 if (container->hasOverflowClip())
1125 offset -= toRenderBox(container)->scrolledContentOffset(); 1119 offset -= toRenderBox(container)->scrolledContentOffset();
1126 1120
1127 if (offsetDependsOnPoint) { 1121 if (offsetDependsOnPoint) {
1128 *offsetDependsOnPoint = container->hasColumns() 1122 *offsetDependsOnPoint = container->hasColumns()
1129 || (container->isBox() && container->style()->isFlippedBlocksWriting Mode()) 1123 || (container->isBox() && container->style()->isFlippedBlocksWriting Mode())
1130 || container->isRenderFlowThread(); 1124 || container->isRenderFlowThread();
1131 } 1125 }
1132 1126
1133 return offset; 1127 return offset;
1134 } 1128 }
1135 1129
1136 void RenderInline::mapLocalToContainer(const RenderLayerModelObject* repaintCont ainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const 1130 void RenderInline::mapLocalToContainer(const RenderLayerModelObject* repaintCont ainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const InvalidationTreeWalkState* invalidationTreeWalkState) const
1137 { 1131 {
1138 if (repaintContainer == this) 1132 if (repaintContainer == this)
1139 return; 1133 return;
1140 1134
1141 if (RenderView *v = view()) { 1135 if (invalidationTreeWalkState && invalidationTreeWalkState->canMapToContaine r(repaintContainer)) {
1142 if (v->canMapUsingLayoutStateForContainer(repaintContainer)) { 1136 LayoutSize offset = invalidationTreeWalkState->paintOffset();
1143 LayoutState* layoutState = v->layoutState(); 1137 if (style()->hasInFlowPosition() && layer())
1144 LayoutSize offset = layoutState->paintOffset(); 1138 offset += layer()->offsetForInFlowPosition();
1145 if (style()->hasInFlowPosition() && layer()) 1139 transformState.move(offset);
1146 offset += layer()->offsetForInFlowPosition(); 1140 return;
1147 transformState.move(offset);
1148 return;
1149 }
1150 } 1141 }
1151 1142
1152 bool containerSkipped; 1143 bool containerSkipped;
1153 RenderObject* o = container(repaintContainer, &containerSkipped); 1144 RenderObject* o = container(repaintContainer, &containerSkipped);
1154 if (!o) 1145 if (!o)
1155 return; 1146 return;
1156 1147
1157 if (mode & ApplyContainerFlip && o->isBox()) { 1148 if (mode & ApplyContainerFlip && o->isBox()) {
1158 if (o->style()->isFlippedBlocksWritingMode()) { 1149 if (o->style()->isFlippedBlocksWritingMode()) {
1159 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()) ; 1150 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()) ;
(...skipping 13 matching lines...) Expand all
1173 transformState.move(containerOffset.width(), containerOffset.height(), p reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo rm); 1164 transformState.move(containerOffset.width(), containerOffset.height(), p reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo rm);
1174 1165
1175 if (containerSkipped) { 1166 if (containerSkipped) {
1176 // There can't be a transform between repaintContainer and o, because tr ansforms create containers, so it should be safe 1167 // There can't be a transform between repaintContainer and o, because tr ansforms create containers, so it should be safe
1177 // to just subtract the delta between the repaintContainer and o. 1168 // to just subtract the delta between the repaintContainer and o.
1178 LayoutSize containerOffset = repaintContainer->offsetFromAncestorContain er(o); 1169 LayoutSize containerOffset = repaintContainer->offsetFromAncestorContain er(o);
1179 transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans form); 1170 transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans form);
1180 return; 1171 return;
1181 } 1172 }
1182 1173
1183 o->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed); 1174 o->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed, inv alidationTreeWalkState);
1184 } 1175 }
1185 1176
1186 void RenderInline::updateDragState(bool dragOn) 1177 void RenderInline::updateDragState(bool dragOn)
1187 { 1178 {
1188 RenderBoxModelObject::updateDragState(dragOn); 1179 RenderBoxModelObject::updateDragState(dragOn);
1189 if (continuation()) 1180 if (continuation())
1190 continuation()->updateDragState(dragOn); 1181 continuation()->updateDragState(dragOn);
1191 } 1182 }
1192 1183
1193 void RenderInline::childBecameNonInline(RenderObject* child) 1184 void RenderInline::childBecameNonInline(RenderObject* child)
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 if (!container) 1552 if (!container)
1562 container = this; 1553 container = this;
1563 1554
1564 FloatPoint absPos = container->localToAbsolute(); 1555 FloatPoint absPos = container->localToAbsolute();
1565 region.bounds.setX(absPos.x() + region.bounds.x()); 1556 region.bounds.setX(absPos.x() + region.bounds.x());
1566 region.bounds.setY(absPos.y() + region.bounds.y()); 1557 region.bounds.setY(absPos.y() + region.bounds.y());
1567 1558
1568 regions.append(region); 1559 regions.append(region);
1569 } 1560 }
1570 1561
1571 void RenderInline::invalidateTreeAfterLayout(const RenderLayerModelObject& paint InvalidationContainer) 1562 void RenderInline::invalidateTreeAfterLayout(const InvalidationTreeWalkState& in validationTreeWalkState)
1572 { 1563 {
1573 LayoutState state(*this); 1564 bool establishesNewPaintInvalidationContainer = isPaintInvalidationContainer ();
1574 RenderObject::invalidateTreeAfterLayout(paintInvalidationContainer); 1565 const RenderLayerModelObject& newPaintInvalidationContainer = *adjustComposi tedContainerForSpecialAncestors(establishesNewPaintInvalidationContainer ? this : &invalidationTreeWalkState.paintInvalidationContainer());
1566 InvalidationTreeWalkState childInvalidationTreeWalkState(invalidationTreeWal kState, *this, newPaintInvalidationContainer);
1567 RenderObject::invalidateTreeAfterLayout(invalidationTreeWalkState);
1575 } 1568 }
1576 1569
1577 } // namespace WebCore 1570 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698