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 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 unsigned m_bitfields; | 130 unsigned m_bitfields; |
131 unsigned m_bitfields2; | 131 unsigned m_bitfields2; |
132 LayoutRect rect; // Stores the previous paint invalidation rect. | 132 LayoutRect rect; // Stores the previous paint invalidation rect. |
133 LayoutPoint position; // Stores the previous position from the paint invalid
ation container. | 133 LayoutPoint position; // Stores the previous position from the paint invalid
ation container. |
134 }; | 134 }; |
135 | 135 |
136 COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObj
ect_should_stay_small); | 136 COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObj
ect_should_stay_small); |
137 | 137 |
138 bool RenderObject::s_affectsParentBlock = false; | 138 bool RenderObject::s_affectsParentBlock = false; |
139 | 139 |
| 140 typedef HashMap<const RenderObject*, LayoutRect> SelectionPaintInvalidationMap; |
| 141 static SelectionPaintInvalidationMap* selectionPaintInvalidationMap = 0; |
| 142 |
140 #if !ENABLE(OILPAN) | 143 #if !ENABLE(OILPAN) |
141 void* RenderObject::operator new(size_t sz) | 144 void* RenderObject::operator new(size_t sz) |
142 { | 145 { |
143 ASSERT(isMainThread()); | 146 ASSERT(isMainThread()); |
144 return partitionAlloc(Partitions::getRenderingPartition(), sz); | 147 return partitionAlloc(Partitions::getRenderingPartition(), sz); |
145 } | 148 } |
146 | 149 |
147 void RenderObject::operator delete(void* ptr) | 150 void RenderObject::operator delete(void* ptr) |
148 { | 151 { |
149 ASSERT(isMainThread()); | 152 ASSERT(isMainThread()); |
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe
cts(const LayoutRect& oldRect, const LayoutPoint& oldLocation, const LayoutRect&
newRect, const LayoutPoint& newLocation) | 1237 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe
cts(const LayoutRect& oldRect, const LayoutPoint& oldLocation, const LayoutRect&
newRect, const LayoutPoint& newLocation) |
1235 { | 1238 { |
1236 RefPtr<TracedValue> value = TracedValue::create(); | 1239 RefPtr<TracedValue> value = TracedValue::create(); |
1237 addJsonObjectForRect(value.get(), "oldRect", oldRect); | 1240 addJsonObjectForRect(value.get(), "oldRect", oldRect); |
1238 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); | 1241 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); |
1239 addJsonObjectForRect(value.get(), "newRect", newRect); | 1242 addJsonObjectForRect(value.get(), "newRect", newRect); |
1240 addJsonObjectForPoint(value.get(), "newLocation", newLocation); | 1243 addJsonObjectForPoint(value.get(), "newLocation", newLocation); |
1241 return value; | 1244 return value; |
1242 } | 1245 } |
1243 | 1246 |
1244 void RenderObject::invalidateSelectionIfNeeded(const RenderLayerModelObject& pai
ntInvalidationContainer) | 1247 LayoutRect RenderObject::previousSelectionRectForPaintInvalidation() const |
| 1248 { |
| 1249 ASSERT(shouldInvalidateSelection()); |
| 1250 |
| 1251 if (!selectionPaintInvalidationMap) |
| 1252 return LayoutRect(); |
| 1253 |
| 1254 return selectionPaintInvalidationMap->get(this); |
| 1255 } |
| 1256 |
| 1257 void RenderObject::setPreviousSelectionRectForPaintInvalidation(const LayoutRect
& selectionRect) |
| 1258 { |
| 1259 if (!selectionPaintInvalidationMap) |
| 1260 selectionPaintInvalidationMap = new SelectionPaintInvalidationMap(); |
| 1261 |
| 1262 selectionPaintInvalidationMap->set(this, selectionRect); |
| 1263 } |
| 1264 |
| 1265 void RenderObject::invalidateSelectionIfNeeded(const RenderLayerModelObject& pai
ntInvalidationContainer, PaintInvalidationReason invalidationReason) |
1245 { | 1266 { |
1246 if (!shouldInvalidateSelection()) | 1267 if (!shouldInvalidateSelection()) |
1247 return; | 1268 return; |
1248 | 1269 |
1249 LayoutRect selection = selectionRectForPaintInvalidation(&paintInvalidationC
ontainer); | 1270 LayoutRect oldSelectionRect = previousSelectionRectForPaintInvalidation(); |
1250 // FIXME: groupedMapping() leaks the squashing abstraction. See RenderBlockS
electionInfo for more details. | 1271 LayoutRect previousSelectionRectForPaintInvalidation = selectionRectForPaint
Invalidation(&paintInvalidationContainer); |
| 1272 // FIXME: groupedMapping() leaks the squashing abstraction. |
1251 if (paintInvalidationContainer.layer()->groupedMapping()) | 1273 if (paintInvalidationContainer.layer()->groupedMapping()) |
1252 RenderLayer::mapRectToPaintBackingCoordinates(&paintInvalidationContaine
r, selection); | 1274 RenderLayer::mapRectToPaintBackingCoordinates(&paintInvalidationContaine
r, previousSelectionRectForPaintInvalidation); |
1253 invalidatePaintUsingContainer(&paintInvalidationContainer, selection, PaintI
nvalidationSelection); | 1275 setPreviousSelectionRectForPaintInvalidation(previousSelectionRectForPaintIn
validation); |
| 1276 |
| 1277 if (view()->doingFullPaintInvalidation() || isFullPaintInvalidationReason(in
validationReason)) |
| 1278 return; |
| 1279 |
| 1280 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection,
oldSelectionRect, previousSelectionRectForPaintInvalidation); |
1254 } | 1281 } |
1255 | 1282 |
1256 PaintInvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalid
ationState& paintInvalidationState, const RenderLayerModelObject& paintInvalidat
ionContainer) | 1283 PaintInvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalid
ationState& paintInvalidationState, const RenderLayerModelObject& paintInvalidat
ionContainer) |
1257 { | 1284 { |
1258 RenderView* v = view(); | 1285 RenderView* v = view(); |
1259 if (v->document().printing()) | 1286 if (v->document().printing()) |
1260 return PaintInvalidationNone; // Don't invalidate paints if we're printi
ng. | 1287 return PaintInvalidationNone; // Don't invalidate paints if we're printi
ng. |
1261 | 1288 |
1262 const LayoutRect oldBounds = previousPaintInvalidationRect(); | 1289 const LayoutRect oldBounds = previousPaintInvalidationRect(); |
1263 const LayoutPoint oldLocation = previousPositionFromPaintInvalidationBacking
(); | 1290 const LayoutPoint oldLocation = previousPositionFromPaintInvalidationBacking
(); |
1264 const LayoutRect newBounds = boundsRectForPaintInvalidation(&paintInvalidati
onContainer, &paintInvalidationState); | 1291 const LayoutRect newBounds = boundsRectForPaintInvalidation(&paintInvalidati
onContainer, &paintInvalidationState); |
1265 const LayoutPoint newLocation = RenderLayer::positionFromPaintInvalidationBa
cking(this, &paintInvalidationContainer, &paintInvalidationState); | 1292 const LayoutPoint newLocation = RenderLayer::positionFromPaintInvalidationBa
cking(this, &paintInvalidationContainer, &paintInvalidationState); |
1266 setPreviousPaintInvalidationRect(newBounds); | 1293 setPreviousPaintInvalidationRect(newBounds); |
1267 setPreviousPositionFromPaintInvalidationBacking(newLocation); | 1294 setPreviousPositionFromPaintInvalidationBacking(newLocation); |
1268 | 1295 |
1269 PaintInvalidationReason invalidationReason = paintInvalidationReason(paintIn
validationContainer, oldBounds, oldLocation, newBounds, newLocation); | 1296 PaintInvalidationReason invalidationReason = paintInvalidationReason(paintIn
validationContainer, oldBounds, oldLocation, newBounds, newLocation); |
1270 | 1297 |
| 1298 // We need to invalidate the selection before checking for whether we are do
ing a full invalidation. |
| 1299 // This is because we need to update the old rect regardless. |
| 1300 invalidateSelectionIfNeeded(paintInvalidationContainer, invalidationReason); |
| 1301 |
1271 // If we are set to do a full paint invalidation that means the RenderView w
ill issue | 1302 // If we are set to do a full paint invalidation that means the RenderView w
ill issue |
1272 // paint invalidations. We can then skip issuing of paint invalidations for
the child | 1303 // paint invalidations. We can then skip issuing of paint invalidations for
the child |
1273 // renderers as they'll be covered by the RenderView. | 1304 // renderers as they'll be covered by the RenderView. |
1274 if (view()->doingFullPaintInvalidation()) | 1305 if (view()->doingFullPaintInvalidation()) |
1275 return invalidationReason; | 1306 return invalidationReason; |
1276 | 1307 |
1277 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintIfNeeded()", | 1308 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintIfNeeded()", |
1278 "object", this->debugName().ascii(), | 1309 "object", this->debugName().ascii(), |
1279 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n
ewLocation)); | 1310 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n
ewLocation)); |
1280 | 1311 |
1281 invalidateSelectionIfNeeded(paintInvalidationContainer); | |
1282 | |
1283 if (invalidationReason == PaintInvalidationNone) | 1312 if (invalidationReason == PaintInvalidationNone) |
1284 return invalidationReason; | 1313 return invalidationReason; |
1285 | 1314 |
1286 if (invalidationReason == PaintInvalidationIncremental) { | 1315 if (invalidationReason == PaintInvalidationIncremental) { |
1287 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds, newLocation); | 1316 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds, newLocation); |
1288 return invalidationReason; | 1317 return invalidationReason; |
1289 } | 1318 } |
1290 | 1319 |
1291 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun
ds, newBounds); | 1320 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun
ds, newBounds); |
1292 return invalidationReason; | 1321 return invalidationReason; |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2337 // m_style is null in cases of partial construction. Any handler we added | 2366 // m_style is null in cases of partial construction. Any handler we added |
2338 // previously may have already been removed by the Document independently. | 2367 // previously may have already been removed by the Document independently. |
2339 if (node() && !node()->isTextNode() && m_style && m_style->touchAction() !=
TouchActionAuto) { | 2368 if (node() && !node()->isTextNode() && m_style && m_style->touchAction() !=
TouchActionAuto) { |
2340 EventHandlerRegistry& registry = document().frameHost()->eventHandlerReg
istry(); | 2369 EventHandlerRegistry& registry = document().frameHost()->eventHandlerReg
istry(); |
2341 if (registry.eventHandlerTargets(EventHandlerRegistry::TouchEvent)->cont
ains(node())) | 2370 if (registry.eventHandlerTargets(EventHandlerRegistry::TouchEvent)->cont
ains(node())) |
2342 registry.didRemoveEventHandler(*node(), EventHandlerRegistry::TouchE
vent); | 2371 registry.didRemoveEventHandler(*node(), EventHandlerRegistry::TouchE
vent); |
2343 } | 2372 } |
2344 | 2373 |
2345 setAncestorLineBoxDirty(false); | 2374 setAncestorLineBoxDirty(false); |
2346 | 2375 |
| 2376 if (selectionPaintInvalidationMap) |
| 2377 selectionPaintInvalidationMap->remove(this); |
| 2378 |
2347 clearLayoutRootIfNeeded(); | 2379 clearLayoutRootIfNeeded(); |
2348 } | 2380 } |
2349 | 2381 |
2350 void RenderObject::insertedIntoTree() | 2382 void RenderObject::insertedIntoTree() |
2351 { | 2383 { |
2352 // FIXME: We should ASSERT(isRooted()) here but generated content makes some
out-of-order insertion. | 2384 // FIXME: We should ASSERT(isRooted()) here but generated content makes some
out-of-order insertion. |
2353 | 2385 |
2354 // Keep our layer hierarchy updated. Optimize for the common case where we d
on't have any children | 2386 // Keep our layer hierarchy updated. Optimize for the common case where we d
on't have any children |
2355 // and don't have a layer attached to ourselves. | 2387 // and don't have a layer attached to ourselves. |
2356 RenderLayer* layer = 0; | 2388 RenderLayer* layer = 0; |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3153 { | 3185 { |
3154 if (object1) { | 3186 if (object1) { |
3155 const blink::RenderObject* root = object1; | 3187 const blink::RenderObject* root = object1; |
3156 while (root->parent()) | 3188 while (root->parent()) |
3157 root = root->parent(); | 3189 root = root->parent(); |
3158 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3190 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3159 } | 3191 } |
3160 } | 3192 } |
3161 | 3193 |
3162 #endif | 3194 #endif |
OLD | NEW |