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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.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) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 if (overflow_y == EOverflow::kVisible) 1937 if (overflow_y == EOverflow::kVisible)
1938 overflow_y = EOverflow::kAuto; 1938 overflow_y = EOverflow::kAuto;
1939 if (overflow_anchor == EOverflowAnchor::kVisible) 1939 if (overflow_anchor == EOverflowAnchor::kVisible)
1940 overflow_anchor = EOverflowAnchor::kAuto; 1940 overflow_anchor = EOverflowAnchor::kAuto;
1941 // Column-gap is (ab)used by the current paged overflow implementation (in 1941 // Column-gap is (ab)used by the current paged overflow implementation (in
1942 // lack of other ways to specify gaps between pages), so we have to 1942 // lack of other ways to specify gaps between pages), so we have to
1943 // propagate it too. 1943 // propagate it too.
1944 column_gap = overflow_style->ColumnGap(); 1944 column_gap = overflow_style->ColumnGap();
1945 } 1945 }
1946 1946
1947 ScrollSnapAlign snap_align = overflow_style->GetScrollSnapAlign();
1947 ScrollSnapType snap_type = overflow_style->GetScrollSnapType(); 1948 ScrollSnapType snap_type = overflow_style->GetScrollSnapType();
1948 const LengthPoint& snap_destination = overflow_style->ScrollSnapDestination(); 1949 const LengthPoint& snap_destination = overflow_style->ScrollSnapDestination();
1949 1950
1950 RefPtr<ComputedStyle> document_style = GetLayoutViewItem().MutableStyle(); 1951 RefPtr<ComputedStyle> document_style = GetLayoutViewItem().MutableStyle();
1951 if (document_style->GetWritingMode() != root_writing_mode || 1952 if (document_style->GetWritingMode() != root_writing_mode ||
1952 document_style->Direction() != root_direction || 1953 document_style->Direction() != root_direction ||
1953 document_style->VisitedDependentColor(CSSPropertyBackgroundColor) != 1954 document_style->VisitedDependentColor(CSSPropertyBackgroundColor) !=
1954 background_color || 1955 background_color ||
1955 document_style->BackgroundLayers() != background_layers || 1956 document_style->BackgroundLayers() != background_layers ||
1956 document_style->ImageRendering() != image_rendering || 1957 document_style->ImageRendering() != image_rendering ||
1957 document_style->OverflowAnchor() != overflow_anchor || 1958 document_style->OverflowAnchor() != overflow_anchor ||
1958 document_style->OverflowX() != overflow_x || 1959 document_style->OverflowX() != overflow_x ||
1959 document_style->OverflowY() != overflow_y || 1960 document_style->OverflowY() != overflow_y ||
1960 document_style->ColumnGap() != column_gap || 1961 document_style->ColumnGap() != column_gap ||
1962 document_style->GetScrollSnapAlign() != snap_align ||
1961 document_style->GetScrollSnapType() != snap_type || 1963 document_style->GetScrollSnapType() != snap_type ||
1962 document_style->ScrollSnapDestination() != snap_destination) { 1964 document_style->ScrollSnapDestination() != snap_destination) {
1963 RefPtr<ComputedStyle> new_style = ComputedStyle::Clone(*document_style); 1965 RefPtr<ComputedStyle> new_style = ComputedStyle::Clone(*document_style);
1964 new_style->SetWritingMode(root_writing_mode); 1966 new_style->SetWritingMode(root_writing_mode);
1965 new_style->SetDirection(root_direction); 1967 new_style->SetDirection(root_direction);
1966 new_style->SetBackgroundColor(background_color); 1968 new_style->SetBackgroundColor(background_color);
1967 new_style->AccessBackgroundLayers() = background_layers; 1969 new_style->AccessBackgroundLayers() = background_layers;
1968 new_style->SetImageRendering(image_rendering); 1970 new_style->SetImageRendering(image_rendering);
1969 new_style->SetOverflowAnchor(overflow_anchor); 1971 new_style->SetOverflowAnchor(overflow_anchor);
1970 new_style->SetOverflowX(overflow_x); 1972 new_style->SetOverflowX(overflow_x);
1971 new_style->SetOverflowY(overflow_y); 1973 new_style->SetOverflowY(overflow_y);
1972 new_style->SetColumnGap(column_gap); 1974 new_style->SetColumnGap(column_gap);
1975 new_style->SetScrollSnapAlign(snap_align);
1973 new_style->SetScrollSnapType(snap_type); 1976 new_style->SetScrollSnapType(snap_type);
1974 new_style->SetScrollSnapDestination(snap_destination); 1977 new_style->SetScrollSnapDestination(snap_destination);
1975 GetLayoutViewItem().SetStyle(new_style); 1978 GetLayoutViewItem().SetStyle(new_style);
1976 SetupFontBuilder(*new_style); 1979 SetupFontBuilder(*new_style);
1977 } 1980 }
1978 1981
1979 if (body) { 1982 if (body) {
1980 if (const ComputedStyle* style = body->GetComputedStyle()) { 1983 if (const ComputedStyle* style = body->GetComputedStyle()) {
1981 if (style->Direction() != root_direction || 1984 if (style->Direction() != root_direction ||
1982 style->GetWritingMode() != root_writing_mode) 1985 style->GetWritingMode() != root_writing_mode)
(...skipping 4342 matching lines...) Expand 10 before | Expand all | Expand 10 after
6325 6328
6326 void Document::SetThreadedParsingEnabledForTesting(bool enabled) { 6329 void Document::SetThreadedParsingEnabledForTesting(bool enabled) {
6327 g_threaded_parsing_enabled_for_testing = enabled; 6330 g_threaded_parsing_enabled_for_testing = enabled;
6328 } 6331 }
6329 6332
6330 bool Document::ThreadedParsingEnabledForTesting() { 6333 bool Document::ThreadedParsingEnabledForTesting() {
6331 return g_threaded_parsing_enabled_for_testing; 6334 return g_threaded_parsing_enabled_for_testing;
6332 } 6335 }
6333 6336
6334 SnapCoordinator* Document::GetSnapCoordinator() { 6337 SnapCoordinator* Document::GetSnapCoordinator() {
6335 if (RuntimeEnabledFeatures::cssScrollSnapPointsEnabled() && 6338 if (/*RuntimeEnabledFeatures::cssScrollSnapPointsEnabled() &&*/
6336 !snap_coordinator_) 6339 !snap_coordinator_) {
6337 snap_coordinator_ = SnapCoordinator::Create(); 6340 snap_coordinator_ = SnapCoordinator::Create();
6341 }
6338 6342
6339 return snap_coordinator_.Get(); 6343 return snap_coordinator_.Get();
6340 } 6344 }
6341 6345
6342 void Document::SetContextFeatures(ContextFeatures& features) { 6346 void Document::SetContextFeatures(ContextFeatures& features) {
6343 context_features_ = &features; 6347 context_features_ = &features;
6344 } 6348 }
6345 6349
6346 // TODO(mustaq) |request| parameter maybe a misuse of HitTestRequest in 6350 // TODO(mustaq) |request| parameter maybe a misuse of HitTestRequest in
6347 // updateHoverActiveState() since the function doesn't bother with hit-testing. 6351 // updateHoverActiveState() since the function doesn't bother with hit-testing.
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
6819 } 6823 }
6820 6824
6821 void showLiveDocumentInstances() { 6825 void showLiveDocumentInstances() {
6822 WeakDocumentSet& set = liveDocumentSet(); 6826 WeakDocumentSet& set = liveDocumentSet();
6823 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6827 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6824 for (blink::Document* document : set) 6828 for (blink::Document* document : set)
6825 fprintf(stderr, "- Document %p URL: %s\n", document, 6829 fprintf(stderr, "- Document %p URL: %s\n", document,
6826 document->Url().GetString().Utf8().data()); 6830 document->Url().GetString().Utf8().data());
6827 } 6831 }
6828 #endif 6832 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698