OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. | 3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 584 |
585 // When neither upstream or downstream gets us to a candidate (upstream/down
stream won't leave | 585 // When neither upstream or downstream gets us to a candidate (upstream/down
stream won't leave |
586 // blocks or enter new ones), we search forward and backward until we find o
ne. | 586 // blocks or enter new ones), we search forward and backward until we find o
ne. |
587 Position next = canonicalizeCandidate(nextCandidate(position)); | 587 Position next = canonicalizeCandidate(nextCandidate(position)); |
588 Position prev = canonicalizeCandidate(previousCandidate(position)); | 588 Position prev = canonicalizeCandidate(previousCandidate(position)); |
589 Node* nextNode = next.deprecatedNode(); | 589 Node* nextNode = next.deprecatedNode(); |
590 Node* prevNode = prev.deprecatedNode(); | 590 Node* prevNode = prev.deprecatedNode(); |
591 | 591 |
592 // The new position must be in the same editable element. Enforce that first
. | 592 // The new position must be in the same editable element. Enforce that first
. |
593 // Unless the descent is from a non-editable html element to an editable bod
y. | 593 // Unless the descent is from a non-editable html element to an editable bod
y. |
594 if (node && node->hasTagName(htmlTag) && !node->rendererIsEditable() && node
->document().body() && node->document().body()->rendererIsEditable()) | 594 if (isHTMLHtmlElement(node) && !node->rendererIsEditable() && node->document
().body() && node->document().body()->rendererIsEditable()) |
595 return next.isNotNull() ? next : prev; | 595 return next.isNotNull() ? next : prev; |
596 | 596 |
597 Node* editingRoot = editableRootForPosition(position); | 597 Node* editingRoot = editableRootForPosition(position); |
598 | 598 |
599 // If the html element is editable, descending into its body will look like
a descent | 599 // If the html element is editable, descending into its body will look like
a descent |
600 // from non-editable to editable content since rootEditableElement() always
stops at the body. | 600 // from non-editable to editable content since rootEditableElement() always
stops at the body. |
601 if ((editingRoot && editingRoot->hasTagName(htmlTag)) || position.deprecated
Node()->isDocumentNode()) | 601 if (isHTMLHtmlElement(editingRoot) || position.deprecatedNode()->isDocumentN
ode()) |
602 return next.isNotNull() ? next : prev; | 602 return next.isNotNull() ? next : prev; |
603 | 603 |
604 bool prevIsInSameEditableElement = prevNode && editableRootForPosition(prev)
== editingRoot; | 604 bool prevIsInSameEditableElement = prevNode && editableRootForPosition(prev)
== editingRoot; |
605 bool nextIsInSameEditableElement = nextNode && editableRootForPosition(next)
== editingRoot; | 605 bool nextIsInSameEditableElement = nextNode && editableRootForPosition(next)
== editingRoot; |
606 if (prevIsInSameEditableElement && !nextIsInSameEditableElement) | 606 if (prevIsInSameEditableElement && !nextIsInSameEditableElement) |
607 return prev; | 607 return prev; |
608 | 608 |
609 if (nextIsInSameEditableElement && !prevIsInSameEditableElement) | 609 if (nextIsInSameEditableElement && !prevIsInSameEditableElement) |
610 return next; | 610 return next; |
611 | 611 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 if (vpos) | 799 if (vpos) |
800 vpos->showTreeForThis(); | 800 vpos->showTreeForThis(); |
801 } | 801 } |
802 | 802 |
803 void showTree(const WebCore::VisiblePosition& vpos) | 803 void showTree(const WebCore::VisiblePosition& vpos) |
804 { | 804 { |
805 vpos.showTreeForThis(); | 805 vpos.showTreeForThis(); |
806 } | 806 } |
807 | 807 |
808 #endif | 808 #endif |
OLD | NEW |