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

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

Issue 1405993008: compositor-worker: plumb element id and mutable properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years 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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 966
967 double scaledLeft = viewport->scrollPositionDouble().x(); 967 double scaledLeft = viewport->scrollPositionDouble().x();
968 double scaledTop = viewport->scrollPositionDouble().y(); 968 double scaledTop = viewport->scrollPositionDouble().y();
969 if (scrollToOptions.hasLeft()) 969 if (scrollToOptions.hasLeft())
970 scaledLeft = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.le ft()) * frame->pageZoomFactor(); 970 scaledLeft = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.le ft()) * frame->pageZoomFactor();
971 if (scrollToOptions.hasTop()) 971 if (scrollToOptions.hasTop())
972 scaledTop = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top ()) * frame->pageZoomFactor(); 972 scaledTop = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top ()) * frame->pageZoomFactor();
973 viewport->setScrollPosition(DoublePoint(scaledLeft, scaledTop), Programmatic Scroll, scrollBehavior); 973 viewport->setScrollPosition(DoublePoint(scaledLeft, scaledTop), Programmatic Scroll, scrollBehavior);
974 } 974 }
975 975
976 void Element::incrementProxyCount() 976 bool Element::hasCompositorProxy() const
977 { 977 {
978 if (ensureElementRareData().incrementProxyCount() == 1) 978 return hasRareData() && elementRareData()->proxiedPropertyCounts();
979 }
980
981 void Element::incrementProxiedPropertyCounts(uint32_t mutableProperties)
982 {
983 const bool hadProxy = hasCompositorProxy();
esprehn 2015/12/02 03:28:49 no const on local primitive values
Ian Vollick 2015/12/03 17:54:43 Done.
984 ensureElementRareData().incrementProxiedPropertyCounts(mutableProperties);
esprehn 2015/12/02 03:28:48 you'd normally write this the other way, you'd wri
Ian Vollick 2015/12/03 17:54:43 That looks much better. Done.
985 if (!hadProxy && hasCompositorProxy())
979 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat e(StyleChangeReason::CompositorProxy)); 986 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat e(StyleChangeReason::CompositorProxy));
980 } 987 }
981 988
982 void Element::decrementProxyCount() 989 void Element::decrementProxiedPropertyCounts(uint32_t mutableProperties)
983 { 990 {
984 if (ensureElementRareData().decrementProxyCount() == 0) 991 ASSERT(hasRareData());
992 const bool hadProxy = hasCompositorProxy();
esprehn 2015/12/02 03:28:49 remove const, but if you're decrementing you must
Ian Vollick 2015/12/03 17:54:43 Done.
993 elementRareData()->decrementProxiedPropertyCounts(mutableProperties);
994 if (hadProxy && !hasCompositorProxy())
985 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat e(StyleChangeReason::CompositorProxy)); 995 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat e(StyleChangeReason::CompositorProxy));
986 } 996 }
987 997
998 uint32_t Element::compositorMutableProperties() const
999 {
1000 if (!hasCompositorProxy())
1001 return WebCompositorMutablePropertyNone;
1002 return elementRareData()->proxiedPropertyCounts()->proxiedProperties();
1003 }
1004
988 bool Element::hasNonEmptyLayoutSize() const 1005 bool Element::hasNonEmptyLayoutSize() const
989 { 1006 {
990 document().updateLayoutIgnorePendingStylesheets(); 1007 document().updateLayoutIgnorePendingStylesheets();
991 1008
992 if (LayoutBoxModelObject* box = layoutBoxModelObject()) 1009 if (LayoutBoxModelObject* box = layoutBoxModelObject())
993 return box->hasNonEmptyLayoutSize(); 1010 return box->hasNonEmptyLayoutSize();
994 return false; 1011 return false;
995 } 1012 }
996 1013
997 IntRect Element::boundsInViewportSpace() 1014 IntRect Element::boundsInViewportSpace()
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 if (ElementAnimations* elementAnimations = this->elementAnimations()) { 1696 if (ElementAnimations* elementAnimations = this->elementAnimations()) {
1680 elementAnimations->cssAnimations().maybeApplyPendingUpdate(this); 1697 elementAnimations->cssAnimations().maybeApplyPendingUpdate(this);
1681 elementAnimations->updateAnimationFlags(*style); 1698 elementAnimations->updateAnimationFlags(*style);
1682 } 1699 }
1683 1700
1684 if (style->hasTransform()) { 1701 if (style->hasTransform()) {
1685 if (const StylePropertySet* inlineStyle = this->inlineStyle()) 1702 if (const StylePropertySet* inlineStyle = this->inlineStyle())
1686 style->setHasInlineTransform(inlineStyle->hasProperty(CSSPropertyTra nsform)); 1703 style->setHasInlineTransform(inlineStyle->hasProperty(CSSPropertyTra nsform));
1687 } 1704 }
1688 1705
1689 if (hasRareData() && elementRareData()->proxyCount() > 0)
1690 style->setHasCompositorProxy(true);
1691
1692 document().didRecalculateStyleForElement(); 1706 document().didRecalculateStyleForElement();
1693 return style.release(); 1707 return style.release();
1694 } 1708 }
1695 1709
1696 PassRefPtr<ComputedStyle> Element::originalStyleForLayoutObject() 1710 PassRefPtr<ComputedStyle> Element::originalStyleForLayoutObject()
1697 { 1711 {
1698 ASSERT(document().inStyleRecalc()); 1712 ASSERT(document().inStyleRecalc());
1699 return document().ensureStyleResolver().styleForElement(this); 1713 return document().ensureStyleResolver().styleForElement(this);
1700 } 1714 }
1701 1715
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after
3567 { 3581 {
3568 #if ENABLE(OILPAN) 3582 #if ENABLE(OILPAN)
3569 if (hasRareData()) 3583 if (hasRareData())
3570 visitor->trace(elementRareData()); 3584 visitor->trace(elementRareData());
3571 visitor->trace(m_elementData); 3585 visitor->trace(m_elementData);
3572 #endif 3586 #endif
3573 ContainerNode::trace(visitor); 3587 ContainerNode::trace(visitor);
3574 } 3588 }
3575 3589
3576 } // namespace blink 3590 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698