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

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: update 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) 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 // isFocusable(), isKeyboardFocusable(), and isMouseFocusable() check
414 // whether the element can actually be focused. Callers should ensure
415 // ComputedStyle is up to date;
416 // e.g. by calling Document::updateLayoutTreeIgnorePendingStylesheets().
414 bool isFocusable() const; 417 bool isFocusable() const;
415 bool isFocusedElementInDocument() const;
416 virtual bool isKeyboardFocusable() const; 418 virtual bool isKeyboardFocusable() const;
417 virtual bool isMouseFocusable() const; 419 virtual bool isMouseFocusable() const;
420 bool isFocusedElementInDocument() const;
421
418 virtual void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType, In putDeviceCapabilities* sourceCapabilities = nullptr); 422 virtual void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType, In putDeviceCapabilities* sourceCapabilities = nullptr);
419 virtual void dispatchBlurEvent(Element* newFocusedElement, WebFocusType, Inp utDeviceCapabilities* sourceCapabilities = nullptr); 423 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); 424 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); 425 void dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocuse dElement, InputDeviceCapabilities* sourceCapabilities = nullptr);
422 426
423 String innerText(); 427 String innerText();
424 String outerText(); 428 String outerText();
425 String innerHTML() const; 429 String innerHTML() const;
426 String outerHTML() const; 430 String outerHTML() const;
427 void setInnerHTML(const String&, ExceptionState&); 431 void setInnerHTML(const String&, ExceptionState&);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 virtual void didRecalcStyle(StyleRecalcChange); 580 virtual void didRecalcStyle(StyleRecalcChange);
577 virtual PassRefPtr<ComputedStyle> customStyleForLayoutObject(); 581 virtual PassRefPtr<ComputedStyle> customStyleForLayoutObject();
578 582
579 virtual bool shouldRegisterAsNamedItem() const { return false; } 583 virtual bool shouldRegisterAsNamedItem() const { return false; }
580 virtual bool shouldRegisterAsExtraNamedItem() const { return false; } 584 virtual bool shouldRegisterAsExtraNamedItem() const { return false; }
581 585
582 bool supportsSpatialNavigationFocus() const; 586 bool supportsSpatialNavigationFocus() const;
583 587
584 void clearTabIndexExplicitlyIfNeeded(); 588 void clearTabIndexExplicitlyIfNeeded();
585 void setTabIndexExplicitly(short); 589 void setTabIndexExplicitly(short);
586 // Subclasses may override this method to affect focusability. Unlike 590 // 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 591 // 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 592 // layoutObject and the LayoutObject::style() to reason about focusability.
589 // moved to LayoutObject because some focusable nodes don't have layoutObjec ts, 593 // However, it must not retrieve layout information like position and size.
590 // e.g., HTMLOptionElement. 594 // This method cannot be moved to LayoutObject because some focusable nodes
595 // don't have layoutObjects. e.g., HTMLOptionElement.
596 // TODO(tkent): Rename this to isFocusableStyle.
591 virtual bool layoutObjectIsFocusable() const; 597 virtual bool layoutObjectIsFocusable() const;
592 598
593 // classAttributeChanged() exists to share code between 599 // classAttributeChanged() exists to share code between
594 // parseAttribute (called via setAttribute()) and 600 // parseAttribute (called via setAttribute()) and
595 // svgAttributeChanged (called when element.className.baseValue is set) 601 // svgAttributeChanged (called when element.className.baseValue is set)
596 void classAttributeChanged(const AtomicString& newClassString); 602 void classAttributeChanged(const AtomicString& newClassString);
597 603
598 static bool attributeValueIsJavaScriptURL(const Attribute&); 604 static bool attributeValueIsJavaScriptURL(const Attribute&);
599 605
600 PassRefPtr<ComputedStyle> originalStyleForLayoutObject(); 606 PassRefPtr<ComputedStyle> originalStyleForLayoutObject();
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&) 945 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&)
940 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ 946 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \
941 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \ 947 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \
942 { \ 948 { \
943 return adoptRefWillBeNoop(new T(tagName, document)); \ 949 return adoptRefWillBeNoop(new T(tagName, document)); \
944 } 950 }
945 951
946 } // namespace blink 952 } // namespace blink
947 953
948 #endif // Element_h 954 #endif // Element_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698