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

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 301843002: Store repaint rects in the coordinate space of their backing GraphicsLayer. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix comment. Created 6 years, 6 months 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) 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
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 { 1415 {
1416 return computeRepaintRectInternal(containerForRepaint()); 1416 return clippedOverflowRectForRepaint(repaintContainer ? repaintContainer: co ntainerForRepaint());
leviw_travelin_and_unemployed 2014/05/29 18:27:08 I don't really want this ternary to exist, but you
chrishtr 2014/05/29 18:34:11 Done.
1417 }
1418
1419 LayoutRect RenderObject::computeRepaintRectInternal(const RenderLayerModelObject * repaintContainer) const
1420 {
1421 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
1430 // the selection. crbug.com/368140 1425 // the selection. crbug.com/368140
1431 if (!isRooted()) 1426 if (!isRooted())
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
leviw_travelin_and_unemployed 2014/05/29 18:27:08 Why add the local?
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()->computeRectForRepaint(repaintCo ntainer, dirtyRect);
1513 else
1514 computeRectForRepaint(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 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« Source/core/rendering/RenderObject.h ('K') | « Source/core/rendering/RenderObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698