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

Side by Side Diff: third_party/WebKit/WebCore/rendering/RenderBox.cpp

Issue 10670: Do another merge using nifty new merge script (CL for that coming soon). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 1045
1046 if (useTransforms && m_layer && m_layer->transform()) 1046 if (useTransforms && m_layer && m_layer->transform())
1047 localPoint = m_layer->transform()->inverse().mapPoint(localPoint); 1047 localPoint = m_layer->transform()->inverse().mapPoint(localPoint);
1048 1048
1049 return localPoint; 1049 return localPoint;
1050 } 1050 }
1051 1051
1052 return FloatPoint(); 1052 return FloatPoint();
1053 } 1053 }
1054 1054
1055 FloatQuad RenderBox::localToAbsoluteQuad(const FloatQuad& localQuad, bool fixed) const
1056 {
1057 // We don't expect localToAbsoluteQuad() to be called during layout (yet)
1058 ASSERT(!view() || !view()->layoutState());
1059
1060 if (style()->position() == FixedPosition)
1061 fixed = true;
1062
1063 RenderObject* o = container();
1064 if (o) {
1065 FloatQuad quad = localQuad;
1066 if (m_layer && m_layer->transform()) {
1067 fixed = false; // Elements with transforms act as a containing bloc k for fixed position descendants
1068 quad = m_layer->transform()->mapQuad(quad);
1069 }
1070
1071 quad += offsetFromContainer(o);
1072
1073 // Take into account space above a vertically aligned table cell
1074 // (see localToAbsoluteForContent())
1075 quad.move(0.0f, static_cast<float>(borderTopExtra()));
1076
1077 return o->localToAbsoluteQuad(quad, fixed);
1078 }
1079
1080 return FloatQuad();
1081 }
1082
1055 IntSize RenderBox::offsetFromContainer(RenderObject* o) const 1083 IntSize RenderBox::offsetFromContainer(RenderObject* o) const
1056 { 1084 {
1057 ASSERT(o == container()); 1085 ASSERT(o == container());
1058 1086
1059 IntSize offset; 1087 IntSize offset;
1060 if (isRelPositioned()) 1088 if (isRelPositioned())
1061 offset += relativePositionOffset(); 1089 offset += relativePositionOffset();
1062 1090
1063 if (!isInline() || isReplaced()) { 1091 if (!isInline() || isReplaced()) {
1064 RenderBlock* cb; 1092 RenderBlock* cb;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 1201
1174 // FIXME: This is really a hack. If the reflection caused the repaint, we d on't have to 1202 // FIXME: This is really a hack. If the reflection caused the repaint, we d on't have to
1175 // do this (and yet we do). If there are nested reflections, then the singl e static is insufficient. 1203 // do this (and yet we do). If there are nested reflections, then the singl e static is insufficient.
1176 static bool invalidatingReflection; 1204 static bool invalidatingReflection;
1177 if (hasReflection() && !invalidatingReflection) { 1205 if (hasReflection() && !invalidatingReflection) {
1178 invalidatingReflection = true; 1206 invalidatingReflection = true;
1179 layer()->reflection()->repaintRectangle(rect); 1207 layer()->reflection()->repaintRectangle(rect);
1180 invalidatingReflection = false; 1208 invalidatingReflection = false;
1181 } 1209 }
1182 1210
1211 RenderObject* o = container();
1212 if (!o)
1213 return;
1214
1183 IntPoint topLeft = rect.location(); 1215 IntPoint topLeft = rect.location();
1184 topLeft.move(m_x, m_y); 1216 topLeft.move(m_x, m_y);
1185 1217
1186 // Apply the relative position offset when invalidating a rectangle. The la yer
1187 // is translated, but the render box isn't, so we need to do this to get the
1188 // right dirty rect. Since this is called from RenderObject::setStyle, the relative position
1189 // flag on the RenderObject has been cleared, so use the one on the style().
1190 if (style()->position() == RelativePosition && m_layer)
1191 topLeft += m_layer->relativePositionOffset();
1192
1193 if (style()->position() == FixedPosition) 1218 if (style()->position() == FixedPosition)
1194 fixed = true; 1219 fixed = true;
1195 1220
1196 RenderObject* o = container(); 1221 if (o->isBlockFlow() && style()->position() != AbsolutePosition && style()-> position() != FixedPosition) {
1197 if (o) { 1222 RenderBlock* cb = static_cast<RenderBlock*>(o);
1198 if (o->isBlockFlow() && style()->position() != AbsolutePosition && style ()->position() != FixedPosition) { 1223 if (cb->hasColumns()) {
1199 RenderBlock* cb = static_cast<RenderBlock*>(o); 1224 IntRect repaintRect(topLeft, rect.size());
1200 if (cb->hasColumns()) { 1225 cb->adjustRectForColumns(repaintRect);
1201 IntRect repaintRect(topLeft, rect.size()); 1226 topLeft = repaintRect.location();
1202 cb->adjustRectForColumns(repaintRect); 1227 rect = repaintRect;
1203 topLeft = repaintRect.location();
1204 rect = repaintRect;
1205 }
1206 } 1228 }
1229 }
1207 1230
1208 if (style()->position() == AbsolutePosition) 1231 // We are now in our parent container's coordinate space. Apply our transfo rm to obtain a bounding box
1209 topLeft += offsetForPositionedInContainer(o); 1232 // in the parent's coordinate space that encloses us.
1210 1233 if (m_layer && m_layer->transform()) {
1211 // We are now in our parent container's coordinate space. Apply our tra nsform to obtain a bounding box 1234 fixed = false;
1212 // in the parent's coordinate space that encloses us. 1235 rect = m_layer->transform()->mapRect(rect);
1213 if (m_layer && m_layer->transform()) { 1236 // FIXME: this clobbers topLeft adjustment done for multicol above
1214 fixed = false; 1237 topLeft = rect.location();
1215 rect = m_layer->transform()->mapRect(rect); 1238 topLeft.move(m_x, m_y);
1216 topLeft = rect.location(); 1239 }
1217 topLeft.move(m_x, m_y);
1218 }
1219 1240
1220 // FIXME: We ignore the lightweight clipping rect that controls use, sin ce if |o| is in mid-layout, 1241 if (style()->position() == AbsolutePosition)
1221 // its controlClipRect will be wrong. For overflow clip we use the value s cached by the layer. 1242 topLeft += offsetForPositionedInContainer(o);
1222 if (o->hasOverflowClip()) { 1243 else if (style()->position() == RelativePosition && m_layer) {
1223 // o->height() is inaccurate if we're in the middle of a layout of | o|, so use the 1244 // Apply the relative position offset when invalidating a rectangle. Th e layer
1224 // layer's size instead. Even if the layer's size is wrong, the lay er itself will repaint 1245 // is translated, but the render box isn't, so we need to do this to get the
1225 // anyway if its size does change. 1246 // right dirty rect. Since this is called from RenderObject::setStyle, the relative position
1226 IntRect boxRect(0, 0, o->layer()->width(), o->layer()->height()); 1247 // flag on the RenderObject has been cleared, so use the one on the styl e().
1227 int x = 0, y = 0; 1248 topLeft += m_layer->relativePositionOffset();
1228 o->layer()->subtractScrolledContentOffset(x, y); // For overflow:aut o/scroll/hidden.
1229 topLeft.move(x, y);
1230 IntRect repaintRect(topLeft, rect.size());
1231 rect = intersection(repaintRect, boxRect);
1232 if (rect.isEmpty())
1233 return;
1234 } else
1235 rect.setLocation(topLeft);
1236
1237 o->computeAbsoluteRepaintRect(rect, fixed);
1238 } 1249 }
1250
1251 // FIXME: We ignore the lightweight clipping rect that controls use, since i f |o| is in mid-layout,
1252 // its controlClipRect will be wrong. For overflow clip we use the values ca ched by the layer.
1253 if (o->hasOverflowClip()) {
1254 // o->height() is inaccurate if we're in the middle of a layout of |o|, so use the
1255 // layer's size instead. Even if the layer's size is wrong, the layer i tself will repaint
1256 // anyway if its size does change.
1257 topLeft -= o->layer()->scrolledContentOffset(); // For overflow:auto/scr oll/hidden.
1258
1259 IntRect repaintRect(topLeft, rect.size());
1260 IntRect boxRect(0, 0, o->layer()->width(), o->layer()->height());
1261 rect = intersection(repaintRect, boxRect);
1262 if (rect.isEmpty())
1263 return;
1264 } else
1265 rect.setLocation(topLeft);
1266
1267 o->computeAbsoluteRepaintRect(rect, fixed);
1239 } 1268 }
1240 1269
1241 void RenderBox::repaintDuringLayoutIfMoved(const IntRect& rect) 1270 void RenderBox::repaintDuringLayoutIfMoved(const IntRect& rect)
1242 { 1271 {
1243 int newX = m_x; 1272 int newX = m_x;
1244 int newY = m_y; 1273 int newY = m_y;
1245 int newWidth = m_width; 1274 int newWidth = m_width;
1246 int newHeight = m_height; 1275 int newHeight = m_height;
1247 if (rect.x() != newX || rect.y() != newY) { 1276 if (rect.x() != newX || rect.y() != newY) {
1248 // The child moved. Invalidate the object's old and new positions. We have to do this 1277 // The child moved. Invalidate the object's old and new positions. We have to do this
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
2741 { 2770 {
2742 if (!includeSelf || !m_height) 2771 if (!includeSelf || !m_height)
2743 return m_width; 2772 return m_width;
2744 int left = 0; 2773 int left = 0;
2745 if (isRelPositioned()) 2774 if (isRelPositioned())
2746 left += relativePositionOffsetX(); 2775 left += relativePositionOffsetX();
2747 return left; 2776 return left;
2748 } 2777 }
2749 2778
2750 } // namespace WebCore 2779 } // namespace WebCore
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/rendering/RenderBox.h ('k') | third_party/WebKit/WebCore/rendering/RenderContainer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698