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

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

Issue 2795143004: [selectors4] Implement :focus-within pseudo-class (Closed)
Patch Set: Now passing all the tests from WPT 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 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004-2011, 2014 Apple Inc. All rights reserved. 5 * Copyright (C) 2004-2011, 2014 Apple Inc. All rights reserved.
6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
7 * (http://www.torchmobile.com/) 7 * (http://www.torchmobile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 return IsUserActionElement() && IsUserActionElementHovered(); 383 return IsUserActionElement() && IsUserActionElementHovered();
384 } 384 }
385 // Note: As a shadow host whose root with delegatesFocus=false may become 385 // Note: As a shadow host whose root with delegatesFocus=false may become
386 // focused state when an inner element gets focused, in that case more than 386 // focused state when an inner element gets focused, in that case more than
387 // one elements in a document can return true for |isFocused()|. Use 387 // one elements in a document can return true for |isFocused()|. Use
388 // Element::isFocusedElementInDocument() or Document::focusedElement() to 388 // Element::isFocusedElementInDocument() or Document::focusedElement() to
389 // check which element is exactly focused. 389 // check which element is exactly focused.
390 bool IsFocused() const { 390 bool IsFocused() const {
391 return IsUserActionElement() && IsUserActionElementFocused(); 391 return IsUserActionElement() && IsUserActionElementFocused();
392 } 392 }
393 bool HasFocusWithin() const {
394 return IsUserActionElement() && IsUserActionElementHasFocusWithin();
395 }
393 396
394 bool NeedsAttach() const { 397 bool NeedsAttach() const {
395 return GetStyleChangeType() == kNeedsReattachStyleChange; 398 return GetStyleChangeType() == kNeedsReattachStyleChange;
396 } 399 }
397 bool NeedsStyleRecalc() const { 400 bool NeedsStyleRecalc() const {
398 return GetStyleChangeType() != kNoStyleChange; 401 return GetStyleChangeType() != kNoStyleChange;
399 } 402 }
400 StyleChangeType GetStyleChangeType() const { 403 StyleChangeType GetStyleChangeType() const {
401 return static_cast<StyleChangeType>(node_flags_ & kStyleChangeMask); 404 return static_cast<StyleChangeType>(node_flags_ & kStyleChangeMask);
402 } 405 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 void UpdateDistribution(); 473 void UpdateDistribution();
471 474
472 void SetIsLink(bool f); 475 void SetIsLink(bool f);
473 476
474 bool HasEventTargetData() const { return GetFlag(kHasEventTargetDataFlag); } 477 bool HasEventTargetData() const { return GetFlag(kHasEventTargetDataFlag); }
475 void SetHasEventTargetData(bool flag) { 478 void SetHasEventTargetData(bool flag) {
476 SetFlag(flag, kHasEventTargetDataFlag); 479 SetFlag(flag, kHasEventTargetDataFlag);
477 } 480 }
478 481
479 virtual void SetFocused(bool flag); 482 virtual void SetFocused(bool flag);
483 virtual void SetHasFocusWithin(bool flag);
480 virtual void SetActive(bool flag = true); 484 virtual void SetActive(bool flag = true);
481 virtual void SetDragged(bool flag); 485 virtual void SetDragged(bool flag);
482 virtual void SetHovered(bool flag = true); 486 virtual void SetHovered(bool flag = true);
483 487
484 virtual int tabIndex() const; 488 virtual int tabIndex() const;
485 489
486 virtual Node* FocusDelegate(); 490 virtual Node* FocusDelegate();
487 // This is called only when the node is focused. 491 // This is called only when the node is focused.
488 virtual bool ShouldHaveFocusAppearance() const; 492 virtual bool ShouldHaveFocusAppearance() const;
489 493
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 // during "commit". The main thread is stopped at that time, but 899 // during "commit". The main thread is stopped at that time, but
896 // it is not safe to cache AtomicStrings because those are 900 // it is not safe to cache AtomicStrings because those are
897 // per-thread. 901 // per-thread.
898 virtual String DebugNodeName() const; 902 virtual String DebugNodeName() const;
899 903
900 bool IsUserActionElementActive() const; 904 bool IsUserActionElementActive() const;
901 bool IsUserActionElementInActiveChain() const; 905 bool IsUserActionElementInActiveChain() const;
902 bool IsUserActionElementDragged() const; 906 bool IsUserActionElementDragged() const;
903 bool IsUserActionElementHovered() const; 907 bool IsUserActionElementHovered() const;
904 bool IsUserActionElementFocused() const; 908 bool IsUserActionElementFocused() const;
909 bool IsUserActionElementHasFocusWithin() const;
905 910
906 void RecalcDistribution(); 911 void RecalcDistribution();
907 912
908 void SetStyleChange(StyleChangeType); 913 void SetStyleChange(StyleChangeType);
909 914
910 virtual const ComputedStyle* VirtualEnsureComputedStyle( 915 virtual const ComputedStyle* VirtualEnsureComputedStyle(
911 PseudoId = kPseudoIdNone); 916 PseudoId = kPseudoIdNone);
912 917
913 void TrackForDebugging(); 918 void TrackForDebugging();
914 919
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 } // namespace blink 998 } // namespace blink
994 999
995 #ifndef NDEBUG 1000 #ifndef NDEBUG
996 // Outside the WebCore namespace for ease of invocation from gdb. 1001 // Outside the WebCore namespace for ease of invocation from gdb.
997 void showNode(const blink::Node*); 1002 void showNode(const blink::Node*);
998 void showTree(const blink::Node*); 1003 void showTree(const blink::Node*);
999 void showNodePath(const blink::Node*); 1004 void showNodePath(const blink::Node*);
1000 #endif 1005 #endif
1001 1006
1002 #endif // Node_h 1007 #endif // Node_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698