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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp

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: rebase 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) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 return object.isLink() || object.isImage() || object.getLayoutObject()->isTe xt(); 419 return object.isLink() || object.isImage() || object.getLayoutObject()->isTe xt();
420 } 420 }
421 421
422 // Requires layoutObject to be present because it relies on style 422 // Requires layoutObject to be present because it relies on style
423 // user-modify. Don't move this logic to AXNodeObject. 423 // user-modify. Don't move this logic to AXNodeObject.
424 bool AXLayoutObject::isEditable() const 424 bool AXLayoutObject::isEditable() const
425 { 425 {
426 if (getLayoutObject() && getLayoutObject()->isTextControl()) 426 if (getLayoutObject() && getLayoutObject()->isTextControl())
427 return true; 427 return true;
428 428
429 if (getNode() && getNode()->isContentEditable()) 429 if (getNode() && isContentEditable(*getNode()))
430 return true; 430 return true;
431 431
432 if (isWebArea()) { 432 if (isWebArea()) {
433 Document& document = getLayoutObject()->document(); 433 Document& document = getLayoutObject()->document();
434 HTMLElement* body = document.body(); 434 HTMLElement* body = document.body();
435 if (body && body->isContentEditable()) 435 if (body && isContentEditable(*body))
436 return true; 436 return true;
437 437
438 return document.isContentEditable(); 438 return isContentEditable(document);
439 } 439 }
440 440
441 return AXNodeObject::isEditable(); 441 return AXNodeObject::isEditable();
442 } 442 }
443 443
444 // Requires layoutObject to be present because it relies on style 444 // Requires layoutObject to be present because it relies on style
445 // user-modify. Don't move this logic to AXNodeObject. 445 // user-modify. Don't move this logic to AXNodeObject.
446 bool AXLayoutObject::isRichlyEditable() const 446 bool AXLayoutObject::isRichlyEditable() const
447 { 447 {
448 if (getNode() && getNode()->isContentRichlyEditable()) 448 if (getNode() && isContentRichlyEditable(*getNode()))
449 return true; 449 return true;
450 450
451 if (isWebArea()) { 451 if (isWebArea()) {
452 Document& document = m_layoutObject->document(); 452 Document& document = m_layoutObject->document();
453 HTMLElement* body = document.body(); 453 HTMLElement* body = document.body();
454 if (body && body->isContentRichlyEditable()) 454 if (body && isContentRichlyEditable(*body))
455 return true; 455 return true;
456 456
457 return document.isContentRichlyEditable(); 457 return isContentRichlyEditable(document);
458 } 458 }
459 459
460 return AXNodeObject::isRichlyEditable(); 460 return AXNodeObject::isRichlyEditable();
461 } 461 }
462 462
463 bool AXLayoutObject::isLinked() const 463 bool AXLayoutObject::isLinked() const
464 { 464 {
465 if (!isLinkable(*this)) 465 if (!isLinkable(*this))
466 return false; 466 return false;
467 467
(...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2570 result.unite(labelRect); 2570 result.unite(labelRect);
2571 } 2571 }
2572 } 2572 }
2573 } 2573 }
2574 } 2574 }
2575 2575
2576 return result; 2576 return result;
2577 } 2577 }
2578 2578
2579 } // namespace blink 2579 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/TouchAdjustment.cpp ('k') | third_party/WebKit/Source/web/WebElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698