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

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

Powered by Google App Engine
This is Rietveld 408576698