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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp

Issue 2767213003: First Implementation of Snapped Points
Patch Set: Rebase and format Created 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 contents_clipping_mask_layer_->SetSize(FloatSize(contents_rect_.Size())); 375 contents_clipping_mask_layer_->SetSize(FloatSize(contents_rect_.Size()));
376 contents_clipping_mask_layer_->SetNeedsDisplay(); 376 contents_clipping_mask_layer_->SetNeedsDisplay();
377 } 377 }
378 contents_clipping_mask_layer_->SetPosition(FloatPoint()); 378 contents_clipping_mask_layer_->SetPosition(FloatPoint());
379 contents_clipping_mask_layer_->SetOffsetFromLayoutObject( 379 contents_clipping_mask_layer_->SetOffsetFromLayoutObject(
380 OffsetFromLayoutObject() + 380 OffsetFromLayoutObject() +
381 IntSize(contents_rect_.Location().X(), contents_rect_.Location().Y())); 381 IntSize(contents_rect_.Location().X(), contents_rect_.Location().Y()));
382 } 382 }
383 } 383 }
384 384
385 void GraphicsLayer::SetSnapOffsets(const WebSnapPointList& offsets) {
386 layer_->Layer()->SetScrollSnapOffsets(offsets);
387 }
388
389 /*void GraphicsLayer::UpdateSnapOffsets() {
390 std::vector<double> horizontalOffsets, verticalOffsets;
391 for (double offset : m_snapOffsetsH) {
392 LOG(ERROR) << offset;
393 horizontalOffsets.push_back(offset);
394 }
395 for (double offset : m_snapOffsetsV) {
396 verticalOffsets.push_back(offset);
397 }
398 m_layer->layer()->setScrollSnapOffsets(horizontalOffsets, verticalOffsets);
399 }*/
400
385 static HashSet<int>* g_registered_layer_set; 401 static HashSet<int>* g_registered_layer_set;
386 402
387 void GraphicsLayer::RegisterContentsLayer(WebLayer* layer) { 403 void GraphicsLayer::RegisterContentsLayer(WebLayer* layer) {
388 if (!g_registered_layer_set) 404 if (!g_registered_layer_set)
389 g_registered_layer_set = new HashSet<int>; 405 g_registered_layer_set = new HashSet<int>;
390 CHECK(!g_registered_layer_set->Contains(layer->Id())); 406 CHECK(!g_registered_layer_set->Contains(layer->Id()));
391 g_registered_layer_set->insert(layer->Id()); 407 g_registered_layer_set->insert(layer->Id());
392 } 408 }
393 409
394 void GraphicsLayer::UnregisterContentsLayer(WebLayer* layer) { 410 void GraphicsLayer::UnregisterContentsLayer(WebLayer* layer) {
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 if (!layer) { 1318 if (!layer) {
1303 LOG(INFO) << "Cannot showGraphicsLayers for (nil)."; 1319 LOG(INFO) << "Cannot showGraphicsLayers for (nil).";
1304 return; 1320 return;
1305 } 1321 }
1306 1322
1307 String output = 1323 String output =
1308 layer->LayerTreeAsText(0xffffffff & ~blink::kOutputAsLayerTree); 1324 layer->LayerTreeAsText(0xffffffff & ~blink::kOutputAsLayerTree);
1309 LOG(INFO) << output.Utf8().data(); 1325 LOG(INFO) << output.Utf8().data();
1310 } 1326 }
1311 #endif 1327 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698