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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 class MODULES_EXPORT AXObject : public RefCountedWillBeGarbageCollectedFinalized
<AXObject> { | 407 class MODULES_EXPORT AXObject : public RefCountedWillBeGarbageCollectedFinalized
<AXObject> { |
408 public: | 408 public: |
409 typedef WillBeHeapVector<RefPtrWillBeMember<AXObject>> AccessibilityChildren
Vector; | 409 typedef WillBeHeapVector<RefPtrWillBeMember<AXObject>> AccessibilityChildren
Vector; |
410 | 410 |
411 struct AXRange { | 411 struct AXRange { |
412 // The deepest descendant in which the range starts. | 412 // The deepest descendant in which the range starts. |
413 // (nullptr means the current object.) | 413 // (nullptr means the current object.) |
414 RefPtrWillBePersistent<AXObject> anchorObject; | 414 RefPtrWillBePersistent<AXObject> anchorObject; |
415 // The number of characters and child objects in the anchor object | 415 // The number of characters and child objects in the anchor object |
416 // before the range starts. | 416 // before the range starts. |
417 int anchorOffset; | 417 unsigned anchorOffset; |
418 // The deepest descendant in which the range ends. | 418 // The deepest descendant in which the range ends. |
419 // (nullptr means the current object.) | 419 // (nullptr means the current object.) |
420 RefPtrWillBePersistent<AXObject> focusObject; | 420 RefPtrWillBePersistent<AXObject> focusObject; |
421 // The number of characters and child objects in the focus object | 421 // The number of characters and child objects in the focus object |
422 // before the range ends. | 422 // before the range ends. |
423 int focusOffset; | 423 unsigned focusOffset; |
424 | 424 |
425 AXRange() | 425 AXRange() |
426 : anchorObject(nullptr) | 426 : anchorObject(nullptr) |
427 , anchorOffset(-1) | 427 , anchorOffset(UINT_MAX) |
428 , focusObject(nullptr) | 428 , focusObject(nullptr) |
429 , focusOffset(-1) | 429 , focusOffset(UINT_MAX) |
430 { } | 430 { } |
431 | 431 |
432 AXRange(int startOffset, int endOffset) | 432 AXRange(unsigned startOffset, unsigned endOffset) |
433 : anchorObject(nullptr) | 433 : anchorObject(nullptr) |
434 , anchorOffset(startOffset) | 434 , anchorOffset(startOffset) |
435 , focusObject(nullptr) | 435 , focusObject(nullptr) |
436 , focusOffset(endOffset) | 436 , focusOffset(endOffset) |
437 { } | 437 { } |
438 | 438 |
439 AXRange(PassRefPtrWillBeRawPtr<AXObject> anchorObject, int anchorOffset, | 439 AXRange(PassRefPtrWillBeRawPtr<AXObject> anchorObject, unsigned anchorOf
fset, |
440 PassRefPtrWillBeRawPtr<AXObject> focusObject, int focusOffset) | 440 PassRefPtrWillBeRawPtr<AXObject> focusObject, unsigned focusOffset) |
441 : anchorObject(anchorObject) | 441 : anchorObject(anchorObject) |
442 , anchorOffset(anchorOffset) | 442 , anchorOffset(anchorOffset) |
443 , focusObject(focusObject) | 443 , focusObject(focusObject) |
444 , focusOffset(focusOffset) | 444 , focusOffset(focusOffset) |
445 { } | 445 { } |
446 | 446 |
447 bool isValid() const | 447 bool isValid() const |
448 { | 448 { |
449 return ((anchorObject && focusObject) | 449 return ((anchorObject && focusObject) |
450 || (!anchorObject && !focusObject)) | 450 || (!anchorObject && !focusObject)); |
451 && anchorOffset >= 0 && focusOffset >= 0; | |
452 } | 451 } |
453 | 452 |
454 // Determines if the range only refers to text offsets under the current
object. | 453 // Determines if the range only refers to text offsets under the current
object. |
455 bool isSimple() const | 454 bool isSimple() const |
456 { | 455 { |
457 return anchorObject == focusObject || !anchorObject || !focusObject; | 456 return anchorObject == focusObject || !anchorObject || !focusObject; |
458 } | 457 } |
459 }; | 458 }; |
460 | 459 |
461 protected: | 460 protected: |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 | 900 |
902 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \ | 901 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \ |
903 DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, object.pred
icate) | 902 DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, object.pred
icate) |
904 | 903 |
905 } // namespace blink | 904 } // namespace blink |
906 | 905 |
907 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::IgnoredReason); | 906 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::IgnoredReason); |
908 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::NameSource); | 907 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::NameSource); |
909 | 908 |
910 #endif // AXObject_h | 909 #endif // AXObject_h |
OLD | NEW |