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

Side by Side Diff: Source/core/accessibility/AXObject.cpp

Issue 248963002: Making LayoutUnit conversions to Int types explicit in core/accessibility (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@patch3
Patch Set: Created 6 years, 8 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, 2009, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 { 723 {
724 // Search up the parent chain until we find the first one that's scrollable. 724 // Search up the parent chain until we find the first one that's scrollable.
725 AXObject* scrollParent = parentObject(); 725 AXObject* scrollParent = parentObject();
726 ScrollableArea* scrollableArea; 726 ScrollableArea* scrollableArea;
727 for (scrollableArea = 0; 727 for (scrollableArea = 0;
728 scrollParent && !(scrollableArea = scrollParent->getScrollableAreaIfScro llable()); 728 scrollParent && !(scrollableArea = scrollParent->getScrollableAreaIfScro llable());
729 scrollParent = scrollParent->parentObject()) { } 729 scrollParent = scrollParent->parentObject()) { }
730 if (!scrollableArea) 730 if (!scrollableArea)
731 return; 731 return;
732 732
733 LayoutRect objectRect = elementRect(); 733 IntRect objectRect = pixelSnappedIntRect(elementRect());
734 IntPoint scrollPosition = scrollableArea->scrollPosition(); 734 IntPoint scrollPosition = scrollableArea->scrollPosition();
735 IntRect scrollVisibleRect = scrollableArea->visibleContentRect(); 735 IntRect scrollVisibleRect = scrollableArea->visibleContentRect();
736 736
737 int desiredX = computeBestScrollOffset( 737 int desiredX = computeBestScrollOffset(
738 scrollPosition.x(), 738 scrollPosition.x(),
739 objectRect.x() + subfocus.x(), objectRect.x() + subfocus.maxX(), 739 objectRect.x() + subfocus.x(), objectRect.x() + subfocus.maxX(),
740 objectRect.x(), objectRect.maxX(), 740 objectRect.x(), objectRect.maxX(),
741 0, scrollVisibleRect.width()); 741 0, scrollVisibleRect.width());
742 int desiredY = computeBestScrollOffset( 742 int desiredY = computeBestScrollOffset(
743 scrollPosition.y(), 743 scrollPosition.y(),
(...skipping 24 matching lines...) Expand all
768 // next innermost object to the given point. 768 // next innermost object to the given point.
769 int offsetX = 0, offsetY = 0; 769 int offsetX = 0, offsetY = 0;
770 IntPoint point = globalPoint; 770 IntPoint point = globalPoint;
771 size_t levels = objects.size() - 1; 771 size_t levels = objects.size() - 1;
772 for (size_t i = 0; i < levels; i++) { 772 for (size_t i = 0; i < levels; i++) {
773 const AXObject* outer = objects[i]; 773 const AXObject* outer = objects[i];
774 const AXObject* inner = objects[i + 1]; 774 const AXObject* inner = objects[i + 1];
775 775
776 ScrollableArea* scrollableArea = outer->getScrollableAreaIfScrollable(); 776 ScrollableArea* scrollableArea = outer->getScrollableAreaIfScrollable();
777 777
778 LayoutRect innerRect = inner->isAXScrollView() ? inner->parentObject()-> elementRect() : inner->elementRect(); 778 IntRect innerRect = inner->isAXScrollView() ? pixelSnappedIntRect(inner- >parentObject()->elementRect()) : pixelSnappedIntRect(inner->elementRect());
779 LayoutRect objectRect = innerRect; 779 IntRect objectRect = innerRect;
780 IntPoint scrollPosition = scrollableArea->scrollPosition(); 780 IntPoint scrollPosition = scrollableArea->scrollPosition();
781 781
782 // Convert the object rect into local coordinates. 782 // Convert the object rect into local coordinates.
783 objectRect.move(offsetX, offsetY); 783 objectRect.move(offsetX, offsetY);
784 if (!outer->isAXScrollView()) 784 if (!outer->isAXScrollView())
785 objectRect.move(scrollPosition.x(), scrollPosition.y()); 785 objectRect.move(scrollPosition.x(), scrollPosition.y());
786 786
787 int desiredX = computeBestScrollOffset( 787 int desiredX = computeBestScrollOffset(
788 0, 788 0,
789 objectRect.x(), objectRect.maxX(), 789 objectRect.x(), objectRect.maxX(),
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 return ToggleButtonRole; 893 return ToggleButtonRole;
894 if (ariaHasPopup()) 894 if (ariaHasPopup())
895 return PopUpButtonRole; 895 return PopUpButtonRole;
896 // We don't contemplate RadioButtonRole, as it depends on the input 896 // We don't contemplate RadioButtonRole, as it depends on the input
897 // type. 897 // type.
898 898
899 return ButtonRole; 899 return ButtonRole;
900 } 900 }
901 901
902 } // namespace WebCore 902 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/accessibility/AXInlineTextBox.cpp ('k') | Source/core/accessibility/AXRenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698