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

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.h

Issue 1667623002: Make sure Document::updateLayoutTree*() is called before Element::isFocusable(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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) 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 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved. 6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 void nativeApplyScroll(ScrollState&); 403 void nativeApplyScroll(ScrollState&);
404 404
405 void callDistributeScroll(ScrollState&); 405 void callDistributeScroll(ScrollState&);
406 void callApplyScroll(ScrollState&); 406 void callApplyScroll(ScrollState&);
407 407
408 // Whether this element can receive focus at all. Most elements are not 408 // Whether this element can receive focus at all. Most elements are not
409 // focusable but some elements, such as form controls and links, are. Unlike 409 // focusable but some elements, such as form controls and links, are. Unlike
410 // layoutObjectIsFocusable(), this method may be called when layout is not u p to 410 // layoutObjectIsFocusable(), this method may be called when layout is not u p to
411 // date, so it must not use the layoutObject to determine focusability. 411 // date, so it must not use the layoutObject to determine focusability.
412 virtual bool supportsFocus() const; 412 virtual bool supportsFocus() const;
413 // Whether the node can actually be focused. 413 // Whether the node can actually be focused. Callers should ensure
414 // ComputedStyle is up to date;
415 // e.g. Calling Document::updateLayoutTreeIgnorePendingStylesheets().
falken 2016/02/05 04:42:40 comment nits: one space after period is consistent
tkent 2016/02/05 04:57:45 Done.
414 bool isFocusable() const; 416 bool isFocusable() const;
415 bool isFocusedElementInDocument() const;
416 virtual bool isKeyboardFocusable() const; 417 virtual bool isKeyboardFocusable() const;
417 virtual bool isMouseFocusable() const; 418 virtual bool isMouseFocusable() const;
419 bool isFocusedElementInDocument() const;
420
418 virtual void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType, In putDeviceCapabilities* sourceCapabilities = nullptr); 421 virtual void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType, In putDeviceCapabilities* sourceCapabilities = nullptr);
419 virtual void dispatchBlurEvent(Element* newFocusedElement, WebFocusType, Inp utDeviceCapabilities* sourceCapabilities = nullptr); 422 virtual void dispatchBlurEvent(Element* newFocusedElement, WebFocusType, Inp utDeviceCapabilities* sourceCapabilities = nullptr);
420 virtual void dispatchFocusInEvent(const AtomicString& eventType, Element* ol dFocusedElement, WebFocusType, InputDeviceCapabilities* sourceCapabilities = nul lptr); 423 virtual void dispatchFocusInEvent(const AtomicString& eventType, Element* ol dFocusedElement, WebFocusType, InputDeviceCapabilities* sourceCapabilities = nul lptr);
421 void dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocuse dElement, InputDeviceCapabilities* sourceCapabilities = nullptr); 424 void dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocuse dElement, InputDeviceCapabilities* sourceCapabilities = nullptr);
422 425
423 String innerText(); 426 String innerText();
424 String outerText(); 427 String outerText();
425 String innerHTML() const; 428 String innerHTML() const;
426 String outerHTML() const; 429 String outerHTML() const;
427 void setInnerHTML(const String&, ExceptionState&); 430 void setInnerHTML(const String&, ExceptionState&);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 virtual void didRecalcStyle(StyleRecalcChange); 579 virtual void didRecalcStyle(StyleRecalcChange);
577 virtual PassRefPtr<ComputedStyle> customStyleForLayoutObject(); 580 virtual PassRefPtr<ComputedStyle> customStyleForLayoutObject();
578 581
579 virtual bool shouldRegisterAsNamedItem() const { return false; } 582 virtual bool shouldRegisterAsNamedItem() const { return false; }
580 virtual bool shouldRegisterAsExtraNamedItem() const { return false; } 583 virtual bool shouldRegisterAsExtraNamedItem() const { return false; }
581 584
582 bool supportsSpatialNavigationFocus() const; 585 bool supportsSpatialNavigationFocus() const;
583 586
584 void clearTabIndexExplicitlyIfNeeded(); 587 void clearTabIndexExplicitlyIfNeeded();
585 void setTabIndexExplicitly(short); 588 void setTabIndexExplicitly(short);
586 // Subclasses may override this method to affect focusability. Unlike 589 // Subclasses may override this method to affect focusability. This method
587 // supportsFocus, this method must be called on an up-to-date layout, so it 590 // must be called on an up-to-date ComputedStyle, so it may use existence of
588 // may use the layoutObject to reason about focusability. This method cannot be 591 // layoutObject and the LayoutObject::style() to reason about focusability.
589 // moved to LayoutObject because some focusable nodes don't have layoutObjec ts, 592 // However, we must not retrieve layout information like position and size.
falken 2016/02/05 04:42:40 "we" -> "it" is more consistent with the previous
tkent 2016/02/05 04:57:45 Done.
590 // e.g., HTMLOptionElement. 593 // This method cannot be moved to LayoutObject because some focusable nodes
594 // don't have layoutObjects. e.g., HTMLOptionElement.
595 // TODO(tkent): Rename this to isFocusableStyle.
falken 2016/02/05 04:42:40 good idea!
591 virtual bool layoutObjectIsFocusable() const; 596 virtual bool layoutObjectIsFocusable() const;
592 597
593 // classAttributeChanged() exists to share code between 598 // classAttributeChanged() exists to share code between
594 // parseAttribute (called via setAttribute()) and 599 // parseAttribute (called via setAttribute()) and
595 // svgAttributeChanged (called when element.className.baseValue is set) 600 // svgAttributeChanged (called when element.className.baseValue is set)
596 void classAttributeChanged(const AtomicString& newClassString); 601 void classAttributeChanged(const AtomicString& newClassString);
597 602
598 static bool attributeValueIsJavaScriptURL(const Attribute&); 603 static bool attributeValueIsJavaScriptURL(const Attribute&);
599 604
600 PassRefPtr<ComputedStyle> originalStyleForLayoutObject(); 605 PassRefPtr<ComputedStyle> originalStyleForLayoutObject();
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&) 944 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&)
940 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ 945 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \
941 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \ 946 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \
942 { \ 947 { \
943 return adoptRefWillBeNoop(new T(tagName, document)); \ 948 return adoptRefWillBeNoop(new T(tagName, document)); \
944 } 949 }
945 950
946 } // namespace blink 951 } // namespace blink
947 952
948 #endif // Element_h 953 #endif // Element_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698