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 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 } | 1404 } |
1405 | 1405 |
1406 static PassRefPtr<JSONValue> jsonObjectForRepaintInfo(const IntRect& rect, const
String& invalidationReason) | 1406 static PassRefPtr<JSONValue> jsonObjectForRepaintInfo(const IntRect& rect, const
String& invalidationReason) |
1407 { | 1407 { |
1408 RefPtr<JSONObject> object = JSONObject::create(); | 1408 RefPtr<JSONObject> object = JSONObject::create(); |
1409 object->setValue("rect", jsonObjectForRect(rect)); | 1409 object->setValue("rect", jsonObjectForRect(rect)); |
1410 object->setString("invalidation_reason", invalidationReason); | 1410 object->setString("invalidation_reason", invalidationReason); |
1411 return object.release(); | 1411 return object.release(); |
1412 } | 1412 } |
1413 | 1413 |
1414 LayoutRect RenderObject::computeRepaintRect() const | 1414 LayoutRect RenderObject::computeRepaintRect(const RenderLayerModelObject* repain
tContainer) const |
1415 { | |
1416 return computeRepaintRectInternal(containerForRepaint()); | |
1417 } | |
1418 | |
1419 LayoutRect RenderObject::computeRepaintRectInternal(const RenderLayerModelObject
* repaintContainer) const | |
1420 { | 1415 { |
1421 return clippedOverflowRectForRepaint(repaintContainer); | 1416 return clippedOverflowRectForRepaint(repaintContainer); |
1422 } | 1417 } |
1423 | 1418 |
1424 void RenderObject::repaintUsingContainer(const RenderLayerModelObject* repaintCo
ntainer, const IntRect& r, InvalidationReason invalidationReason) const | 1419 void RenderObject::repaintUsingContainer(const RenderLayerModelObject* repaintCo
ntainer, const IntRect& r, InvalidationReason invalidationReason) const |
1425 { | 1420 { |
1426 if (r.isEmpty()) | 1421 if (r.isEmpty()) |
1427 return; | 1422 return; |
1428 | 1423 |
1429 // FIXME: This should be an assert, but editing/selection can trigger this c
ase to invalidate | 1424 // FIXME: This should be an assert, but editing/selection can trigger this c
ase to invalidate |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 if (!isRooted()) | 1473 if (!isRooted()) |
1479 return; | 1474 return; |
1480 | 1475 |
1481 if (view()->document().printing()) | 1476 if (view()->document().printing()) |
1482 return; // Don't repaint if we're printing. | 1477 return; // Don't repaint if we're printing. |
1483 | 1478 |
1484 // FIXME: really, we're in the repaint phase here, and the following queries
are legal. | 1479 // FIXME: really, we're in the repaint phase here, and the following queries
are legal. |
1485 // Until those states are fully fledged, I'll just disable the ASSERTS. | 1480 // Until those states are fully fledged, I'll just disable the ASSERTS. |
1486 DisableCompositingQueryAsserts disabler; | 1481 DisableCompositingQueryAsserts disabler; |
1487 const RenderLayerModelObject* repaintContainer = containerForRepaint(); | 1482 const RenderLayerModelObject* repaintContainer = containerForRepaint(); |
1488 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(computeRepaintRe
ctInternal(repaintContainer)), InvalidationRepaint); | 1483 LayoutRect repaintRect = boundsRectForRepaint(repaintContainer); |
| 1484 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(repaintRect), In
validationRepaint); |
| 1485 } |
| 1486 |
| 1487 LayoutRect RenderObject::boundsRectForRepaint(const RenderLayerModelObject* repa
intContainer) const |
| 1488 { |
| 1489 if (hasLayer()) |
| 1490 return toRenderLayerModelObject(this)->layer()->computeRepaintRect(repai
ntContainer); |
| 1491 return computeRepaintRect(repaintContainer); |
1489 } | 1492 } |
1490 | 1493 |
1491 void RenderObject::repaintRectangle(const LayoutRect& r) const | 1494 void RenderObject::repaintRectangle(const LayoutRect& r) const |
1492 { | 1495 { |
1493 if (!isRooted()) | 1496 if (!isRooted()) |
1494 return; | 1497 return; |
1495 | 1498 |
1496 if (view()->document().printing()) | 1499 if (view()->document().printing()) |
1497 return; // Don't repaint if we're printing. | 1500 return; // Don't repaint if we're printing. |
1498 | 1501 |
1499 LayoutRect dirtyRect(r); | 1502 LayoutRect dirtyRect(r); |
1500 | 1503 |
1501 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { | 1504 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { |
1502 // FIXME: layoutDelta needs to be applied in parts before/after transfor
ms and | 1505 // FIXME: layoutDelta needs to be applied in parts before/after transfor
ms and |
1503 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 | 1506 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 |
1504 dirtyRect.move(view()->layoutDelta()); | 1507 dirtyRect.move(view()->layoutDelta()); |
1505 } | 1508 } |
1506 | 1509 |
1507 const RenderLayerModelObject* repaintContainer = containerForRepaint(); | 1510 const RenderLayerModelObject* repaintContainer = containerForRepaint(); |
1508 computeRectForRepaint(repaintContainer, dirtyRect); | 1511 if (hasLayer()) |
| 1512 toRenderLayerModelObject(this)->layer()->mapRectToRepaintBacking(repaint
Container, dirtyRect); |
| 1513 else |
| 1514 mapRectToRepaintBacking(repaintContainer, dirtyRect); |
1509 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(dirtyRect), Inva
lidationRepaintRectangle); | 1515 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(dirtyRect), Inva
lidationRepaintRectangle); |
1510 } | 1516 } |
1511 | 1517 |
1512 IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const | 1518 IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const |
1513 { | 1519 { |
1514 return pixelSnappedIntRect(absoluteClippedOverflowRect()); | 1520 return pixelSnappedIntRect(absoluteClippedOverflowRect()); |
1515 } | 1521 } |
1516 | 1522 |
1517 const char* RenderObject::invalidationReasonToString(InvalidationReason reason)
const | 1523 const char* RenderObject::invalidationReasonToString(InvalidationReason reason)
const |
1518 { | 1524 { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1739 r.inflate(outlineWidth); | 1745 r.inflate(outlineWidth); |
1740 return r; | 1746 return r; |
1741 } | 1747 } |
1742 | 1748 |
1743 LayoutRect RenderObject::clippedOverflowRectForRepaint(const RenderLayerModelObj
ect*) const | 1749 LayoutRect RenderObject::clippedOverflowRectForRepaint(const RenderLayerModelObj
ect*) const |
1744 { | 1750 { |
1745 ASSERT_NOT_REACHED(); | 1751 ASSERT_NOT_REACHED(); |
1746 return LayoutRect(); | 1752 return LayoutRect(); |
1747 } | 1753 } |
1748 | 1754 |
1749 void RenderObject::computeRectForRepaint(const RenderLayerModelObject* repaintCo
ntainer, LayoutRect& rect, bool fixed) const | 1755 void RenderObject::mapRectToRepaintBacking(const RenderLayerModelObject* repaint
Container, LayoutRect& rect, bool fixed) const |
1750 { | 1756 { |
1751 if (repaintContainer == this) | 1757 if (repaintContainer == this) |
1752 return; | 1758 return; |
1753 | 1759 |
1754 if (RenderObject* o = parent()) { | 1760 if (RenderObject* o = parent()) { |
1755 if (o->isRenderBlockFlow()) { | 1761 if (o->isRenderBlockFlow()) { |
1756 RenderBlock* cb = toRenderBlock(o); | 1762 RenderBlock* cb = toRenderBlock(o); |
1757 if (cb->hasColumns()) | 1763 if (cb->hasColumns()) |
1758 cb->adjustRectForColumns(rect); | 1764 cb->adjustRectForColumns(rect); |
1759 } | 1765 } |
1760 | 1766 |
1761 if (o->hasOverflowClip()) { | 1767 if (o->hasOverflowClip()) { |
1762 RenderBox* boxParent = toRenderBox(o); | 1768 RenderBox* boxParent = toRenderBox(o); |
1763 boxParent->applyCachedClipAndScrollOffsetForRepaint(rect); | 1769 boxParent->applyCachedClipAndScrollOffsetForRepaint(rect); |
1764 if (rect.isEmpty()) | 1770 if (rect.isEmpty()) |
1765 return; | 1771 return; |
1766 } | 1772 } |
1767 | 1773 |
1768 o->computeRectForRepaint(repaintContainer, rect, fixed); | 1774 o->mapRectToRepaintBacking(repaintContainer, rect, fixed); |
1769 } | 1775 } |
1770 } | 1776 } |
1771 | 1777 |
1772 void RenderObject::computeFloatRectForRepaint(const RenderLayerModelObject*, Flo
atRect&, bool) const | 1778 void RenderObject::computeFloatRectForRepaint(const RenderLayerModelObject*, Flo
atRect&, bool) const |
1773 { | 1779 { |
1774 ASSERT_NOT_REACHED(); | 1780 ASSERT_NOT_REACHED(); |
1775 } | 1781 } |
1776 | 1782 |
1777 void RenderObject::dirtyLinesFromChangedChild(RenderObject*) | 1783 void RenderObject::dirtyLinesFromChangedChild(RenderObject*) |
1778 { | 1784 { |
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3469 { | 3475 { |
3470 if (object1) { | 3476 if (object1) { |
3471 const WebCore::RenderObject* root = object1; | 3477 const WebCore::RenderObject* root = object1; |
3472 while (root->parent()) | 3478 while (root->parent()) |
3473 root = root->parent(); | 3479 root = root->parent(); |
3474 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3480 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3475 } | 3481 } |
3476 } | 3482 } |
3477 | 3483 |
3478 #endif | 3484 #endif |
OLD | NEW |