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

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

Issue 1330633003: Intersection Observer first draft Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix segfault on null input. 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 2468 matching lines...) Expand 10 before | Expand all | Expand 10 after
2479 2479
2480 if (StyleImage* maskBoxImage = m_style->maskBoxImage().image()) 2480 if (StyleImage* maskBoxImage = m_style->maskBoxImage().image())
2481 maskBoxImage->removeClient(this); 2481 maskBoxImage->removeClient(this);
2482 2482
2483 removeShapeImageClient(m_style->shapeOutside()); 2483 removeShapeImageClient(m_style->shapeOutside());
2484 } 2484 }
2485 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLayout Object(this); 2485 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLayout Object(this);
2486 2486
2487 if (frameView()) 2487 if (frameView())
2488 setIsSlowRepaintObject(false); 2488 setIsSlowRepaintObject(false);
2489
2490 if (view() && hasIntersectionObserver()) {
ojan 2015/09/21 03:49:09 Ditto nits about curlies here and below
MikeB 2015/09/24 19:04:04 Done.
2491 view()->removeIntersectionObserverTarget(this);
2492 }
2489 } 2493 }
2490 2494
2491 void LayoutObject::insertedIntoTree() 2495 void LayoutObject::insertedIntoTree()
2492 { 2496 {
2493 // FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion. 2497 // FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion.
2494 2498
2495 // Keep our layer hierarchy updated. Optimize for the common case where we d on't have any children 2499 // Keep our layer hierarchy updated. Optimize for the common case where we d on't have any children
2496 // and don't have a layer attached to ourselves. 2500 // and don't have a layer attached to ourselves.
2497 DeprecatedPaintLayer* layer = nullptr; 2501 DeprecatedPaintLayer* layer = nullptr;
2498 if (slowFirstChild() || hasLayer()) { 2502 if (slowFirstChild() || hasLayer()) {
2499 layer = parent()->enclosingLayer(); 2503 layer = parent()->enclosingLayer();
2500 addLayers(layer); 2504 addLayers(layer);
2501 } 2505 }
2502 2506
2503 // If |this| is visible but this object was not, tell the layer it has some visible content 2507 // If |this| is visible but this object was not, tell the layer it has some visible content
2504 // that needs to be drawn and layer visibility optimization can't be used 2508 // that needs to be drawn and layer visibility optimization can't be used
2505 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) { 2509 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) {
2506 if (!layer) 2510 if (!layer)
2507 layer = parent()->enclosingLayer(); 2511 layer = parent()->enclosingLayer();
2508 if (layer) 2512 if (layer)
2509 layer->dirtyVisibleContentStatus(); 2513 layer->dirtyVisibleContentStatus();
2510 } 2514 }
2511 2515
2512 if (parent()->childrenInline()) 2516 if (parent()->childrenInline())
2513 parent()->dirtyLinesFromChangedChild(this); 2517 parent()->dirtyLinesFromChangedChild(this);
2514 2518
2515 if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) 2519 if (LayoutFlowThread* flowThread = flowThreadContainingBlock())
2516 flowThread->flowThreadDescendantWasInserted(this); 2520 flowThread->flowThreadDescendantWasInserted(this);
2521
2522 if (view() && hasIntersectionObserver()) {
2523 view()->addIntersectionObserverTarget(this);
2524 }
2517 } 2525 }
2518 2526
2519 void LayoutObject::willBeRemovedFromTree() 2527 void LayoutObject::willBeRemovedFromTree()
2520 { 2528 {
2521 // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removal s which would need to be fixed first. 2529 // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removal s which would need to be fixed first.
2522 2530
2523 // If we remove a visible child from an invisible parent, we don't know the layer visibility any more. 2531 // If we remove a visible child from an invisible parent, we don't know the layer visibility any more.
2524 DeprecatedPaintLayer* layer = nullptr; 2532 DeprecatedPaintLayer* layer = nullptr;
2525 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) { 2533 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) {
2526 layer = parent()->enclosingLayer(); 2534 layer = parent()->enclosingLayer();
2527 if (layer) 2535 if (layer)
2528 layer->dirtyVisibleContentStatus(); 2536 layer->dirtyVisibleContentStatus();
2529 } 2537 }
2530 2538
2531 // Keep our layer hierarchy updated. 2539 // Keep our layer hierarchy updated.
2532 if (slowFirstChild() || hasLayer()) { 2540 if (slowFirstChild() || hasLayer()) {
2533 if (!layer) 2541 if (!layer)
2534 layer = parent()->enclosingLayer(); 2542 layer = parent()->enclosingLayer();
2535 removeLayers(layer); 2543 removeLayers(layer);
2536 } 2544 }
2537 2545
2538 if (isOutOfFlowPositioned() && parent()->childrenInline()) 2546 if (isOutOfFlowPositioned() && parent()->childrenInline())
2539 parent()->dirtyLinesFromChangedChild(this); 2547 parent()->dirtyLinesFromChangedChild(this);
2540 2548
2541 removeFromLayoutFlowThread(); 2549 removeFromLayoutFlowThread();
2542 2550
2543 // Update cached boundaries in SVG layoutObjects if a child is removed. 2551 // Update cached boundaries in SVG layoutObjects if a child is removed.
2544 if (parent()->isSVG()) 2552 if (parent()->isSVG())
2545 parent()->setNeedsBoundariesUpdate(); 2553 parent()->setNeedsBoundariesUpdate();
2554
2555 if (view() && hasIntersectionObserver()) {
ojan 2015/09/21 03:49:09 I'm not sure, but I believe this function gets cal
2556 view()->removeIntersectionObserverTarget(this);
2557 }
2546 } 2558 }
2547 2559
2548 void LayoutObject::removeFromLayoutFlowThread() 2560 void LayoutObject::removeFromLayoutFlowThread()
2549 { 2561 {
2550 if (!isInsideFlowThread()) 2562 if (!isInsideFlowThread())
2551 return; 2563 return;
2552 2564
2553 // Sometimes we remove the element from the flow, but it's not destroyed at that time. 2565 // Sometimes we remove the element from the flow, but it's not destroyed at that time.
2554 // It's only until later when we actually destroy it and remove all the chil dren from it. 2566 // It's only until later when we actually destroy it and remove all the chil dren from it.
2555 // Currently, that happens for firstLetter elements and list markers. 2567 // Currently, that happens for firstLetter elements and list markers.
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
3408 const blink::LayoutObject* root = object1; 3420 const blink::LayoutObject* root = object1;
3409 while (root->parent()) 3421 while (root->parent())
3410 root = root->parent(); 3422 root = root->parent();
3411 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3423 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3412 } else { 3424 } else {
3413 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3425 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3414 } 3426 }
3415 } 3427 }
3416 3428
3417 #endif 3429 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698