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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.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) 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 SnapCoordinator* snap_coordinator = GetDocument().GetSnapCoordinator(); 444 SnapCoordinator* snap_coordinator = GetDocument().GetSnapCoordinator();
445 if (!snap_coordinator) 445 if (!snap_coordinator)
446 return; 446 return;
447 447
448 // Scroll snap type has no effect on the viewport defining element instead 448 // Scroll snap type has no effect on the viewport defining element instead
449 // they are handled by the LayoutView. 449 // they are handled by the LayoutView.
450 bool allows_snap_container = 450 bool allows_snap_container =
451 GetNode() != GetDocument().ViewportDefiningElement(); 451 GetNode() != GetDocument().ViewportDefiningElement();
452 452
453 ScrollSnapType old_snap_type = 453 ScrollSnapType old_snap_type =
454 old_style ? old_style->GetScrollSnapType() : kScrollSnapTypeNone; 454 old_style ? old_style->GetScrollSnapType() : ScrollSnapType();
455 ScrollSnapType new_snap_type = new_style && allows_snap_container 455 ScrollSnapType new_snap_type = new_style && allows_snap_container
456 ? new_style->GetScrollSnapType() 456 ? new_style->GetScrollSnapType()
457 : kScrollSnapTypeNone; 457 : ScrollSnapType();
458 if (old_snap_type != new_snap_type) 458 if (old_snap_type != new_snap_type)
459 snap_coordinator->SnapContainerDidChange(*this, new_snap_type); 459 snap_coordinator->SnapContainerDidChange(*this, new_snap_type);
460 460
461 Vector<LengthPoint> empty_vector; 461 /*Vector<LengthPoint> empty_vector;
462 const Vector<LengthPoint>& old_snap_coordinate = 462 const Vector<LengthPoint>& old_snap_coordinate =
463 old_style ? old_style->ScrollSnapCoordinate() : empty_vector; 463 old_style ? old_style->ScrollSnapCoordinate() : empty_vector;
464 const Vector<LengthPoint>& new_snap_coordinate = 464 const Vector<LengthPoint>& new_snap_coordinate =
465 new_style ? new_style->ScrollSnapCoordinate() : empty_vector; 465 new_style ? new_style->ScrollSnapCoordinate() : empty_vector;
466 if (old_snap_coordinate != new_snap_coordinate) 466 if (old_snap_coordinate != new_snap_coordinate)
467 snap_coordinator->SnapAreaDidChange(*this, new_snap_coordinate); 467 snap_coordinator->SnapAreaDidChange(*this, new_snap_coordinate);*/
468
469 ScrollSnapAlign old_snap_align =
470 old_style ? old_style->GetScrollSnapAlign() : ScrollSnapAlign();
471 ScrollSnapAlign new_snap_align = new_style && allows_snap_container
472 ? new_style->GetScrollSnapAlign()
473 : ScrollSnapAlign();
474 if (old_snap_align != new_snap_align)
475 snap_coordinator->SnapAreaDidChange(*this, new_snap_align);
468 } 476 }
469 477
470 void LayoutBox::AddScrollSnapMapping() { 478 void LayoutBox::AddScrollSnapMapping() {
471 UpdateScrollSnapMappingAfterStyleChange(Style(), nullptr); 479 UpdateScrollSnapMappingAfterStyleChange(Style(), nullptr);
472 } 480 }
473 481
474 void LayoutBox::ClearScrollSnapMapping() { 482 void LayoutBox::ClearScrollSnapMapping() {
475 UpdateScrollSnapMappingAfterStyleChange(nullptr, Style()); 483 UpdateScrollSnapMappingAfterStyleChange(nullptr, Style());
476 } 484 }
477 485
(...skipping 5413 matching lines...) Expand 10 before | Expand all | Expand 10 after
5891 void LayoutBox::MutableForPainting:: 5899 void LayoutBox::MutableForPainting::
5892 SavePreviousContentBoxSizeAndLayoutOverflowRect() { 5900 SavePreviousContentBoxSizeAndLayoutOverflowRect() {
5893 auto& rare_data = GetLayoutBox().EnsureRareData(); 5901 auto& rare_data = GetLayoutBox().EnsureRareData();
5894 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; 5902 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true;
5895 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); 5903 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size();
5896 rare_data.previous_layout_overflow_rect_ = 5904 rare_data.previous_layout_overflow_rect_ =
5897 GetLayoutBox().LayoutOverflowRect(); 5905 GetLayoutBox().LayoutOverflowRect();
5898 } 5906 }
5899 5907
5900 } // namespace blink 5908 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698