Rename composited selection anchor/focus to start/end

Maintain naming consistency with Blink wherein selection start and end indicate
proper and consistent ordering in the document.

BUG=279489

Review URL: https://codereview.chromium.org/379473002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283421 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/output/compositor_frame_metadata.h b/cc/output/compositor_frame_metadata.h
index 4beb678..b7f244c 100644
--- a/cc/output/compositor_frame_metadata.h
+++ b/cc/output/compositor_frame_metadata.h
@@ -43,8 +43,8 @@
 
   // Provides selection region updates relative to the current viewport. If the
   // selection is empty or otherwise unused, the bound types will indicate such.
-  ViewportSelectionBound selection_anchor;
-  ViewportSelectionBound selection_focus;
+  ViewportSelectionBound selection_start;
+  ViewportSelectionBound selection_end;
 
   std::vector<ui::LatencyInfo> latency_info;
 };
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 3618a4b..770c3953 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -322,7 +322,7 @@
     sync_tree->ClearViewportLayers();
   }
 
-  sync_tree->RegisterSelection(selection_anchor_, selection_focus_);
+  sync_tree->RegisterSelection(selection_start_, selection_end_);
 
   float page_scale_delta =
       sync_tree->page_scale_delta() / sync_tree->sent_page_scale_delta();
@@ -1239,13 +1239,13 @@
   outer_viewport_scroll_layer_ = outer_viewport_scroll_layer;
 }
 
-void LayerTreeHost::RegisterSelection(const LayerSelectionBound& anchor,
-                                      const LayerSelectionBound& focus) {
-  if (selection_anchor_ == anchor && selection_focus_ == focus)
+void LayerTreeHost::RegisterSelection(const LayerSelectionBound& start,
+                                      const LayerSelectionBound& end) {
+  if (selection_start_ == start && selection_end_ == end)
     return;
 
-  selection_anchor_ = anchor;
-  selection_focus_ = focus;
+  selection_start_ = start;
+  selection_end_ = end;
   SetNeedsCommit();
 }
 
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index 1e977c3b..d53140e 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -179,8 +179,8 @@
     return outer_viewport_scroll_layer_.get();
   }
 
-  void RegisterSelection(const LayerSelectionBound& anchor,
-                         const LayerSelectionBound& focus);
+  void RegisterSelection(const LayerSelectionBound& start,
+                         const LayerSelectionBound& end);
 
   const LayerTreeSettings& settings() const { return settings_; }
 
@@ -443,8 +443,8 @@
   scoped_refptr<Layer> inner_viewport_scroll_layer_;
   scoped_refptr<Layer> outer_viewport_scroll_layer_;
 
-  LayerSelectionBound selection_anchor_;
-  LayerSelectionBound selection_focus_;
+  LayerSelectionBound selection_start_;
+  LayerSelectionBound selection_end_;
 
   SharedBitmapManager* shared_bitmap_manager_;
 
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 539eac4..f3cf1562 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1419,8 +1419,8 @@
     metadata.overdraw_bottom_height = overdraw_bottom_height_;
   }
 
-  active_tree_->GetViewportSelection(&metadata.selection_anchor,
-                                     &metadata.selection_focus);
+  active_tree_->GetViewportSelection(&metadata.selection_start,
+                                     &metadata.selection_end);
 
   if (!InnerViewportScrollLayer())
     return metadata;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index d9d3d57..e6f443a 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -6336,21 +6336,21 @@
   // Ensure the default frame selection bounds are empty.
   FakeOutputSurface* fake_output_surface =
       static_cast<FakeOutputSurface*>(host_impl_->output_surface());
-  const ViewportSelectionBound& selection_anchor_before =
-      fake_output_surface->last_sent_frame().metadata.selection_anchor;
-  const ViewportSelectionBound& selection_focus_before =
-      fake_output_surface->last_sent_frame().metadata.selection_focus;
-  EXPECT_EQ(ViewportSelectionBound(), selection_anchor_before);
-  EXPECT_EQ(ViewportSelectionBound(), selection_focus_before);
+  const ViewportSelectionBound& selection_start_before =
+      fake_output_surface->last_sent_frame().metadata.selection_start;
+  const ViewportSelectionBound& selection_end_before =
+      fake_output_surface->last_sent_frame().metadata.selection_end;
+  EXPECT_EQ(ViewportSelectionBound(), selection_start_before);
+  EXPECT_EQ(ViewportSelectionBound(), selection_end_before);
 
   // Plumb the layer-local selection bounds.
   gfx::Rect selection_rect(5, 0, 0, 5);
-  LayerSelectionBound anchor, focus;
-  anchor.type = SELECTION_BOUND_CENTER;
-  anchor.layer_id = root_layer_id;
-  anchor.layer_rect = selection_rect;
-  focus = anchor;
-  host_impl_->active_tree()->RegisterSelection(anchor, focus);
+  LayerSelectionBound start, end;
+  start.type = SELECTION_BOUND_CENTER;
+  start.layer_id = root_layer_id;
+  start.layer_rect = selection_rect;
+  end = start;
+  host_impl_->active_tree()->RegisterSelection(start, end);
 
   // Trigger a draw-swap sequence.
   host_impl_->SetNeedsRedraw();
@@ -6363,16 +6363,16 @@
   EXPECT_TRUE(host_impl_->SwapBuffers(frame));
 
   // Ensure the selection bounds have propagated to the frame metadata.
-  const ViewportSelectionBound& selection_anchor_after =
-      fake_output_surface->last_sent_frame().metadata.selection_anchor;
-  const ViewportSelectionBound& selection_focus_after =
-      fake_output_surface->last_sent_frame().metadata.selection_focus;
-  EXPECT_EQ(anchor.type, selection_anchor_after.type);
-  EXPECT_EQ(focus.type, selection_focus_after.type);
-  EXPECT_EQ(selection_rect, selection_anchor_after.viewport_rect);
-  EXPECT_EQ(selection_rect, selection_anchor_after.viewport_rect);
-  EXPECT_TRUE(selection_anchor_after.visible);
-  EXPECT_TRUE(selection_anchor_after.visible);
+  const ViewportSelectionBound& selection_start_after =
+      fake_output_surface->last_sent_frame().metadata.selection_start;
+  const ViewportSelectionBound& selection_end_after =
+      fake_output_surface->last_sent_frame().metadata.selection_end;
+  EXPECT_EQ(start.type, selection_start_after.type);
+  EXPECT_EQ(end.type, selection_end_after.type);
+  EXPECT_EQ(selection_rect, selection_start_after.viewport_rect);
+  EXPECT_EQ(selection_rect, selection_start_after.viewport_rect);
+  EXPECT_TRUE(selection_start_after.visible);
+  EXPECT_TRUE(selection_start_after.visible);
 }
 
 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor {
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index bf0a996..392e80b 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -211,7 +211,7 @@
     target_tree->ClearViewportLayers();
   }
 
-  target_tree->RegisterSelection(selection_anchor_, selection_focus_);
+  target_tree->RegisterSelection(selection_start_, selection_end_);
 
   // This should match the property synchronization in
   // LayerTreeHost::finishCommitOnImplThread().
@@ -1315,10 +1315,10 @@
   return data_for_recursion.closest_match;
 }
 
-void LayerTreeImpl::RegisterSelection(const LayerSelectionBound& anchor,
-                                      const LayerSelectionBound& focus) {
-  selection_anchor_ = anchor;
-  selection_focus_ = focus;
+void LayerTreeImpl::RegisterSelection(const LayerSelectionBound& start,
+                                      const LayerSelectionBound& end) {
+  selection_start_ = start;
+  selection_end_ = end;
 }
 
 static ViewportSelectionBound ComputeViewportSelection(
@@ -1349,22 +1349,22 @@
   return result;
 }
 
-void LayerTreeImpl::GetViewportSelection(ViewportSelectionBound* anchor,
-                                         ViewportSelectionBound* focus) {
-  DCHECK(anchor);
-  DCHECK(focus);
+void LayerTreeImpl::GetViewportSelection(ViewportSelectionBound* start,
+                                         ViewportSelectionBound* end) {
+  DCHECK(start);
+  DCHECK(end);
 
-  *anchor = ComputeViewportSelection(
-      selection_anchor_,
-      selection_anchor_.layer_id ? LayerById(selection_anchor_.layer_id) : NULL,
+  *start = ComputeViewportSelection(
+      selection_start_,
+      selection_start_.layer_id ? LayerById(selection_start_.layer_id) : NULL,
       device_scale_factor());
-  if (anchor->type == SELECTION_BOUND_CENTER ||
-      anchor->type == SELECTION_BOUND_EMPTY) {
-    *focus = *anchor;
+  if (start->type == SELECTION_BOUND_CENTER ||
+      start->type == SELECTION_BOUND_EMPTY) {
+    *end = *start;
   } else {
-    *focus = ComputeViewportSelection(
-        selection_focus_,
-        selection_focus_.layer_id ? LayerById(selection_focus_.layer_id) : NULL,
+    *end = ComputeViewportSelection(
+        selection_end_,
+        selection_end_.layer_id ? LayerById(selection_end_.layer_id) : NULL,
         device_scale_factor());
   }
 }
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h
index 13746c3..48c6f47 100644
--- a/cc/trees/layer_tree_impl.h
+++ b/cc/trees/layer_tree_impl.h
@@ -267,13 +267,13 @@
   LayerImpl* FindLayerThatIsHitByPointInTouchHandlerRegion(
       const gfx::PointF& screen_space_point);
 
-  void RegisterSelection(const LayerSelectionBound& anchor,
-                         const LayerSelectionBound& focus);
+  void RegisterSelection(const LayerSelectionBound& start,
+                         const LayerSelectionBound& end);
 
   // Compute the current selection handle location and visbility with respect to
   // the viewport.
-  void GetViewportSelection(ViewportSelectionBound* anchor,
-                            ViewportSelectionBound* focus);
+  void GetViewportSelection(ViewportSelectionBound* start,
+                            ViewportSelectionBound* end);
 
   void RegisterPictureLayerImpl(PictureLayerImpl* layer);
   void UnregisterPictureLayerImpl(PictureLayerImpl* layer);
@@ -299,8 +299,8 @@
   LayerImpl* inner_viewport_scroll_layer_;
   LayerImpl* outer_viewport_scroll_layer_;
 
-  LayerSelectionBound selection_anchor_;
-  LayerSelectionBound selection_focus_;
+  LayerSelectionBound selection_start_;
+  LayerSelectionBound selection_end_;
 
   float page_scale_factor_;
   float page_scale_delta_;