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

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

Issue 2824753005: Rename HostWindow to PlatformChromeClient (Closed)
Patch Set: mac Created 3 years, 8 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 return true; 153 return true;
154 154
155 ASSERT(!frame_view->NeedsLayout()); 155 ASSERT(!frame_view->NeedsLayout());
156 156
157 LayoutRect container_viewport_rect(frame_view->VisibleContentRect()); 157 LayoutRect container_viewport_rect(frame_view->VisibleContentRect());
158 // We want to select a node if it is currently off screen, but will be 158 // We want to select a node if it is currently off screen, but will be
159 // exposed after we scroll. Adjust the viewport to post-scrolling position. 159 // exposed after we scroll. Adjust the viewport to post-scrolling position.
160 // If the container has overflow:hidden, we cannot scroll, so we do not pass 160 // If the container has overflow:hidden, we cannot scroll, so we do not pass
161 // direction and we do not adjust for scrolling. 161 // direction and we do not adjust for scrolling.
162 int pixels_per_line_step = 162 int pixels_per_line_step =
163 ScrollableArea::PixelsPerLineStep(frame_view->GetHostWindow()); 163 ScrollableArea::PixelsPerLineStep(frame_view->GetChromeClient());
164 switch (type) { 164 switch (type) {
165 case kWebFocusTypeLeft: 165 case kWebFocusTypeLeft:
166 container_viewport_rect.SetX(container_viewport_rect.X() - 166 container_viewport_rect.SetX(container_viewport_rect.X() -
167 pixels_per_line_step); 167 pixels_per_line_step);
168 container_viewport_rect.SetWidth(container_viewport_rect.Width() + 168 container_viewport_rect.SetWidth(container_viewport_rect.Width() +
169 pixels_per_line_step); 169 pixels_per_line_step);
170 break; 170 break;
171 case kWebFocusTypeRight: 171 case kWebFocusTypeRight:
172 container_viewport_rect.SetWidth(container_viewport_rect.Width() + 172 container_viewport_rect.SetWidth(container_viewport_rect.Width() +
173 pixels_per_line_step); 173 pixels_per_line_step);
(...skipping 23 matching lines...) Expand all
197 return !container_viewport_rect.Intersects(rect); 197 return !container_viewport_rect.Intersects(rect);
198 } 198 }
199 199
200 bool ScrollInDirection(LocalFrame* frame, WebFocusType type) { 200 bool ScrollInDirection(LocalFrame* frame, WebFocusType type) {
201 ASSERT(frame); 201 ASSERT(frame);
202 202
203 if (frame && CanScrollInDirection(frame->GetDocument(), type)) { 203 if (frame && CanScrollInDirection(frame->GetDocument(), type)) {
204 int dx = 0; 204 int dx = 0;
205 int dy = 0; 205 int dy = 0;
206 int pixels_per_line_step = 206 int pixels_per_line_step =
207 ScrollableArea::PixelsPerLineStep(frame->View()->GetHostWindow()); 207 ScrollableArea::PixelsPerLineStep(frame->View()->GetChromeClient());
208 switch (type) { 208 switch (type) {
209 case kWebFocusTypeLeft: 209 case kWebFocusTypeLeft:
210 dx = -pixels_per_line_step; 210 dx = -pixels_per_line_step;
211 break; 211 break;
212 case kWebFocusTypeRight: 212 case kWebFocusTypeRight:
213 dx = pixels_per_line_step; 213 dx = pixels_per_line_step;
214 break; 214 break;
215 case kWebFocusTypeUp: 215 case kWebFocusTypeUp:
216 dy = -pixels_per_line_step; 216 dy = -pixels_per_line_step;
217 break; 217 break;
(...skipping 18 matching lines...) Expand all
236 236
237 if (!container->GetLayoutBox()) 237 if (!container->GetLayoutBox())
238 return false; 238 return false;
239 239
240 if (CanScrollInDirection(container, type)) { 240 if (CanScrollInDirection(container, type)) {
241 int dx = 0; 241 int dx = 0;
242 int dy = 0; 242 int dy = 0;
243 // TODO(leviw): Why are these values truncated (toInt) instead of rounding? 243 // TODO(leviw): Why are these values truncated (toInt) instead of rounding?
244 FrameView* frame_view = container->GetDocument().View(); 244 FrameView* frame_view = container->GetDocument().View();
245 int pixels_per_line_step = ScrollableArea::PixelsPerLineStep( 245 int pixels_per_line_step = ScrollableArea::PixelsPerLineStep(
246 frame_view ? frame_view->GetHostWindow() : nullptr); 246 frame_view ? frame_view->GetChromeClient() : nullptr);
247 switch (type) { 247 switch (type) {
248 case kWebFocusTypeLeft: 248 case kWebFocusTypeLeft:
249 dx = -pixels_per_line_step; 249 dx = -pixels_per_line_step;
250 break; 250 break;
251 case kWebFocusTypeRight: 251 case kWebFocusTypeRight:
252 ASSERT(container->GetLayoutBox()->ScrollWidth() > 252 ASSERT(container->GetLayoutBox()->ScrollWidth() >
253 (container->GetLayoutBox()->ScrollLeft() + 253 (container->GetLayoutBox()->ScrollLeft() +
254 container->GetLayoutBox()->ClientWidth())); 254 container->GetLayoutBox()->ClientWidth()));
255 dx = pixels_per_line_step; 255 dx = pixels_per_line_step;
256 break; 256 break;
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 return rect; 689 return rect;
690 } 690 }
691 691
692 HTMLFrameOwnerElement* FrameOwnerElement(FocusCandidate& candidate) { 692 HTMLFrameOwnerElement* FrameOwnerElement(FocusCandidate& candidate) {
693 return candidate.IsFrameOwnerElement() 693 return candidate.IsFrameOwnerElement()
694 ? ToHTMLFrameOwnerElement(candidate.visible_node) 694 ? ToHTMLFrameOwnerElement(candidate.visible_node)
695 : nullptr; 695 : nullptr;
696 }; 696 };
697 697
698 } // namespace blink 698 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/ChromeClient.cpp ('k') | third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698