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

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: s/WebMutable/WebCompositorMutable/g Created 5 years, 1 month 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();
984 ensureElementRareData().incrementProxiedPropertyCounts(mutableProperties);
985 if (!hadProxy && hasCompositorProxy())
979 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat e(StyleChangeReason::CompositorProxy)); 986 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat e(StyleChangeReason::CompositorProxy));
chrishtr 2015/11/24 16:22:50 Incrementing a count can cause a style recalc? Tha
Ian Vollick 2015/11/25 18:28:45 Yes, it's like saying that you "will change" a pro
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();
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::mutableProperties() 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 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after
3573 { 3587 {
3574 #if ENABLE(OILPAN) 3588 #if ENABLE(OILPAN)
3575 if (hasRareData()) 3589 if (hasRareData())
3576 visitor->trace(elementRareData()); 3590 visitor->trace(elementRareData());
3577 visitor->trace(m_elementData); 3591 visitor->trace(m_elementData);
3578 #endif 3592 #endif
3579 ContainerNode::trace(visitor); 3593 ContainerNode::trace(visitor);
3580 } 3594 }
3581 3595
3582 } // namespace blink 3596 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698