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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 1330633003: Intersection Observer first draft Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Lost newline in merge Created 5 years, 3 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
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 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 2461
2462 if (StyleImage* maskBoxImage = m_style->maskBoxImage().image()) 2462 if (StyleImage* maskBoxImage = m_style->maskBoxImage().image())
2463 maskBoxImage->removeClient(this); 2463 maskBoxImage->removeClient(this);
2464 2464
2465 removeShapeImageClient(m_style->shapeOutside()); 2465 removeShapeImageClient(m_style->shapeOutside());
2466 } 2466 }
2467 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLayout Object(this); 2467 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLayout Object(this);
2468 2468
2469 if (frameView()) 2469 if (frameView())
2470 setIsSlowRepaintObject(false); 2470 setIsSlowRepaintObject(false);
2471
2472 if (view() && hasIntersectionObserver())
2473 view()->removeIntersectionObserverTarget(this);
2471 } 2474 }
2472 2475
2473 void LayoutObject::insertedIntoTree() 2476 void LayoutObject::insertedIntoTree()
2474 { 2477 {
2475 // FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion. 2478 // FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion.
2476 2479
2477 // Keep our layer hierarchy updated. Optimize for the common case where we d on't have any children 2480 // Keep our layer hierarchy updated. Optimize for the common case where we d on't have any children
2478 // and don't have a layer attached to ourselves. 2481 // and don't have a layer attached to ourselves.
2479 DeprecatedPaintLayer* layer = nullptr; 2482 DeprecatedPaintLayer* layer = nullptr;
2480 if (slowFirstChild() || hasLayer()) { 2483 if (slowFirstChild() || hasLayer()) {
2481 layer = parent()->enclosingLayer(); 2484 layer = parent()->enclosingLayer();
2482 addLayers(layer); 2485 addLayers(layer);
2483 } 2486 }
2484 2487
2485 // If |this| is visible but this object was not, tell the layer it has some visible content 2488 // If |this| is visible but this object was not, tell the layer it has some visible content
2486 // that needs to be drawn and layer visibility optimization can't be used 2489 // that needs to be drawn and layer visibility optimization can't be used
2487 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) { 2490 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) {
2488 if (!layer) 2491 if (!layer)
2489 layer = parent()->enclosingLayer(); 2492 layer = parent()->enclosingLayer();
2490 if (layer) 2493 if (layer)
2491 layer->dirtyVisibleContentStatus(); 2494 layer->dirtyVisibleContentStatus();
2492 } 2495 }
2493 2496
2494 if (parent()->childrenInline()) 2497 if (parent()->childrenInline())
2495 parent()->dirtyLinesFromChangedChild(this); 2498 parent()->dirtyLinesFromChangedChild(this);
2496 2499
2497 if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) 2500 if (LayoutFlowThread* flowThread = flowThreadContainingBlock())
2498 flowThread->flowThreadDescendantWasInserted(this); 2501 flowThread->flowThreadDescendantWasInserted(this);
2502
2503 if (view() && hasIntersectionObserver())
2504 view()->addIntersectionObserverTarget(this);
2499 } 2505 }
2500 2506
2501 void LayoutObject::willBeRemovedFromTree() 2507 void LayoutObject::willBeRemovedFromTree()
2502 { 2508 {
2503 // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removal s which would need to be fixed first. 2509 // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removal s which would need to be fixed first.
2504 2510
2505 // If we remove a visible child from an invisible parent, we don't know the layer visibility any more. 2511 // If we remove a visible child from an invisible parent, we don't know the layer visibility any more.
2506 DeprecatedPaintLayer* layer = nullptr; 2512 DeprecatedPaintLayer* layer = nullptr;
2507 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) { 2513 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) {
2508 layer = parent()->enclosingLayer(); 2514 layer = parent()->enclosingLayer();
2509 if (layer) 2515 if (layer)
2510 layer->dirtyVisibleContentStatus(); 2516 layer->dirtyVisibleContentStatus();
2511 } 2517 }
2512 2518
2513 // Keep our layer hierarchy updated. 2519 // Keep our layer hierarchy updated.
2514 if (slowFirstChild() || hasLayer()) { 2520 if (slowFirstChild() || hasLayer()) {
2515 if (!layer) 2521 if (!layer)
2516 layer = parent()->enclosingLayer(); 2522 layer = parent()->enclosingLayer();
2517 removeLayers(layer); 2523 removeLayers(layer);
2518 } 2524 }
2519 2525
2520 if (isOutOfFlowPositioned() && parent()->childrenInline()) 2526 if (isOutOfFlowPositioned() && parent()->childrenInline())
2521 parent()->dirtyLinesFromChangedChild(this); 2527 parent()->dirtyLinesFromChangedChild(this);
2522 2528
2523 removeFromLayoutFlowThread(); 2529 removeFromLayoutFlowThread();
2524 2530
2525 // Update cached boundaries in SVG layoutObjects if a child is removed. 2531 // Update cached boundaries in SVG layoutObjects if a child is removed.
2526 if (parent()->isSVG()) 2532 if (parent()->isSVG())
2527 parent()->setNeedsBoundariesUpdate(); 2533 parent()->setNeedsBoundariesUpdate();
2534
2535 if (view() && hasIntersectionObserver())
2536 view()->removeIntersectionObserverTarget(this);
2528 } 2537 }
2529 2538
2530 void LayoutObject::removeFromLayoutFlowThread() 2539 void LayoutObject::removeFromLayoutFlowThread()
2531 { 2540 {
2532 if (!isInsideFlowThread()) 2541 if (!isInsideFlowThread())
2533 return; 2542 return;
2534 2543
2535 // Sometimes we remove the element from the flow, but it's not destroyed at that time. 2544 // Sometimes we remove the element from the flow, but it's not destroyed at that time.
2536 // It's only until later when we actually destroy it and remove all the chil dren from it. 2545 // It's only until later when we actually destroy it and remove all the chil dren from it.
2537 // Currently, that happens for firstLetter elements and list markers. 2546 // Currently, that happens for firstLetter elements and list markers.
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
3394 const blink::LayoutObject* root = object1; 3403 const blink::LayoutObject* root = object1;
3395 while (root->parent()) 3404 while (root->parent())
3396 root = root->parent(); 3405 root = root->parent();
3397 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3406 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3398 } else { 3407 } else {
3399 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3408 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3400 } 3409 }
3401 } 3410 }
3402 3411
3403 #endif 3412 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698