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

Side by Side Diff: third_party/WebKit/Source/core/page/SpatialNavigation.cpp

Issue 1653673002: Even more explicit LayoutUnit conversion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@moarConstructors
Patch Set: address comments Created 4 years, 10 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 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
3 * Copyright (C) 2009 Antonio Gomes <tonikitoo@webkit.org> 3 * Copyright (C) 2009 Antonio Gomes <tonikitoo@webkit.org>
4 * 4 *
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 return true; 187 return true;
188 188
189 return !containerViewportRect.intersects(rect); 189 return !containerViewportRect.intersects(rect);
190 } 190 }
191 191
192 bool scrollInDirection(LocalFrame* frame, WebFocusType type) 192 bool scrollInDirection(LocalFrame* frame, WebFocusType type)
193 { 193 {
194 ASSERT(frame); 194 ASSERT(frame);
195 195
196 if (frame && canScrollInDirection(frame->document(), type)) { 196 if (frame && canScrollInDirection(frame->document(), type)) {
197 LayoutUnit dx = 0; 197 LayoutUnit dx;
198 LayoutUnit dy = 0; 198 LayoutUnit dy;
199 switch (type) { 199 switch (type) {
200 case WebFocusTypeLeft: 200 case WebFocusTypeLeft:
201 dx = - ScrollableArea::pixelsPerLineStep(); 201 dx = - ScrollableArea::pixelsPerLineStep();
202 break; 202 break;
203 case WebFocusTypeRight: 203 case WebFocusTypeRight:
204 dx = ScrollableArea::pixelsPerLineStep(); 204 dx = ScrollableArea::pixelsPerLineStep();
205 break; 205 break;
206 case WebFocusTypeUp: 206 case WebFocusTypeUp:
207 dy = - ScrollableArea::pixelsPerLineStep(); 207 dy = - ScrollableArea::pixelsPerLineStep();
208 break; 208 break;
(...skipping 14 matching lines...) Expand all
223 bool scrollInDirection(Node* container, WebFocusType type) 223 bool scrollInDirection(Node* container, WebFocusType type)
224 { 224 {
225 ASSERT(container); 225 ASSERT(container);
226 if (container->isDocumentNode()) 226 if (container->isDocumentNode())
227 return scrollInDirection(toDocument(container)->frame(), type); 227 return scrollInDirection(toDocument(container)->frame(), type);
228 228
229 if (!container->layoutBox()) 229 if (!container->layoutBox())
230 return false; 230 return false;
231 231
232 if (canScrollInDirection(container, type)) { 232 if (canScrollInDirection(container, type)) {
233 LayoutUnit dx = 0; 233 LayoutUnit dx;
234 LayoutUnit dy = 0; 234 LayoutUnit dy;
235 switch (type) { 235 switch (type) {
236 case WebFocusTypeLeft: 236 case WebFocusTypeLeft:
237 dx = - std::min<LayoutUnit>(ScrollableArea::pixelsPerLineStep(), con tainer->layoutBox()->scrollLeft()); 237 dx = - std::min<LayoutUnit>(ScrollableArea::pixelsPerLineStep(), con tainer->layoutBox()->scrollLeft());
238 break; 238 break;
239 case WebFocusTypeRight: 239 case WebFocusTypeRight:
240 ASSERT(container->layoutBox()->scrollWidth() > (container->layoutBox ()->scrollLeft() + container->layoutBox()->clientWidth())); 240 ASSERT(container->layoutBox()->scrollWidth() > (container->layoutBox ()->scrollLeft() + container->layoutBox()->clientWidth()));
241 dx = std::min<LayoutUnit>(ScrollableArea::pixelsPerLineStep(), conta iner->layoutBox()->scrollWidth() - (container->layoutBox()->scrollLeft() + conta iner->layoutBox()->clientWidth())); 241 dx = std::min<LayoutUnit>(ScrollableArea::pixelsPerLineStep(), conta iner->layoutBox()->scrollWidth() - (container->layoutBox()->scrollLeft() + conta iner->layoutBox()->clientWidth()));
242 break; 242 break;
243 case WebFocusTypeUp: 243 case WebFocusTypeUp:
244 dy = - std::min<LayoutUnit>(ScrollableArea::pixelsPerLineStep(), con tainer->layoutBox()->scrollTop()); 244 dy = - std::min<LayoutUnit>(ScrollableArea::pixelsPerLineStep(), con tainer->layoutBox()->scrollTop());
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar ea.document().frame(), area.computeRect(area.imageElement()->layoutObject())), 1 ); 624 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar ea.document().frame(), area.computeRect(area.imageElement()->layoutObject())), 1 );
625 return rect; 625 return rect;
626 } 626 }
627 627
628 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) 628 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate)
629 { 629 {
630 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v isibleNode) : nullptr; 630 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v isibleNode) : nullptr;
631 }; 631 };
632 632
633 } // namespace blink 633 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698