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 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 drawLineForBoxSide(graphicsContext, rightInner, topOuter, rightOuter, bottom
Outer, BSRight, outlineColor, outlineStyle, outlineWidth, outlineWidth); | 1245 drawLineForBoxSide(graphicsContext, rightInner, topOuter, rightOuter, bottom
Outer, BSRight, outlineColor, outlineStyle, outlineWidth, outlineWidth); |
1246 drawLineForBoxSide(graphicsContext, leftOuter, bottomInner, rightOuter, bott
omOuter, BSBottom, outlineColor, outlineStyle, outlineWidth, outlineWidth); | 1246 drawLineForBoxSide(graphicsContext, leftOuter, bottomInner, rightOuter, bott
omOuter, BSBottom, outlineColor, outlineStyle, outlineWidth, outlineWidth); |
1247 | 1247 |
1248 if (useTransparencyLayer) | 1248 if (useTransparencyLayer) |
1249 graphicsContext->endLayer(); | 1249 graphicsContext->endLayer(); |
1250 } | 1250 } |
1251 | 1251 |
1252 // FIXME: In repaint-after-layout, we should be able to change the logic to remo
ve the need for this function. See crbug.com/368416. | 1252 // FIXME: In repaint-after-layout, we should be able to change the logic to remo
ve the need for this function. See crbug.com/368416. |
1253 LayoutPoint RenderObject::positionFromRepaintContainer(const RenderLayerModelObj
ect* repaintContainer) const | 1253 LayoutPoint RenderObject::positionFromRepaintContainer(const RenderLayerModelObj
ect* repaintContainer) const |
1254 { | 1254 { |
1255 ASSERT(containerForRepaint() == repaintContainer); | 1255 // FIXME: This assert should be re-enabled when we move repaint to after com
positing update. crbug.com/360286 |
| 1256 // ASSERT(containerForRepaint() == repaintContainer); |
1256 | 1257 |
1257 LayoutPoint offset = isBox() ? toRenderBox(this)->location() : LayoutPoint()
; | 1258 LayoutPoint offset = isBox() ? toRenderBox(this)->location() : LayoutPoint()
; |
1258 if (repaintContainer == this) | 1259 if (repaintContainer == this) |
1259 return offset; | 1260 return offset; |
1260 | 1261 |
1261 return roundedIntPoint(localToContainerPoint(offset, repaintContainer)); | 1262 return roundedIntPoint(localToContainerPoint(offset, repaintContainer)); |
1262 } | 1263 } |
1263 | 1264 |
1264 IntRect RenderObject::absoluteBoundingBoxRect() const | 1265 IntRect RenderObject::absoluteBoundingBoxRect() const |
1265 { | 1266 { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 | 1346 |
1346 void RenderObject::paint(PaintInfo&, const LayoutPoint&) | 1347 void RenderObject::paint(PaintInfo&, const LayoutPoint&) |
1347 { | 1348 { |
1348 } | 1349 } |
1349 | 1350 |
1350 const RenderLayerModelObject* RenderObject::containerForRepaint() const | 1351 const RenderLayerModelObject* RenderObject::containerForRepaint() const |
1351 { | 1352 { |
1352 if (!isRooted()) | 1353 if (!isRooted()) |
1353 return 0; | 1354 return 0; |
1354 | 1355 |
1355 const RenderLayerModelObject* repaintContainer = 0; | 1356 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta
iner()); |
| 1357 } |
1356 | 1358 |
1357 RenderView* renderView = view(); | 1359 const RenderLayerModelObject* RenderObject::enclosingCompositedContainer() const |
1358 if (renderView->usesCompositing()) { | 1360 { |
| 1361 RenderLayerModelObject* container = 0; |
| 1362 if (view()->usesCompositing()) { |
1359 // FIXME: CompositingState is not necessarily up to date for many caller
s of this function. | 1363 // FIXME: CompositingState is not necessarily up to date for many caller
s of this function. |
1360 DisableCompositingQueryAsserts disabler; | 1364 DisableCompositingQueryAsserts disabler; |
1361 | 1365 |
1362 if (RenderLayer* compositingLayer = enclosingLayer()->enclosingCompositi
ngLayerForRepaint()) | 1366 if (RenderLayer* compositingLayer = enclosingLayer()->enclosingCompositi
ngLayerForRepaint()) |
1363 repaintContainer = compositingLayer->renderer(); | 1367 container = compositingLayer->renderer(); |
1364 } | 1368 } |
| 1369 return container; |
| 1370 } |
| 1371 |
| 1372 const RenderLayerModelObject* RenderObject::adjustCompositedContainerForSpecialA
ncestors(const RenderLayerModelObject* repaintContainer) const |
| 1373 { |
1365 | 1374 |
1366 if (document().view()->hasSoftwareFilters()) { | 1375 if (document().view()->hasSoftwareFilters()) { |
1367 if (RenderLayer* enclosingFilterLayer = enclosingLayer()->enclosingFilte
rLayer()) | 1376 if (RenderLayer* enclosingFilterLayer = enclosingLayer()->enclosingFilte
rLayer()) |
1368 return enclosingFilterLayer->renderer(); | 1377 return enclosingFilterLayer->renderer(); |
1369 } | 1378 } |
1370 | 1379 |
1371 // If we have a flow thread, then we need to do individual repaints within t
he RenderRegions instead. | 1380 // If we have a flow thread, then we need to do individual repaints within t
he RenderRegions instead. |
1372 // Return the flow thread as a repaint container in order to create a chokep
oint that allows us to change | 1381 // Return the flow thread as a repaint container in order to create a chokep
oint that allows us to change |
1373 // repainting to do individual region repaints. | 1382 // repainting to do individual region repaints. |
1374 if (RenderFlowThread* parentRenderFlowThread = flowThreadContainingBlock())
{ | 1383 if (RenderFlowThread* parentRenderFlowThread = flowThreadContainingBlock())
{ |
1375 // If we have already found a repaint container then we will repaint int
o that container only if it is part of the same | 1384 // If we have already found a repaint container then we will repaint int
o that container only if it is part of the same |
1376 // flow thread. Otherwise we will need to catch the repaint call and sen
d it to the flow thread. | 1385 // flow thread. Otherwise we will need to catch the repaint call and sen
d it to the flow thread. |
1377 if (!repaintContainer || repaintContainer->flowThreadContainingBlock() !
= parentRenderFlowThread) | 1386 if (!repaintContainer || repaintContainer->flowThreadContainingBlock() !
= parentRenderFlowThread) |
1378 repaintContainer = parentRenderFlowThread; | 1387 repaintContainer = parentRenderFlowThread; |
1379 } | 1388 } |
1380 return repaintContainer ? repaintContainer : renderView; | 1389 return repaintContainer ? repaintContainer : view(); |
| 1390 } |
| 1391 |
| 1392 bool RenderObject::isRepaintContainer() const |
| 1393 { |
| 1394 return hasLayer() && toRenderLayerModelObject(this)->layer()->isRepaintConta
iner(); |
1381 } | 1395 } |
1382 | 1396 |
1383 template<typename T> PassRefPtr<JSONValue> jsonObjectForRect(const T& rect) | 1397 template<typename T> PassRefPtr<JSONValue> jsonObjectForRect(const T& rect) |
1384 { | 1398 { |
1385 RefPtr<JSONObject> object = JSONObject::create(); | 1399 RefPtr<JSONObject> object = JSONObject::create(); |
1386 object->setNumber("x", rect.x()); | 1400 object->setNumber("x", rect.x()); |
1387 object->setNumber("y", rect.y()); | 1401 object->setNumber("y", rect.y()); |
1388 object->setNumber("width", rect.width()); | 1402 object->setNumber("width", rect.width()); |
1389 object->setNumber("height", rect.height()); | 1403 object->setNumber("height", rect.height()); |
1390 return object.release(); | 1404 return object.release(); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 return "layer"; | 1530 return "layer"; |
1517 case InvalidationRepaint: | 1531 case InvalidationRepaint: |
1518 return "repaint"; | 1532 return "repaint"; |
1519 case InvalidationRepaintRectangle: | 1533 case InvalidationRepaintRectangle: |
1520 return "repaint rectangle"; | 1534 return "repaint rectangle"; |
1521 } | 1535 } |
1522 ASSERT_NOT_REACHED(); | 1536 ASSERT_NOT_REACHED(); |
1523 return ""; | 1537 return ""; |
1524 } | 1538 } |
1525 | 1539 |
1526 void RenderObject::repaintTreeAfterLayout() | 1540 void RenderObject::repaintTreeAfterLayout(const RenderLayerModelObject& repaintC
ontainer) |
1527 { | 1541 { |
1528 // If we didn't need invalidation then our children don't need as well. | 1542 // If we didn't need invalidation then our children don't need as well. |
1529 // Skip walking down the tree as everything should be fine below us. | 1543 // Skip walking down the tree as everything should be fine below us. |
1530 if (!shouldCheckForInvalidationAfterLayout()) | 1544 if (!shouldCheckForInvalidationAfterLayout()) |
1531 return; | 1545 return; |
1532 | 1546 |
1533 clearRepaintState(); | 1547 clearRepaintState(); |
1534 | 1548 |
1535 for (RenderObject* child = firstChild(); child; child = child->nextSibling()
) { | 1549 for (RenderObject* child = firstChild(); child; child = child->nextSibling()
) { |
1536 if (!child->isOutOfFlowPositioned()) | 1550 if (!child->isOutOfFlowPositioned()) |
1537 child->repaintTreeAfterLayout(); | 1551 child->repaintTreeAfterLayout(repaintContainer); |
1538 } | 1552 } |
1539 } | 1553 } |
1540 | 1554 |
1541 static PassRefPtr<JSONValue> jsonObjectForOldAndNewRects(const LayoutRect& oldRe
ct, const LayoutRect& newRect) | 1555 static PassRefPtr<JSONValue> jsonObjectForOldAndNewRects(const LayoutRect& oldRe
ct, const LayoutRect& newRect) |
1542 { | 1556 { |
1543 RefPtr<JSONObject> object = JSONObject::create(); | 1557 RefPtr<JSONObject> object = JSONObject::create(); |
1544 | 1558 |
1545 object->setValue("old", jsonObjectForRect(oldRect)); | 1559 object->setValue("old", jsonObjectForRect(oldRect)); |
1546 object->setValue("new", jsonObjectForRect(newRect)); | 1560 object->setValue("new", jsonObjectForRect(newRect)); |
1547 return object.release(); | 1561 return object.release(); |
(...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3464 { | 3478 { |
3465 if (object1) { | 3479 if (object1) { |
3466 const WebCore::RenderObject* root = object1; | 3480 const WebCore::RenderObject* root = object1; |
3467 while (root->parent()) | 3481 while (root->parent()) |
3468 root = root->parent(); | 3482 root = root->parent(); |
3469 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3483 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3470 } | 3484 } |
3471 } | 3485 } |
3472 | 3486 |
3473 #endif | 3487 #endif |
OLD | NEW |