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

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 2204503002: ResizeObserver pt6: integration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR fixes fixed Created 4 years, 4 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) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 #include "core/html/HTMLSlotElement.h" 109 #include "core/html/HTMLSlotElement.h"
110 #include "core/html/HTMLTableRowsCollection.h" 110 #include "core/html/HTMLTableRowsCollection.h"
111 #include "core/html/HTMLTemplateElement.h" 111 #include "core/html/HTMLTemplateElement.h"
112 #include "core/html/parser/HTMLParserIdioms.h" 112 #include "core/html/parser/HTMLParserIdioms.h"
113 #include "core/input/EventHandler.h" 113 #include "core/input/EventHandler.h"
114 #include "core/inspector/InspectorInstrumentation.h" 114 #include "core/inspector/InspectorInstrumentation.h"
115 #include "core/layout/LayoutTextFragment.h" 115 #include "core/layout/LayoutTextFragment.h"
116 #include "core/layout/api/LayoutBoxItem.h" 116 #include "core/layout/api/LayoutBoxItem.h"
117 #include "core/layout/api/LayoutViewItem.h" 117 #include "core/layout/api/LayoutViewItem.h"
118 #include "core/loader/DocumentLoader.h" 118 #include "core/loader/DocumentLoader.h"
119 #include "core/observer/ResizeObservation.h"
119 #include "core/page/ChromeClient.h" 120 #include "core/page/ChromeClient.h"
120 #include "core/page/FocusController.h" 121 #include "core/page/FocusController.h"
121 #include "core/page/Page.h" 122 #include "core/page/Page.h"
122 #include "core/page/PointerLockController.h" 123 #include "core/page/PointerLockController.h"
123 #include "core/page/SpatialNavigation.h" 124 #include "core/page/SpatialNavigation.h"
124 #include "core/page/scrolling/RootScrollerController.h" 125 #include "core/page/scrolling/RootScrollerController.h"
125 #include "core/page/scrolling/ScrollCustomizationCallbacks.h" 126 #include "core/page/scrolling/ScrollCustomizationCallbacks.h"
126 #include "core/page/scrolling/ScrollState.h" 127 #include "core/page/scrolling/ScrollState.h"
127 #include "core/page/scrolling/ScrollStateCallback.h" 128 #include "core/page/scrolling/ScrollStateCallback.h"
128 #include "core/paint/PaintLayer.h" 129 #include "core/paint/PaintLayer.h"
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 document().activeChainNodeDetached(*this); 1617 document().activeChainNodeDetached(*this);
1617 document().userActionElements().didDetach(*this); 1618 document().userActionElements().didDetach(*this);
1618 } 1619 }
1619 1620
1620 if (context.clearInvalidation) 1621 if (context.clearInvalidation)
1621 document().styleEngine().styleInvalidator().clearInvalidation(*this); 1622 document().styleEngine().styleInvalidator().clearInvalidation(*this);
1622 1623
1623 if (svgFilterNeedsLayerUpdate()) 1624 if (svgFilterNeedsLayerUpdate())
1624 document().unscheduleSVGFilterLayerUpdateHack(*this); 1625 document().unscheduleSVGFilterLayerUpdateHack(*this);
1625 1626
1627 sizeMayHaveChanged();
1628
1626 DCHECK(needsAttach()); 1629 DCHECK(needsAttach());
1627 } 1630 }
1628 1631
1629 bool Element::pseudoStyleCacheIsInvalid(const ComputedStyle* currentStyle, Compu tedStyle* newStyle) 1632 bool Element::pseudoStyleCacheIsInvalid(const ComputedStyle* currentStyle, Compu tedStyle* newStyle)
1630 { 1633 {
1631 DCHECK_EQ(currentStyle, computedStyle()); 1634 DCHECK_EQ(currentStyle, computedStyle());
1632 DCHECK(layoutObject()); 1635 DCHECK(layoutObject());
1633 1636
1634 if (!currentStyle) 1637 if (!currentStyle)
1635 return false; 1638 return false;
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2656 if (hasRareData()) 2659 if (hasRareData())
2657 return elementRareData()->resizeObserverData(); 2660 return elementRareData()->resizeObserverData();
2658 return nullptr; 2661 return nullptr;
2659 } 2662 }
2660 2663
2661 HeapHashMap<Member<ResizeObserver>, Member<ResizeObservation>>& Element::ensureR esizeObserverData() 2664 HeapHashMap<Member<ResizeObserver>, Member<ResizeObservation>>& Element::ensureR esizeObserverData()
2662 { 2665 {
2663 return ensureElementRareData().ensureResizeObserverData(); 2666 return ensureElementRareData().ensureResizeObserverData();
2664 } 2667 }
2665 2668
2669 void Element::sizeMayHaveChanged()
2670 {
2671 HeapHashMap<Member<ResizeObserver>, Member<ResizeObservation>>* roData = res izeObserverData();
esprehn 2016/08/03 18:06:51 don't abbreviate, I'd either call this |data| or |
atotic1 2016/08/04 23:59:39 Done.
2672 if (roData) {
esprehn 2016/08/03 18:06:51 I'd early return: if (!data) return; You can e
atotic1 2016/08/04 23:59:39 Done.
2673 for (auto& iter : *roData)
esprehn 2016/08/03 18:06:51 ->values() and make the loop variable |observation
atotic1 2016/08/04 23:59:39 Done. Thanks for providing the solution. Still fee
2674 iter.value->elementSizeChanged();
2675 }
2676 }
2677
2666 // Step 1 of http://domparsing.spec.whatwg.org/#insertadjacenthtml() 2678 // Step 1 of http://domparsing.spec.whatwg.org/#insertadjacenthtml()
2667 static Element* contextElementForInsertion(const String& where, Element* element , ExceptionState& exceptionState) 2679 static Element* contextElementForInsertion(const String& where, Element* element , ExceptionState& exceptionState)
2668 { 2680 {
2669 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "aft erEnd")) { 2681 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "aft erEnd")) {
2670 Element* parent = element->parentElement(); 2682 Element* parent = element->parentElement();
2671 if (!parent) { 2683 if (!parent) {
2672 exceptionState.throwDOMException(NoModificationAllowedError, "The el ement has no parent."); 2684 exceptionState.throwDOMException(NoModificationAllowedError, "The el ement has no parent.");
2673 return nullptr; 2685 return nullptr;
2674 } 2686 }
2675 return parent; 2687 return parent;
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
3769 3781
3770 DEFINE_TRACE_WRAPPERS(Element) 3782 DEFINE_TRACE_WRAPPERS(Element)
3771 { 3783 {
3772 if (hasRareData()) { 3784 if (hasRareData()) {
3773 visitor->traceWrappers(elementRareData()); 3785 visitor->traceWrappers(elementRareData());
3774 } 3786 }
3775 ContainerNode::traceWrappers(visitor); 3787 ContainerNode::traceWrappers(visitor);
3776 } 3788 }
3777 3789
3778 } // namespace blink 3790 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698