| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 #endif | 119 #endif |
| 120 | 120 |
| 121 struct SameSizeAsRenderObject { | 121 struct SameSizeAsRenderObject { |
| 122 virtual ~SameSizeAsRenderObject() { } // Allocate vtable pointer. | 122 virtual ~SameSizeAsRenderObject() { } // Allocate vtable pointer. |
| 123 void* pointers[5]; | 123 void* pointers[5]; |
| 124 #ifndef NDEBUG | 124 #ifndef NDEBUG |
| 125 unsigned m_debugBitfields : 2; | 125 unsigned m_debugBitfields : 2; |
| 126 #endif | 126 #endif |
| 127 unsigned m_bitfields; | 127 unsigned m_bitfields; |
| 128 unsigned m_bitfields2; | 128 unsigned m_bitfields2; |
| 129 LayoutRect rect; // Stores the previous repaint rect. | 129 LayoutRect rect; // Stores the previous paint invalidation rect. |
| 130 LayoutPoint position; // Stores the previous position from the repaint conta
iner. | 130 LayoutPoint position; // Stores the previous position from the paint invalid
ation container. |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObj
ect_should_stay_small); | 133 COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObj
ect_should_stay_small); |
| 134 | 134 |
| 135 bool RenderObject::s_affectsParentBlock = false; | 135 bool RenderObject::s_affectsParentBlock = false; |
| 136 | 136 |
| 137 void* RenderObject::operator new(size_t sz) | 137 void* RenderObject::operator new(size_t sz) |
| 138 { | 138 { |
| 139 ASSERT(isMainThread()); | 139 ASSERT(isMainThread()); |
| 140 return partitionAlloc(Partitions::getRenderingPartition(), sz); | 140 return partitionAlloc(Partitions::getRenderingPartition(), sz); |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 | 742 |
| 743 o->m_bitfields.setPreferredLogicalWidthsDirty(true); | 743 o->m_bitfields.setPreferredLogicalWidthsDirty(true); |
| 744 if (o->style()->hasOutOfFlowPosition()) | 744 if (o->style()->hasOutOfFlowPosition()) |
| 745 // A positioned object has no effect on the min/max width of its con
taining block ever. | 745 // A positioned object has no effect on the min/max width of its con
taining block ever. |
| 746 // We can optimize this case and not go up any further. | 746 // We can optimize this case and not go up any further. |
| 747 break; | 747 break; |
| 748 o = container; | 748 o = container; |
| 749 } | 749 } |
| 750 } | 750 } |
| 751 | 751 |
| 752 void RenderObject::setLayerNeedsFullRepaintForPositionedMovementLayout() | 752 void RenderObject::setLayerNeedsFullPaintInvalidationForPositionedMovementLayout
() |
| 753 { | 753 { |
| 754 ASSERT(hasLayer()); | 754 ASSERT(hasLayer()); |
| 755 toRenderLayerModelObject(this)->layer()->repainter().setRepaintStatus(NeedsF
ullRepaintForPositionedMovementLayout); | 755 toRenderLayerModelObject(this)->layer()->repainter().setRepaintStatus(NeedsF
ullRepaintForPositionedMovementLayout); |
| 756 } | 756 } |
| 757 | 757 |
| 758 RenderBlock* RenderObject::containerForFixedPosition(const RenderLayerModelObjec
t* repaintContainer, bool* repaintContainerSkipped) const | 758 RenderBlock* RenderObject::containerForFixedPosition(const RenderLayerModelObjec
t* paintInvalidationContainer, bool* paintInvalidationContainerSkipped) const |
| 759 { | 759 { |
| 760 ASSERT(!repaintContainerSkipped || !*repaintContainerSkipped); | 760 ASSERT(!paintInvalidationContainerSkipped || !*paintInvalidationContainerSki
pped); |
| 761 ASSERT(!isText()); | 761 ASSERT(!isText()); |
| 762 ASSERT(style()->position() == FixedPosition); | 762 ASSERT(style()->position() == FixedPosition); |
| 763 | 763 |
| 764 RenderObject* ancestor = parent(); | 764 RenderObject* ancestor = parent(); |
| 765 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a
ncestor->parent()) { | 765 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a
ncestor->parent()) { |
| 766 if (repaintContainerSkipped && ancestor == repaintContainer) | 766 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo
ntainer) |
| 767 *repaintContainerSkipped = true; | 767 *paintInvalidationContainerSkipped = true; |
| 768 } | 768 } |
| 769 | 769 |
| 770 ASSERT(!ancestor || !ancestor->isAnonymousBlock()); | 770 ASSERT(!ancestor || !ancestor->isAnonymousBlock()); |
| 771 return toRenderBlock(ancestor); | 771 return toRenderBlock(ancestor); |
| 772 } | 772 } |
| 773 | 773 |
| 774 RenderBlock* RenderObject::containingBlock() const | 774 RenderBlock* RenderObject::containingBlock() const |
| 775 { | 775 { |
| 776 RenderObject* o = parent(); | 776 RenderObject* o = parent(); |
| 777 if (!o && isRenderScrollbarPart()) | 777 if (!o && isRenderScrollbarPart()) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 } | 839 } |
| 840 | 840 |
| 841 bool RenderObject::canRenderBorderImage() const | 841 bool RenderObject::canRenderBorderImage() const |
| 842 { | 842 { |
| 843 ASSERT(style()->hasBorder()); | 843 ASSERT(style()->hasBorder()); |
| 844 | 844 |
| 845 StyleImage* borderImage = style()->borderImage().image(); | 845 StyleImage* borderImage = style()->borderImage().image(); |
| 846 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); | 846 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); |
| 847 } | 847 } |
| 848 | 848 |
| 849 bool RenderObject::mustRepaintFillLayersOnWidthChange(const FillLayer& layer) co
nst | 849 bool RenderObject::mustInvalidateFillLayersPaintOnWidthChange(const FillLayer& l
ayer) const |
| 850 { | 850 { |
| 851 // Nobody will use multiple layers without wanting fancy positioning. | 851 // Nobody will use multiple layers without wanting fancy positioning. |
| 852 if (layer.next()) | 852 if (layer.next()) |
| 853 return true; | 853 return true; |
| 854 | 854 |
| 855 // Make sure we have a valid image. | 855 // Make sure we have a valid image. |
| 856 StyleImage* img = layer.image(); | 856 StyleImage* img = layer.image(); |
| 857 if (!img || !img->canRender(*this, style()->effectiveZoom())) | 857 if (!img || !img->canRender(*this, style()->effectiveZoom())) |
| 858 return false; | 858 return false; |
| 859 | 859 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 876 return true; | 876 return true; |
| 877 if (img->isGeneratedImage() && layer.sizeLength().width().isAuto()) | 877 if (img->isGeneratedImage() && layer.sizeLength().width().isAuto()) |
| 878 return true; | 878 return true; |
| 879 } else if (img->usesImageContainerSize()) { | 879 } else if (img->usesImageContainerSize()) { |
| 880 return true; | 880 return true; |
| 881 } | 881 } |
| 882 | 882 |
| 883 return false; | 883 return false; |
| 884 } | 884 } |
| 885 | 885 |
| 886 bool RenderObject::mustRepaintFillLayersOnHeightChange(const FillLayer& layer) c
onst | 886 bool RenderObject::mustInvalidateFillLayersPaintOnHeightChange(const FillLayer&
layer) const |
| 887 { | 887 { |
| 888 // Nobody will use multiple layers without wanting fancy positioning. | 888 // Nobody will use multiple layers without wanting fancy positioning. |
| 889 if (layer.next()) | 889 if (layer.next()) |
| 890 return true; | 890 return true; |
| 891 | 891 |
| 892 // Make sure we have a valid image. | 892 // Make sure we have a valid image. |
| 893 StyleImage* img = layer.image(); | 893 StyleImage* img = layer.image(); |
| 894 if (!img || !img->canRender(*this, style()->effectiveZoom())) | 894 if (!img || !img->canRender(*this, style()->effectiveZoom())) |
| 895 return false; | 895 return false; |
| 896 | 896 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 913 return true; | 913 return true; |
| 914 if (img->isGeneratedImage() && layer.sizeLength().height().isAuto()) | 914 if (img->isGeneratedImage() && layer.sizeLength().height().isAuto()) |
| 915 return true; | 915 return true; |
| 916 } else if (img->usesImageContainerSize()) { | 916 } else if (img->usesImageContainerSize()) { |
| 917 return true; | 917 return true; |
| 918 } | 918 } |
| 919 | 919 |
| 920 return false; | 920 return false; |
| 921 } | 921 } |
| 922 | 922 |
| 923 bool RenderObject::mustRepaintBackgroundOrBorderOnWidthChange() const | 923 bool RenderObject::mustInvalidateBackgroundOrBorderPaintOnWidthChange() const |
| 924 { | 924 { |
| 925 if (hasMask() && mustRepaintFillLayersOnWidthChange(*style()->maskLayers())) | 925 if (hasMask() && mustInvalidateFillLayersPaintOnWidthChange(*style()->maskLa
yers())) |
| 926 return true; | 926 return true; |
| 927 | 927 |
| 928 // If we don't have a background/border/mask, then nothing to do. | 928 // If we don't have a background/border/mask, then nothing to do. |
| 929 if (!hasBoxDecorations()) | 929 if (!hasBoxDecorations()) |
| 930 return false; | 930 return false; |
| 931 | 931 |
| 932 if (mustRepaintFillLayersOnWidthChange(*style()->backgroundLayers())) | 932 if (mustInvalidateFillLayersPaintOnWidthChange(*style()->backgroundLayers())
) |
| 933 return true; | 933 return true; |
| 934 | 934 |
| 935 // Our fill layers are ok. Let's check border. | 935 // Our fill layers are ok. Let's check border. |
| 936 if (style()->hasBorder() && canRenderBorderImage()) | 936 if (style()->hasBorder() && canRenderBorderImage()) |
| 937 return true; | 937 return true; |
| 938 | 938 |
| 939 return false; | 939 return false; |
| 940 } | 940 } |
| 941 | 941 |
| 942 bool RenderObject::mustRepaintBackgroundOrBorderOnHeightChange() const | 942 bool RenderObject::mustInvalidateBackgroundOrBorderPaintOnHeightChange() const |
| 943 { | 943 { |
| 944 if (hasMask() && mustRepaintFillLayersOnHeightChange(*style()->maskLayers())
) | 944 if (hasMask() && mustInvalidateFillLayersPaintOnHeightChange(*style()->maskL
ayers())) |
| 945 return true; | 945 return true; |
| 946 | 946 |
| 947 // If we don't have a background/border/mask, then nothing to do. | 947 // If we don't have a background/border/mask, then nothing to do. |
| 948 if (!hasBoxDecorations()) | 948 if (!hasBoxDecorations()) |
| 949 return false; | 949 return false; |
| 950 | 950 |
| 951 if (mustRepaintFillLayersOnHeightChange(*style()->backgroundLayers())) | 951 if (mustInvalidateFillLayersPaintOnHeightChange(*style()->backgroundLayers()
)) |
| 952 return true; | 952 return true; |
| 953 | 953 |
| 954 // Our fill layers are ok. Let's check border. | 954 // Our fill layers are ok. Let's check border. |
| 955 if (style()->hasBorder() && canRenderBorderImage()) | 955 if (style()->hasBorder() && canRenderBorderImage()) |
| 956 return true; | 956 return true; |
| 957 | 957 |
| 958 return false; | 958 return false; |
| 959 } | 959 } |
| 960 | 960 |
| 961 void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1,
int y1, int x2, int y2, | 961 void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1,
int y1, int x2, int y2, |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 pos.move(box->locationOffset()); // FIXME: Snap offsets? crbug.c
om/350474 | 1330 pos.move(box->locationOffset()); // FIXME: Snap offsets? crbug.c
om/350474 |
| 1331 box->addFocusRingRects(rects, flooredIntPoint(pos), paintContain
er); | 1331 box->addFocusRingRects(rects, flooredIntPoint(pos), paintContain
er); |
| 1332 } | 1332 } |
| 1333 } else { | 1333 } else { |
| 1334 current->addFocusRingRects(rects, additionalOffset, paintContainer); | 1334 current->addFocusRingRects(rects, additionalOffset, paintContainer); |
| 1335 } | 1335 } |
| 1336 } | 1336 } |
| 1337 } | 1337 } |
| 1338 | 1338 |
| 1339 // 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. | 1339 // 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. |
| 1340 LayoutPoint RenderObject::positionFromRepaintContainer(const RenderLayerModelObj
ect* repaintContainer) const | 1340 LayoutPoint RenderObject::positionFromPaintInvalidationContainer(const RenderLay
erModelObject* paintInvalidationContainer) const |
| 1341 { | 1341 { |
| 1342 // FIXME: This assert should be re-enabled when we move repaint to after com
positing update. crbug.com/360286 | 1342 // FIXME: This assert should be re-enabled when we move paint invalidation t
o after compositing update. crbug.com/360286 |
| 1343 // ASSERT(containerForRepaint() == repaintContainer); | 1343 // ASSERT(containerForPaintInvalidation() == paintInvalidationContainer); |
| 1344 | 1344 |
| 1345 LayoutPoint offset = isBox() ? toRenderBox(this)->location() : LayoutPoint()
; | 1345 LayoutPoint offset = isBox() ? toRenderBox(this)->location() : LayoutPoint()
; |
| 1346 if (repaintContainer == this) | 1346 if (paintInvalidationContainer == this) |
| 1347 return offset; | 1347 return offset; |
| 1348 | 1348 |
| 1349 return roundedIntPoint(localToContainerPoint(offset, repaintContainer)); | 1349 return roundedIntPoint(localToContainerPoint(offset, paintInvalidationContai
ner)); |
| 1350 } | 1350 } |
| 1351 | 1351 |
| 1352 IntRect RenderObject::absoluteBoundingBoxRect() const | 1352 IntRect RenderObject::absoluteBoundingBoxRect() const |
| 1353 { | 1353 { |
| 1354 Vector<FloatQuad> quads; | 1354 Vector<FloatQuad> quads; |
| 1355 absoluteQuads(quads); | 1355 absoluteQuads(quads); |
| 1356 | 1356 |
| 1357 size_t n = quads.size(); | 1357 size_t n = quads.size(); |
| 1358 if (!n) | 1358 if (!n) |
| 1359 return IntRect(); | 1359 return IntRect(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1376 | 1376 |
| 1377 LayoutRect result = rects[0]; | 1377 LayoutRect result = rects[0]; |
| 1378 for (size_t i = 1; i < n; ++i) | 1378 for (size_t i = 1; i < n; ++i) |
| 1379 result.unite(rects[i]); | 1379 result.unite(rects[i]); |
| 1380 return pixelSnappedIntRect(result); | 1380 return pixelSnappedIntRect(result); |
| 1381 } | 1381 } |
| 1382 | 1382 |
| 1383 void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads) | 1383 void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads) |
| 1384 { | 1384 { |
| 1385 Vector<IntRect> rects; | 1385 Vector<IntRect> rects; |
| 1386 const RenderLayerModelObject* container = containerForRepaint(); | 1386 const RenderLayerModelObject* container = containerForPaintInvalidation(); |
| 1387 addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), con
tainer)), container); | 1387 addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), con
tainer)), container); |
| 1388 size_t count = rects.size(); | 1388 size_t count = rects.size(); |
| 1389 for (size_t i = 0; i < count; ++i) | 1389 for (size_t i = 0; i < count; ++i) |
| 1390 quads.append(container->localToAbsoluteQuad(FloatQuad(rects[i]))); | 1390 quads.append(container->localToAbsoluteQuad(FloatQuad(rects[i]))); |
| 1391 } | 1391 } |
| 1392 | 1392 |
| 1393 FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range) | 1393 FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range) |
| 1394 { | 1394 { |
| 1395 if (!range || !range->startContainer()) | 1395 if (!range || !range->startContainer()) |
| 1396 return FloatRect(); | 1396 return FloatRect(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1421 topLevelRect = result; | 1421 topLevelRect = result; |
| 1422 for (RenderObject* current = slowFirstChild(); current; current = current->n
extSibling()) | 1422 for (RenderObject* current = slowFirstChild(); current; current = current->n
extSibling()) |
| 1423 current->addAbsoluteRectForLayer(result); | 1423 current->addAbsoluteRectForLayer(result); |
| 1424 return result; | 1424 return result; |
| 1425 } | 1425 } |
| 1426 | 1426 |
| 1427 void RenderObject::paint(PaintInfo&, const LayoutPoint&) | 1427 void RenderObject::paint(PaintInfo&, const LayoutPoint&) |
| 1428 { | 1428 { |
| 1429 } | 1429 } |
| 1430 | 1430 |
| 1431 const RenderLayerModelObject* RenderObject::containerForRepaint() const | 1431 const RenderLayerModelObject* RenderObject::containerForPaintInvalidation() cons
t |
| 1432 { | 1432 { |
| 1433 if (!isRooted()) | 1433 if (!isRooted()) |
| 1434 return 0; | 1434 return 0; |
| 1435 | 1435 |
| 1436 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta
iner()); | 1436 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta
iner()); |
| 1437 } | 1437 } |
| 1438 | 1438 |
| 1439 const RenderLayerModelObject* RenderObject::enclosingCompositedContainer() const | 1439 const RenderLayerModelObject* RenderObject::enclosingCompositedContainer() const |
| 1440 { | 1440 { |
| 1441 RenderLayerModelObject* container = 0; | 1441 RenderLayerModelObject* container = 0; |
| 1442 if (view()->usesCompositing()) { | 1442 if (view()->usesCompositing()) { |
| 1443 // FIXME: CompositingState is not necessarily up to date for many caller
s of this function. | 1443 // FIXME: CompositingState is not necessarily up to date for many caller
s of this function. |
| 1444 DisableCompositingQueryAsserts disabler; | 1444 DisableCompositingQueryAsserts disabler; |
| 1445 | 1445 |
| 1446 if (RenderLayer* compositingLayer = enclosingLayer()->enclosingCompositi
ngLayerForRepaint()) | 1446 if (RenderLayer* compositingLayer = enclosingLayer()->enclosingCompositi
ngLayerForRepaint()) |
| 1447 container = compositingLayer->renderer(); | 1447 container = compositingLayer->renderer(); |
| 1448 } | 1448 } |
| 1449 return container; | 1449 return container; |
| 1450 } | 1450 } |
| 1451 | 1451 |
| 1452 const RenderLayerModelObject* RenderObject::adjustCompositedContainerForSpecialA
ncestors(const RenderLayerModelObject* repaintContainer) const | 1452 const RenderLayerModelObject* RenderObject::adjustCompositedContainerForSpecialA
ncestors(const RenderLayerModelObject* paintInvalidationContainer) const |
| 1453 { | 1453 { |
| 1454 | 1454 |
| 1455 if (document().view()->hasSoftwareFilters()) { | 1455 if (document().view()->hasSoftwareFilters()) { |
| 1456 if (RenderLayer* enclosingFilterLayer = enclosingLayer()->enclosingFilte
rLayer()) | 1456 if (RenderLayer* enclosingFilterLayer = enclosingLayer()->enclosingFilte
rLayer()) |
| 1457 return enclosingFilterLayer->renderer(); | 1457 return enclosingFilterLayer->renderer(); |
| 1458 } | 1458 } |
| 1459 | 1459 |
| 1460 // If we have a flow thread, then we need to do individual repaints within t
he RenderRegions instead. | 1460 // If we have a flow thread, then we need to do individual paint invalidatio
ns within the RenderRegions instead. |
| 1461 // Return the flow thread as a repaint container in order to create a chokep
oint that allows us to change | 1461 // Return the flow thread as a paint invalidation container in order to crea
te a chokepoint that allows us to change |
| 1462 // repainting to do individual region repaints. | 1462 // paint invalidation to do individual region paint invalidations. |
| 1463 if (RenderFlowThread* parentRenderFlowThread = flowThreadContainingBlock())
{ | 1463 if (RenderFlowThread* parentRenderFlowThread = flowThreadContainingBlock())
{ |
| 1464 // If we have already found a repaint container then we will repaint int
o that container only if it is part of the same | 1464 // If we have already found a paint invalidation container then we will
invalidate paints in that container only if it is part of the same |
| 1465 // flow thread. Otherwise we will need to catch the repaint call and sen
d it to the flow thread. | 1465 // flow thread. Otherwise we will need to catch the paint invalidation c
all and send it to the flow thread. |
| 1466 if (!repaintContainer || repaintContainer->flowThreadContainingBlock() !
= parentRenderFlowThread) | 1466 if (!paintInvalidationContainer || paintInvalidationContainer->flowThrea
dContainingBlock() != parentRenderFlowThread) |
| 1467 repaintContainer = parentRenderFlowThread; | 1467 paintInvalidationContainer = parentRenderFlowThread; |
| 1468 } | 1468 } |
| 1469 return repaintContainer ? repaintContainer : view(); | 1469 return paintInvalidationContainer ? paintInvalidationContainer : view(); |
| 1470 } | 1470 } |
| 1471 | 1471 |
| 1472 bool RenderObject::isRepaintContainer() const | 1472 bool RenderObject::isPaintInvalidationContainer() const |
| 1473 { | 1473 { |
| 1474 return hasLayer() && toRenderLayerModelObject(this)->layer()->isRepaintConta
iner(); | 1474 return hasLayer() && toRenderLayerModelObject(this)->layer()->isRepaintConta
iner(); |
| 1475 } | 1475 } |
| 1476 | 1476 |
| 1477 template<typename T> PassRefPtr<JSONValue> jsonObjectForRect(const T& rect) | 1477 template<typename T> PassRefPtr<JSONValue> jsonObjectForRect(const T& rect) |
| 1478 { | 1478 { |
| 1479 RefPtr<JSONObject> object = JSONObject::create(); | 1479 RefPtr<JSONObject> object = JSONObject::create(); |
| 1480 object->setNumber("x", rect.x()); | 1480 object->setNumber("x", rect.x()); |
| 1481 object->setNumber("y", rect.y()); | 1481 object->setNumber("y", rect.y()); |
| 1482 object->setNumber("width", rect.width()); | 1482 object->setNumber("width", rect.width()); |
| 1483 object->setNumber("height", rect.height()); | 1483 object->setNumber("height", rect.height()); |
| 1484 return object.release(); | 1484 return object.release(); |
| 1485 } | 1485 } |
| 1486 | 1486 |
| 1487 static PassRefPtr<JSONValue> jsonObjectForRepaintInfo(const IntRect& rect, const
String& invalidationReason) | 1487 static PassRefPtr<JSONValue> jsonObjectForPaintInvalidationInfo(const IntRect& r
ect, const String& invalidationReason) |
| 1488 { | 1488 { |
| 1489 RefPtr<JSONObject> object = JSONObject::create(); | 1489 RefPtr<JSONObject> object = JSONObject::create(); |
| 1490 object->setValue("rect", jsonObjectForRect(rect)); | 1490 object->setValue("rect", jsonObjectForRect(rect)); |
| 1491 object->setString("invalidation_reason", invalidationReason); | 1491 object->setString("invalidation_reason", invalidationReason); |
| 1492 return object.release(); | 1492 return object.release(); |
| 1493 } | 1493 } |
| 1494 | 1494 |
| 1495 LayoutRect RenderObject::computeRepaintRect(const RenderLayerModelObject* repain
tContainer) const | 1495 LayoutRect RenderObject::computePaintInvalidationRect(const RenderLayerModelObje
ct* paintInvalidationContainer) const |
| 1496 { | 1496 { |
| 1497 return clippedOverflowRectForRepaint(repaintContainer); | 1497 return clippedOverflowRectForPaintInvalidation(paintInvalidationContainer); |
| 1498 } | 1498 } |
| 1499 | 1499 |
| 1500 void RenderObject::invalidatePaintUsingContainer(const RenderLayerModelObject* p
aintInvalidationContainer, const IntRect& r, InvalidationReason invalidationReas
on) const | 1500 void RenderObject::invalidatePaintUsingContainer(const RenderLayerModelObject* p
aintInvalidationContainer, const IntRect& r, InvalidationReason invalidationReas
on) const |
| 1501 { | 1501 { |
| 1502 if (r.isEmpty()) | 1502 if (r.isEmpty()) |
| 1503 return; | 1503 return; |
| 1504 | 1504 |
| 1505 // FIXME: This should be an assert, but editing/selection can trigger this c
ase to invalidate | 1505 // FIXME: This should be an assert, but editing/selection can trigger this c
ase to invalidate |
| 1506 // the selection. crbug.com/368140. | 1506 // the selection. crbug.com/368140. |
| 1507 if (!isRooted()) | 1507 if (!isRooted()) |
| 1508 return; | 1508 return; |
| 1509 | 1509 |
| 1510 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintUsingContainer()", | 1510 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintUsingContainer()", |
| 1511 "object", this->debugName().ascii(), | 1511 "object", this->debugName().ascii(), |
| 1512 "info", TracedValue::fromJSONValue(jsonObjectForRepaintInfo(r, invalidat
ionReasonToString(invalidationReason)))); | 1512 "info", TracedValue::fromJSONValue(jsonObjectForPaintInvalidationInfo(r,
invalidationReasonToString(invalidationReason)))); |
| 1513 | 1513 |
| 1514 // FIXME: Don't read compositing state here since we do this in the middle o
f recalc/layout. | 1514 // FIXME: Don't read compositing state here since we do this in the middle o
f recalc/layout. |
| 1515 DisableCompositingQueryAsserts disabler; | 1515 DisableCompositingQueryAsserts disabler; |
| 1516 if (paintInvalidationContainer->compositingState() == PaintsIntoGroupedBacki
ng) { | 1516 if (paintInvalidationContainer->compositingState() == PaintsIntoGroupedBacki
ng) { |
| 1517 ASSERT(paintInvalidationContainer->groupedMapping()); | 1517 ASSERT(paintInvalidationContainer->groupedMapping()); |
| 1518 ASSERT(paintInvalidationContainer->layer()); | 1518 ASSERT(paintInvalidationContainer->layer()); |
| 1519 | 1519 |
| 1520 // Not clean, but if squashing layer does not yet exist here (e.g. paint
invalidation coming from within recomputing compositing requirements) | 1520 // Not clean, but if squashing layer does not yet exist here (e.g. paint
invalidation coming from within recomputing compositing requirements) |
| 1521 // then it's ok to just exit here, since the squashing layer will get in
validate when it is newly created. | 1521 // then it's ok to just exit here, since the squashing layer will get in
validate when it is newly created. |
| 1522 if (!paintInvalidationContainer->groupedMapping()->squashingLayer()) | 1522 if (!paintInvalidationContainer->groupedMapping()->squashingLayer()) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1550 { | 1550 { |
| 1551 if (!isRooted()) | 1551 if (!isRooted()) |
| 1552 return; | 1552 return; |
| 1553 | 1553 |
| 1554 if (view()->document().printing()) | 1554 if (view()->document().printing()) |
| 1555 return; // Don't invalidate paints if we're printing. | 1555 return; // Don't invalidate paints if we're printing. |
| 1556 | 1556 |
| 1557 // FIXME: really, we're in the paint invalidation phase here, and the follow
ing queries are legal. | 1557 // FIXME: really, we're in the paint invalidation phase here, and the follow
ing queries are legal. |
| 1558 // Until those states are fully fledged, I'll just disable the ASSERTS. | 1558 // Until those states are fully fledged, I'll just disable the ASSERTS. |
| 1559 DisableCompositingQueryAsserts disabler; | 1559 DisableCompositingQueryAsserts disabler; |
| 1560 const RenderLayerModelObject* paintInvalidationContainer = containerForRepai
nt(); | 1560 const RenderLayerModelObject* paintInvalidationContainer = containerForPaint
Invalidation(); |
| 1561 LayoutRect paintInvalidationRect = boundsRectForRepaint(paintInvalidationCon
tainer); | 1561 LayoutRect paintInvalidationRect = boundsRectForPaintInvalidation(paintInval
idationContainer); |
| 1562 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRec
t(paintInvalidationRect), InvalidationRepaint); | 1562 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRec
t(paintInvalidationRect), InvalidationPaint); |
| 1563 } | 1563 } |
| 1564 | 1564 |
| 1565 LayoutRect RenderObject::boundsRectForRepaint(const RenderLayerModelObject* repa
intContainer) const | 1565 LayoutRect RenderObject::boundsRectForPaintInvalidation(const RenderLayerModelOb
ject* paintInvalidationContainer) const |
| 1566 { | 1566 { |
| 1567 if (!repaintContainer) | 1567 if (!paintInvalidationContainer) |
| 1568 return computeRepaintRect(repaintContainer); | 1568 return computePaintInvalidationRect(paintInvalidationContainer); |
| 1569 return RenderLayer::computeRepaintRect(this, repaintContainer->layer()); | 1569 return RenderLayer::computeRepaintRect(this, paintInvalidationContainer->lay
er()); |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 void RenderObject::invalidatePaintRectangle(const LayoutRect& r) const | 1572 void RenderObject::invalidatePaintRectangle(const LayoutRect& r) const |
| 1573 { | 1573 { |
| 1574 if (!isRooted()) | 1574 if (!isRooted()) |
| 1575 return; | 1575 return; |
| 1576 | 1576 |
| 1577 if (view()->document().printing()) | 1577 if (view()->document().printing()) |
| 1578 return; // Don't invalidate paints if we're printing. | 1578 return; // Don't invalidate paints if we're printing. |
| 1579 | 1579 |
| 1580 LayoutRect dirtyRect(r); | 1580 LayoutRect dirtyRect(r); |
| 1581 | 1581 |
| 1582 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { | 1582 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { |
| 1583 // FIXME: layoutDelta needs to be applied in parts before/after transfor
ms and | 1583 // FIXME: layoutDelta needs to be applied in parts before/after transfor
ms and |
| 1584 // paint invalidation containers. https://bugs.webkit.org/show_bug.cgi?i
d=23308 | 1584 // paint invalidation containers. https://bugs.webkit.org/show_bug.cgi?i
d=23308 |
| 1585 dirtyRect.move(view()->layoutDelta()); | 1585 dirtyRect.move(view()->layoutDelta()); |
| 1586 } | 1586 } |
| 1587 | 1587 |
| 1588 const RenderLayerModelObject* paintInvalidationContainer = containerForRepai
nt(); | 1588 const RenderLayerModelObject* paintInvalidationContainer = containerForPaint
Invalidation(); |
| 1589 RenderLayer::mapRectToRepaintBacking(this, paintInvalidationContainer, dirty
Rect); | 1589 RenderLayer::mapRectToRepaintBacking(this, paintInvalidationContainer, dirty
Rect); |
| 1590 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRec
t(dirtyRect), InvalidationRepaintRectangle); | 1590 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRec
t(dirtyRect), InvalidationPaintRectangle); |
| 1591 } | 1591 } |
| 1592 | 1592 |
| 1593 IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const | 1593 IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const |
| 1594 { | 1594 { |
| 1595 return pixelSnappedIntRect(absoluteClippedOverflowRect()); | 1595 return pixelSnappedIntRect(absoluteClippedOverflowRect()); |
| 1596 } | 1596 } |
| 1597 | 1597 |
| 1598 const char* RenderObject::invalidationReasonToString(InvalidationReason reason)
const | 1598 const char* RenderObject::invalidationReasonToString(InvalidationReason reason)
const |
| 1599 { | 1599 { |
| 1600 switch (reason) { | 1600 switch (reason) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1611 case InvalidationBoundsChange: | 1611 case InvalidationBoundsChange: |
| 1612 return "bounds change"; | 1612 return "bounds change"; |
| 1613 case InvalidationLocationChange: | 1613 case InvalidationLocationChange: |
| 1614 return "location change"; | 1614 return "location change"; |
| 1615 case InvalidationScroll: | 1615 case InvalidationScroll: |
| 1616 return "scroll"; | 1616 return "scroll"; |
| 1617 case InvalidationSelection: | 1617 case InvalidationSelection: |
| 1618 return "selection"; | 1618 return "selection"; |
| 1619 case InvalidationLayer: | 1619 case InvalidationLayer: |
| 1620 return "layer"; | 1620 return "layer"; |
| 1621 case InvalidationRepaint: | 1621 case InvalidationPaint: |
| 1622 return "invalidate paint"; | 1622 return "invalidate paint"; |
| 1623 case InvalidationRepaintRectangle: | 1623 case InvalidationPaintRectangle: |
| 1624 return "invalidate paint rectangle"; | 1624 return "invalidate paint rectangle"; |
| 1625 } | 1625 } |
| 1626 ASSERT_NOT_REACHED(); | 1626 ASSERT_NOT_REACHED(); |
| 1627 return ""; | 1627 return ""; |
| 1628 } | 1628 } |
| 1629 | 1629 |
| 1630 void RenderObject::invalidateTreeAfterLayout(const RenderLayerModelObject& paint
InvalidationContainer) | 1630 void RenderObject::invalidateTreeAfterLayout(const RenderLayerModelObject& paint
InvalidationContainer) |
| 1631 { | 1631 { |
| 1632 // If we didn't need paint invalidation then our children don't need as well
. | 1632 // If we didn't need paint invalidation then our children don't need as well
. |
| 1633 // Skip walking down the tree as everything should be fine below us. | 1633 // Skip walking down the tree as everything should be fine below us. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1652 } | 1652 } |
| 1653 | 1653 |
| 1654 bool RenderObject::invalidatePaintAfterLayoutIfNeeded(const RenderLayerModelObje
ct* paintInvalidationContainer, bool wasSelfLayout, | 1654 bool RenderObject::invalidatePaintAfterLayoutIfNeeded(const RenderLayerModelObje
ct* paintInvalidationContainer, bool wasSelfLayout, |
| 1655 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t* newBoundsPtr, const LayoutPoint* newLocationPtr) | 1655 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t* newBoundsPtr, const LayoutPoint* newLocationPtr) |
| 1656 { | 1656 { |
| 1657 RenderView* v = view(); | 1657 RenderView* v = view(); |
| 1658 if (v->document().printing()) | 1658 if (v->document().printing()) |
| 1659 return false; // Don't invalidate paints if we're printing. | 1659 return false; // Don't invalidate paints if we're printing. |
| 1660 | 1660 |
| 1661 // This ASSERT fails due to animations. See https://bugs.webkit.org/show_bu
g.cgi?id=37048 | 1661 // This ASSERT fails due to animations. See https://bugs.webkit.org/show_bu
g.cgi?id=37048 |
| 1662 // ASSERT(!newBoundsPtr || *newBoundsPtr == clippedOverflowRectForRepaint(pa
intInvalidationContainer)); | 1662 // ASSERT(!newBoundsPtr || *newBoundsPtr == clippedOverflowRectForPaintInval
idation(paintInvalidationContainer)); |
| 1663 LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : computeRepaintRect(); | 1663 LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : computePaintInvalidati
onRect(); |
| 1664 LayoutPoint newLocation = newLocationPtr ? (*newLocationPtr) : positionFromR
epaintContainer(paintInvalidationContainer); | 1664 LayoutPoint newLocation = newLocationPtr ? (*newLocationPtr) : positionFromP
aintInvalidationContainer(paintInvalidationContainer); |
| 1665 | 1665 |
| 1666 // FIXME: This should use a ConvertableToTraceFormat when they are available
in Blink. | 1666 // FIXME: This should use a ConvertableToTraceFormat when they are available
in Blink. |
| 1667 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintAfterLayoutIfNeeded()", | 1667 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintAfterLayoutIfNeeded()", |
| 1668 "object", this->debugName().ascii(), | 1668 "object", this->debugName().ascii(), |
| 1669 "info", TracedValue::fromJSONValue(jsonObjectForOldAndNewRects(oldBounds
, newBounds))); | 1669 "info", TracedValue::fromJSONValue(jsonObjectForOldAndNewRects(oldBounds
, newBounds))); |
| 1670 | 1670 |
| 1671 InvalidationReason invalidationReason = wasSelfLayout ? InvalidationSelfLayo
ut : InvalidationIncremental; | 1671 InvalidationReason invalidationReason = wasSelfLayout ? InvalidationSelfLayo
ut : InvalidationIncremental; |
| 1672 | 1672 |
| 1673 // Presumably a background or a border exists if border-fit:lines was specif
ied. | 1673 // Presumably a background or a border exists if border-fit:lines was specif
ied. |
| 1674 if (invalidationReason == InvalidationIncremental && style()->borderFit() ==
BorderFitLines) | 1674 if (invalidationReason == InvalidationIncremental && style()->borderFit() ==
BorderFitLines) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1686 if (invalidationReason == InvalidationIncremental && compositingState() != P
aintsIntoOwnBacking && newLocation != oldLocation) | 1686 if (invalidationReason == InvalidationIncremental && compositingState() != P
aintsIntoOwnBacking && newLocation != oldLocation) |
| 1687 invalidationReason = InvalidationLocationChange; | 1687 invalidationReason = InvalidationLocationChange; |
| 1688 | 1688 |
| 1689 // If the bounds are the same then we know that none of the statements below | 1689 // If the bounds are the same then we know that none of the statements below |
| 1690 // can match, so we can early out since we will not need to do any | 1690 // can match, so we can early out since we will not need to do any |
| 1691 // invalidation. | 1691 // invalidation. |
| 1692 if (invalidationReason == InvalidationIncremental && oldBounds == newBounds) | 1692 if (invalidationReason == InvalidationIncremental && oldBounds == newBounds) |
| 1693 return false; | 1693 return false; |
| 1694 | 1694 |
| 1695 if (invalidationReason == InvalidationIncremental) { | 1695 if (invalidationReason == InvalidationIncremental) { |
| 1696 if (oldBounds.width() != newBounds.width() && mustRepaintBackgroundOrBor
derOnWidthChange()) | 1696 if (oldBounds.width() != newBounds.width() && mustInvalidateBackgroundOr
BorderPaintOnWidthChange()) |
| 1697 invalidationReason = InvalidationBoundsChangeWithBackground; | 1697 invalidationReason = InvalidationBoundsChangeWithBackground; |
| 1698 else if (oldBounds.height() != newBounds.height() && mustRepaintBackgrou
ndOrBorderOnHeightChange()) | 1698 else if (oldBounds.height() != newBounds.height() && mustInvalidateBackg
roundOrBorderPaintOnHeightChange()) |
| 1699 invalidationReason = InvalidationBoundsChangeWithBackground; | 1699 invalidationReason = InvalidationBoundsChangeWithBackground; |
| 1700 } | 1700 } |
| 1701 | 1701 |
| 1702 // If we shifted, we don't know the exact reason so we are conservative and
trigger a full invalidation. Shifting could | 1702 // If we shifted, we don't know the exact reason so we are conservative and
trigger a full invalidation. Shifting could |
| 1703 // be caused by some layout property (left / top) or some in-flow renderer i
nserted / removed before us in the tree. | 1703 // be caused by some layout property (left / top) or some in-flow renderer i
nserted / removed before us in the tree. |
| 1704 if (invalidationReason == InvalidationIncremental && newBounds.location() !=
oldBounds.location()) | 1704 if (invalidationReason == InvalidationIncremental && newBounds.location() !=
oldBounds.location()) |
| 1705 invalidationReason = InvalidationBoundsChange; | 1705 invalidationReason = InvalidationBoundsChange; |
| 1706 | 1706 |
| 1707 // If the size is zero on one of our bounds then we know we're going to have | 1707 // If the size is zero on one of our bounds then we know we're going to have |
| 1708 // to do a full invalidation of either old bounds or new bounds. If we fall | 1708 // to do a full invalidation of either old bounds or new bounds. If we fall |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1743 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom), invalida
tionReason); | 1743 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom), invalida
tionReason); |
| 1744 else if (deltaBottom < 0) | 1744 else if (deltaBottom < 0) |
| 1745 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom), invalid
ationReason); | 1745 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom), invalid
ationReason); |
| 1746 | 1746 |
| 1747 // FIXME: This is a limitation of our visual overflow being a single rectang
le. | 1747 // FIXME: This is a limitation of our visual overflow being a single rectang
le. |
| 1748 if (!style()->boxShadow() && !style()->hasBorderImageOutsets() && !style()->
hasOutline()) | 1748 if (!style()->boxShadow() && !style()->hasBorderImageOutsets() && !style()->
hasOutline()) |
| 1749 return false; | 1749 return false; |
| 1750 | 1750 |
| 1751 // We didn't move, but we did change size. Invalidate the delta, which will
consist of possibly | 1751 // We didn't move, but we did change size. Invalidate the delta, which will
consist of possibly |
| 1752 // two rectangles (but typically only one). | 1752 // two rectangles (but typically only one). |
| 1753 RenderStyle* outlineStyle = outlineStyleForRepaint(); | 1753 RenderStyle* outlineStyle = outlineStyleForPaintInvalidation(); |
| 1754 LayoutUnit outlineWidth = outlineStyle->outlineSize(); | 1754 LayoutUnit outlineWidth = outlineStyle->outlineSize(); |
| 1755 LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent(); | 1755 LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent(); |
| 1756 LayoutUnit width = absoluteValue(newBounds.width() - oldBounds.width()); | 1756 LayoutUnit width = absoluteValue(newBounds.width() - oldBounds.width()); |
| 1757 if (width) { | 1757 if (width) { |
| 1758 LayoutUnit shadowLeft; | 1758 LayoutUnit shadowLeft; |
| 1759 LayoutUnit shadowRight; | 1759 LayoutUnit shadowRight; |
| 1760 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight); | 1760 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight); |
| 1761 int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0; | 1761 int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0; |
| 1762 LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit(
); | 1762 LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit(
); |
| 1763 LayoutUnit minInsetRightShadowExtent = min<LayoutUnit>(-insetShadowExten
t.right(), min<LayoutUnit>(newBounds.width(), oldBounds.width())); | 1763 LayoutUnit minInsetRightShadowExtent = min<LayoutUnit>(-insetShadowExten
t.right(), min<LayoutUnit>(newBounds.width(), oldBounds.width())); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1801 void RenderObject::invalidatePaintForOverflow() | 1801 void RenderObject::invalidatePaintForOverflow() |
| 1802 { | 1802 { |
| 1803 } | 1803 } |
| 1804 | 1804 |
| 1805 void RenderObject::invalidatePaintForOverflowIfNeeded() | 1805 void RenderObject::invalidatePaintForOverflowIfNeeded() |
| 1806 { | 1806 { |
| 1807 if (shouldInvalidateOverflowForPaint()) | 1807 if (shouldInvalidateOverflowForPaint()) |
| 1808 invalidatePaintForOverflow(); | 1808 invalidatePaintForOverflow(); |
| 1809 } | 1809 } |
| 1810 | 1810 |
| 1811 bool RenderObject::checkForRepaint() const | 1811 bool RenderObject::checkForPaintInvalidation() const |
| 1812 { | 1812 { |
| 1813 return !document().view()->needsFullPaintInvalidation() && everHadLayout(); | 1813 return !document().view()->needsFullPaintInvalidation() && everHadLayout(); |
| 1814 } | 1814 } |
| 1815 | 1815 |
| 1816 bool RenderObject::checkForRepaintDuringLayout() const | 1816 bool RenderObject::checkForPaintInvalidationDuringLayout() const |
| 1817 { | 1817 { |
| 1818 return !RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && checkForRepai
nt(); | 1818 return !RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && checkForPaint
Invalidation(); |
| 1819 } | 1819 } |
| 1820 | 1820 |
| 1821 LayoutRect RenderObject::rectWithOutlineForRepaint(const RenderLayerModelObject*
repaintContainer, LayoutUnit outlineWidth) const | 1821 LayoutRect RenderObject::rectWithOutlineForPaintInvalidation(const RenderLayerMo
delObject* paintInvalidationContainer, LayoutUnit outlineWidth) const |
| 1822 { | 1822 { |
| 1823 LayoutRect r(clippedOverflowRectForRepaint(repaintContainer)); | 1823 LayoutRect r(clippedOverflowRectForPaintInvalidation(paintInvalidationContai
ner)); |
| 1824 r.inflate(outlineWidth); | 1824 r.inflate(outlineWidth); |
| 1825 return r; | 1825 return r; |
| 1826 } | 1826 } |
| 1827 | 1827 |
| 1828 LayoutRect RenderObject::clippedOverflowRectForRepaint(const RenderLayerModelObj
ect*) const | 1828 LayoutRect RenderObject::clippedOverflowRectForPaintInvalidation(const RenderLay
erModelObject*) const |
| 1829 { | 1829 { |
| 1830 ASSERT_NOT_REACHED(); | 1830 ASSERT_NOT_REACHED(); |
| 1831 return LayoutRect(); | 1831 return LayoutRect(); |
| 1832 } | 1832 } |
| 1833 | 1833 |
| 1834 void RenderObject::mapRectToRepaintBacking(const RenderLayerModelObject* repaint
Container, LayoutRect& rect, bool fixed) const | 1834 void RenderObject::mapRectToPaintInvalidationBacking(const RenderLayerModelObjec
t* paintInvalidationContainer, LayoutRect& rect, bool fixed) const |
| 1835 { | 1835 { |
| 1836 if (repaintContainer == this) | 1836 if (paintInvalidationContainer == this) |
| 1837 return; | 1837 return; |
| 1838 | 1838 |
| 1839 if (RenderObject* o = parent()) { | 1839 if (RenderObject* o = parent()) { |
| 1840 if (o->isRenderBlockFlow()) { | 1840 if (o->isRenderBlockFlow()) { |
| 1841 RenderBlock* cb = toRenderBlock(o); | 1841 RenderBlock* cb = toRenderBlock(o); |
| 1842 if (cb->hasColumns()) | 1842 if (cb->hasColumns()) |
| 1843 cb->adjustRectForColumns(rect); | 1843 cb->adjustRectForColumns(rect); |
| 1844 } | 1844 } |
| 1845 | 1845 |
| 1846 if (o->hasOverflowClip()) { | 1846 if (o->hasOverflowClip()) { |
| 1847 RenderBox* boxParent = toRenderBox(o); | 1847 RenderBox* boxParent = toRenderBox(o); |
| 1848 boxParent->applyCachedClipAndScrollOffsetForRepaint(rect); | 1848 boxParent->applyCachedClipAndScrollOffsetForRepaint(rect); |
| 1849 if (rect.isEmpty()) | 1849 if (rect.isEmpty()) |
| 1850 return; | 1850 return; |
| 1851 } | 1851 } |
| 1852 | 1852 |
| 1853 o->mapRectToRepaintBacking(repaintContainer, rect, fixed); | 1853 o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, f
ixed); |
| 1854 } | 1854 } |
| 1855 } | 1855 } |
| 1856 | 1856 |
| 1857 void RenderObject::computeFloatRectForRepaint(const RenderLayerModelObject*, Flo
atRect&, bool) const | 1857 void RenderObject::computeFloatRectForPaintInvalidation(const RenderLayerModelOb
ject*, FloatRect&, bool) const |
| 1858 { | 1858 { |
| 1859 ASSERT_NOT_REACHED(); | 1859 ASSERT_NOT_REACHED(); |
| 1860 } | 1860 } |
| 1861 | 1861 |
| 1862 void RenderObject::dirtyLinesFromChangedChild(RenderObject*) | 1862 void RenderObject::dirtyLinesFromChangedChild(RenderObject*) |
| 1863 { | 1863 { |
| 1864 } | 1864 } |
| 1865 | 1865 |
| 1866 #ifndef NDEBUG | 1866 #ifndef NDEBUG |
| 1867 | 1867 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1993 block->children()->appendChildNode(block, childlist->removeChildNode
(parent(), this)); | 1993 block->children()->appendChildNode(block, childlist->removeChildNode
(parent(), this)); |
| 1994 } | 1994 } |
| 1995 } | 1995 } |
| 1996 } | 1996 } |
| 1997 | 1997 |
| 1998 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsign
ed contextSensitiveProperties) const | 1998 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsign
ed contextSensitiveProperties) const |
| 1999 { | 1999 { |
| 2000 if (contextSensitiveProperties & ContextSensitivePropertyTransform && isSVG(
)) | 2000 if (contextSensitiveProperties & ContextSensitivePropertyTransform && isSVG(
)) |
| 2001 diff.setNeedsFullLayout(); | 2001 diff.setNeedsFullLayout(); |
| 2002 | 2002 |
| 2003 // If transform changed, and the layer does not paint into its own separate
backing, then we need to repaint. | 2003 // If transform changed, and the layer does not paint into its own separate
backing, then we need to invalidate paints. |
| 2004 if (contextSensitiveProperties & ContextSensitivePropertyTransform) { | 2004 if (contextSensitiveProperties & ContextSensitivePropertyTransform) { |
| 2005 // Text nodes share style with their parents but transforms don't apply
to them, | 2005 // Text nodes share style with their parents but transforms don't apply
to them, |
| 2006 // hence the !isText() check. | 2006 // hence the !isText() check. |
| 2007 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer(
)->styleDeterminedCompositingReasons())) | 2007 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer(
)->styleDeterminedCompositingReasons())) |
| 2008 diff.setNeedsRepaintLayer(); | 2008 diff.setNeedsRepaintLayer(); |
| 2009 else | 2009 else |
| 2010 diff.setNeedsRecompositeLayer(); | 2010 diff.setNeedsRecompositeLayer(); |
| 2011 } | 2011 } |
| 2012 | 2012 |
| 2013 // If opacity or zIndex changed, and the layer does not paint into its own s
eparate backing, then we need to repaint (also | 2013 // If opacity or zIndex changed, and the layer does not paint into its own s
eparate backing, then we need to invalidate paints (also |
| 2014 // ignoring text nodes) | 2014 // ignoring text nodes) |
| 2015 if (contextSensitiveProperties & (ContextSensitivePropertyOpacity | ContextS
ensitivePropertyZIndex)) { | 2015 if (contextSensitiveProperties & (ContextSensitivePropertyOpacity | ContextS
ensitivePropertyZIndex)) { |
| 2016 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer(
)->styleDeterminedCompositingReasons())) | 2016 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer(
)->styleDeterminedCompositingReasons())) |
| 2017 diff.setNeedsRepaintLayer(); | 2017 diff.setNeedsRepaintLayer(); |
| 2018 else | 2018 else |
| 2019 diff.setNeedsRecompositeLayer(); | 2019 diff.setNeedsRecompositeLayer(); |
| 2020 } | 2020 } |
| 2021 | 2021 |
| 2022 // If filter changed, and the layer does not paint into its own separate bac
king or it paints with filters, then we need to repaint. | 2022 // If filter changed, and the layer does not paint into its own separate bac
king or it paints with filters, then we need to invalidate paints. |
| 2023 if ((contextSensitiveProperties & ContextSensitivePropertyFilter) && hasLaye
r()) { | 2023 if ((contextSensitiveProperties & ContextSensitivePropertyFilter) && hasLaye
r()) { |
| 2024 RenderLayer* layer = toRenderLayerModelObject(this)->layer(); | 2024 RenderLayer* layer = toRenderLayerModelObject(this)->layer(); |
| 2025 if (!layer->styleDeterminedCompositingReasons() || layer->paintsWithFilt
ers()) | 2025 if (!layer->styleDeterminedCompositingReasons() || layer->paintsWithFilt
ers()) |
| 2026 diff.setNeedsRepaintLayer(); | 2026 diff.setNeedsRepaintLayer(); |
| 2027 else | 2027 else |
| 2028 diff.setNeedsRecompositeLayer(); | 2028 diff.setNeedsRecompositeLayer(); |
| 2029 } | 2029 } |
| 2030 | 2030 |
| 2031 if ((contextSensitiveProperties & ContextSensitivePropertyTextOrColor) && !d
iff.needsRepaint() | 2031 if ((contextSensitiveProperties & ContextSensitivePropertyTextOrColor) && !d
iff.needsRepaint() |
| 2032 && hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor()) | 2032 && hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor()) |
| 2033 diff.setNeedsRepaintObject(); | 2033 diff.setNeedsRepaintObject(); |
| 2034 | 2034 |
| 2035 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch
ange without the actual | 2035 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch
ange without the actual |
| 2036 // style changing, since it depends on whether we decide to composite these
elements. When the | 2036 // style changing, since it depends on whether we decide to composite these
elements. When the |
| 2037 // layer status of one of these elements changes, we need to force a layout. | 2037 // layer status of one of these elements changes, we need to force a layout. |
| 2038 if (!diff.needsFullLayout() && style() && isLayerModelObject()) { | 2038 if (!diff.needsFullLayout() && style() && isLayerModelObject()) { |
| 2039 bool requiresLayer = toRenderLayerModelObject(this)->layerTypeRequired()
!= NoLayer; | 2039 bool requiresLayer = toRenderLayerModelObject(this)->layerTypeRequired()
!= NoLayer; |
| 2040 if (hasLayer() != requiresLayer) | 2040 if (hasLayer() != requiresLayer) |
| 2041 diff.setNeedsFullLayout(); | 2041 diff.setNeedsFullLayout(); |
| 2042 } | 2042 } |
| 2043 | 2043 |
| 2044 // If we have no layer(), just treat a RepaintLayer hint as a normal Repaint
. | 2044 // If we have no layer(), just treat a RepaintLayer hint as a normal paint i
nvalidation. |
| 2045 if (diff.needsRepaintLayer() && !hasLayer()) { | 2045 if (diff.needsRepaintLayer() && !hasLayer()) { |
| 2046 diff.clearNeedsRepaint(); | 2046 diff.clearNeedsRepaint(); |
| 2047 diff.setNeedsRepaintObject(); | 2047 diff.setNeedsRepaintObject(); |
| 2048 } | 2048 } |
| 2049 | 2049 |
| 2050 return diff; | 2050 return diff; |
| 2051 } | 2051 } |
| 2052 | 2052 |
| 2053 void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle) | 2053 void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle) |
| 2054 { | 2054 { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2136 styleDidChange(diff, oldStyle.get()); | 2136 styleDidChange(diff, oldStyle.get()); |
| 2137 | 2137 |
| 2138 // FIXME: |this| might be destroyed here. This can currently happen for a Re
nderTextFragment when | 2138 // FIXME: |this| might be destroyed here. This can currently happen for a Re
nderTextFragment when |
| 2139 // its first-letter block gets an update in RenderTextFragment::styleDidChan
ge. For RenderTextFragment(s), | 2139 // its first-letter block gets an update in RenderTextFragment::styleDidChan
ge. For RenderTextFragment(s), |
| 2140 // we will safely bail out with the doesNotNeedLayout flag. We might want to
broaden this condition | 2140 // we will safely bail out with the doesNotNeedLayout flag. We might want to
broaden this condition |
| 2141 // in the future as we move renderer changes out of layout and into style ch
anges. | 2141 // in the future as we move renderer changes out of layout and into style ch
anges. |
| 2142 if (doesNotNeedLayout) | 2142 if (doesNotNeedLayout) |
| 2143 return; | 2143 return; |
| 2144 | 2144 |
| 2145 // Now that the layer (if any) has been updated, we need to adjust the diff
again, | 2145 // Now that the layer (if any) has been updated, we need to adjust the diff
again, |
| 2146 // check whether we should layout now, and decide if we need to repaint. | 2146 // check whether we should layout now, and decide if we need to invalidate p
aints. |
| 2147 StyleDifference updatedDiff = adjustStyleDifference(diff, contextSensitivePr
operties); | 2147 StyleDifference updatedDiff = adjustStyleDifference(diff, contextSensitivePr
operties); |
| 2148 | 2148 |
| 2149 if (!diff.needsFullLayout()) { | 2149 if (!diff.needsFullLayout()) { |
| 2150 if (updatedDiff.needsFullLayout()) | 2150 if (updatedDiff.needsFullLayout()) |
| 2151 setNeedsLayoutAndPrefWidthsRecalc(); | 2151 setNeedsLayoutAndPrefWidthsRecalc(); |
| 2152 else if (updatedDiff.needsPositionedMovementLayout()) | 2152 else if (updatedDiff.needsPositionedMovementLayout()) |
| 2153 setNeedsPositionedMovementLayout(); | 2153 setNeedsPositionedMovementLayout(); |
| 2154 } | 2154 } |
| 2155 | 2155 |
| 2156 if (contextSensitiveProperties & ContextSensitivePropertyTransform && !needs
Layout()) { | 2156 if (contextSensitiveProperties & ContextSensitivePropertyTransform && !needs
Layout()) { |
| 2157 if (RenderBlock* container = containingBlock()) | 2157 if (RenderBlock* container = containingBlock()) |
| 2158 container->setNeedsOverflowRecalcAfterStyleChange(); | 2158 container->setNeedsOverflowRecalcAfterStyleChange(); |
| 2159 if (isBox()) | 2159 if (isBox()) |
| 2160 toRenderBox(this)->updateLayerTransform(); | 2160 toRenderBox(this)->updateLayerTransform(); |
| 2161 } | 2161 } |
| 2162 | 2162 |
| 2163 if (updatedDiff.needsRepaint()) { | 2163 if (updatedDiff.needsRepaint()) { |
| 2164 // Repaint with the new style, e.g., for example if we go from not havin
g | 2164 // Invalidate paints with the new style, e.g., for example if we go from
not having |
| 2165 // an outline to having an outline. | 2165 // an outline to having an outline. |
| 2166 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && needsLayout()
) | 2166 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && needsLayout()
) |
| 2167 setShouldDoFullPaintInvalidationAfterLayout(true); | 2167 setShouldDoFullPaintInvalidationAfterLayout(true); |
| 2168 else if (!selfNeedsLayout()) | 2168 else if (!selfNeedsLayout()) |
| 2169 paintInvalidationForWholeRenderer(); | 2169 paintInvalidationForWholeRenderer(); |
| 2170 } | 2170 } |
| 2171 } | 2171 } |
| 2172 | 2172 |
| 2173 static inline bool rendererHasBackground(const RenderObject* renderer) | 2173 static inline bool rendererHasBackground(const RenderObject* renderer) |
| 2174 { | 2174 { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2311 | 2311 |
| 2312 // Ditto. | 2312 // Ditto. |
| 2313 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s
tyle->position()) | 2313 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s
tyle->position()) |
| 2314 markContainingBlocksForOverflowRecalc(); | 2314 markContainingBlocksForOverflowRecalc(); |
| 2315 | 2315 |
| 2316 if (diff.needsFullLayout()) | 2316 if (diff.needsFullLayout()) |
| 2317 setNeedsLayoutAndPrefWidthsRecalc(); | 2317 setNeedsLayoutAndPrefWidthsRecalc(); |
| 2318 } else if (diff.needsPositionedMovementLayout()) | 2318 } else if (diff.needsPositionedMovementLayout()) |
| 2319 setNeedsPositionedMovementLayout(); | 2319 setNeedsPositionedMovementLayout(); |
| 2320 | 2320 |
| 2321 // Don't check for repaint here; we need to wait until the layer has been | 2321 // Don't check for paint invalidation here; we need to wait until the layer
has been |
| 2322 // updated by subclasses before we know if we have to repaint (in setStyle()
). | 2322 // updated by subclasses before we know if we have to invalidate paints (in
setStyle()). |
| 2323 | 2323 |
| 2324 if (oldStyle && !areCursorsEqual(oldStyle, style())) { | 2324 if (oldStyle && !areCursorsEqual(oldStyle, style())) { |
| 2325 if (LocalFrame* frame = this->frame()) | 2325 if (LocalFrame* frame = this->frame()) |
| 2326 frame->eventHandler().scheduleCursorUpdate(); | 2326 frame->eventHandler().scheduleCursorUpdate(); |
| 2327 } | 2327 } |
| 2328 } | 2328 } |
| 2329 | 2329 |
| 2330 void RenderObject::propagateStyleToAnonymousChildren(bool blockChildrenOnly) | 2330 void RenderObject::propagateStyleToAnonymousChildren(bool blockChildrenOnly) |
| 2331 { | 2331 { |
| 2332 // FIXME: We could save this call when the change only affected non-inherite
d properties. | 2332 // FIXME: We could save this call when the change only affected non-inherite
d properties. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2415 } | 2415 } |
| 2416 | 2416 |
| 2417 FloatQuad RenderObject::absoluteToLocalQuad(const FloatQuad& quad, MapCoordinate
sFlags mode) const | 2417 FloatQuad RenderObject::absoluteToLocalQuad(const FloatQuad& quad, MapCoordinate
sFlags mode) const |
| 2418 { | 2418 { |
| 2419 TransformState transformState(TransformState::UnapplyInverseTransformDirecti
on, quad.boundingBox().center(), quad); | 2419 TransformState transformState(TransformState::UnapplyInverseTransformDirecti
on, quad.boundingBox().center(), quad); |
| 2420 mapAbsoluteToLocalPoint(mode, transformState); | 2420 mapAbsoluteToLocalPoint(mode, transformState); |
| 2421 transformState.flatten(); | 2421 transformState.flatten(); |
| 2422 return transformState.lastPlanarQuad(); | 2422 return transformState.lastPlanarQuad(); |
| 2423 } | 2423 } |
| 2424 | 2424 |
| 2425 void RenderObject::mapLocalToContainer(const RenderLayerModelObject* repaintCont
ainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed)
const | 2425 void RenderObject::mapLocalToContainer(const RenderLayerModelObject* paintInvali
dationContainer, TransformState& transformState, MapCoordinatesFlags mode, bool*
wasFixed) const |
| 2426 { | 2426 { |
| 2427 if (repaintContainer == this) | 2427 if (paintInvalidationContainer == this) |
| 2428 return; | 2428 return; |
| 2429 | 2429 |
| 2430 RenderObject* o = parent(); | 2430 RenderObject* o = parent(); |
| 2431 if (!o) | 2431 if (!o) |
| 2432 return; | 2432 return; |
| 2433 | 2433 |
| 2434 // FIXME: this should call offsetFromContainer to share code, but I'm not su
re it's ever called. | 2434 // FIXME: this should call offsetFromContainer to share code, but I'm not su
re it's ever called. |
| 2435 LayoutPoint centerPoint = roundedLayoutPoint(transformState.mappedPoint()); | 2435 LayoutPoint centerPoint = roundedLayoutPoint(transformState.mappedPoint()); |
| 2436 if (mode & ApplyContainerFlip && o->isBox()) { | 2436 if (mode & ApplyContainerFlip && o->isBox()) { |
| 2437 if (o->style()->isFlippedBlocksWritingMode()) | 2437 if (o->style()->isFlippedBlocksWritingMode()) |
| 2438 transformState.move(toRenderBox(o)->flipForWritingModeIncludingColum
ns(roundedLayoutPoint(transformState.mappedPoint())) - centerPoint); | 2438 transformState.move(toRenderBox(o)->flipForWritingModeIncludingColum
ns(roundedLayoutPoint(transformState.mappedPoint())) - centerPoint); |
| 2439 mode &= ~ApplyContainerFlip; | 2439 mode &= ~ApplyContainerFlip; |
| 2440 } | 2440 } |
| 2441 | 2441 |
| 2442 transformState.move(o->columnOffset(roundedLayoutPoint(transformState.mapped
Point()))); | 2442 transformState.move(o->columnOffset(roundedLayoutPoint(transformState.mapped
Point()))); |
| 2443 | 2443 |
| 2444 if (o->hasOverflowClip()) | 2444 if (o->hasOverflowClip()) |
| 2445 transformState.move(-toRenderBox(o)->scrolledContentOffset()); | 2445 transformState.move(-toRenderBox(o)->scrolledContentOffset()); |
| 2446 | 2446 |
| 2447 o->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed); | 2447 o->mapLocalToContainer(paintInvalidationContainer, transformState, mode, was
Fixed); |
| 2448 } | 2448 } |
| 2449 | 2449 |
| 2450 const RenderObject* RenderObject::pushMappingToContainer(const RenderLayerModelO
bject* ancestorToStopAt, RenderGeometryMap& geometryMap) const | 2450 const RenderObject* RenderObject::pushMappingToContainer(const RenderLayerModelO
bject* ancestorToStopAt, RenderGeometryMap& geometryMap) const |
| 2451 { | 2451 { |
| 2452 ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != this); | 2452 ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != this); |
| 2453 | 2453 |
| 2454 RenderObject* container = parent(); | 2454 RenderObject* container = parent(); |
| 2455 if (!container) | 2455 if (!container) |
| 2456 return 0; | 2456 return 0; |
| 2457 | 2457 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2497 | 2497 |
| 2498 TransformationMatrix perspectiveMatrix; | 2498 TransformationMatrix perspectiveMatrix; |
| 2499 perspectiveMatrix.applyPerspective(containerObject->style()->perspective
()); | 2499 perspectiveMatrix.applyPerspective(containerObject->style()->perspective
()); |
| 2500 | 2500 |
| 2501 transform.translateRight3d(-perspectiveOrigin.x(), -perspectiveOrigin.y(
), 0); | 2501 transform.translateRight3d(-perspectiveOrigin.x(), -perspectiveOrigin.y(
), 0); |
| 2502 transform = perspectiveMatrix * transform; | 2502 transform = perspectiveMatrix * transform; |
| 2503 transform.translateRight3d(perspectiveOrigin.x(), perspectiveOrigin.y(),
0); | 2503 transform.translateRight3d(perspectiveOrigin.x(), perspectiveOrigin.y(),
0); |
| 2504 } | 2504 } |
| 2505 } | 2505 } |
| 2506 | 2506 |
| 2507 FloatQuad RenderObject::localToContainerQuad(const FloatQuad& localQuad, const R
enderLayerModelObject* repaintContainer, MapCoordinatesFlags mode, bool* wasFixe
d) const | 2507 FloatQuad RenderObject::localToContainerQuad(const FloatQuad& localQuad, const R
enderLayerModelObject* paintInvalidationContainer, MapCoordinatesFlags mode, boo
l* wasFixed) const |
| 2508 { | 2508 { |
| 2509 // Track the point at the center of the quad's bounding box. As mapLocalToCo
ntainer() calls offsetFromContainer(), | 2509 // Track the point at the center of the quad's bounding box. As mapLocalToCo
ntainer() calls offsetFromContainer(), |
| 2510 // it will use that point as the reference point to decide which column's tr
ansform to apply in multiple-column blocks. | 2510 // it will use that point as the reference point to decide which column's tr
ansform to apply in multiple-column blocks. |
| 2511 TransformState transformState(TransformState::ApplyTransformDirection, local
Quad.boundingBox().center(), localQuad); | 2511 TransformState transformState(TransformState::ApplyTransformDirection, local
Quad.boundingBox().center(), localQuad); |
| 2512 mapLocalToContainer(repaintContainer, transformState, mode | ApplyContainerF
lip | UseTransforms, wasFixed); | 2512 mapLocalToContainer(paintInvalidationContainer, transformState, mode | Apply
ContainerFlip | UseTransforms, wasFixed); |
| 2513 transformState.flatten(); | 2513 transformState.flatten(); |
| 2514 | 2514 |
| 2515 return transformState.lastPlanarQuad(); | 2515 return transformState.lastPlanarQuad(); |
| 2516 } | 2516 } |
| 2517 | 2517 |
| 2518 FloatPoint RenderObject::localToContainerPoint(const FloatPoint& localPoint, con
st RenderLayerModelObject* repaintContainer, MapCoordinatesFlags mode, bool* was
Fixed) const | 2518 FloatPoint RenderObject::localToContainerPoint(const FloatPoint& localPoint, con
st RenderLayerModelObject* paintInvalidationContainer, MapCoordinatesFlags mode,
bool* wasFixed) const |
| 2519 { | 2519 { |
| 2520 TransformState transformState(TransformState::ApplyTransformDirection, local
Point); | 2520 TransformState transformState(TransformState::ApplyTransformDirection, local
Point); |
| 2521 mapLocalToContainer(repaintContainer, transformState, mode | ApplyContainerF
lip | UseTransforms, wasFixed); | 2521 mapLocalToContainer(paintInvalidationContainer, transformState, mode | Apply
ContainerFlip | UseTransforms, wasFixed); |
| 2522 transformState.flatten(); | 2522 transformState.flatten(); |
| 2523 | 2523 |
| 2524 return transformState.lastPlanarPoint(); | 2524 return transformState.lastPlanarPoint(); |
| 2525 } | 2525 } |
| 2526 | 2526 |
| 2527 LayoutSize RenderObject::offsetFromContainer(const RenderObject* o, const Layout
Point& point, bool* offsetDependsOnPoint) const | 2527 LayoutSize RenderObject::offsetFromContainer(const RenderObject* o, const Layout
Point& point, bool* offsetDependsOnPoint) const |
| 2528 { | 2528 { |
| 2529 ASSERT(o == container()); | 2529 ASSERT(o == container()); |
| 2530 | 2530 |
| 2531 LayoutSize offset = o->columnOffset(point); | 2531 LayoutSize offset = o->columnOffset(point); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2683 bool RenderObject::hasOutlineAnnotation() const | 2683 bool RenderObject::hasOutlineAnnotation() const |
| 2684 { | 2684 { |
| 2685 return node() && node()->isLink() && document().printing(); | 2685 return node() && node()->isLink() && document().printing(); |
| 2686 } | 2686 } |
| 2687 | 2687 |
| 2688 bool RenderObject::hasEntirelyFixedBackground() const | 2688 bool RenderObject::hasEntirelyFixedBackground() const |
| 2689 { | 2689 { |
| 2690 return m_style->hasEntirelyFixedBackground(); | 2690 return m_style->hasEntirelyFixedBackground(); |
| 2691 } | 2691 } |
| 2692 | 2692 |
| 2693 RenderObject* RenderObject::container(const RenderLayerModelObject* repaintConta
iner, bool* repaintContainerSkipped) const | 2693 RenderObject* RenderObject::container(const RenderLayerModelObject* paintInvalid
ationContainer, bool* paintInvalidationContainerSkipped) const |
| 2694 { | 2694 { |
| 2695 if (repaintContainerSkipped) | 2695 if (paintInvalidationContainerSkipped) |
| 2696 *repaintContainerSkipped = false; | 2696 *paintInvalidationContainerSkipped = false; |
| 2697 | 2697 |
| 2698 // This method is extremely similar to containingBlock(), but with a few not
able | 2698 // This method is extremely similar to containingBlock(), but with a few not
able |
| 2699 // exceptions. | 2699 // exceptions. |
| 2700 // (1) It can be used on orphaned subtrees, i.e., it can be called safely ev
en when | 2700 // (1) It can be used on orphaned subtrees, i.e., it can be called safely ev
en when |
| 2701 // the object is not part of the primary document subtree yet. | 2701 // the object is not part of the primary document subtree yet. |
| 2702 // (2) For normal flow elements, it just returns the parent. | 2702 // (2) For normal flow elements, it just returns the parent. |
| 2703 // (3) For absolute positioned elements, it will return a relative positione
d inline. | 2703 // (3) For absolute positioned elements, it will return a relative positione
d inline. |
| 2704 // containingBlock() simply skips relpositioned inlines and lets an enclosin
g block handle | 2704 // containingBlock() simply skips relpositioned inlines and lets an enclosin
g block handle |
| 2705 // the layout of the positioned object. This does mean that computePosition
edLogicalWidth and | 2705 // the layout of the positioned object. This does mean that computePosition
edLogicalWidth and |
| 2706 // computePositionedLogicalHeight have to use container(). | 2706 // computePositionedLogicalHeight have to use container(). |
| 2707 RenderObject* o = parent(); | 2707 RenderObject* o = parent(); |
| 2708 | 2708 |
| 2709 if (isText()) | 2709 if (isText()) |
| 2710 return o; | 2710 return o; |
| 2711 | 2711 |
| 2712 EPosition pos = m_style->position(); | 2712 EPosition pos = m_style->position(); |
| 2713 if (pos == FixedPosition) { | 2713 if (pos == FixedPosition) { |
| 2714 return containerForFixedPosition(repaintContainer, repaintContainerSkipp
ed); | 2714 return containerForFixedPosition(paintInvalidationContainer, paintInvali
dationContainerSkipped); |
| 2715 } else if (pos == AbsolutePosition) { | 2715 } else if (pos == AbsolutePosition) { |
| 2716 // We technically just want our containing block, but | 2716 // We technically just want our containing block, but |
| 2717 // we may not have one if we're part of an uninstalled | 2717 // we may not have one if we're part of an uninstalled |
| 2718 // subtree. We'll climb as high as we can though. | 2718 // subtree. We'll climb as high as we can though. |
| 2719 while (o) { | 2719 while (o) { |
| 2720 if (o->style()->position() != StaticPosition) | 2720 if (o->style()->position() != StaticPosition) |
| 2721 break; | 2721 break; |
| 2722 | 2722 |
| 2723 if (o->canContainFixedPositionObjects()) | 2723 if (o->canContainFixedPositionObjects()) |
| 2724 break; | 2724 break; |
| 2725 | 2725 |
| 2726 if (repaintContainerSkipped && o == repaintContainer) | 2726 if (paintInvalidationContainerSkipped && o == paintInvalidationConta
iner) |
| 2727 *repaintContainerSkipped = true; | 2727 *paintInvalidationContainerSkipped = true; |
| 2728 | 2728 |
| 2729 o = o->parent(); | 2729 o = o->parent(); |
| 2730 } | 2730 } |
| 2731 } | 2731 } |
| 2732 | 2732 |
| 2733 return o; | 2733 return o; |
| 2734 } | 2734 } |
| 2735 | 2735 |
| 2736 bool RenderObject::isSelectionBorder() const | 2736 bool RenderObject::isSelectionBorder() const |
| 2737 { | 2737 { |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3463 } | 3463 } |
| 3464 | 3464 |
| 3465 FloatRect RenderObject::strokeBoundingBox() const | 3465 FloatRect RenderObject::strokeBoundingBox() const |
| 3466 { | 3466 { |
| 3467 ASSERT_NOT_REACHED(); | 3467 ASSERT_NOT_REACHED(); |
| 3468 return FloatRect(); | 3468 return FloatRect(); |
| 3469 } | 3469 } |
| 3470 | 3470 |
| 3471 // Returns the smallest rectangle enclosing all of the painted content | 3471 // Returns the smallest rectangle enclosing all of the painted content |
| 3472 // respecting clipping, masking, filters, opacity, stroke-width and markers | 3472 // respecting clipping, masking, filters, opacity, stroke-width and markers |
| 3473 FloatRect RenderObject::repaintRectInLocalCoordinates() const | 3473 FloatRect RenderObject::paintInvalidationRectInLocalCoordinates() const |
| 3474 { | 3474 { |
| 3475 ASSERT_NOT_REACHED(); | 3475 ASSERT_NOT_REACHED(); |
| 3476 return FloatRect(); | 3476 return FloatRect(); |
| 3477 } | 3477 } |
| 3478 | 3478 |
| 3479 AffineTransform RenderObject::localTransform() const | 3479 AffineTransform RenderObject::localTransform() const |
| 3480 { | 3480 { |
| 3481 static const AffineTransform identity; | 3481 static const AffineTransform identity; |
| 3482 return identity; | 3482 return identity; |
| 3483 } | 3483 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3550 { | 3550 { |
| 3551 if (object1) { | 3551 if (object1) { |
| 3552 const WebCore::RenderObject* root = object1; | 3552 const WebCore::RenderObject* root = object1; |
| 3553 while (root->parent()) | 3553 while (root->parent()) |
| 3554 root = root->parent(); | 3554 root = root->parent(); |
| 3555 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3555 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3556 } | 3556 } |
| 3557 } | 3557 } |
| 3558 | 3558 |
| 3559 #endif | 3559 #endif |
| OLD | NEW |