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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLAreaElement.cpp

Issue 2810593002: Set plugin focus by implementing HTMLPlugInElement::SetFocused. (Closed)
Patch Set: fix comments 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) 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 * Copyright (C) 2004, 2005, 2006, 2009, 2011 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2009, 2011 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 bool HTMLAreaElement::LayoutObjectIsFocusable() const { 197 bool HTMLAreaElement::LayoutObjectIsFocusable() const {
198 HTMLImageElement* image = ImageElement(); 198 HTMLImageElement* image = ImageElement();
199 if (!image || !image->GetLayoutObject() || 199 if (!image || !image->GetLayoutObject() ||
200 image->GetLayoutObject()->Style()->Visibility() != EVisibility::kVisible) 200 image->GetLayoutObject()->Style()->Visibility() != EVisibility::kVisible)
201 return false; 201 return false;
202 202
203 return SupportsFocus() && Element::tabIndex() >= 0; 203 return SupportsFocus() && Element::tabIndex() >= 0;
204 } 204 }
205 205
206 void HTMLAreaElement::SetFocused(bool should_be_focused) { 206 void HTMLAreaElement::SetFocused(bool should_be_focused,
207 WebFocusType focus_type) {
207 if (IsFocused() == should_be_focused) 208 if (IsFocused() == should_be_focused)
208 return; 209 return;
209 210
210 HTMLAnchorElement::SetFocused(should_be_focused); 211 HTMLAnchorElement::SetFocused(should_be_focused, focus_type);
211 212
212 HTMLImageElement* image_element = this->ImageElement(); 213 HTMLImageElement* image_element = this->ImageElement();
213 if (!image_element) 214 if (!image_element)
214 return; 215 return;
215 216
216 LayoutObject* layout_object = image_element->GetLayoutObject(); 217 LayoutObject* layout_object = image_element->GetLayoutObject();
217 if (!layout_object || !layout_object->IsImage()) 218 if (!layout_object || !layout_object->IsImage())
218 return; 219 return;
219 220
220 ToLayoutImage(layout_object)->AreaElementFocusChanged(this); 221 ToLayoutImage(layout_object)->AreaElementFocusChanged(this);
221 } 222 }
222 223
223 void HTMLAreaElement::UpdateFocusAppearance( 224 void HTMLAreaElement::UpdateFocusAppearance(
224 SelectionBehaviorOnFocus selection_behavior) { 225 SelectionBehaviorOnFocus selection_behavior) {
225 GetDocument().UpdateStyleAndLayoutTreeForNode(this); 226 GetDocument().UpdateStyleAndLayoutTreeForNode(this);
226 if (!IsFocusable()) 227 if (!IsFocusable())
227 return; 228 return;
228 229
229 if (HTMLImageElement* image_element = this->ImageElement()) 230 if (HTMLImageElement* image_element = this->ImageElement())
230 image_element->UpdateFocusAppearance(selection_behavior); 231 image_element->UpdateFocusAppearance(selection_behavior);
231 } 232 }
232 233
233 } // namespace blink 234 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLAreaElement.h ('k') | third_party/WebKit/Source/core/html/HTMLFrameElementBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698