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

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

Issue 2121313003: [Editing][DOM][CodeHealth] Make Node::isContentEditable and Node::isRichEditable global functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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. (http://www.t orchmobile.com/) 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 UserSelectAllDoesNotAffectEditability, 424 UserSelectAllDoesNotAffectEditability,
425 UserSelectAllIsAlwaysNonEditable 425 UserSelectAllIsAlwaysNonEditable
426 }; 426 };
427 bool isContentEditable(UserSelectAllTreatment = UserSelectAllDoesNotAffectEd itability) const; 427 bool isContentEditable(UserSelectAllTreatment = UserSelectAllDoesNotAffectEd itability) const;
428 bool isContentRichlyEditable() const; 428 bool isContentRichlyEditable() const;
429 429
430 bool hasEditableStyle(EditableType editableType = ContentIsEditable, UserSel ectAllTreatment treatment = UserSelectAllIsAlwaysNonEditable) const 430 bool hasEditableStyle(EditableType editableType = ContentIsEditable, UserSel ectAllTreatment treatment = UserSelectAllIsAlwaysNonEditable) const
431 { 431 {
432 switch (editableType) { 432 switch (editableType) {
433 case ContentIsEditable: 433 case ContentIsEditable:
434 return hasEditableStyle(Editable, treatment); 434 return hasEditableStyle(this, Editable, treatment);
435 case HasEditableAXRole: 435 case HasEditableAXRole:
436 return isEditableToAccessibility(Editable); 436 return isEditableToAccessibility(this, Editable);
437 } 437 }
438 ASSERT_NOT_REACHED(); 438 ASSERT_NOT_REACHED();
439 return false; 439 return false;
440 } 440 }
441 441
442 bool layoutObjectIsRichlyEditable(EditableType editableType = ContentIsEdita ble) const 442 bool layoutObjectIsRichlyEditable(EditableType editableType = ContentIsEdita ble) const
443 { 443 {
444 switch (editableType) { 444 switch (editableType) {
445 case ContentIsEditable: 445 case ContentIsEditable:
446 return hasEditableStyle(RichlyEditable, UserSelectAllIsAlwaysNonEdit able); 446 return hasEditableStyle(this, RichlyEditable, UserSelectAllIsAlwaysN onEditable);
447 case HasEditableAXRole: 447 case HasEditableAXRole:
448 return isEditableToAccessibility(RichlyEditable); 448 return isEditableToAccessibility(this, RichlyEditable);
449 } 449 }
450 ASSERT_NOT_REACHED(); 450 ASSERT_NOT_REACHED();
451 return false; 451 return false;
452 } 452 }
453 453
454 virtual LayoutRect boundingBox() const; 454 virtual LayoutRect boundingBox() const;
455 IntRect pixelSnappedBoundingBox() const { return pixelSnappedIntRect(boundin gBox()); } 455 IntRect pixelSnappedBoundingBox() const { return pixelSnappedIntRect(boundin gBox()); }
456 456
457 unsigned nodeIndex() const; 457 unsigned nodeIndex() const;
458 458
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 private: 797 private:
798 // Gets nodeName without caching AtomicStrings. Used by 798 // Gets nodeName without caching AtomicStrings. Used by
799 // debugName. Compositor may call debugName from the "impl" thread 799 // debugName. Compositor may call debugName from the "impl" thread
800 // during "commit". The main thread is stopped at that time, but 800 // during "commit". The main thread is stopped at that time, but
801 // it is not safe to cache AtomicStrings because those are 801 // it is not safe to cache AtomicStrings because those are
802 // per-thread. 802 // per-thread.
803 virtual String debugNodeName() const; 803 virtual String debugNodeName() const;
804 804
805 void checkSlotChange(); 805 void checkSlotChange();
806 806
807 // TODO(yoichio): Move these to core/editing
807 enum EditableLevel { Editable, RichlyEditable }; 808 enum EditableLevel { Editable, RichlyEditable };
808 bool hasEditableStyle(EditableLevel, UserSelectAllTreatment = UserSelectAllI sAlwaysNonEditable) const; 809 static bool hasEditableStyle(const Node*, EditableLevel, UserSelectAllTreatm ent = UserSelectAllIsAlwaysNonEditable);
809 bool isEditableToAccessibility(EditableLevel) const; 810 static bool isEditableToAccessibility(const Node*, EditableLevel);
810 811
811 bool isUserActionElementActive() const; 812 bool isUserActionElementActive() const;
812 bool isUserActionElementInActiveChain() const; 813 bool isUserActionElementInActiveChain() const;
813 bool isUserActionElementHovered() const; 814 bool isUserActionElementHovered() const;
814 bool isUserActionElementFocused() const; 815 bool isUserActionElementFocused() const;
815 816
816 void recalcDistribution(); 817 void recalcDistribution();
817 818
818 void setStyleChange(StyleChangeType); 819 void setStyleChange(StyleChangeType);
819 820
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 } // namespace blink 922 } // namespace blink
922 923
923 #ifndef NDEBUG 924 #ifndef NDEBUG
924 // Outside the WebCore namespace for ease of invocation from gdb. 925 // Outside the WebCore namespace for ease of invocation from gdb.
925 void showNode(const blink::Node*); 926 void showNode(const blink::Node*);
926 void showTree(const blink::Node*); 927 void showTree(const blink::Node*);
927 void showNodePath(const blink::Node*); 928 void showNodePath(const blink::Node*);
928 #endif 929 #endif
929 930
930 #endif // Node_h 931 #endif // Node_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Node.cpp » ('j') | third_party/WebKit/Source/core/dom/Node.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698