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 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1324 | 1324 |
1325 void RenderObject::paint(PaintInfo&, const LayoutPoint&) | 1325 void RenderObject::paint(PaintInfo&, const LayoutPoint&) |
1326 { | 1326 { |
1327 } | 1327 } |
1328 | 1328 |
1329 RenderLayerModelObject* RenderObject::containerForRepaint() const | 1329 RenderLayerModelObject* RenderObject::containerForRepaint() const |
1330 { | 1330 { |
1331 if (!isRooted()) | 1331 if (!isRooted()) |
1332 return 0; | 1332 return 0; |
1333 | 1333 |
1334 // FIXME: Repaint container should never be null when we're rooted. crbug.co m/363699 | |
1335 RenderLayerModelObject* repaintContainer = 0; | 1334 RenderLayerModelObject* repaintContainer = 0; |
1336 | 1335 |
1337 RenderView* v = view(); | 1336 RenderView* v = view(); |
ojan
2014/04/23 02:07:31
Mind renaming this to renderView while you're in t
| |
1338 if (v->usesCompositing()) { | 1337 if (v->usesCompositing()) { |
1339 // FIXME: CompositingState is not necessarily up to date for many caller s of this function. | 1338 // FIXME: CompositingState is not necessarily up to date for many caller s of this function. |
1340 DisableCompositingQueryAsserts disabler; | 1339 DisableCompositingQueryAsserts disabler; |
1341 | 1340 |
1342 if (RenderLayer* compositingLayer = enclosingLayer()->enclosingCompositi ngLayerForRepaint()) | 1341 if (RenderLayer* compositingLayer = enclosingLayer()->enclosingCompositi ngLayerForRepaint()) |
1343 repaintContainer = compositingLayer->renderer(); | 1342 repaintContainer = compositingLayer->renderer(); |
1344 } | 1343 } |
1345 | 1344 |
1346 if (document().view()->hasSoftwareFilters()) { | 1345 if (document().view()->hasSoftwareFilters()) { |
1347 if (RenderLayer* enclosingFilterLayer = enclosingLayer()->enclosingFilte rLayer()) | 1346 if (RenderLayer* enclosingFilterLayer = enclosingLayer()->enclosingFilte rLayer()) |
1348 return enclosingFilterLayer->renderer(); | 1347 return enclosingFilterLayer->renderer(); |
1349 } | 1348 } |
1350 | 1349 |
1351 // If we have a flow thread, then we need to do individual repaints within t he RenderRegions instead. | 1350 // If we have a flow thread, then we need to do individual repaints within t he RenderRegions instead. |
1352 // Return the flow thread as a repaint container in order to create a chokep oint that allows us to change | 1351 // Return the flow thread as a repaint container in order to create a chokep oint that allows us to change |
1353 // repainting to do individual region repaints. | 1352 // repainting to do individual region repaints. |
1354 if (RenderFlowThread* parentRenderFlowThread = flowThreadContainingBlock()) { | 1353 if (RenderFlowThread* parentRenderFlowThread = flowThreadContainingBlock()) { |
1355 // If we have already found a repaint container then we will repaint int o that container only if it is part of the same | 1354 // If we have already found a repaint container then we will repaint int o that container only if it is part of the same |
1356 // flow thread. Otherwise we will need to catch the repaint call and sen d it to the flow thread. | 1355 // flow thread. Otherwise we will need to catch the repaint call and sen d it to the flow thread. |
1357 if (!repaintContainer || repaintContainer->flowThreadContainingBlock() ! = parentRenderFlowThread) | 1356 if (!repaintContainer || repaintContainer->flowThreadContainingBlock() ! = parentRenderFlowThread) |
1358 repaintContainer = parentRenderFlowThread; | 1357 repaintContainer = parentRenderFlowThread; |
1359 } | 1358 } |
1360 return repaintContainer; | 1359 return repaintContainer ? repaintContainer : v; |
1361 } | 1360 } |
1362 | 1361 |
1363 void RenderObject::repaintUsingContainer(const RenderLayerModelObject* repaintCo ntainer, const IntRect& r, InvalidationReason invalidationReason) const | 1362 void RenderObject::repaintUsingContainer(const RenderLayerModelObject* repaintCo ntainer, const IntRect& r, InvalidationReason invalidationReason) const |
1364 { | 1363 { |
1365 // FIXME: This should use a ConvertableToTraceFormat when they are available in Blink. | 1364 // FIXME: This should use a ConvertableToTraceFormat when they are available in Blink. |
1366 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject: :repaintUsingContainer()", | 1365 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject: :repaintUsingContainer()", |
1367 "object", TRACE_STR_COPY(this->debugName().ascii().data()), | 1366 "object", TRACE_STR_COPY(this->debugName().ascii().data()), |
1368 "info", TRACE_STR_COPY(String::format("rect: %d,%d %dx%d, invalidation_r eason: %s", | 1367 "info", TRACE_STR_COPY(String::format("rect: %d,%d %dx%d, invalidation_r eason: %s", |
1369 r.x(), r.y(), r.width(), r.height(), invalidationReasonToString(inva lidationReason)).ascii().data())); | 1368 r.x(), r.y(), r.width(), r.height(), invalidationReasonToString(inva lidationReason)).ascii().data())); |
1370 | 1369 |
1371 // FIXME: Repaint container should never be null. crbug.com/363699 | 1370 if (!repaintContainer) |
ojan
2014/04/23 02:07:31
Can we ASSERT(!isRooted()) here?
| |
1372 if (!repaintContainer) { | |
1373 view()->repaintViewRectangle(r); | |
1374 return; | 1371 return; |
1375 } | |
1376 | 1372 |
1377 // FIXME: Don't read compositing state here since we do this in the middle o f recalc/layout. | 1373 // FIXME: Don't read compositing state here since we do this in the middle o f recalc/layout. |
1378 DisableCompositingQueryAsserts disabler; | 1374 DisableCompositingQueryAsserts disabler; |
1379 if (repaintContainer->compositingState() == PaintsIntoGroupedBacking) { | 1375 if (repaintContainer->compositingState() == PaintsIntoGroupedBacking) { |
1380 ASSERT(repaintContainer->groupedMapping()); | 1376 ASSERT(repaintContainer->groupedMapping()); |
1381 ASSERT(repaintContainer->layer()); | 1377 ASSERT(repaintContainer->layer()); |
1382 | 1378 |
1383 // Not clean, but if squashing layer does not yet exist here (e.g. repai nt invalidation coming from within recomputing compositing requirements) | 1379 // Not clean, but if squashing layer does not yet exist here (e.g. repai nt invalidation coming from within recomputing compositing requirements) |
1384 // then it's ok to just exit here, since the squashing layer will get re painted when it is newly created. | 1380 // then it's ok to just exit here, since the squashing layer will get re painted when it is newly created. |
1385 if (!repaintContainer->groupedMapping()->squashingLayer()) | 1381 if (!repaintContainer->groupedMapping()->squashingLayer()) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1436 if (!isRooted()) | 1432 if (!isRooted()) |
1437 return; | 1433 return; |
1438 | 1434 |
1439 if (view()->document().printing()) | 1435 if (view()->document().printing()) |
1440 return; // Don't repaint if we're printing. | 1436 return; // Don't repaint if we're printing. |
1441 | 1437 |
1442 // FIXME: really, we're in the repaint phase here, and the following queries are legal. | 1438 // FIXME: really, we're in the repaint phase here, and the following queries are legal. |
1443 // Until those states are fully fledged, I'll just disable the ASSERTS. | 1439 // Until those states are fully fledged, I'll just disable the ASSERTS. |
1444 DisableCompositingQueryAsserts disabler; | 1440 DisableCompositingQueryAsserts disabler; |
1445 RenderLayerModelObject* repaintContainer = containerForRepaint(); | 1441 RenderLayerModelObject* repaintContainer = containerForRepaint(); |
1446 repaintUsingContainer(repaintContainer ? repaintContainer : view(), pixelSna ppedIntRect(clippedOverflowRectForRepaint(repaintContainer)), InvalidationRepain t); | 1442 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(clippedOverflowR ectForRepaint(repaintContainer)), InvalidationRepaint); |
1447 } | 1443 } |
1448 | 1444 |
1449 void RenderObject::repaintRectangle(const LayoutRect& r) const | 1445 void RenderObject::repaintRectangle(const LayoutRect& r) const |
1450 { | 1446 { |
1451 if (!isRooted()) | 1447 if (!isRooted()) |
1452 return; | 1448 return; |
1453 | 1449 |
1454 if (view()->document().printing()) | 1450 if (view()->document().printing()) |
1455 return; // Don't repaint if we're printing. | 1451 return; // Don't repaint if we're printing. |
1456 | 1452 |
1457 LayoutRect dirtyRect(r); | 1453 LayoutRect dirtyRect(r); |
1458 | 1454 |
1459 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { | 1455 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { |
1460 // FIXME: layoutDelta needs to be applied in parts before/after transfor ms and | 1456 // FIXME: layoutDelta needs to be applied in parts before/after transfor ms and |
1461 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 | 1457 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 |
1462 dirtyRect.move(view()->layoutDelta()); | 1458 dirtyRect.move(view()->layoutDelta()); |
1463 } | 1459 } |
1464 | 1460 |
1465 RenderLayerModelObject* repaintContainer = containerForRepaint(); | 1461 RenderLayerModelObject* repaintContainer = containerForRepaint(); |
1466 computeRectForRepaint(repaintContainer, dirtyRect); | 1462 computeRectForRepaint(repaintContainer, dirtyRect); |
1467 repaintUsingContainer(repaintContainer ? repaintContainer : view(), pixelSna ppedIntRect(dirtyRect), InvalidationRepaintRectangle); | 1463 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(dirtyRect), Inva lidationRepaintRectangle); |
1468 } | 1464 } |
1469 | 1465 |
1470 IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const | 1466 IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const |
1471 { | 1467 { |
1472 return pixelSnappedIntRect(absoluteClippedOverflowRect()); | 1468 return pixelSnappedIntRect(absoluteClippedOverflowRect()); |
1473 } | 1469 } |
1474 | 1470 |
1475 const char* RenderObject::invalidationReasonToString(InvalidationReason reason) const | 1471 const char* RenderObject::invalidationReasonToString(InvalidationReason reason) const |
1476 { | 1472 { |
1477 switch (reason) { | 1473 switch (reason) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1551 if (invalidationReason == InvalidationIncremental && newBounds.location() != oldBounds.location()) | 1547 if (invalidationReason == InvalidationIncremental && newBounds.location() != oldBounds.location()) |
1552 invalidationReason = InvalidationBoundsChange; | 1548 invalidationReason = InvalidationBoundsChange; |
1553 | 1549 |
1554 // If the size is zero on one of our bounds then we know we're going to have | 1550 // If the size is zero on one of our bounds then we know we're going to have |
1555 // to do a full invalidation of either old bounds or new bounds. If we fall | 1551 // to do a full invalidation of either old bounds or new bounds. If we fall |
1556 // into the incremental invalidation we'll issue two invalidations instead | 1552 // into the incremental invalidation we'll issue two invalidations instead |
1557 // of one. | 1553 // of one. |
1558 if (invalidationReason == InvalidationIncremental && (oldBounds.size().isZer o() || newBounds.size().isZero())) | 1554 if (invalidationReason == InvalidationIncremental && (oldBounds.size().isZer o() || newBounds.size().isZero())) |
1559 invalidationReason = InvalidationBoundsChange; | 1555 invalidationReason = InvalidationBoundsChange; |
1560 | 1556 |
1561 // FIXME: Repaint container should never be null. crbug.com/363699 | 1557 ASSERT(repaintContainer); |
1562 if (!repaintContainer) | |
1563 repaintContainer = v; | |
1564 | 1558 |
1565 if (invalidationReason != InvalidationIncremental) { | 1559 if (invalidationReason != InvalidationIncremental) { |
1566 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds), invalidationReason); | 1560 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds), invalidationReason); |
1567 if (newBounds != oldBounds) | 1561 if (newBounds != oldBounds) |
1568 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBound s), invalidationReason); | 1562 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBound s), invalidationReason); |
1569 return true; | 1563 return true; |
1570 } | 1564 } |
1571 | 1565 |
1572 if (oldBounds == newBounds) | 1566 if (oldBounds == newBounds) |
1573 return false; | 1567 return false; |
(...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3400 { | 3394 { |
3401 if (object1) { | 3395 if (object1) { |
3402 const WebCore::RenderObject* root = object1; | 3396 const WebCore::RenderObject* root = object1; |
3403 while (root->parent()) | 3397 while (root->parent()) |
3404 root = root->parent(); | 3398 root = root->parent(); |
3405 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3399 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3406 } | 3400 } |
3407 } | 3401 } |
3408 | 3402 |
3409 #endif | 3403 #endif |
OLD | NEW |