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

Unified Diff: third_party/WebKit/Source/core/dom/CompositorProxy.cpp

Issue 2041193005: [compositorworker] compositor proxy mutation updates underlying layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compositor-worker-upstream-registration
Patch Set: Fix inlcudes Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/CompositorProxy.cpp
diff --git a/third_party/WebKit/Source/core/dom/CompositorProxy.cpp b/third_party/WebKit/Source/core/dom/CompositorProxy.cpp
index a40403acfab8e3435b1627555e3326a3c7135a34..b6fcb9f53536d6dcd1f3551317183312a8b60027 100644
--- a/third_party/WebKit/Source/core/dom/CompositorProxy.cpp
+++ b/third_party/WebKit/Source/core/dom/CompositorProxy.cpp
@@ -178,7 +178,9 @@ double CompositorProxy::opacity(ExceptionState& exceptionState) const
return 0.0;
if (raiseExceptionIfNotMutable(CompositorMutableProperty::kOpacity, exceptionState))
return 0.0;
- return m_opacity;
+ if (!m_state.get())
jbroman 2016/06/13 19:45:17 Should these be returning zero? What does it mean
majidvp 2016/06/13 21:52:51 Not having a state is equivalent to the underlying
Ian Vollick 2016/06/14 11:24:28 There's no harm in throwing in the getter and I th
majidvp 2016/06/14 17:25:58 Done.
+ return 0.0;
+ return m_state->opacity();
}
double CompositorProxy::scrollLeft(ExceptionState& exceptionState) const
@@ -187,7 +189,9 @@ double CompositorProxy::scrollLeft(ExceptionState& exceptionState) const
return 0.0;
if (raiseExceptionIfNotMutable(CompositorMutableProperty::kScrollLeft, exceptionState))
return 0.0;
- return m_scrollLeft;
+ if (!m_state.get())
+ return 0.0;
+ return m_state->scrollLeft();
}
double CompositorProxy::scrollTop(ExceptionState& exceptionState) const
@@ -196,7 +200,9 @@ double CompositorProxy::scrollTop(ExceptionState& exceptionState) const
return 0.0;
if (raiseExceptionIfNotMutable(CompositorMutableProperty::kScrollTop, exceptionState))
return 0.0;
- return m_scrollTop;
+ if (!m_state.get())
+ return 0.0;
+ return m_state->scrollTop();
}
DOMMatrix* CompositorProxy::transform(ExceptionState& exceptionState) const
@@ -205,7 +211,9 @@ DOMMatrix* CompositorProxy::transform(ExceptionState& exceptionState) const
return nullptr;
if (raiseExceptionIfNotMutable(CompositorMutableProperty::kTransform, exceptionState))
return nullptr;
- return m_transform;
+ if (!m_state.get())
+ return DOMMatrix::create();
+ return DOMMatrix::create(m_state->transform());
}
void CompositorProxy::setOpacity(double opacity, ExceptionState& exceptionState)
@@ -214,8 +222,10 @@ void CompositorProxy::setOpacity(double opacity, ExceptionState& exceptionState)
return;
if (raiseExceptionIfNotMutable(CompositorMutableProperty::kOpacity, exceptionState))
return;
- m_opacity = std::min(1., std::max(0., opacity));
- m_mutatedProperties |= CompositorMutableProperty::kTransform;
+ if (!m_state.get())
+ return;
+
+ m_state->setOpacity(std::min(1., std::max(0., opacity)));
}
void CompositorProxy::setScrollLeft(double scrollLeft, ExceptionState& exceptionState)
@@ -224,8 +234,9 @@ void CompositorProxy::setScrollLeft(double scrollLeft, ExceptionState& exception
return;
if (raiseExceptionIfNotMutable(CompositorMutableProperty::kScrollLeft, exceptionState))
return;
- m_scrollLeft = scrollLeft;
- m_mutatedProperties |= CompositorMutableProperty::kScrollLeft;
+ if (!m_state.get())
+ return;
+ m_state->setScrollLeft(scrollLeft);
}
void CompositorProxy::setScrollTop(double scrollTop, ExceptionState& exceptionState)
@@ -234,8 +245,9 @@ void CompositorProxy::setScrollTop(double scrollTop, ExceptionState& exceptionSt
return;
if (raiseExceptionIfNotMutable(CompositorMutableProperty::kScrollTop, exceptionState))
return;
- m_scrollTop = scrollTop;
- m_mutatedProperties |= CompositorMutableProperty::kScrollTop;
+ if (!m_state.get())
+ return;
+ m_state->setScrollTop(scrollTop);
}
void CompositorProxy::setTransform(DOMMatrix* transform, ExceptionState& exceptionState)
@@ -244,8 +256,14 @@ void CompositorProxy::setTransform(DOMMatrix* transform, ExceptionState& excepti
return;
if (raiseExceptionIfNotMutable(CompositorMutableProperty::kTransform, exceptionState))
return;
- m_transform = transform;
- m_mutatedProperties |= CompositorMutableProperty::kTransform;
+ if (!m_state.get())
+ return;
+ m_state->setTransform(TransformationMatrix::toSkMatrix44(transform->matrix()));
+}
+
+void CompositorProxy::takeCompositorMutableState(std::unique_ptr<CompositorMutableState> state)
+{
+ m_state = std::move(state);
}
bool CompositorProxy::raiseExceptionIfNotMutable(uint32_t property, ExceptionState& exceptionState) const

Powered by Google App Engine
This is Rietveld 408576698