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

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

Issue 898783003: Move rendering/RenderLayer* to layout/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderObjectChildList.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "core/frame/FrameView.h" 42 #include "core/frame/FrameView.h"
43 #include "core/frame/LocalFrame.h" 43 #include "core/frame/LocalFrame.h"
44 #include "core/frame/Settings.h" 44 #include "core/frame/Settings.h"
45 #include "core/frame/UseCounter.h" 45 #include "core/frame/UseCounter.h"
46 #include "core/html/HTMLAnchorElement.h" 46 #include "core/html/HTMLAnchorElement.h"
47 #include "core/html/HTMLElement.h" 47 #include "core/html/HTMLElement.h"
48 #include "core/html/HTMLHtmlElement.h" 48 #include "core/html/HTMLHtmlElement.h"
49 #include "core/html/HTMLTableCellElement.h" 49 #include "core/html/HTMLTableCellElement.h"
50 #include "core/html/HTMLTableElement.h" 50 #include "core/html/HTMLTableElement.h"
51 #include "core/layout/HitTestResult.h" 51 #include "core/layout/HitTestResult.h"
52 #include "core/layout/Layer.h"
52 #include "core/layout/LayoutCounter.h" 53 #include "core/layout/LayoutCounter.h"
53 #include "core/layout/LayoutTableCaption.h" 54 #include "core/layout/LayoutTableCaption.h"
54 #include "core/layout/LayoutTableCell.h" 55 #include "core/layout/LayoutTableCell.h"
55 #include "core/layout/LayoutTableCol.h" 56 #include "core/layout/LayoutTableCol.h"
56 #include "core/layout/LayoutTableRow.h" 57 #include "core/layout/LayoutTableRow.h"
57 #include "core/layout/LayoutTheme.h" 58 #include "core/layout/LayoutTheme.h"
58 #include "core/layout/compositing/CompositedLayerMapping.h" 59 #include "core/layout/compositing/CompositedLayerMapping.h"
59 #include "core/layout/compositing/RenderLayerCompositor.h" 60 #include "core/layout/compositing/LayerCompositor.h"
60 #include "core/page/AutoscrollController.h" 61 #include "core/page/AutoscrollController.h"
61 #include "core/page/EventHandler.h" 62 #include "core/page/EventHandler.h"
62 #include "core/page/Page.h" 63 #include "core/page/Page.h"
63 #include "core/paint/ObjectPainter.h" 64 #include "core/paint/ObjectPainter.h"
64 #include "core/rendering/RenderDeprecatedFlexibleBox.h" 65 #include "core/rendering/RenderDeprecatedFlexibleBox.h"
65 #include "core/rendering/RenderFlexibleBox.h" 66 #include "core/rendering/RenderFlexibleBox.h"
66 #include "core/rendering/RenderFlowThread.h" 67 #include "core/rendering/RenderFlowThread.h"
67 #include "core/rendering/RenderGeometryMap.h" 68 #include "core/rendering/RenderGeometryMap.h"
68 #include "core/rendering/RenderGrid.h" 69 #include "core/rendering/RenderGrid.h"
69 #include "core/rendering/RenderImage.h" 70 #include "core/rendering/RenderImage.h"
70 #include "core/rendering/RenderImageResourceStyleImage.h" 71 #include "core/rendering/RenderImageResourceStyleImage.h"
71 #include "core/rendering/RenderInline.h" 72 #include "core/rendering/RenderInline.h"
72 #include "core/rendering/RenderLayer.h"
73 #include "core/rendering/RenderListItem.h" 73 #include "core/rendering/RenderListItem.h"
74 #include "core/rendering/RenderMultiColumnSpannerPlaceholder.h" 74 #include "core/rendering/RenderMultiColumnSpannerPlaceholder.h"
75 #include "core/rendering/RenderObjectInlines.h" 75 #include "core/rendering/RenderObjectInlines.h"
76 #include "core/rendering/RenderPart.h" 76 #include "core/rendering/RenderPart.h"
77 #include "core/rendering/RenderScrollbarPart.h" 77 #include "core/rendering/RenderScrollbarPart.h"
78 #include "core/rendering/RenderView.h" 78 #include "core/rendering/RenderView.h"
79 #include "core/rendering/style/ContentData.h" 79 #include "core/rendering/style/ContentData.h"
80 #include "core/rendering/style/ShadowList.h" 80 #include "core/rendering/style/ShadowList.h"
81 #include "platform/JSONValues.h" 81 #include "platform/JSONValues.h"
82 #include "platform/Partitions.h" 82 #include "platform/Partitions.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 table->addChild(newChild); 332 table->addChild(newChild);
333 } else 333 } else
334 children->insertChildNode(this, newChild, beforeChild); 334 children->insertChildNode(this, newChild, beforeChild);
335 335
336 if (newChild->isText() && newChild->style()->textTransform() == CAPITALIZE) 336 if (newChild->isText() && newChild->style()->textTransform() == CAPITALIZE)
337 toRenderText(newChild)->transformText(); 337 toRenderText(newChild)->transformText();
338 338
339 // SVG creates renderers for <g display="none">, as SVG requires children of hidden 339 // SVG creates renderers for <g display="none">, as SVG requires children of hidden
340 // <g>s to have renderers - at least that's how our implementation works. Co nsider: 340 // <g>s to have renderers - at least that's how our implementation works. Co nsider:
341 // <g display="none"><foreignObject><body style="position: relative">FOO... 341 // <g display="none"><foreignObject><body style="position: relative">FOO...
342 // - layerTypeRequired() would return true for the <body>, creating a new Re nderLayer 342 // - layerTypeRequired() would return true for the <body>, creating a new La yer
343 // - when the document is painted, both layers are painted. The <body> layer doesn't 343 // - when the document is painted, both layers are painted. The <body> layer doesn't
344 // know that it's inside a "hidden SVG subtree", and thus paints, even if it shouldn't. 344 // know that it's inside a "hidden SVG subtree", and thus paints, even if it shouldn't.
345 // To avoid the problem alltogether, detect early if we're inside a hidden S VG subtree 345 // To avoid the problem alltogether, detect early if we're inside a hidden S VG subtree
346 // and stop creating layers at all for these cases - they're not used anyway s. 346 // and stop creating layers at all for these cases - they're not used anyway s.
347 if (newChild->hasLayer() && !layerCreationAllowedForSubtree()) 347 if (newChild->hasLayer() && !layerCreationAllowedForSubtree())
348 toRenderLayerModelObject(newChild)->layer()->removeOnlyThisLayer(); 348 toLayoutLayerModelObject(newChild)->layer()->removeOnlyThisLayer();
349 } 349 }
350 350
351 void RenderObject::removeChild(RenderObject* oldChild) 351 void RenderObject::removeChild(RenderObject* oldChild)
352 { 352 {
353 ASSERT(isAllowedToModifyRenderTreeStructure(document())); 353 ASSERT(isAllowedToModifyRenderTreeStructure(document()));
354 354
355 RenderObjectChildList* children = virtualChildren(); 355 RenderObjectChildList* children = virtualChildren();
356 ASSERT(children); 356 ASSERT(children);
357 if (!children) 357 if (!children)
358 return; 358 return;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 while (r) { 438 while (r) {
439 RenderObject* n = 0; 439 RenderObject* n = 0;
440 n = r->slowLastChild(); 440 n = r->slowLastChild();
441 if (!n) 441 if (!n)
442 break; 442 break;
443 r = n; 443 r = n;
444 } 444 }
445 return r; 445 return r;
446 } 446 }
447 447
448 static void addLayers(RenderObject* obj, RenderLayer* parentLayer, RenderObject* & newObject, 448 static void addLayers(RenderObject* obj, Layer* parentLayer, RenderObject*& newO bject,
449 RenderLayer*& beforeChild) 449 Layer*& beforeChild)
450 { 450 {
451 if (obj->hasLayer()) { 451 if (obj->hasLayer()) {
452 if (!beforeChild && newObject) { 452 if (!beforeChild && newObject) {
453 // We need to figure out the layer that follows newObject. We only d o 453 // We need to figure out the layer that follows newObject. We only d o
454 // this the first time we find a child layer, and then we update the 454 // this the first time we find a child layer, and then we update the
455 // pointer values for newObject and beforeChild used by everyone els e. 455 // pointer values for newObject and beforeChild used by everyone els e.
456 beforeChild = newObject->parent()->findNextLayer(parentLayer, newObj ect); 456 beforeChild = newObject->parent()->findNextLayer(parentLayer, newObj ect);
457 newObject = 0; 457 newObject = 0;
458 } 458 }
459 parentLayer->addChild(toRenderLayerModelObject(obj)->layer(), beforeChil d); 459 parentLayer->addChild(toLayoutLayerModelObject(obj)->layer(), beforeChil d);
460 return; 460 return;
461 } 461 }
462 462
463 for (RenderObject* curr = obj->slowFirstChild(); curr; curr = curr->nextSibl ing()) 463 for (RenderObject* curr = obj->slowFirstChild(); curr; curr = curr->nextSibl ing())
464 addLayers(curr, parentLayer, newObject, beforeChild); 464 addLayers(curr, parentLayer, newObject, beforeChild);
465 } 465 }
466 466
467 void RenderObject::addLayers(RenderLayer* parentLayer) 467 void RenderObject::addLayers(Layer* parentLayer)
468 { 468 {
469 if (!parentLayer) 469 if (!parentLayer)
470 return; 470 return;
471 471
472 RenderObject* object = this; 472 RenderObject* object = this;
473 RenderLayer* beforeChild = 0; 473 Layer* beforeChild = 0;
474 blink::addLayers(this, parentLayer, object, beforeChild); 474 blink::addLayers(this, parentLayer, object, beforeChild);
475 } 475 }
476 476
477 void RenderObject::removeLayers(RenderLayer* parentLayer) 477 void RenderObject::removeLayers(Layer* parentLayer)
478 { 478 {
479 if (!parentLayer) 479 if (!parentLayer)
480 return; 480 return;
481 481
482 if (hasLayer()) { 482 if (hasLayer()) {
483 parentLayer->removeChild(toRenderLayerModelObject(this)->layer()); 483 parentLayer->removeChild(toLayoutLayerModelObject(this)->layer());
484 return; 484 return;
485 } 485 }
486 486
487 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling() ) 487 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling() )
488 curr->removeLayers(parentLayer); 488 curr->removeLayers(parentLayer);
489 } 489 }
490 490
491 void RenderObject::moveLayers(RenderLayer* oldParent, RenderLayer* newParent) 491 void RenderObject::moveLayers(Layer* oldParent, Layer* newParent)
492 { 492 {
493 if (!newParent) 493 if (!newParent)
494 return; 494 return;
495 495
496 if (hasLayer()) { 496 if (hasLayer()) {
497 RenderLayer* layer = toRenderLayerModelObject(this)->layer(); 497 Layer* layer = toLayoutLayerModelObject(this)->layer();
498 ASSERT(oldParent == layer->parent()); 498 ASSERT(oldParent == layer->parent());
499 if (oldParent) 499 if (oldParent)
500 oldParent->removeChild(layer); 500 oldParent->removeChild(layer);
501 newParent->addChild(layer); 501 newParent->addChild(layer);
502 return; 502 return;
503 } 503 }
504 504
505 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling() ) 505 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling() )
506 curr->moveLayers(oldParent, newParent); 506 curr->moveLayers(oldParent, newParent);
507 } 507 }
508 508
509 RenderLayer* RenderObject::findNextLayer(RenderLayer* parentLayer, RenderObject* startPoint, 509 Layer* RenderObject::findNextLayer(Layer* parentLayer, RenderObject* startPoint,
510 bool checkParent) 510 bool checkParent)
511 { 511 {
512 // Error check the parent layer passed in. If it's null, we can't find anyth ing. 512 // Error check the parent layer passed in. If it's null, we can't find anyth ing.
513 if (!parentLayer) 513 if (!parentLayer)
514 return 0; 514 return 0;
515 515
516 // Step 1: If our layer is a child of the desired parent, then return our la yer. 516 // Step 1: If our layer is a child of the desired parent, then return our la yer.
517 RenderLayer* ourLayer = hasLayer() ? toRenderLayerModelObject(this)->layer() : 0; 517 Layer* ourLayer = hasLayer() ? toLayoutLayerModelObject(this)->layer() : 0;
518 if (ourLayer && ourLayer->parent() == parentLayer) 518 if (ourLayer && ourLayer->parent() == parentLayer)
519 return ourLayer; 519 return ourLayer;
520 520
521 // Step 2: If we don't have a layer, or our layer is the desired parent, the n descend 521 // Step 2: If we don't have a layer, or our layer is the desired parent, the n descend
522 // into our siblings trying to find the next layer whose parent is the desir ed parent. 522 // into our siblings trying to find the next layer whose parent is the desir ed parent.
523 if (!ourLayer || ourLayer == parentLayer) { 523 if (!ourLayer || ourLayer == parentLayer) {
524 for (RenderObject* curr = startPoint ? startPoint->nextSibling() : slowF irstChild(); 524 for (RenderObject* curr = startPoint ? startPoint->nextSibling() : slowF irstChild();
525 curr; curr = curr->nextSibling()) { 525 curr; curr = curr->nextSibling()) {
526 RenderLayer* nextLayer = curr->findNextLayer(parentLayer, 0, false); 526 Layer* nextLayer = curr->findNextLayer(parentLayer, 0, false);
527 if (nextLayer) 527 if (nextLayer)
528 return nextLayer; 528 return nextLayer;
529 } 529 }
530 } 530 }
531 531
532 // Step 3: If our layer is the desired parent layer, then we're finished. We didn't 532 // Step 3: If our layer is the desired parent layer, then we're finished. We didn't
533 // find anything. 533 // find anything.
534 if (parentLayer == ourLayer) 534 if (parentLayer == ourLayer)
535 return 0; 535 return 0;
536 536
537 // Step 4: If |checkParent| is set, climb up to our parent and check its sib lings that 537 // Step 4: If |checkParent| is set, climb up to our parent and check its sib lings that
538 // follow us to see if we can locate a layer. 538 // follow us to see if we can locate a layer.
539 if (checkParent && parent()) 539 if (checkParent && parent())
540 return parent()->findNextLayer(parentLayer, this, true); 540 return parent()->findNextLayer(parentLayer, this, true);
541 541
542 return 0; 542 return 0;
543 } 543 }
544 544
545 RenderLayer* RenderObject::enclosingLayer() const 545 Layer* RenderObject::enclosingLayer() const
546 { 546 {
547 for (const RenderObject* current = this; current; current = current->parent( )) { 547 for (const RenderObject* current = this; current; current = current->parent( )) {
548 if (current->hasLayer()) 548 if (current->hasLayer())
549 return toRenderLayerModelObject(current)->layer(); 549 return toLayoutLayerModelObject(current)->layer();
550 } 550 }
551 // FIXME: we should get rid of detached render subtrees, at which point this code should 551 // FIXME: we should get rid of detached render subtrees, at which point this code should
552 // not be reached. crbug.com/411429 552 // not be reached. crbug.com/411429
553 return 0; 553 return 0;
554 } 554 }
555 555
556 bool RenderObject::scrollRectToVisible(const LayoutRect& rect, const ScrollAlign ment& alignX, const ScrollAlignment& alignY) 556 bool RenderObject::scrollRectToVisible(const LayoutRect& rect, const ScrollAlign ment& alignX, const ScrollAlignment& alignY)
557 { 557 {
558 RenderBox* enclosingBox = this->enclosingBox(); 558 RenderBox* enclosingBox = this->enclosingBox();
559 if (!enclosingBox) 559 if (!enclosingBox)
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 762
763 o->m_bitfields.setPreferredLogicalWidthsDirty(true); 763 o->m_bitfields.setPreferredLogicalWidthsDirty(true);
764 if (o->style()->hasOutOfFlowPosition()) 764 if (o->style()->hasOutOfFlowPosition())
765 // A positioned object has no effect on the min/max width of its con taining block ever. 765 // A positioned object has no effect on the min/max width of its con taining block ever.
766 // We can optimize this case and not go up any further. 766 // We can optimize this case and not go up any further.
767 break; 767 break;
768 o = container; 768 o = container;
769 } 769 }
770 } 770 }
771 771
772 RenderBlock* RenderObject::containerForFixedPosition(const RenderLayerModelObjec t* paintInvalidationContainer, bool* paintInvalidationContainerSkipped) const 772 RenderBlock* RenderObject::containerForFixedPosition(const LayoutLayerModelObjec t* paintInvalidationContainer, bool* paintInvalidationContainerSkipped) const
773 { 773 {
774 ASSERT(!paintInvalidationContainerSkipped || !*paintInvalidationContainerSki pped); 774 ASSERT(!paintInvalidationContainerSkipped || !*paintInvalidationContainerSki pped);
775 ASSERT(!isText()); 775 ASSERT(!isText());
776 ASSERT(style()->position() == FixedPosition); 776 ASSERT(style()->position() == FixedPosition);
777 777
778 RenderObject* ancestor = parent(); 778 RenderObject* ancestor = parent();
779 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a ncestor->parent()) { 779 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a ncestor->parent()) {
780 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo ntainer) 780 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo ntainer)
781 *paintInvalidationContainerSkipped = true; 781 *paintInvalidationContainerSkipped = true;
782 } 782 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 979
980 LayoutRect result = rects[0]; 980 LayoutRect result = rects[0];
981 for (size_t i = 1; i < n; ++i) 981 for (size_t i = 1; i < n; ++i)
982 result.unite(rects[i]); 982 result.unite(rects[i]);
983 return pixelSnappedIntRect(result); 983 return pixelSnappedIntRect(result);
984 } 984 }
985 985
986 IntRect RenderObject::absoluteFocusRingBoundingBoxRect() const 986 IntRect RenderObject::absoluteFocusRingBoundingBoxRect() const
987 { 987 {
988 Vector<LayoutRect> rects; 988 Vector<LayoutRect> rects;
989 const RenderLayerModelObject* container = enclosingLayer()->renderer(); 989 const LayoutLayerModelObject* container = enclosingLayer()->renderer();
990 addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), con tainer))); 990 addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), con tainer)));
991 return container->localToAbsoluteQuad(FloatQuad(unionRect(rects))).enclosing BoundingBox(); 991 return container->localToAbsoluteQuad(FloatQuad(unionRect(rects))).enclosing BoundingBox();
992 } 992 }
993 993
994 FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range) 994 FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range)
995 { 995 {
996 if (!range || !range->startContainer()) 996 if (!range || !range->startContainer())
997 return FloatRect(); 997 return FloatRect();
998 998
999 range->ownerDocument().updateLayout(); 999 range->ownerDocument().updateLayout();
(...skipping 22 matching lines...) Expand all
1022 topLevelRect = result; 1022 topLevelRect = result;
1023 for (RenderObject* current = slowFirstChild(); current; current = current->n extSibling()) 1023 for (RenderObject* current = slowFirstChild(); current; current = current->n extSibling())
1024 current->addAbsoluteRectForLayer(result); 1024 current->addAbsoluteRectForLayer(result);
1025 return result; 1025 return result;
1026 } 1026 }
1027 1027
1028 void RenderObject::paint(const PaintInfo&, const LayoutPoint&) 1028 void RenderObject::paint(const PaintInfo&, const LayoutPoint&)
1029 { 1029 {
1030 } 1030 }
1031 1031
1032 const RenderLayerModelObject* RenderObject::containerForPaintInvalidation() cons t 1032 const LayoutLayerModelObject* RenderObject::containerForPaintInvalidation() cons t
1033 { 1033 {
1034 RELEASE_ASSERT(isRooted()); 1034 RELEASE_ASSERT(isRooted());
1035 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta iner()); 1035 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta iner());
1036 } 1036 }
1037 1037
1038 const RenderLayerModelObject* RenderObject::enclosingCompositedContainer() const 1038 const LayoutLayerModelObject* RenderObject::enclosingCompositedContainer() const
1039 { 1039 {
1040 RenderLayerModelObject* container = 0; 1040 LayoutLayerModelObject* container = 0;
1041 // FIXME: CompositingState is not necessarily up to date for many callers of this function. 1041 // FIXME: CompositingState is not necessarily up to date for many callers of this function.
1042 DisableCompositingQueryAsserts disabler; 1042 DisableCompositingQueryAsserts disabler;
1043 1043
1044 if (RenderLayer* compositingLayer = enclosingLayer()->enclosingLayerForPaint InvalidationCrossingFrameBoundaries()) 1044 if (Layer* compositingLayer = enclosingLayer()->enclosingLayerForPaintInvali dationCrossingFrameBoundaries())
1045 container = compositingLayer->renderer(); 1045 container = compositingLayer->renderer();
1046 return container; 1046 return container;
1047 } 1047 }
1048 1048
1049 const RenderLayerModelObject* RenderObject::adjustCompositedContainerForSpecialA ncestors(const RenderLayerModelObject* paintInvalidationContainer) const 1049 const LayoutLayerModelObject* RenderObject::adjustCompositedContainerForSpecialA ncestors(const LayoutLayerModelObject* paintInvalidationContainer) const
1050 { 1050 {
1051 if (paintInvalidationContainer) 1051 if (paintInvalidationContainer)
1052 return paintInvalidationContainer; 1052 return paintInvalidationContainer;
1053 1053
1054 RenderView* renderView = view(); 1054 RenderView* renderView = view();
1055 while (renderView->frame()->ownerRenderer()) 1055 while (renderView->frame()->ownerRenderer())
1056 renderView = renderView->frame()->ownerRenderer()->view(); 1056 renderView = renderView->frame()->ownerRenderer()->view();
1057 return renderView; 1057 return renderView;
1058 } 1058 }
1059 1059
1060 bool RenderObject::isPaintInvalidationContainer() const 1060 bool RenderObject::isPaintInvalidationContainer() const
1061 { 1061 {
1062 return hasLayer() && toRenderLayerModelObject(this)->layer()->isPaintInvalid ationContainer(); 1062 return hasLayer() && toLayoutLayerModelObject(this)->layer()->isPaintInvalid ationContainer();
1063 } 1063 }
1064 1064
1065 template <typename T> 1065 template <typename T>
1066 void addJsonObjectForRect(TracedValue* value, const char* name, const T& rect) 1066 void addJsonObjectForRect(TracedValue* value, const char* name, const T& rect)
1067 { 1067 {
1068 value->beginDictionary(name); 1068 value->beginDictionary(name);
1069 value->setDouble("x", rect.x()); 1069 value->setDouble("x", rect.x());
1070 value->setDouble("y", rect.y()); 1070 value->setDouble("y", rect.y());
1071 value->setDouble("width", rect.width()); 1071 value->setDouble("width", rect.width());
1072 value->setDouble("height", rect.height()); 1072 value->setDouble("height", rect.height());
(...skipping 10 matching lines...) Expand all
1083 } 1083 }
1084 1084
1085 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForPaintInvali dationInfo(const LayoutRect& rect, const String& invalidationReason) 1085 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForPaintInvali dationInfo(const LayoutRect& rect, const String& invalidationReason)
1086 { 1086 {
1087 RefPtr<TracedValue> value = TracedValue::create(); 1087 RefPtr<TracedValue> value = TracedValue::create();
1088 addJsonObjectForRect(value.get(), "rect", rect); 1088 addJsonObjectForRect(value.get(), "rect", rect);
1089 value->setString("invalidation_reason", invalidationReason); 1089 value->setString("invalidation_reason", invalidationReason);
1090 return value; 1090 return value;
1091 } 1091 }
1092 1092
1093 LayoutRect RenderObject::computePaintInvalidationRect(const RenderLayerModelObje ct* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS tate) const 1093 LayoutRect RenderObject::computePaintInvalidationRect(const LayoutLayerModelObje ct* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS tate) const
1094 { 1094 {
1095 return clippedOverflowRectForPaintInvalidation(paintInvalidationContainer, p aintInvalidationState); 1095 return clippedOverflowRectForPaintInvalidation(paintInvalidationContainer, p aintInvalidationState);
1096 } 1096 }
1097 1097
1098 void RenderObject::invalidatePaintUsingContainer(const RenderLayerModelObject* p aintInvalidationContainer, const LayoutRect& r, PaintInvalidationReason invalida tionReason) const 1098 void RenderObject::invalidatePaintUsingContainer(const LayoutLayerModelObject* p aintInvalidationContainer, const LayoutRect& r, PaintInvalidationReason invalida tionReason) const
1099 { 1099 {
1100 if (r.isEmpty()) 1100 if (r.isEmpty())
1101 return; 1101 return;
1102 1102
1103 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { 1103 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
1104 if (RenderLayer* container = enclosingLayer()->enclosingLayerForPaintInv alidationCrossingFrameBoundaries()) 1104 if (Layer* container = enclosingLayer()->enclosingLayerForPaintInvalidat ionCrossingFrameBoundaries())
1105 invalidateDisplayItemClients(container->graphicsLayerBacking()->disp layItemList()); 1105 invalidateDisplayItemClients(container->graphicsLayerBacking()->disp layItemList());
1106 } 1106 }
1107 1107
1108 RELEASE_ASSERT(isRooted()); 1108 RELEASE_ASSERT(isRooted());
1109 1109
1110 // FIXME: Unify "devtools.timeline.invalidationTracking" and "blink.invalida tion". crbug.com/413527. 1110 // FIXME: Unify "devtools.timeline.invalidationTracking" and "blink.invalida tion". crbug.com/413527.
1111 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidati onTracking"), 1111 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidati onTracking"),
1112 "PaintInvalidationTracking", 1112 "PaintInvalidationTracking",
1113 "data", InspectorPaintInvalidationTrackingEvent::data(this, paintInvalid ationContainer)); 1113 "data", InspectorPaintInvalidationTrackingEvent::data(this, paintInvalid ationContainer));
1114 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject: :invalidatePaintUsingContainer()", 1114 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject: :invalidatePaintUsingContainer()",
1115 "object", this->debugName().ascii(), 1115 "object", this->debugName().ascii(),
1116 "info", jsonObjectForPaintInvalidationInfo(r, paintInvalidationReasonToS tring(invalidationReason))); 1116 "info", jsonObjectForPaintInvalidationInfo(r, paintInvalidationReasonToS tring(invalidationReason)));
1117 1117
1118 if (paintInvalidationContainer->isRenderView()) { 1118 if (paintInvalidationContainer->isRenderView()) {
1119 toRenderView(paintInvalidationContainer)->invalidatePaintForRectangle(r, invalidationReason); 1119 toRenderView(paintInvalidationContainer)->invalidatePaintForRectangle(r, invalidationReason);
1120 return; 1120 return;
1121 } 1121 }
1122 1122
1123 if (paintInvalidationContainer->view()->usesCompositing()) { 1123 if (paintInvalidationContainer->view()->usesCompositing()) {
1124 ASSERT(paintInvalidationContainer->isPaintInvalidationContainer()); 1124 ASSERT(paintInvalidationContainer->isPaintInvalidationContainer());
1125 paintInvalidationContainer->setBackingNeedsPaintInvalidationInRect(r, in validationReason); 1125 paintInvalidationContainer->setBackingNeedsPaintInvalidationInRect(r, in validationReason);
1126 } 1126 }
1127 } 1127 }
1128 1128
1129 void RenderObject::invalidateDisplayItemClients(DisplayItemList* displayItemList ) const 1129 void RenderObject::invalidateDisplayItemClients(DisplayItemList* displayItemList ) const
1130 { 1130 {
1131 displayItemList->invalidate(displayItemClient()); 1131 displayItemList->invalidate(displayItemClient());
1132 } 1132 }
1133 1133
1134 LayoutRect RenderObject::boundsRectForPaintInvalidation(const RenderLayerModelOb ject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidatio nState) const 1134 LayoutRect RenderObject::boundsRectForPaintInvalidation(const LayoutLayerModelOb ject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidatio nState) const
1135 { 1135 {
1136 if (!paintInvalidationContainer) 1136 if (!paintInvalidationContainer)
1137 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState); 1137 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState);
1138 return RenderLayer::computePaintInvalidationRect(this, paintInvalidationCont ainer->layer(), paintInvalidationState); 1138 return Layer::computePaintInvalidationRect(this, paintInvalidationContainer- >layer(), paintInvalidationState);
1139 } 1139 }
1140 1140
1141 void RenderObject::invalidatePaintRectangle(const LayoutRect& r) const 1141 void RenderObject::invalidatePaintRectangle(const LayoutRect& r) const
1142 { 1142 {
1143 RELEASE_ASSERT(isRooted()); 1143 RELEASE_ASSERT(isRooted());
1144 1144
1145 if (view()->document().printing()) 1145 if (view()->document().printing())
1146 return; // Don't invalidate paints if we're printing. 1146 return; // Don't invalidate paints if we're printing.
1147 1147
1148 LayoutRect dirtyRect(r); 1148 LayoutRect dirtyRect(r);
1149 1149
1150 const RenderLayerModelObject* paintInvalidationContainer = containerForPaint Invalidation(); 1150 const LayoutLayerModelObject* paintInvalidationContainer = containerForPaint Invalidation();
1151 RenderLayer::mapRectToPaintInvalidationBacking(this, paintInvalidationContai ner, dirtyRect); 1151 Layer::mapRectToPaintInvalidationBacking(this, paintInvalidationContainer, d irtyRect);
1152 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintIn validationRectangle); 1152 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintIn validationRectangle);
1153 } 1153 }
1154 1154
1155 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState) 1155 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState)
1156 { 1156 {
1157 ASSERT(!needsLayout()); 1157 ASSERT(!needsLayout());
1158 1158
1159 // If we didn't need paint invalidation then our children don't need as well . 1159 // If we didn't need paint invalidation then our children don't need as well .
1160 // Skip walking down the tree as everything should be fine below us. 1160 // Skip walking down the tree as everything should be fine below us.
1161 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) 1161 if (!shouldCheckForPaintInvalidation(paintInvalidationState))
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 return; 1199 return;
1200 selectionPaintInvalidationMap = new SelectionPaintInvalidationMap(); 1200 selectionPaintInvalidationMap = new SelectionPaintInvalidationMap();
1201 } 1201 }
1202 1202
1203 if (selectionRect.isEmpty()) 1203 if (selectionRect.isEmpty())
1204 selectionPaintInvalidationMap->remove(this); 1204 selectionPaintInvalidationMap->remove(this);
1205 else 1205 else
1206 selectionPaintInvalidationMap->set(this, selectionRect); 1206 selectionPaintInvalidationMap->set(this, selectionRect);
1207 } 1207 }
1208 1208
1209 void RenderObject::invalidateSelectionIfNeeded(const RenderLayerModelObject& pai ntInvalidationContainer, PaintInvalidationReason invalidationReason) 1209 void RenderObject::invalidateSelectionIfNeeded(const LayoutLayerModelObject& pai ntInvalidationContainer, PaintInvalidationReason invalidationReason)
1210 { 1210 {
1211 // Update selection rect when we are doing full invalidation (in case that t he object is moved, composite status changed, etc.) 1211 // Update selection rect when we are doing full invalidation (in case that t he object is moved, composite status changed, etc.)
1212 // or shouldInvalidationSelection is set (in case that the selection itself changed). 1212 // or shouldInvalidationSelection is set (in case that the selection itself changed).
1213 bool fullInvalidation = view()->doingFullPaintInvalidation() || isFullPaintI nvalidationReason(invalidationReason); 1213 bool fullInvalidation = view()->doingFullPaintInvalidation() || isFullPaintI nvalidationReason(invalidationReason);
1214 if (!fullInvalidation && !shouldInvalidateSelection()) 1214 if (!fullInvalidation && !shouldInvalidateSelection())
1215 return; 1215 return;
1216 1216
1217 LayoutRect oldSelectionRect = previousSelectionRectForPaintInvalidation(); 1217 LayoutRect oldSelectionRect = previousSelectionRectForPaintInvalidation();
1218 LayoutRect newSelectionRect = selectionRectForPaintInvalidation(&paintInvali dationContainer); 1218 LayoutRect newSelectionRect = selectionRectForPaintInvalidation(&paintInvali dationContainer);
1219 setPreviousSelectionRectForPaintInvalidation(newSelectionRect); 1219 setPreviousSelectionRectForPaintInvalidation(newSelectionRect);
1220 1220
1221 if (fullInvalidation) 1221 if (fullInvalidation)
1222 return; 1222 return;
1223 1223
1224 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection, oldSelectionRect, newSelectionRect); 1224 fullyInvalidatePaint(paintInvalidationContainer, PaintInvalidationSelection, oldSelectionRect, newSelectionRect);
1225 } 1225 }
1226 1226
1227 PaintInvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalid ationState& paintInvalidationState, const RenderLayerModelObject& paintInvalidat ionContainer) 1227 PaintInvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalid ationState& paintInvalidationState, const LayoutLayerModelObject& paintInvalidat ionContainer)
1228 { 1228 {
1229 RenderView* v = view(); 1229 RenderView* v = view();
1230 if (v->document().printing()) 1230 if (v->document().printing())
1231 return PaintInvalidationNone; // Don't invalidate paints if we're printi ng. 1231 return PaintInvalidationNone; // Don't invalidate paints if we're printi ng.
1232 1232
1233 const LayoutRect oldBounds = previousPaintInvalidationRect(); 1233 const LayoutRect oldBounds = previousPaintInvalidationRect();
1234 const LayoutPoint oldLocation = previousPositionFromPaintInvalidationBacking (); 1234 const LayoutPoint oldLocation = previousPositionFromPaintInvalidationBacking ();
1235 const LayoutRect newBounds = boundsRectForPaintInvalidation(&paintInvalidati onContainer, &paintInvalidationState); 1235 const LayoutRect newBounds = boundsRectForPaintInvalidation(&paintInvalidati onContainer, &paintInvalidationState);
1236 const LayoutPoint newLocation = RenderLayer::positionFromPaintInvalidationBa cking(this, &paintInvalidationContainer, &paintInvalidationState); 1236 const LayoutPoint newLocation = Layer::positionFromPaintInvalidationBacking( this, &paintInvalidationContainer, &paintInvalidationState);
1237 setPreviousPaintInvalidationRect(newBounds); 1237 setPreviousPaintInvalidationRect(newBounds);
1238 setPreviousPositionFromPaintInvalidationBacking(newLocation); 1238 setPreviousPositionFromPaintInvalidationBacking(newLocation);
1239 1239
1240 PaintInvalidationReason invalidationReason = paintInvalidationReason(paintIn validationContainer, oldBounds, oldLocation, newBounds, newLocation); 1240 PaintInvalidationReason invalidationReason = paintInvalidationReason(paintIn validationContainer, oldBounds, oldLocation, newBounds, newLocation);
1241 1241
1242 // We need to invalidate the selection before checking for whether we are do ing a full invalidation. 1242 // We need to invalidate the selection before checking for whether we are do ing a full invalidation.
1243 // This is because we need to update the old rect regardless. 1243 // This is because we need to update the old rect regardless.
1244 invalidateSelectionIfNeeded(paintInvalidationContainer, invalidationReason); 1244 invalidateSelectionIfNeeded(paintInvalidationContainer, invalidationReason);
1245 1245
1246 // If we are set to do a full paint invalidation that means the RenderView w ill issue 1246 // If we are set to do a full paint invalidation that means the RenderView w ill issue
(...skipping 11 matching lines...) Expand all
1258 1258
1259 if (invalidationReason == PaintInvalidationIncremental) { 1259 if (invalidationReason == PaintInvalidationIncremental) {
1260 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation); 1260 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds, newLocation);
1261 return invalidationReason; 1261 return invalidationReason;
1262 } 1262 }
1263 1263
1264 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds); 1264 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds);
1265 return invalidationReason; 1265 return invalidationReason;
1266 } 1266 }
1267 1267
1268 PaintInvalidationReason RenderObject::paintInvalidationReason(const RenderLayerM odelObject& paintInvalidationContainer, 1268 PaintInvalidationReason RenderObject::paintInvalidationReason(const LayoutLayerM odelObject& paintInvalidationContainer,
1269 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida tionBacking, 1269 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida tionBacking,
1270 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida tionBacking) const 1270 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida tionBacking) const
1271 { 1271 {
1272 // First check for InvalidationLocationChange to avoid it from being hidden by other 1272 // First check for InvalidationLocationChange to avoid it from being hidden by other
1273 // invalidation reasons because we'll need to force check for paint invalida tion for 1273 // invalidation reasons because we'll need to force check for paint invalida tion for
1274 // children when location of this object changed. 1274 // children when location of this object changed.
1275 if (newPositionFromPaintInvalidationBacking != oldPositionFromPaintInvalidat ionBacking) 1275 if (newPositionFromPaintInvalidationBacking != oldPositionFromPaintInvalidat ionBacking)
1276 return PaintInvalidationLocationChange; 1276 return PaintInvalidationLocationChange;
1277 1277
1278 if (shouldDoFullPaintInvalidation()) 1278 if (shouldDoFullPaintInvalidation())
(...skipping 22 matching lines...) Expand all
1301 // into the incremental invalidation we'll issue two invalidations instead 1301 // into the incremental invalidation we'll issue two invalidations instead
1302 // of one. 1302 // of one.
1303 if (oldBounds.isEmpty()) 1303 if (oldBounds.isEmpty())
1304 return PaintInvalidationBecameVisible; 1304 return PaintInvalidationBecameVisible;
1305 if (newBounds.isEmpty()) 1305 if (newBounds.isEmpty())
1306 return PaintInvalidationBecameInvisible; 1306 return PaintInvalidationBecameInvisible;
1307 1307
1308 return PaintInvalidationIncremental; 1308 return PaintInvalidationIncremental;
1309 } 1309 }
1310 1310
1311 void RenderObject::incrementallyInvalidatePaint(const RenderLayerModelObject& pa intInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBoun ds, const LayoutPoint& positionFromPaintInvalidationBacking) 1311 void RenderObject::incrementallyInvalidatePaint(const LayoutLayerModelObject& pa intInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBoun ds, const LayoutPoint& positionFromPaintInvalidationBacking)
1312 { 1312 {
1313 ASSERT(oldBounds.location() == newBounds.location()); 1313 ASSERT(oldBounds.location() == newBounds.location());
1314 1314
1315 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); 1315 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX();
1316 if (deltaRight > 0) 1316 if (deltaRight > 0)
1317 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ol dBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()), PaintInvalidatio nIncremental); 1317 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ol dBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()), PaintInvalidatio nIncremental);
1318 else if (deltaRight < 0) 1318 else if (deltaRight < 0)
1319 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ne wBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()), PaintInvalidati onIncremental); 1319 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ne wBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()), PaintInvalidati onIncremental);
1320 1320
1321 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); 1321 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY();
1322 if (deltaBottom > 0) 1322 if (deltaBottom > 0)
1323 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ne wBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom), PaintInvalidatio nIncremental); 1323 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ne wBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom), PaintInvalidatio nIncremental);
1324 else if (deltaBottom < 0) 1324 else if (deltaBottom < 0)
1325 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ol dBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom), PaintInvalidati onIncremental); 1325 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ol dBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom), PaintInvalidati onIncremental);
1326 } 1326 }
1327 1327
1328 void RenderObject::fullyInvalidatePaint(const RenderLayerModelObject& paintInval idationContainer, PaintInvalidationReason invalidationReason, const LayoutRect& oldBounds, const LayoutRect& newBounds) 1328 void RenderObject::fullyInvalidatePaint(const LayoutLayerModelObject& paintInval idationContainer, PaintInvalidationReason invalidationReason, const LayoutRect& oldBounds, const LayoutRect& newBounds)
1329 { 1329 {
1330 // Otherwise do full paint invalidation. 1330 // Otherwise do full paint invalidation.
1331 invalidatePaintUsingContainer(&paintInvalidationContainer, oldBounds, invali dationReason); 1331 invalidatePaintUsingContainer(&paintInvalidationContainer, oldBounds, invali dationReason);
1332 if (newBounds != oldBounds) 1332 if (newBounds != oldBounds)
1333 invalidatePaintUsingContainer(&paintInvalidationContainer, newBounds, in validationReason); 1333 invalidatePaintUsingContainer(&paintInvalidationContainer, newBounds, in validationReason);
1334 } 1334 }
1335 1335
1336 void RenderObject::invalidatePaintForOverflow() 1336 void RenderObject::invalidatePaintForOverflow()
1337 { 1337 {
1338 } 1338 }
1339 1339
1340 void RenderObject::invalidatePaintForOverflowIfNeeded() 1340 void RenderObject::invalidatePaintForOverflowIfNeeded()
1341 { 1341 {
1342 if (shouldInvalidateOverflowForPaint()) 1342 if (shouldInvalidateOverflowForPaint())
1343 invalidatePaintForOverflow(); 1343 invalidatePaintForOverflow();
1344 } 1344 }
1345 1345
1346 LayoutRect RenderObject::rectWithOutlineForPaintInvalidation(const RenderLayerMo delObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInval idationState* paintInvalidationState) const 1346 LayoutRect RenderObject::rectWithOutlineForPaintInvalidation(const LayoutLayerMo delObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInval idationState* paintInvalidationState) const
1347 { 1347 {
1348 LayoutRect r(clippedOverflowRectForPaintInvalidation(paintInvalidationContai ner, paintInvalidationState)); 1348 LayoutRect r(clippedOverflowRectForPaintInvalidation(paintInvalidationContai ner, paintInvalidationState));
1349 r.inflate(outlineWidth); 1349 r.inflate(outlineWidth);
1350 return r; 1350 return r;
1351 } 1351 }
1352 1352
1353 LayoutRect RenderObject::absoluteClippedOverflowRect() const 1353 LayoutRect RenderObject::absoluteClippedOverflowRect() const
1354 { 1354 {
1355 return clippedOverflowRectForPaintInvalidation(view()); 1355 return clippedOverflowRectForPaintInvalidation(view());
1356 } 1356 }
1357 1357
1358 LayoutRect RenderObject::clippedOverflowRectForPaintInvalidation(const RenderLay erModelObject*, const PaintInvalidationState*) const 1358 LayoutRect RenderObject::clippedOverflowRectForPaintInvalidation(const LayoutLay erModelObject*, const PaintInvalidationState*) const
1359 { 1359 {
1360 ASSERT_NOT_REACHED(); 1360 ASSERT_NOT_REACHED();
1361 return LayoutRect(); 1361 return LayoutRect();
1362 } 1362 }
1363 1363
1364 void RenderObject::mapRectToPaintInvalidationBacking(const RenderLayerModelObjec t* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* p aintInvalidationState) const 1364 void RenderObject::mapRectToPaintInvalidationBacking(const LayoutLayerModelObjec t* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* p aintInvalidationState) const
1365 { 1365 {
1366 if (paintInvalidationContainer == this) 1366 if (paintInvalidationContainer == this)
1367 return; 1367 return;
1368 1368
1369 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain tInvalidationContainer)) { 1369 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain tInvalidationContainer)) {
1370 rect.move(paintInvalidationState->paintOffset()); 1370 rect.move(paintInvalidationState->paintOffset());
1371 if (paintInvalidationState->isClipped()) 1371 if (paintInvalidationState->isClipped())
1372 rect.intersect(paintInvalidationState->clipRect()); 1372 rect.intersect(paintInvalidationState->clipRect());
1373 return; 1373 return;
1374 } 1374 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 1523
1524 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff) const 1524 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff) const
1525 { 1525 {
1526 if (diff.transformChanged() && isSVG()) 1526 if (diff.transformChanged() && isSVG())
1527 diff.setNeedsFullLayout(); 1527 diff.setNeedsFullLayout();
1528 1528
1529 // If transform changed, and the layer does not paint into its own separate backing, then we need to invalidate paints. 1529 // If transform changed, and the layer does not paint into its own separate backing, then we need to invalidate paints.
1530 if (diff.transformChanged()) { 1530 if (diff.transformChanged()) {
1531 // Text nodes share style with their parents but transforms don't apply to them, 1531 // Text nodes share style with their parents but transforms don't apply to them,
1532 // hence the !isText() check. 1532 // hence the !isText() check.
1533 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer( )->hasStyleDeterminedDirectCompositingReasons())) 1533 if (!isText() && (!hasLayer() || !toLayoutLayerModelObject(this)->layer( )->hasStyleDeterminedDirectCompositingReasons()))
1534 diff.setNeedsPaintInvalidationLayer(); 1534 diff.setNeedsPaintInvalidationLayer();
1535 } 1535 }
1536 1536
1537 // If opacity or zIndex changed, and the layer does not paint into its own s eparate backing, then we need to invalidate paints (also 1537 // If opacity or zIndex changed, and the layer does not paint into its own s eparate backing, then we need to invalidate paints (also
1538 // ignoring text nodes) 1538 // ignoring text nodes)
1539 if (diff.opacityChanged() || diff.zIndexChanged()) { 1539 if (diff.opacityChanged() || diff.zIndexChanged()) {
1540 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer( )->hasStyleDeterminedDirectCompositingReasons())) 1540 if (!isText() && (!hasLayer() || !toLayoutLayerModelObject(this)->layer( )->hasStyleDeterminedDirectCompositingReasons()))
1541 diff.setNeedsPaintInvalidationLayer(); 1541 diff.setNeedsPaintInvalidationLayer();
1542 } 1542 }
1543 1543
1544 // 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. 1544 // 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.
1545 if (diff.filterChanged() && hasLayer()) { 1545 if (diff.filterChanged() && hasLayer()) {
1546 RenderLayer* layer = toRenderLayerModelObject(this)->layer(); 1546 Layer* layer = toLayoutLayerModelObject(this)->layer();
1547 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paint sWithFilters()) 1547 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paint sWithFilters())
1548 diff.setNeedsPaintInvalidationLayer(); 1548 diff.setNeedsPaintInvalidationLayer();
1549 } 1549 }
1550 1550
1551 if (diff.textOrColorChanged() && !diff.needsPaintInvalidation()) { 1551 if (diff.textOrColorChanged() && !diff.needsPaintInvalidation()) {
1552 if (style()->hasBorder() || style()->hasOutline() 1552 if (style()->hasBorder() || style()->hasOutline()
1553 || (isText() && !toRenderText(this)->isAllCollapsibleWhitespace())) 1553 || (isText() && !toRenderText(this)->isAllCollapsibleWhitespace()))
1554 diff.setNeedsPaintInvalidationObject(); 1554 diff.setNeedsPaintInvalidationObject();
1555 } 1555 }
1556 1556
1557 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch ange without the actual 1557 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch ange without the actual
1558 // style changing, since it depends on whether we decide to composite these elements. When the 1558 // style changing, since it depends on whether we decide to composite these elements. When the
1559 // layer status of one of these elements changes, we need to force a layout. 1559 // layer status of one of these elements changes, we need to force a layout.
1560 if (!diff.needsFullLayout() && style() && isLayerModelObject()) { 1560 if (!diff.needsFullLayout() && style() && isLayoutLayerModelObject()) {
1561 bool requiresLayer = toRenderLayerModelObject(this)->layerTypeRequired() != NoLayer; 1561 bool requiresLayer = toLayoutLayerModelObject(this)->layerTypeRequired() != NoLayer;
1562 if (hasLayer() != requiresLayer) 1562 if (hasLayer() != requiresLayer)
1563 diff.setNeedsFullLayout(); 1563 diff.setNeedsFullLayout();
1564 } 1564 }
1565 1565
1566 // If we have no layer(), just treat a PaintInvalidationLayer hint as a norm al paint invalidation. 1566 // If we have no layer(), just treat a PaintInvalidationLayer hint as a norm al paint invalidation.
1567 if (diff.needsPaintInvalidationLayer() && !hasLayer()) { 1567 if (diff.needsPaintInvalidationLayer() && !hasLayer()) {
1568 diff.clearNeedsPaintInvalidation(); 1568 diff.clearNeedsPaintInvalidation();
1569 diff.setNeedsPaintInvalidationObject(); 1569 diff.setNeedsPaintInvalidationObject();
1570 } 1570 }
1571 1571
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 else if (updatedDiff.needsPositionedMovementLayout()) 1660 else if (updatedDiff.needsPositionedMovementLayout())
1661 setNeedsPositionedMovementLayout(); 1661 setNeedsPositionedMovementLayout();
1662 } 1662 }
1663 1663
1664 if (diff.transformChanged() && !needsLayout()) { 1664 if (diff.transformChanged() && !needsLayout()) {
1665 if (RenderBlock* container = containingBlock()) 1665 if (RenderBlock* container = containingBlock())
1666 container->setNeedsOverflowRecalcAfterStyleChange(); 1666 container->setNeedsOverflowRecalcAfterStyleChange();
1667 } 1667 }
1668 1668
1669 if (updatedDiff.needsPaintInvalidationLayer()) 1669 if (updatedDiff.needsPaintInvalidationLayer())
1670 toRenderLayerModelObject(this)->layer()->setShouldDoFullPaintInvalidatio nIncludingNonCompositingDescendants(); 1670 toLayoutLayerModelObject(this)->layer()->setShouldDoFullPaintInvalidatio nIncludingNonCompositingDescendants();
1671 else if (diff.needsPaintInvalidationObject() || updatedDiff.needsPaintInvali dationObject()) 1671 else if (diff.needsPaintInvalidationObject() || updatedDiff.needsPaintInvali dationObject())
1672 setShouldDoFullPaintInvalidation(); 1672 setShouldDoFullPaintInvalidation();
1673 } 1673 }
1674 1674
1675 static inline bool rendererHasBackground(const RenderObject* renderer) 1675 static inline bool rendererHasBackground(const RenderObject* renderer)
1676 { 1676 {
1677 return renderer && renderer->hasBackground(); 1677 return renderer && renderer->hasBackground();
1678 } 1678 }
1679 1679
1680 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle) 1680 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle)
1681 { 1681 {
1682 if (m_style) { 1682 if (m_style) {
1683 // If our z-index changes value or our visibility changes, 1683 // If our z-index changes value or our visibility changes,
1684 // we need to dirty our stacking context's z-order list. 1684 // we need to dirty our stacking context's z-order list.
1685 bool visibilityChanged = m_style->visibility() != newStyle.visibility() 1685 bool visibilityChanged = m_style->visibility() != newStyle.visibility()
1686 || m_style->zIndex() != newStyle.zIndex() 1686 || m_style->zIndex() != newStyle.zIndex()
1687 || m_style->hasAutoZIndex() != newStyle.hasAutoZIndex(); 1687 || m_style->hasAutoZIndex() != newStyle.hasAutoZIndex();
1688 if (visibilityChanged) { 1688 if (visibilityChanged) {
1689 document().setAnnotatedRegionsDirty(true); 1689 document().setAnnotatedRegionsDirty(true);
1690 if (AXObjectCache* cache = document().existingAXObjectCache()) 1690 if (AXObjectCache* cache = document().existingAXObjectCache())
1691 cache->childrenChanged(parent()); 1691 cache->childrenChanged(parent());
1692 } 1692 }
1693 1693
1694 // Keep layer hierarchy visibility bits up to date if visibility changes . 1694 // Keep layer hierarchy visibility bits up to date if visibility changes .
1695 if (m_style->visibility() != newStyle.visibility()) { 1695 if (m_style->visibility() != newStyle.visibility()) {
1696 // We might not have an enclosing layer yet because we might not be in the tree. 1696 // We might not have an enclosing layer yet because we might not be in the tree.
1697 if (RenderLayer* layer = enclosingLayer()) 1697 if (Layer* layer = enclosingLayer())
1698 layer->potentiallyDirtyVisibleContentStatus(newStyle.visibility( )); 1698 layer->potentiallyDirtyVisibleContentStatus(newStyle.visibility( ));
1699 } 1699 }
1700 1700
1701 if (isFloating() && (m_style->floating() != newStyle.floating())) 1701 if (isFloating() && (m_style->floating() != newStyle.floating()))
1702 // For changes in float styles, we need to conceivably remove oursel ves 1702 // For changes in float styles, we need to conceivably remove oursel ves
1703 // from the floating objects list. 1703 // from the floating objects list.
1704 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); 1704 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists();
1705 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos ition())) 1705 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos ition()))
1706 // For changes in positioning styles, we need to conceivably remove ourselves 1706 // For changes in positioning styles, we need to conceivably remove ourselves
1707 // from the positioned objects list. 1707 // from the positioned objects list.
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 } 1908 }
1909 1909
1910 FloatQuad RenderObject::absoluteToLocalQuad(const FloatQuad& quad, MapCoordinate sFlags mode) const 1910 FloatQuad RenderObject::absoluteToLocalQuad(const FloatQuad& quad, MapCoordinate sFlags mode) const
1911 { 1911 {
1912 TransformState transformState(TransformState::UnapplyInverseTransformDirecti on, quad.boundingBox().center(), quad); 1912 TransformState transformState(TransformState::UnapplyInverseTransformDirecti on, quad.boundingBox().center(), quad);
1913 mapAbsoluteToLocalPoint(mode, transformState); 1913 mapAbsoluteToLocalPoint(mode, transformState);
1914 transformState.flatten(); 1914 transformState.flatten();
1915 return transformState.lastPlanarQuad(); 1915 return transformState.lastPlanarQuad();
1916 } 1916 }
1917 1917
1918 void RenderObject::mapLocalToContainer(const RenderLayerModelObject* paintInvali dationContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const PaintInvalidationState* paintInvalidationState) const 1918 void RenderObject::mapLocalToContainer(const LayoutLayerModelObject* paintInvali dationContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const PaintInvalidationState* paintInvalidationState) const
1919 { 1919 {
1920 if (paintInvalidationContainer == this) 1920 if (paintInvalidationContainer == this)
1921 return; 1921 return;
1922 1922
1923 RenderObject* o = parent(); 1923 RenderObject* o = parent();
1924 if (!o) 1924 if (!o)
1925 return; 1925 return;
1926 1926
1927 // FIXME: this should call offsetFromContainer to share code, but I'm not su re it's ever called. 1927 // FIXME: this should call offsetFromContainer to share code, but I'm not su re it's ever called.
1928 LayoutPoint centerPoint = roundedLayoutPoint(transformState.mappedPoint()); 1928 LayoutPoint centerPoint = roundedLayoutPoint(transformState.mappedPoint());
1929 if (mode & ApplyContainerFlip && o->isBox()) { 1929 if (mode & ApplyContainerFlip && o->isBox()) {
1930 if (o->style()->isFlippedBlocksWritingMode()) 1930 if (o->style()->isFlippedBlocksWritingMode())
1931 transformState.move(toRenderBox(o)->flipForWritingModeIncludingColum ns(roundedLayoutPoint(transformState.mappedPoint())) - centerPoint); 1931 transformState.move(toRenderBox(o)->flipForWritingModeIncludingColum ns(roundedLayoutPoint(transformState.mappedPoint())) - centerPoint);
1932 mode &= ~ApplyContainerFlip; 1932 mode &= ~ApplyContainerFlip;
1933 } 1933 }
1934 1934
1935 transformState.move(o->columnOffset(roundedLayoutPoint(transformState.mapped Point()))); 1935 transformState.move(o->columnOffset(roundedLayoutPoint(transformState.mapped Point())));
1936 1936
1937 if (o->hasOverflowClip()) 1937 if (o->hasOverflowClip())
1938 transformState.move(-toRenderBox(o)->scrolledContentOffset()); 1938 transformState.move(-toRenderBox(o)->scrolledContentOffset());
1939 1939
1940 o->mapLocalToContainer(paintInvalidationContainer, transformState, mode, was Fixed, paintInvalidationState); 1940 o->mapLocalToContainer(paintInvalidationContainer, transformState, mode, was Fixed, paintInvalidationState);
1941 } 1941 }
1942 1942
1943 const RenderObject* RenderObject::pushMappingToContainer(const RenderLayerModelO bject* ancestorToStopAt, RenderGeometryMap& geometryMap) const 1943 const RenderObject* RenderObject::pushMappingToContainer(const LayoutLayerModelO bject* ancestorToStopAt, RenderGeometryMap& geometryMap) const
1944 { 1944 {
1945 ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != this); 1945 ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != this);
1946 1946
1947 RenderObject* container = parent(); 1947 RenderObject* container = parent();
1948 if (!container) 1948 if (!container)
1949 return 0; 1949 return 0;
1950 1950
1951 // FIXME: this should call offsetFromContainer to share code, but I'm not su re it's ever called. 1951 // FIXME: this should call offsetFromContainer to share code, but I'm not su re it's ever called.
1952 LayoutSize offset; 1952 LayoutSize offset;
1953 if (container->hasOverflowClip()) 1953 if (container->hasOverflowClip())
(...skipping 11 matching lines...) Expand all
1965 o->mapAbsoluteToLocalPoint(mode, transformState); 1965 o->mapAbsoluteToLocalPoint(mode, transformState);
1966 if (o->hasOverflowClip()) 1966 if (o->hasOverflowClip())
1967 transformState.move(toRenderBox(o)->scrolledContentOffset()); 1967 transformState.move(toRenderBox(o)->scrolledContentOffset());
1968 } 1968 }
1969 } 1969 }
1970 1970
1971 bool RenderObject::shouldUseTransformFromContainer(const RenderObject* container Object) const 1971 bool RenderObject::shouldUseTransformFromContainer(const RenderObject* container Object) const
1972 { 1972 {
1973 // hasTransform() indicates whether the object has transform, transform-styl e or perspective. We just care about transform, 1973 // hasTransform() indicates whether the object has transform, transform-styl e or perspective. We just care about transform,
1974 // so check the layer's transform directly. 1974 // so check the layer's transform directly.
1975 return (hasLayer() && toRenderLayerModelObject(this)->layer()->transform()) || (containerObject && containerObject->style()->hasPerspective()); 1975 return (hasLayer() && toLayoutLayerModelObject(this)->layer()->transform()) || (containerObject && containerObject->style()->hasPerspective());
1976 } 1976 }
1977 1977
1978 void RenderObject::getTransformFromContainer(const RenderObject* containerObject , const LayoutSize& offsetInContainer, TransformationMatrix& transform) const 1978 void RenderObject::getTransformFromContainer(const RenderObject* containerObject , const LayoutSize& offsetInContainer, TransformationMatrix& transform) const
1979 { 1979 {
1980 transform.makeIdentity(); 1980 transform.makeIdentity();
1981 transform.translate(offsetInContainer.width().toFloat(), offsetInContainer.h eight().toFloat()); 1981 transform.translate(offsetInContainer.width().toFloat(), offsetInContainer.h eight().toFloat());
1982 RenderLayer* layer = hasLayer() ? toRenderLayerModelObject(this)->layer() : 0; 1982 Layer* layer = hasLayer() ? toLayoutLayerModelObject(this)->layer() : 0;
1983 if (layer && layer->transform()) 1983 if (layer && layer->transform())
1984 transform.multiply(layer->currentTransform()); 1984 transform.multiply(layer->currentTransform());
1985 1985
1986 if (containerObject && containerObject->hasLayer() && containerObject->style ()->hasPerspective()) { 1986 if (containerObject && containerObject->hasLayer() && containerObject->style ()->hasPerspective()) {
1987 // Perpsective on the container affects us, so we have to factor it in h ere. 1987 // Perpsective on the container affects us, so we have to factor it in h ere.
1988 ASSERT(containerObject->hasLayer()); 1988 ASSERT(containerObject->hasLayer());
1989 FloatPoint perspectiveOrigin = toRenderLayerModelObject(containerObject) ->layer()->perspectiveOrigin(); 1989 FloatPoint perspectiveOrigin = toLayoutLayerModelObject(containerObject) ->layer()->perspectiveOrigin();
1990 1990
1991 TransformationMatrix perspectiveMatrix; 1991 TransformationMatrix perspectiveMatrix;
1992 perspectiveMatrix.applyPerspective(containerObject->style()->perspective ()); 1992 perspectiveMatrix.applyPerspective(containerObject->style()->perspective ());
1993 1993
1994 transform.translateRight3d(-perspectiveOrigin.x(), -perspectiveOrigin.y( ), 0); 1994 transform.translateRight3d(-perspectiveOrigin.x(), -perspectiveOrigin.y( ), 0);
1995 transform = perspectiveMatrix * transform; 1995 transform = perspectiveMatrix * transform;
1996 transform.translateRight3d(perspectiveOrigin.x(), perspectiveOrigin.y(), 0); 1996 transform.translateRight3d(perspectiveOrigin.x(), perspectiveOrigin.y(), 0);
1997 } 1997 }
1998 } 1998 }
1999 1999
2000 FloatQuad RenderObject::localToContainerQuad(const FloatQuad& localQuad, const R enderLayerModelObject* paintInvalidationContainer, MapCoordinatesFlags mode, boo l* wasFixed) const 2000 FloatQuad RenderObject::localToContainerQuad(const FloatQuad& localQuad, const L ayoutLayerModelObject* paintInvalidationContainer, MapCoordinatesFlags mode, boo l* wasFixed) const
2001 { 2001 {
2002 // Track the point at the center of the quad's bounding box. As mapLocalToCo ntainer() calls offsetFromContainer(), 2002 // Track the point at the center of the quad's bounding box. As mapLocalToCo ntainer() calls offsetFromContainer(),
2003 // it will use that point as the reference point to decide which column's tr ansform to apply in multiple-column blocks. 2003 // it will use that point as the reference point to decide which column's tr ansform to apply in multiple-column blocks.
2004 TransformState transformState(TransformState::ApplyTransformDirection, local Quad.boundingBox().center(), localQuad); 2004 TransformState transformState(TransformState::ApplyTransformDirection, local Quad.boundingBox().center(), localQuad);
2005 mapLocalToContainer(paintInvalidationContainer, transformState, mode | Apply ContainerFlip | UseTransforms, wasFixed); 2005 mapLocalToContainer(paintInvalidationContainer, transformState, mode | Apply ContainerFlip | UseTransforms, wasFixed);
2006 transformState.flatten(); 2006 transformState.flatten();
2007 2007
2008 return transformState.lastPlanarQuad(); 2008 return transformState.lastPlanarQuad();
2009 } 2009 }
2010 2010
2011 FloatPoint RenderObject::localToContainerPoint(const FloatPoint& localPoint, con st RenderLayerModelObject* paintInvalidationContainer, MapCoordinatesFlags mode, bool* wasFixed, const PaintInvalidationState* paintInvalidationState) const 2011 FloatPoint RenderObject::localToContainerPoint(const FloatPoint& localPoint, con st LayoutLayerModelObject* paintInvalidationContainer, MapCoordinatesFlags mode, bool* wasFixed, const PaintInvalidationState* paintInvalidationState) const
2012 { 2012 {
2013 TransformState transformState(TransformState::ApplyTransformDirection, local Point); 2013 TransformState transformState(TransformState::ApplyTransformDirection, local Point);
2014 mapLocalToContainer(paintInvalidationContainer, transformState, mode | Apply ContainerFlip | UseTransforms, wasFixed, paintInvalidationState); 2014 mapLocalToContainer(paintInvalidationContainer, transformState, mode | Apply ContainerFlip | UseTransforms, wasFixed, paintInvalidationState);
2015 transformState.flatten(); 2015 transformState.flatten();
2016 2016
2017 return transformState.lastPlanarPoint(); 2017 return transformState.lastPlanarPoint();
2018 } 2018 }
2019 2019
2020 FloatPoint RenderObject::localToInvalidationBackingPoint(const LayoutPoint& loca lPoint, RenderLayer** backingLayer) 2020 FloatPoint RenderObject::localToInvalidationBackingPoint(const LayoutPoint& loca lPoint, Layer** backingLayer)
2021 { 2021 {
2022 const RenderLayerModelObject* paintInvalidationContainer = containerForPaint Invalidation(); 2022 const LayoutLayerModelObject* paintInvalidationContainer = containerForPaint Invalidation();
2023 ASSERT(paintInvalidationContainer); 2023 ASSERT(paintInvalidationContainer);
2024 ASSERT(paintInvalidationContainer->layer()); 2024 ASSERT(paintInvalidationContainer->layer());
2025 2025
2026 if (backingLayer) 2026 if (backingLayer)
2027 *backingLayer = paintInvalidationContainer->layer(); 2027 *backingLayer = paintInvalidationContainer->layer();
2028 FloatPoint containerPoint = localToContainerPoint(FloatPoint(localPoint), pa intInvalidationContainer, TraverseDocumentBoundaries); 2028 FloatPoint containerPoint = localToContainerPoint(FloatPoint(localPoint), pa intInvalidationContainer, TraverseDocumentBoundaries);
2029 2029
2030 // A renderer can have no invalidation backing if it is from a detached fram e, 2030 // A renderer can have no invalidation backing if it is from a detached fram e,
2031 // or when forced compositing is disabled. 2031 // or when forced compositing is disabled.
2032 if (paintInvalidationContainer->layer()->compositingState() == NotComposited ) 2032 if (paintInvalidationContainer->layer()->compositingState() == NotComposited )
2033 return containerPoint; 2033 return containerPoint;
2034 2034
2035 RenderLayer::mapPointToPaintBackingCoordinates(paintInvalidationContainer, c ontainerPoint); 2035 Layer::mapPointToPaintBackingCoordinates(paintInvalidationContainer, contain erPoint);
2036 return containerPoint; 2036 return containerPoint;
2037 } 2037 }
2038 2038
2039 LayoutSize RenderObject::offsetFromContainer(const RenderObject* o, const Layout Point& point, bool* offsetDependsOnPoint) const 2039 LayoutSize RenderObject::offsetFromContainer(const RenderObject* o, const Layout Point& point, bool* offsetDependsOnPoint) const
2040 { 2040 {
2041 ASSERT(o == container()); 2041 ASSERT(o == container());
2042 2042
2043 LayoutSize offset = o->columnOffset(point); 2043 LayoutSize offset = o->columnOffset(point);
2044 2044
2045 if (o->hasOverflowClip()) 2045 if (o->hasOverflowClip())
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 *extraWidthToEndOfLine = 0; 2080 *extraWidthToEndOfLine = 0;
2081 2081
2082 return LayoutRect(); 2082 return LayoutRect();
2083 } 2083 }
2084 2084
2085 void RenderObject::computeLayerHitTestRects(LayerHitTestRects& layerRects) const 2085 void RenderObject::computeLayerHitTestRects(LayerHitTestRects& layerRects) const
2086 { 2086 {
2087 // Figure out what layer our container is in. Any offset (or new layer) for this 2087 // Figure out what layer our container is in. Any offset (or new layer) for this
2088 // renderer within it's container will be applied in addLayerHitTestRects. 2088 // renderer within it's container will be applied in addLayerHitTestRects.
2089 LayoutPoint layerOffset; 2089 LayoutPoint layerOffset;
2090 const RenderLayer* currentLayer = 0; 2090 const Layer* currentLayer = 0;
2091 2091
2092 if (!hasLayer()) { 2092 if (!hasLayer()) {
2093 RenderObject* container = this->container(); 2093 RenderObject* container = this->container();
2094 currentLayer = container->enclosingLayer(); 2094 currentLayer = container->enclosingLayer();
2095 if (container && currentLayer->renderer() != container) { 2095 if (container && currentLayer->renderer() != container) {
2096 layerOffset.move(container->offsetFromAncestorContainer(currentLayer ->renderer())); 2096 layerOffset.move(container->offsetFromAncestorContainer(currentLayer ->renderer()));
2097 // If the layer itself is scrolled, we have to undo the subtraction of its scroll 2097 // If the layer itself is scrolled, we have to undo the subtraction of its scroll
2098 // offset since we want the offset relative to the scrolling content , not the 2098 // offset since we want the offset relative to the scrolling content , not the
2099 // element itself. 2099 // element itself.
2100 if (currentLayer->renderer()->hasOverflowClip()) 2100 if (currentLayer->renderer()->hasOverflowClip())
2101 layerOffset.move(currentLayer->renderBox()->scrolledContentOffse t()); 2101 layerOffset.move(currentLayer->renderBox()->scrolledContentOffse t());
2102 } 2102 }
2103 } 2103 }
2104 2104
2105 this->addLayerHitTestRects(layerRects, currentLayer, layerOffset, LayoutRect ()); 2105 this->addLayerHitTestRects(layerRects, currentLayer, layerOffset, LayoutRect ());
2106 } 2106 }
2107 2107
2108 void RenderObject::addLayerHitTestRects(LayerHitTestRects& layerRects, const Ren derLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& contai nerRect) const 2108 void RenderObject::addLayerHitTestRects(LayerHitTestRects& layerRects, const Lay er* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRec t) const
2109 { 2109 {
2110 ASSERT(currentLayer); 2110 ASSERT(currentLayer);
2111 ASSERT(currentLayer == this->enclosingLayer()); 2111 ASSERT(currentLayer == this->enclosingLayer());
2112 2112
2113 // Compute the rects for this renderer only and add them to the results. 2113 // Compute the rects for this renderer only and add them to the results.
2114 // Note that we could avoid passing the offset and instead adjust each resul t, but this 2114 // Note that we could avoid passing the offset and instead adjust each resul t, but this
2115 // seems slightly simpler. 2115 // seems slightly simpler.
2116 Vector<LayoutRect> ownRects; 2116 Vector<LayoutRect> ownRects;
2117 LayoutRect newContainerRect; 2117 LayoutRect newContainerRect;
2118 computeSelfHitTestRects(ownRects, layerOffset); 2118 computeSelfHitTestRects(ownRects, layerOffset);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 } 2159 }
2160 } 2160 }
2161 } 2161 }
2162 2162
2163 bool RenderObject::isRooted() const 2163 bool RenderObject::isRooted() const
2164 { 2164 {
2165 const RenderObject* object = this; 2165 const RenderObject* object = this;
2166 while (object->parent() && !object->hasLayer()) 2166 while (object->parent() && !object->hasLayer())
2167 object = object->parent(); 2167 object = object->parent();
2168 if (object->hasLayer()) 2168 if (object->hasLayer())
2169 return toRenderLayerModelObject(object)->layer()->root()->isRootLayer(); 2169 return toLayoutLayerModelObject(object)->layer()->root()->isRootLayer();
2170 return false; 2170 return false;
2171 } 2171 }
2172 2172
2173 RenderObject* RenderObject::rendererForRootBackground() 2173 RenderObject* RenderObject::rendererForRootBackground()
2174 { 2174 {
2175 ASSERT(isDocumentElement()); 2175 ASSERT(isDocumentElement());
2176 if (!hasBackground() && isHTMLHtmlElement(node())) { 2176 if (!hasBackground() && isHTMLHtmlElement(node())) {
2177 // Locate the <body> element using the DOM. This is easier than trying 2177 // Locate the <body> element using the DOM. This is easier than trying
2178 // to crawl around a render tree with potential :before/:after content a nd 2178 // to crawl around a render tree with potential :before/:after content a nd
2179 // anonymous blocks created by inline <body> tags etc. We can locate the <body> 2179 // anonymous blocks created by inline <body> tags etc. We can locate the <body>
(...skipping 13 matching lines...) Expand all
2193 // an <img> and the setting to respect it everywhere is set. 2193 // an <img> and the setting to respect it everywhere is set.
2194 return document().isImageDocument() 2194 return document().isImageDocument()
2195 || (document().settings() && document().settings()->shouldRespectImageOr ientation() && isHTMLImageElement(node())) ? RespectImageOrientation : DoNotResp ectImageOrientation; 2195 || (document().settings() && document().settings()->shouldRespectImageOr ientation() && isHTMLImageElement(node())) ? RespectImageOrientation : DoNotResp ectImageOrientation;
2196 } 2196 }
2197 2197
2198 bool RenderObject::hasEntirelyFixedBackground() const 2198 bool RenderObject::hasEntirelyFixedBackground() const
2199 { 2199 {
2200 return m_style->hasEntirelyFixedBackground(); 2200 return m_style->hasEntirelyFixedBackground();
2201 } 2201 }
2202 2202
2203 RenderObject* RenderObject::container(const RenderLayerModelObject* paintInvalid ationContainer, bool* paintInvalidationContainerSkipped) const 2203 RenderObject* RenderObject::container(const LayoutLayerModelObject* paintInvalid ationContainer, bool* paintInvalidationContainerSkipped) const
2204 { 2204 {
2205 if (paintInvalidationContainerSkipped) 2205 if (paintInvalidationContainerSkipped)
2206 *paintInvalidationContainerSkipped = false; 2206 *paintInvalidationContainerSkipped = false;
2207 2207
2208 // This method is extremely similar to containingBlock(), but with a few not able 2208 // This method is extremely similar to containingBlock(), but with a few not able
2209 // exceptions. 2209 // exceptions.
2210 // (1) It can be used on orphaned subtrees, i.e., it can be called safely ev en when 2210 // (1) It can be used on orphaned subtrees, i.e., it can be called safely ev en when
2211 // the object is not part of the primary document subtree yet. 2211 // the object is not part of the primary document subtree yet.
2212 // (2) For normal flow elements, it just returns the parent. 2212 // (2) For normal flow elements, it just returns the parent.
2213 // (3) For absolute positioned elements, it will return a relative positione d inline. 2213 // (3) For absolute positioned elements, it will return a relative positione d inline.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 2328
2329 clearLayoutRootIfNeeded(); 2329 clearLayoutRootIfNeeded();
2330 } 2330 }
2331 2331
2332 void RenderObject::insertedIntoTree() 2332 void RenderObject::insertedIntoTree()
2333 { 2333 {
2334 // FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion. 2334 // FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion.
2335 2335
2336 // Keep our layer hierarchy updated. Optimize for the common case where we d on't have any children 2336 // Keep our layer hierarchy updated. Optimize for the common case where we d on't have any children
2337 // and don't have a layer attached to ourselves. 2337 // and don't have a layer attached to ourselves.
2338 RenderLayer* layer = 0; 2338 Layer* layer = 0;
2339 if (slowFirstChild() || hasLayer()) { 2339 if (slowFirstChild() || hasLayer()) {
2340 layer = parent()->enclosingLayer(); 2340 layer = parent()->enclosingLayer();
2341 addLayers(layer); 2341 addLayers(layer);
2342 } 2342 }
2343 2343
2344 // If |this| is visible but this object was not, tell the layer it has some visible content 2344 // If |this| is visible but this object was not, tell the layer it has some visible content
2345 // that needs to be drawn and layer visibility optimization can't be used 2345 // that needs to be drawn and layer visibility optimization can't be used
2346 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) { 2346 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) {
2347 if (!layer) 2347 if (!layer)
2348 layer = parent()->enclosingLayer(); 2348 layer = parent()->enclosingLayer();
2349 if (layer) 2349 if (layer)
2350 layer->dirtyVisibleContentStatus(); 2350 layer->dirtyVisibleContentStatus();
2351 } 2351 }
2352 2352
2353 if (!isFloating() && parent()->childrenInline()) 2353 if (!isFloating() && parent()->childrenInline())
2354 parent()->dirtyLinesFromChangedChild(this); 2354 parent()->dirtyLinesFromChangedChild(this);
2355 2355
2356 if (RenderFlowThread* flowThread = parent()->flowThreadContainingBlock()) 2356 if (RenderFlowThread* flowThread = parent()->flowThreadContainingBlock())
2357 flowThread->flowThreadDescendantWasInserted(this); 2357 flowThread->flowThreadDescendantWasInserted(this);
2358 } 2358 }
2359 2359
2360 void RenderObject::willBeRemovedFromTree() 2360 void RenderObject::willBeRemovedFromTree()
2361 { 2361 {
2362 // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removal s which would need to be fixed first. 2362 // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removal s which would need to be fixed first.
2363 2363
2364 // If we remove a visible child from an invisible parent, we don't know the layer visibility any more. 2364 // If we remove a visible child from an invisible parent, we don't know the layer visibility any more.
2365 RenderLayer* layer = 0; 2365 Layer* layer = 0;
2366 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) { 2366 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) {
2367 layer = parent()->enclosingLayer(); 2367 layer = parent()->enclosingLayer();
2368 if (layer) 2368 if (layer)
2369 layer->dirtyVisibleContentStatus(); 2369 layer->dirtyVisibleContentStatus();
2370 } 2370 }
2371 2371
2372 // Keep our layer hierarchy updated. 2372 // Keep our layer hierarchy updated.
2373 if (slowFirstChild() || hasLayer()) { 2373 if (slowFirstChild() || hasLayer()) {
2374 if (!layer) 2374 if (!layer)
2375 layer = parent()->enclosingLayer(); 2375 layer = parent()->enclosingLayer();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2499 node()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFor Tracing::create(StyleChangeReason::Drag)); 2499 node()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFor Tracing::create(StyleChangeReason::Drag));
2500 else if (style()->affectedByDrag()) 2500 else if (style()->affectedByDrag())
2501 node()->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr acing::create(StyleChangeReason::Drag)); 2501 node()->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr acing::create(StyleChangeReason::Drag));
2502 } 2502 }
2503 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling() ) 2503 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling() )
2504 curr->updateDragState(dragOn); 2504 curr->updateDragState(dragOn);
2505 } 2505 }
2506 2506
2507 CompositingState RenderObject::compositingState() const 2507 CompositingState RenderObject::compositingState() const
2508 { 2508 {
2509 return hasLayer() ? toRenderLayerModelObject(this)->layer()->compositingStat e() : NotComposited; 2509 return hasLayer() ? toLayoutLayerModelObject(this)->layer()->compositingStat e() : NotComposited;
2510 } 2510 }
2511 2511
2512 CompositingReasons RenderObject::additionalCompositingReasons() const 2512 CompositingReasons RenderObject::additionalCompositingReasons() const
2513 { 2513 {
2514 return CompositingReasonNone; 2514 return CompositingReasonNone;
2515 } 2515 }
2516 2516
2517 bool RenderObject::hitTest(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffse t, HitTestFilter hitTestFilter) 2517 bool RenderObject::hitTest(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffse t, HitTestFilter hitTestFilter)
2518 { 2518 {
2519 bool inside = false; 2519 bool inside = false;
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
3126 { 3126 {
3127 return gModifyRenderTreeStructureAnyState; 3127 return gModifyRenderTreeStructureAnyState;
3128 } 3128 }
3129 3129
3130 // Since we're only painting non-composited layers, we know that they all share the same paintInvalidationContainer. 3130 // Since we're only painting non-composited layers, we know that they all share the same paintInvalidationContainer.
3131 void RenderObject::invalidatePaintIncludingNonCompositingDescendants() 3131 void RenderObject::invalidatePaintIncludingNonCompositingDescendants()
3132 { 3132 {
3133 invalidatePaintIncludingNonCompositingDescendantsInternal(containerForPaintI nvalidation()); 3133 invalidatePaintIncludingNonCompositingDescendantsInternal(containerForPaintI nvalidation());
3134 } 3134 }
3135 3135
3136 void RenderObject::invalidatePaintIncludingNonCompositingDescendantsInternal(con st RenderLayerModelObject* paintInvalidationContainer) 3136 void RenderObject::invalidatePaintIncludingNonCompositingDescendantsInternal(con st LayoutLayerModelObject* paintInvalidationContainer)
3137 { 3137 {
3138 invalidatePaintUsingContainer(paintInvalidationContainer, previousPaintInval idationRect(), PaintInvalidationLayer); 3138 invalidatePaintUsingContainer(paintInvalidationContainer, previousPaintInval idationRect(), PaintInvalidationLayer);
3139 3139
3140 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { 3140 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli ng()) {
3141 if (!child->isPaintInvalidationContainer()) 3141 if (!child->isPaintInvalidationContainer())
3142 child->invalidatePaintIncludingNonCompositingDescendantsInternal(pai ntInvalidationContainer); 3142 child->invalidatePaintIncludingNonCompositingDescendantsInternal(pai ntInvalidationContainer);
3143 } 3143 }
3144 } 3144 }
3145 3145
3146 3146
(...skipping 22 matching lines...) Expand all
3169 { 3169 {
3170 if (object1) { 3170 if (object1) {
3171 const blink::RenderObject* root = object1; 3171 const blink::RenderObject* root = object1;
3172 while (root->parent()) 3172 while (root->parent())
3173 root = root->parent(); 3173 root = root->parent();
3174 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3174 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3175 } 3175 }
3176 } 3176 }
3177 3177
3178 #endif 3178 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderObjectChildList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698