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

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

Issue 2821303005: [selectors4] Use common ancestor strategy for :focus-within (Closed)
Patch Set: 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 WebFocusType focus_type,
208 Node* common_ancestor) {
208 if (IsFocused() == should_be_focused) 209 if (IsFocused() == should_be_focused)
209 return; 210 return;
210 211
211 HTMLAnchorElement::SetFocused(should_be_focused, focus_type); 212 HTMLAnchorElement::SetFocused(should_be_focused, focus_type, common_ancestor);
212 213
213 HTMLImageElement* image_element = this->ImageElement(); 214 HTMLImageElement* image_element = this->ImageElement();
214 if (!image_element) 215 if (!image_element)
215 return; 216 return;
216 217
217 LayoutObject* layout_object = image_element->GetLayoutObject(); 218 LayoutObject* layout_object = image_element->GetLayoutObject();
218 if (!layout_object || !layout_object->IsImage()) 219 if (!layout_object || !layout_object->IsImage())
219 return; 220 return;
220 221
221 ToLayoutImage(layout_object)->AreaElementFocusChanged(this); 222 ToLayoutImage(layout_object)->AreaElementFocusChanged(this);
222 } 223 }
223 224
224 void HTMLAreaElement::UpdateFocusAppearance( 225 void HTMLAreaElement::UpdateFocusAppearance(
225 SelectionBehaviorOnFocus selection_behavior) { 226 SelectionBehaviorOnFocus selection_behavior) {
226 GetDocument().UpdateStyleAndLayoutTreeForNode(this); 227 GetDocument().UpdateStyleAndLayoutTreeForNode(this);
227 if (!IsFocusable()) 228 if (!IsFocusable())
228 return; 229 return;
229 230
230 if (HTMLImageElement* image_element = this->ImageElement()) 231 if (HTMLImageElement* image_element = this->ImageElement())
231 image_element->UpdateFocusAppearance(selection_behavior); 232 image_element->UpdateFocusAppearance(selection_behavior);
232 } 233 }
233 234
234 } // namespace blink 235 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698