| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Nuanti Ltd. | 3 * Copyright (C) 2008 Nuanti Ltd. |
| 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 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 typedef HeapVector<Member<AXObject>> AXObjectVector; | 486 typedef HeapVector<Member<AXObject>> AXObjectVector; |
| 487 | 487 |
| 488 struct AXRange { | 488 struct AXRange { |
| 489 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 489 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 490 // The deepest descendant in which the range starts. | 490 // The deepest descendant in which the range starts. |
| 491 // (nullptr means the current object.) | 491 // (nullptr means the current object.) |
| 492 Persistent<AXObject> anchorObject; | 492 Persistent<AXObject> anchorObject; |
| 493 // The number of characters and child objects in the anchor object | 493 // The number of characters and child objects in the anchor object |
| 494 // before the range starts. | 494 // before the range starts. |
| 495 int anchorOffset; | 495 int anchorOffset; |
| 496 // When the same character offset could correspond to two possible |
| 497 // cursor positions, upstream means it's on the previous line rather |
| 498 // than the next line. |
| 499 TextAffinity anchorAffinity; |
| 500 |
| 496 // The deepest descendant in which the range ends. | 501 // The deepest descendant in which the range ends. |
| 497 // (nullptr means the current object.) | 502 // (nullptr means the current object.) |
| 498 Persistent<AXObject> focusObject; | 503 Persistent<AXObject> focusObject; |
| 499 // The number of characters and child objects in the focus object | 504 // The number of characters and child objects in the focus object |
| 500 // before the range ends. | 505 // before the range ends. |
| 501 int focusOffset; | 506 int focusOffset; |
| 507 // When the same character offset could correspond to two possible |
| 508 // cursor positions, upstream means it's on the previous line rather |
| 509 // than the next line. |
| 510 TextAffinity focusAffinity; |
| 502 | 511 |
| 503 AXRange() | 512 AXRange() |
| 504 : anchorObject(nullptr) | 513 : anchorObject(nullptr) |
| 505 , anchorOffset(-1) | 514 , anchorOffset(-1) |
| 515 , anchorAffinity(TextAffinity::Upstream) |
| 506 , focusObject(nullptr) | 516 , focusObject(nullptr) |
| 507 , focusOffset(-1) | 517 , focusOffset(-1) |
| 518 , focusAffinity(TextAffinity::Downstream) |
| 508 { } | 519 { } |
| 509 | 520 |
| 510 AXRange(int startOffset, int endOffset) | 521 AXRange(int startOffset, int endOffset) |
| 511 : anchorObject(nullptr) | 522 : anchorObject(nullptr) |
| 512 , anchorOffset(startOffset) | 523 , anchorOffset(startOffset) |
| 524 , anchorAffinity(TextAffinity::Upstream) |
| 513 , focusObject(nullptr) | 525 , focusObject(nullptr) |
| 514 , focusOffset(endOffset) | 526 , focusOffset(endOffset) |
| 527 , focusAffinity(TextAffinity::Downstream) |
| 515 { } | 528 { } |
| 516 | 529 |
| 517 AXRange(AXObject* anchorObject, int anchorOffset, | 530 AXRange(AXObject* anchorObject, int anchorOffset, TextAffinity anchorAff
inity, |
| 518 AXObject* focusObject, int focusOffset) | 531 AXObject* focusObject, int focusOffset, TextAffinity focusAffinity) |
| 519 : anchorObject(anchorObject) | 532 : anchorObject(anchorObject) |
| 520 , anchorOffset(anchorOffset) | 533 , anchorOffset(anchorOffset) |
| 534 , anchorAffinity(anchorAffinity) |
| 521 , focusObject(focusObject) | 535 , focusObject(focusObject) |
| 522 , focusOffset(focusOffset) | 536 , focusOffset(focusOffset) |
| 537 , focusAffinity(focusAffinity) |
| 523 { } | 538 { } |
| 524 | 539 |
| 525 bool isValid() const | 540 bool isValid() const |
| 526 { | 541 { |
| 527 return ((anchorObject && focusObject) | 542 return ((anchorObject && focusObject) |
| 528 || (!anchorObject && !focusObject)) | 543 || (!anchorObject && !focusObject)) |
| 529 && anchorOffset >= 0 && focusOffset >= 0; | 544 && anchorOffset >= 0 && focusOffset >= 0; |
| 530 } | 545 } |
| 531 | 546 |
| 532 // Determines if the range only refers to text offsets under the current
object. | 547 // Determines if the range only refers to text offsets under the current
object. |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 | 1011 |
| 997 static unsigned s_numberOfLiveAXObjects; | 1012 static unsigned s_numberOfLiveAXObjects; |
| 998 }; | 1013 }; |
| 999 | 1014 |
| 1000 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \ | 1015 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \ |
| 1001 DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, object.pred
icate) | 1016 DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, object.pred
icate) |
| 1002 | 1017 |
| 1003 } // namespace blink | 1018 } // namespace blink |
| 1004 | 1019 |
| 1005 #endif // AXObject_h | 1020 #endif // AXObject_h |
| OLD | NEW |