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

Unified Diff: cc/layers/layer_position_constraint.cc

Issue 12552004: Support bottom-right anchored fixed-position elements during a pinch gesture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 7 years, 9 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: cc/layers/layer_position_constraint.cc
diff --git a/cc/layers/layer_position_constraint.cc b/cc/layers/layer_position_constraint.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d18fbe9dece4f21649b22ec38587d4c07baf8627
--- /dev/null
+++ b/cc/layers/layer_position_constraint.cc
@@ -0,0 +1,48 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/layers/layer_position_constraint.h"
+
+#include "third_party/WebKit/Source/Platform/chromium/public/WebLayerPositionConstraint.h"
+
+using WebKit::WebLayerPositionConstraint;
+
+namespace cc {
+
+LayerPositionConstraint::LayerPositionConstraint()
+ : is_fixed_position_(false),
+ is_fixed_to_right_edge_(false),
+ is_fixed_to_bottom_edge_(false) {
+}
+
+LayerPositionConstraint::LayerPositionConstraint(
+ const WebLayerPositionConstraint& constraint)
+ : is_fixed_position_(constraint.isFixedPosition),
+ is_fixed_to_right_edge_(constraint.isFixedToRightEdge),
+ is_fixed_to_bottom_edge_(constraint.isFixedToBottomEdge) {
+}
+
+bool LayerPositionConstraint::operator==(
+ const LayerPositionConstraint& other) const {
+ if (!is_fixed_position_ && !other.is_fixed_position_)
+ return true;
+ return is_fixed_position_ == other.is_fixed_position_ &&
+ is_fixed_to_right_edge_ == other.is_fixed_to_right_edge_ &&
+ is_fixed_to_bottom_edge_ == other.is_fixed_to_bottom_edge_;
+}
+
+bool LayerPositionConstraint::operator!=(
+ const LayerPositionConstraint& other) const {
+ return !(*this == other);
+}
+
+LayerPositionConstraint::operator WebLayerPositionConstraint() const {
+ WebLayerPositionConstraint constraint;
+ constraint.isFixedPosition = is_fixed_position_;
+ constraint.isFixedToRightEdge = is_fixed_to_right_edge_;
+ constraint.isFixedToBottomEdge = is_fixed_to_bottom_edge_;
+ return constraint;
+}
+
+} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698