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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2932593004: Update the snap points css properties (Closed)
Patch Set: Fix nits 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 ScrollSnapAlign old_snap_align =
462 const Vector<LengthPoint>& old_snap_coordinate = 462 old_style ? old_style->GetScrollSnapAlign() : ScrollSnapAlign();
463 old_style ? old_style->ScrollSnapCoordinate() : empty_vector; 463 ScrollSnapAlign new_snap_align = new_style && allows_snap_container
464 const Vector<LengthPoint>& new_snap_coordinate = 464 ? new_style->GetScrollSnapAlign()
465 new_style ? new_style->ScrollSnapCoordinate() : empty_vector; 465 : ScrollSnapAlign();
466 if (old_snap_coordinate != new_snap_coordinate) 466 if (old_snap_align != new_snap_align)
467 snap_coordinator->SnapAreaDidChange(*this, new_snap_coordinate); 467 snap_coordinator->SnapAreaDidChange(*this, new_snap_align);
468 } 468 }
469 469
470 void LayoutBox::AddScrollSnapMapping() { 470 void LayoutBox::AddScrollSnapMapping() {
471 UpdateScrollSnapMappingAfterStyleChange(Style(), nullptr); 471 UpdateScrollSnapMappingAfterStyleChange(Style(), nullptr);
472 } 472 }
473 473
474 void LayoutBox::ClearScrollSnapMapping() { 474 void LayoutBox::ClearScrollSnapMapping() {
475 UpdateScrollSnapMappingAfterStyleChange(nullptr, Style()); 475 UpdateScrollSnapMappingAfterStyleChange(nullptr, Style());
476 } 476 }
477 477
(...skipping 5465 matching lines...) Expand 10 before | Expand all | Expand 10 after
5943 void LayoutBox::MutableForPainting:: 5943 void LayoutBox::MutableForPainting::
5944 SavePreviousContentBoxSizeAndLayoutOverflowRect() { 5944 SavePreviousContentBoxSizeAndLayoutOverflowRect() {
5945 auto& rare_data = GetLayoutBox().EnsureRareData(); 5945 auto& rare_data = GetLayoutBox().EnsureRareData();
5946 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; 5946 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true;
5947 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); 5947 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size();
5948 rare_data.previous_layout_overflow_rect_ = 5948 rare_data.previous_layout_overflow_rect_ =
5949 GetLayoutBox().LayoutOverflowRect(); 5949 GetLayoutBox().LayoutOverflowRect();
5950 } 5950 }
5951 5951
5952 } // namespace blink 5952 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698