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

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

Issue 295513003: add 'slow' prefix to RenderObject's firstChild() / lastChild() methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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/RenderRuby.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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 RenderObjectChildList* children = virtualChildren(); 349 RenderObjectChildList* children = virtualChildren();
350 ASSERT(children); 350 ASSERT(children);
351 if (!children) 351 if (!children)
352 return; 352 return;
353 353
354 children->removeChildNode(this, oldChild); 354 children->removeChildNode(this, oldChild);
355 } 355 }
356 356
357 RenderObject* RenderObject::nextInPreOrder() const 357 RenderObject* RenderObject::nextInPreOrder() const
358 { 358 {
359 if (RenderObject* o = firstChild()) 359 if (RenderObject* o = slowFirstChild())
360 return o; 360 return o;
361 361
362 return nextInPreOrderAfterChildren(); 362 return nextInPreOrderAfterChildren();
363 } 363 }
364 364
365 RenderObject* RenderObject::nextInPreOrderAfterChildren() const 365 RenderObject* RenderObject::nextInPreOrderAfterChildren() const
366 { 366 {
367 RenderObject* o; 367 RenderObject* o;
368 if (!(o = nextSibling())) { 368 if (!(o = nextSibling())) {
369 o = parent(); 369 o = parent();
370 while (o && !o->nextSibling()) 370 while (o && !o->nextSibling())
371 o = o->parent(); 371 o = o->parent();
372 if (o) 372 if (o)
373 o = o->nextSibling(); 373 o = o->nextSibling();
374 } 374 }
375 375
376 return o; 376 return o;
377 } 377 }
378 378
379 RenderObject* RenderObject::nextInPreOrder(const RenderObject* stayWithin) const 379 RenderObject* RenderObject::nextInPreOrder(const RenderObject* stayWithin) const
380 { 380 {
381 if (RenderObject* o = firstChild()) 381 if (RenderObject* o = slowFirstChild())
382 return o; 382 return o;
383 383
384 return nextInPreOrderAfterChildren(stayWithin); 384 return nextInPreOrderAfterChildren(stayWithin);
385 } 385 }
386 386
387 RenderObject* RenderObject::nextInPreOrderAfterChildren(const RenderObject* stay Within) const 387 RenderObject* RenderObject::nextInPreOrderAfterChildren(const RenderObject* stay Within) const
388 { 388 {
389 if (this == stayWithin) 389 if (this == stayWithin)
390 return 0; 390 return 0;
391 391
392 const RenderObject* current = this; 392 const RenderObject* current = this;
393 RenderObject* next; 393 RenderObject* next;
394 while (!(next = current->nextSibling())) { 394 while (!(next = current->nextSibling())) {
395 current = current->parent(); 395 current = current->parent();
396 if (!current || current == stayWithin) 396 if (!current || current == stayWithin)
397 return 0; 397 return 0;
398 } 398 }
399 return next; 399 return next;
400 } 400 }
401 401
402 RenderObject* RenderObject::previousInPreOrder() const 402 RenderObject* RenderObject::previousInPreOrder() const
403 { 403 {
404 if (RenderObject* o = previousSibling()) { 404 if (RenderObject* o = previousSibling()) {
405 while (o->lastChild()) 405 while (RenderObject* lastChild = o->slowLastChild())
406 o = o->lastChild(); 406 o = lastChild;
407 return o; 407 return o;
408 } 408 }
409 409
410 return parent(); 410 return parent();
411 } 411 }
412 412
413 RenderObject* RenderObject::previousInPreOrder(const RenderObject* stayWithin) c onst 413 RenderObject* RenderObject::previousInPreOrder(const RenderObject* stayWithin) c onst
414 { 414 {
415 if (this == stayWithin) 415 if (this == stayWithin)
416 return 0; 416 return 0;
417 417
418 return previousInPreOrder(); 418 return previousInPreOrder();
419 } 419 }
420 420
421 RenderObject* RenderObject::childAt(unsigned index) const 421 RenderObject* RenderObject::childAt(unsigned index) const
422 { 422 {
423 RenderObject* child = firstChild(); 423 RenderObject* child = slowFirstChild();
424 for (unsigned i = 0; child && i < index; i++) 424 for (unsigned i = 0; child && i < index; i++)
425 child = child->nextSibling(); 425 child = child->nextSibling();
426 return child; 426 return child;
427 } 427 }
428 428
429 RenderObject* RenderObject::lastLeafChild() const 429 RenderObject* RenderObject::lastLeafChild() const
430 { 430 {
431 RenderObject* r = lastChild(); 431 RenderObject* r = slowLastChild();
432 while (r) { 432 while (r) {
433 RenderObject* n = 0; 433 RenderObject* n = 0;
434 n = r->lastChild(); 434 n = r->slowLastChild();
435 if (!n) 435 if (!n)
436 break; 436 break;
437 r = n; 437 r = n;
438 } 438 }
439 return r; 439 return r;
440 } 440 }
441 441
442 static void addLayers(RenderObject* obj, RenderLayer* parentLayer, RenderObject* & newObject, 442 static void addLayers(RenderObject* obj, RenderLayer* parentLayer, RenderObject* & newObject,
443 RenderLayer*& beforeChild) 443 RenderLayer*& beforeChild)
444 { 444 {
445 if (obj->hasLayer()) { 445 if (obj->hasLayer()) {
446 if (!beforeChild && newObject) { 446 if (!beforeChild && newObject) {
447 // We need to figure out the layer that follows newObject. We only d o 447 // We need to figure out the layer that follows newObject. We only d o
448 // this the first time we find a child layer, and then we update the 448 // this the first time we find a child layer, and then we update the
449 // pointer values for newObject and beforeChild used by everyone els e. 449 // pointer values for newObject and beforeChild used by everyone els e.
450 beforeChild = newObject->parent()->findNextLayer(parentLayer, newObj ect); 450 beforeChild = newObject->parent()->findNextLayer(parentLayer, newObj ect);
451 newObject = 0; 451 newObject = 0;
452 } 452 }
453 parentLayer->addChild(toRenderLayerModelObject(obj)->layer(), beforeChil d); 453 parentLayer->addChild(toRenderLayerModelObject(obj)->layer(), beforeChil d);
454 return; 454 return;
455 } 455 }
456 456
457 for (RenderObject* curr = obj->firstChild(); curr; curr = curr->nextSibling( )) 457 for (RenderObject* curr = obj->slowFirstChild(); curr; curr = curr->nextSibl ing())
458 addLayers(curr, parentLayer, newObject, beforeChild); 458 addLayers(curr, parentLayer, newObject, beforeChild);
459 } 459 }
460 460
461 void RenderObject::addLayers(RenderLayer* parentLayer) 461 void RenderObject::addLayers(RenderLayer* parentLayer)
462 { 462 {
463 if (!parentLayer) 463 if (!parentLayer)
464 return; 464 return;
465 465
466 RenderObject* object = this; 466 RenderObject* object = this;
467 RenderLayer* beforeChild = 0; 467 RenderLayer* beforeChild = 0;
468 WebCore::addLayers(this, parentLayer, object, beforeChild); 468 WebCore::addLayers(this, parentLayer, object, beforeChild);
469 } 469 }
470 470
471 void RenderObject::removeLayers(RenderLayer* parentLayer) 471 void RenderObject::removeLayers(RenderLayer* parentLayer)
472 { 472 {
473 if (!parentLayer) 473 if (!parentLayer)
474 return; 474 return;
475 475
476 if (hasLayer()) { 476 if (hasLayer()) {
477 parentLayer->removeChild(toRenderLayerModelObject(this)->layer()); 477 parentLayer->removeChild(toRenderLayerModelObject(this)->layer());
478 return; 478 return;
479 } 479 }
480 480
481 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) 481 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling() )
482 curr->removeLayers(parentLayer); 482 curr->removeLayers(parentLayer);
483 } 483 }
484 484
485 void RenderObject::moveLayers(RenderLayer* oldParent, RenderLayer* newParent) 485 void RenderObject::moveLayers(RenderLayer* oldParent, RenderLayer* newParent)
486 { 486 {
487 if (!newParent) 487 if (!newParent)
488 return; 488 return;
489 489
490 if (hasLayer()) { 490 if (hasLayer()) {
491 RenderLayer* layer = toRenderLayerModelObject(this)->layer(); 491 RenderLayer* layer = toRenderLayerModelObject(this)->layer();
492 ASSERT(oldParent == layer->parent()); 492 ASSERT(oldParent == layer->parent());
493 if (oldParent) 493 if (oldParent)
494 oldParent->removeChild(layer); 494 oldParent->removeChild(layer);
495 newParent->addChild(layer); 495 newParent->addChild(layer);
496 return; 496 return;
497 } 497 }
498 498
499 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) 499 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling() )
500 curr->moveLayers(oldParent, newParent); 500 curr->moveLayers(oldParent, newParent);
501 } 501 }
502 502
503 RenderLayer* RenderObject::findNextLayer(RenderLayer* parentLayer, RenderObject* startPoint, 503 RenderLayer* RenderObject::findNextLayer(RenderLayer* parentLayer, RenderObject* startPoint,
504 bool checkParent) 504 bool checkParent)
505 { 505 {
506 // Error check the parent layer passed in. If it's null, we can't find anyth ing. 506 // Error check the parent layer passed in. If it's null, we can't find anyth ing.
507 if (!parentLayer) 507 if (!parentLayer)
508 return 0; 508 return 0;
509 509
510 // Step 1: If our layer is a child of the desired parent, then return our la yer. 510 // Step 1: If our layer is a child of the desired parent, then return our la yer.
511 RenderLayer* ourLayer = hasLayer() ? toRenderLayerModelObject(this)->layer() : 0; 511 RenderLayer* ourLayer = hasLayer() ? toRenderLayerModelObject(this)->layer() : 0;
512 if (ourLayer && ourLayer->parent() == parentLayer) 512 if (ourLayer && ourLayer->parent() == parentLayer)
513 return ourLayer; 513 return ourLayer;
514 514
515 // Step 2: If we don't have a layer, or our layer is the desired parent, the n descend 515 // Step 2: If we don't have a layer, or our layer is the desired parent, the n descend
516 // into our siblings trying to find the next layer whose parent is the desir ed parent. 516 // into our siblings trying to find the next layer whose parent is the desir ed parent.
517 if (!ourLayer || ourLayer == parentLayer) { 517 if (!ourLayer || ourLayer == parentLayer) {
518 for (RenderObject* curr = startPoint ? startPoint->nextSibling() : first Child(); 518 for (RenderObject* curr = startPoint ? startPoint->nextSibling() : slowF irstChild();
519 curr; curr = curr->nextSibling()) { 519 curr; curr = curr->nextSibling()) {
520 RenderLayer* nextLayer = curr->findNextLayer(parentLayer, 0, false); 520 RenderLayer* nextLayer = curr->findNextLayer(parentLayer, 0, false);
521 if (nextLayer) 521 if (nextLayer)
522 return nextLayer; 522 return nextLayer;
523 } 523 }
524 } 524 }
525 525
526 // Step 3: If our layer is the desired parent layer, then we're finished. We didn't 526 // Step 3: If our layer is the desired parent layer, then we're finished. We didn't
527 // find anything. 527 // find anything.
528 if (parentLayer == ourLayer) 528 if (parentLayer == ourLayer)
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 for (size_t i = 0; i < quads.size(); ++i) 1324 for (size_t i = 0; i < quads.size(); ++i)
1325 result.unite(quads[i].boundingBox()); 1325 result.unite(quads[i].boundingBox());
1326 1326
1327 return result; 1327 return result;
1328 } 1328 }
1329 1329
1330 void RenderObject::addAbsoluteRectForLayer(LayoutRect& result) 1330 void RenderObject::addAbsoluteRectForLayer(LayoutRect& result)
1331 { 1331 {
1332 if (hasLayer()) 1332 if (hasLayer())
1333 result.unite(absoluteBoundingBoxRectIgnoringTransforms()); 1333 result.unite(absoluteBoundingBoxRectIgnoringTransforms());
1334 for (RenderObject* current = firstChild(); current; current = current->nextS ibling()) 1334 for (RenderObject* current = slowFirstChild(); current; current = current->n extSibling())
1335 current->addAbsoluteRectForLayer(result); 1335 current->addAbsoluteRectForLayer(result);
1336 } 1336 }
1337 1337
1338 LayoutRect RenderObject::paintingRootRect(LayoutRect& topLevelRect) 1338 LayoutRect RenderObject::paintingRootRect(LayoutRect& topLevelRect)
1339 { 1339 {
1340 LayoutRect result = absoluteBoundingBoxRectIgnoringTransforms(); 1340 LayoutRect result = absoluteBoundingBoxRectIgnoringTransforms();
1341 topLevelRect = result; 1341 topLevelRect = result;
1342 for (RenderObject* current = firstChild(); current; current = current->nextS ibling()) 1342 for (RenderObject* current = slowFirstChild(); current; current = current->n extSibling())
1343 current->addAbsoluteRectForLayer(result); 1343 current->addAbsoluteRectForLayer(result);
1344 return result; 1344 return result;
1345 } 1345 }
1346 1346
1347 void RenderObject::paint(PaintInfo&, const LayoutPoint&) 1347 void RenderObject::paint(PaintInfo&, const LayoutPoint&)
1348 { 1348 {
1349 } 1349 }
1350 1350
1351 const RenderLayerModelObject* RenderObject::containerForRepaint() const 1351 const RenderLayerModelObject* RenderObject::containerForRepaint() const
1352 { 1352 {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 1539
1540 void RenderObject::repaintTreeAfterLayout(const RenderLayerModelObject& repaintC ontainer) 1540 void RenderObject::repaintTreeAfterLayout(const RenderLayerModelObject& repaintC ontainer)
1541 { 1541 {
1542 // If we didn't need invalidation then our children don't need as well. 1542 // If we didn't need invalidation then our children don't need as well.
1543 // Skip walking down the tree as everything should be fine below us. 1543 // Skip walking down the tree as everything should be fine below us.
1544 if (!shouldCheckForInvalidationAfterLayout()) 1544 if (!shouldCheckForInvalidationAfterLayout())
1545 return; 1545 return;
1546 1546
1547 clearRepaintState(); 1547 clearRepaintState();
1548 1548
1549 for (RenderObject* child = firstChild(); child; child = child->nextSibling() ) { 1549 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli ng()) {
1550 if (!child->isOutOfFlowPositioned()) 1550 if (!child->isOutOfFlowPositioned())
1551 child->repaintTreeAfterLayout(repaintContainer); 1551 child->repaintTreeAfterLayout(repaintContainer);
1552 } 1552 }
1553 } 1553 }
1554 1554
1555 static PassRefPtr<JSONValue> jsonObjectForOldAndNewRects(const LayoutRect& oldRe ct, const LayoutRect& newRect) 1555 static PassRefPtr<JSONValue> jsonObjectForOldAndNewRects(const LayoutRect& oldRe ct, const LayoutRect& newRect)
1556 { 1556 {
1557 RefPtr<JSONObject> object = JSONObject::create(); 1557 RefPtr<JSONObject> object = JSONObject::create();
1558 1558
1559 object->setValue("old", jsonObjectForRect(oldRect)); 1559 object->setValue("old", jsonObjectForRect(oldRect));
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 printedCharacters += fprintf(stderr, "%s", markedLabel1); 1821 printedCharacters += fprintf(stderr, "%s", markedLabel1);
1822 if (markedObject2 == this && markedLabel2) 1822 if (markedObject2 == this && markedLabel2)
1823 printedCharacters += fprintf(stderr, "%s", markedLabel2); 1823 printedCharacters += fprintf(stderr, "%s", markedLabel2);
1824 for (; printedCharacters < depth * 2; printedCharacters++) 1824 for (; printedCharacters < depth * 2; printedCharacters++)
1825 fputc(' ', stderr); 1825 fputc(' ', stderr);
1826 1826
1827 showRenderObject(printedCharacters); 1827 showRenderObject(printedCharacters);
1828 if (!this) 1828 if (!this)
1829 return; 1829 return;
1830 1830
1831 for (const RenderObject* child = firstChild(); child; child = child->nextSib ling()) 1831 for (const RenderObject* child = slowFirstChild(); child; child = child->nex tSibling())
1832 child->showRenderTreeAndMark(markedObject1, markedLabel1, markedObject2, markedLabel2, depth + 1); 1832 child->showRenderTreeAndMark(markedObject1, markedLabel1, markedObject2, markedLabel2, depth + 1);
1833 } 1833 }
1834 1834
1835 #endif // NDEBUG 1835 #endif // NDEBUG
1836 1836
1837 bool RenderObject::isSelectable() const 1837 bool RenderObject::isSelectable() const
1838 { 1838 {
1839 return !isInert() && !(style()->userSelect() == SELECT_NONE && style()->user Modify() == READ_ONLY); 1839 return !isInert() && !(style()->userSelect() == SELECT_NONE && style()->user Modify() == READ_ONLY);
1840 } 1840 }
1841 1841
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 return; 1979 return;
1980 } 1980 }
1981 1981
1982 setStyle(pseudoStyle); 1982 setStyle(pseudoStyle);
1983 } 1983 }
1984 1984
1985 inline bool RenderObject::hasImmediateNonWhitespaceTextChildOrPropertiesDependen tOnColor() const 1985 inline bool RenderObject::hasImmediateNonWhitespaceTextChildOrPropertiesDependen tOnColor() const
1986 { 1986 {
1987 if (style()->hasBorder() || style()->hasOutline()) 1987 if (style()->hasBorder() || style()->hasOutline())
1988 return true; 1988 return true;
1989 for (const RenderObject* r = firstChild(); r; r = r->nextSibling()) { 1989 for (const RenderObject* r = slowFirstChild(); r; r = r->nextSibling()) {
1990 if (r->isText() && !toRenderText(r)->isAllCollapsibleWhitespace()) 1990 if (r->isText() && !toRenderText(r)->isAllCollapsibleWhitespace())
1991 return true; 1991 return true;
1992 if (r->style()->hasOutline() || r->style()->hasBorder()) 1992 if (r->style()->hasOutline() || r->style()->hasBorder())
1993 return true; 1993 return true;
1994 } 1994 }
1995 return false; 1995 return false;
1996 } 1996 }
1997 1997
1998 void RenderObject::markContainingBlocksForOverflowRecalc() 1998 void RenderObject::markContainingBlocksForOverflowRecalc()
1999 { 1999 {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 2234
2235 if (oldStyle && !areCursorsEqual(oldStyle, style())) { 2235 if (oldStyle && !areCursorsEqual(oldStyle, style())) {
2236 if (LocalFrame* frame = this->frame()) 2236 if (LocalFrame* frame = this->frame())
2237 frame->eventHandler().scheduleCursorUpdate(); 2237 frame->eventHandler().scheduleCursorUpdate();
2238 } 2238 }
2239 } 2239 }
2240 2240
2241 void RenderObject::propagateStyleToAnonymousChildren(bool blockChildrenOnly) 2241 void RenderObject::propagateStyleToAnonymousChildren(bool blockChildrenOnly)
2242 { 2242 {
2243 // FIXME: We could save this call when the change only affected non-inherite d properties. 2243 // FIXME: We could save this call when the change only affected non-inherite d properties.
2244 for (RenderObject* child = firstChild(); child; child = child->nextSibling() ) { 2244 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli ng()) {
2245 if (!child->isAnonymous() || child->style()->styleType() != NOPSEUDO) 2245 if (!child->isAnonymous() || child->style()->styleType() != NOPSEUDO)
2246 continue; 2246 continue;
2247 2247
2248 if (blockChildrenOnly && !child->isRenderBlock()) 2248 if (blockChildrenOnly && !child->isRenderBlock())
2249 continue; 2249 continue;
2250 2250
2251 if (child->isRenderFullScreen() || child->isRenderFullScreenPlaceholder( )) 2251 if (child->isRenderFullScreen() || child->isRenderFullScreenPlaceholder( ))
2252 continue; 2252 continue;
2253 2253
2254 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisp lay(style(), child->style()->display()); 2254 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisp lay(style(), child->style()->display());
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2543 newContainerRect = containerRect; 2543 newContainerRect = containerRect;
2544 2544
2545 // If it's possible for children to have rects outside our bounds, then we n eed to descend into 2545 // If it's possible for children to have rects outside our bounds, then we n eed to descend into
2546 // the children and compute them. 2546 // the children and compute them.
2547 // Ideally there would be other cases where we could detect that children co uldn't have rects 2547 // Ideally there would be other cases where we could detect that children co uldn't have rects
2548 // outside our bounds and prune the tree walk. 2548 // outside our bounds and prune the tree walk.
2549 // Note that we don't use Region here because Union is O(N) - better to just keep a list of 2549 // Note that we don't use Region here because Union is O(N) - better to just keep a list of
2550 // partially redundant rectangles. If we find examples where this is expensi ve, then we could 2550 // partially redundant rectangles. If we find examples where this is expensi ve, then we could
2551 // rewrite Region to be more efficient. See https://bugs.webkit.org/show_bug .cgi?id=100814. 2551 // rewrite Region to be more efficient. See https://bugs.webkit.org/show_bug .cgi?id=100814.
2552 if (!isRenderView()) { 2552 if (!isRenderView()) {
2553 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling() ) { 2553 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibli ng()) {
2554 curr->addLayerHitTestRects(layerRects, currentLayer, layerOffset, n ewContainerRect); 2554 curr->addLayerHitTestRects(layerRects, currentLayer, layerOffset, n ewContainerRect);
2555 } 2555 }
2556 } 2556 }
2557 } 2557 }
2558 2558
2559 bool RenderObject::isRooted() const 2559 bool RenderObject::isRooted() const
2560 { 2560 {
2561 const RenderObject* object = this; 2561 const RenderObject* object = this;
2562 while (object->parent() && !object->hasLayer()) 2562 while (object->parent() && !object->hasLayer())
2563 object = object->parent(); 2563 object = object->parent();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2711 clearLayoutRootIfNeeded(); 2711 clearLayoutRootIfNeeded();
2712 } 2712 }
2713 2713
2714 void RenderObject::insertedIntoTree() 2714 void RenderObject::insertedIntoTree()
2715 { 2715 {
2716 // FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion. 2716 // FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion.
2717 2717
2718 // Keep our layer hierarchy updated. Optimize for the common case where we d on't have any children 2718 // Keep our layer hierarchy updated. Optimize for the common case where we d on't have any children
2719 // and don't have a layer attached to ourselves. 2719 // and don't have a layer attached to ourselves.
2720 RenderLayer* layer = 0; 2720 RenderLayer* layer = 0;
2721 if (firstChild() || hasLayer()) { 2721 if (slowFirstChild() || hasLayer()) {
2722 layer = parent()->enclosingLayer(); 2722 layer = parent()->enclosingLayer();
2723 addLayers(layer); 2723 addLayers(layer);
2724 } 2724 }
2725 2725
2726 // If |this| is visible but this object was not, tell the layer it has some visible content 2726 // If |this| is visible but this object was not, tell the layer it has some visible content
2727 // that needs to be drawn and layer visibility optimization can't be used 2727 // that needs to be drawn and layer visibility optimization can't be used
2728 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) { 2728 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) {
2729 if (!layer) 2729 if (!layer)
2730 layer = parent()->enclosingLayer(); 2730 layer = parent()->enclosingLayer();
2731 if (layer) 2731 if (layer)
(...skipping 10 matching lines...) Expand all
2742 2742
2743 // If we remove a visible child from an invisible parent, we don't know the layer visibility any more. 2743 // If we remove a visible child from an invisible parent, we don't know the layer visibility any more.
2744 RenderLayer* layer = 0; 2744 RenderLayer* layer = 0;
2745 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) { 2745 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) {
2746 layer = parent()->enclosingLayer(); 2746 layer = parent()->enclosingLayer();
2747 if (layer) 2747 if (layer)
2748 layer->dirtyVisibleContentStatus(); 2748 layer->dirtyVisibleContentStatus();
2749 } 2749 }
2750 2750
2751 // Keep our layer hierarchy updated. 2751 // Keep our layer hierarchy updated.
2752 if (firstChild() || hasLayer()) { 2752 if (slowFirstChild() || hasLayer()) {
2753 if (!layer) 2753 if (!layer)
2754 layer = parent()->enclosingLayer(); 2754 layer = parent()->enclosingLayer();
2755 removeLayers(layer); 2755 removeLayers(layer);
2756 } 2756 }
2757 2757
2758 if (isOutOfFlowPositioned() && parent()->childrenInline()) 2758 if (isOutOfFlowPositioned() && parent()->childrenInline())
2759 parent()->dirtyLinesFromChangedChild(this); 2759 parent()->dirtyLinesFromChangedChild(this);
2760 2760
2761 removeFromRenderFlowThread(); 2761 removeFromRenderFlowThread();
2762 2762
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2798 RenderObject* destroyRoot = this; 2798 RenderObject* destroyRoot = this;
2799 for (RenderObject* destroyRootParent = destroyRoot->parent(); destroyRootPar ent && destroyRootParent->isAnonymous(); destroyRoot = destroyRootParent, destro yRootParent = destroyRootParent->parent()) { 2799 for (RenderObject* destroyRootParent = destroyRoot->parent(); destroyRootPar ent && destroyRootParent->isAnonymous(); destroyRoot = destroyRootParent, destro yRootParent = destroyRootParent->parent()) {
2800 // Anonymous block continuations are tracked and destroyed elsewhere (se e the bottom of RenderBlock::removeChild) 2800 // Anonymous block continuations are tracked and destroyed elsewhere (se e the bottom of RenderBlock::removeChild)
2801 if (destroyRootParent->isRenderBlock() && toRenderBlock(destroyRootParen t)->isAnonymousBlockContinuation()) 2801 if (destroyRootParent->isRenderBlock() && toRenderBlock(destroyRootParen t)->isAnonymousBlockContinuation())
2802 break; 2802 break;
2803 // Render flow threads are tracked by the FlowThreadController, so we ca n't destroy them here. 2803 // Render flow threads are tracked by the FlowThreadController, so we ca n't destroy them here.
2804 // Column spans are tracked elsewhere. 2804 // Column spans are tracked elsewhere.
2805 if (destroyRootParent->isRenderFlowThread() || destroyRootParent->isAnon ymousColumnSpanBlock()) 2805 if (destroyRootParent->isRenderFlowThread() || destroyRootParent->isAnon ymousColumnSpanBlock())
2806 break; 2806 break;
2807 2807
2808 if (destroyRootParent->firstChild() != this || destroyRootParent->lastCh ild() != this) 2808 if (destroyRootParent->slowFirstChild() != this || destroyRootParent->sl owLastChild() != this)
2809 break; 2809 break;
2810 } 2810 }
2811 2811
2812 destroyRoot->destroy(); 2812 destroyRoot->destroy();
2813 2813
2814 // WARNING: |this| is deleted here. 2814 // WARNING: |this| is deleted here.
2815 } 2815 }
2816 2816
2817 void RenderObject::destroy() 2817 void RenderObject::destroy()
2818 { 2818 {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2862 void RenderObject::updateDragState(bool dragOn) 2862 void RenderObject::updateDragState(bool dragOn)
2863 { 2863 {
2864 bool valueChanged = (dragOn != isDragging()); 2864 bool valueChanged = (dragOn != isDragging());
2865 setIsDragging(dragOn); 2865 setIsDragging(dragOn);
2866 if (valueChanged && node()) { 2866 if (valueChanged && node()) {
2867 if (node()->isElementNode() && toElement(node())->childrenAffectedByDrag ()) 2867 if (node()->isElementNode() && toElement(node())->childrenAffectedByDrag ())
2868 node()->setNeedsStyleRecalc(SubtreeStyleChange); 2868 node()->setNeedsStyleRecalc(SubtreeStyleChange);
2869 else if (style()->affectedByDrag()) 2869 else if (style()->affectedByDrag())
2870 node()->setNeedsStyleRecalc(LocalStyleChange); 2870 node()->setNeedsStyleRecalc(LocalStyleChange);
2871 } 2871 }
2872 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) 2872 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling() )
2873 curr->updateDragState(dragOn); 2873 curr->updateDragState(dragOn);
2874 } 2874 }
2875 2875
2876 CompositingState RenderObject::compositingState() const 2876 CompositingState RenderObject::compositingState() const
2877 { 2877 {
2878 return hasLayer() ? toRenderLayerModelObject(this)->layer()->compositingStat e() : NotComposited; 2878 return hasLayer() ? toRenderLayerModelObject(this)->layer()->compositingStat e() : NotComposited;
2879 } 2879 }
2880 2880
2881 CompositingReasons RenderObject::additionalCompositingReasons(CompositingTrigger Flags) const 2881 CompositingReasons RenderObject::additionalCompositingReasons(CompositingTrigger Flags) const
2882 { 2882 {
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
3171 } 3171 }
3172 3172
3173 void RenderObject::collectAnnotatedRegions(Vector<AnnotatedRegionValue>& regions ) 3173 void RenderObject::collectAnnotatedRegions(Vector<AnnotatedRegionValue>& regions )
3174 { 3174 {
3175 // RenderTexts don't have their own style, they just use their parent's styl e, 3175 // RenderTexts don't have their own style, they just use their parent's styl e,
3176 // so we don't want to include them. 3176 // so we don't want to include them.
3177 if (isText()) 3177 if (isText())
3178 return; 3178 return;
3179 3179
3180 addAnnotatedRegions(regions); 3180 addAnnotatedRegions(regions);
3181 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) 3181 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling() )
3182 curr->collectAnnotatedRegions(regions); 3182 curr->collectAnnotatedRegions(regions);
3183 } 3183 }
3184 3184
3185 bool RenderObject::willRenderImage(ImageResource*) 3185 bool RenderObject::willRenderImage(ImageResource*)
3186 { 3186 {
3187 // Without visibility we won't render (and therefore don't care about animat ion). 3187 // Without visibility we won't render (and therefore don't care about animat ion).
3188 if (style()->visibility() != VISIBLE) 3188 if (style()->visibility() != VISIBLE)
3189 return false; 3189 return false;
3190 3190
3191 // We will not render a new image when Active DOM is suspended 3191 // We will not render a new image when Active DOM is suspended
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
3478 { 3478 {
3479 if (object1) { 3479 if (object1) {
3480 const WebCore::RenderObject* root = object1; 3480 const WebCore::RenderObject* root = object1;
3481 while (root->parent()) 3481 while (root->parent())
3482 root = root->parent(); 3482 root = root->parent();
3483 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3483 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3484 } 3484 }
3485 } 3485 }
3486 3486
3487 #endif 3487 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderRuby.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698