OLD | NEW |
---|---|
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 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2008 return; | 2008 return; |
2009 | 2009 |
2010 if (selection.anchorObject && !isValidSelectionBound(selection.anchorObject. get())) | 2010 if (selection.anchorObject && !isValidSelectionBound(selection.anchorObject. get())) |
2011 return; | 2011 return; |
2012 | 2012 |
2013 if (selection.focusObject && !isValidSelectionBound(selection.focusObject.ge t())) | 2013 if (selection.focusObject && !isValidSelectionBound(selection.focusObject.ge t())) |
2014 return; | 2014 return; |
2015 | 2015 |
2016 AXObject* anchorObject = selection.anchorObject ? | 2016 AXObject* anchorObject = selection.anchorObject ? |
2017 selection.anchorObject.get() : this; | 2017 selection.anchorObject.get() : this; |
2018 AXObject* focusObject = selection.focusObject ? | 2018 AXObject* focusObject = selection.focusObject ? |
Peter Lundblad
2015/08/28 15:09:43
Perhaps the initial part of this function could be
| |
2019 selection.focusObject.get() : this; | 2019 selection.focusObject.get() : this; |
2020 | 2020 |
2021 if (anchorObject == this && anchorObject == focusObject | 2021 if (anchorObject == focusObject |
2022 && layoutObject()->isTextControl()) { | 2022 && anchorObject->layoutObject()->isTextControl()) { |
2023 HTMLTextFormControlElement* textControl = toLayoutTextControl( | 2023 HTMLTextFormControlElement* textControl = toLayoutTextControl( |
2024 layoutObject())->textFormControlElement(); | 2024 anchorObject->layoutObject())->textFormControlElement(); |
2025 textControl->setSelectionRange(selection.anchorOffset, selection.focusOf fset, | 2025 textControl->setSelectionRange(selection.anchorOffset, selection.focusOf fset, |
2026 SelectionHasNoDirection, NotDispatchSelectEvent); | 2026 SelectionHasNoDirection, NotDispatchSelectEvent); |
Peter Lundblad
2015/08/28 15:09:43
Why doesn't the direction depend on which one of t
| |
2027 return; | 2027 return; |
2028 } | 2028 } |
2029 | 2029 |
2030 Node* anchorNode = nullptr; | 2030 Node* anchorNode = nullptr; |
2031 while (anchorObject && !anchorNode) { | 2031 while (anchorObject && !anchorNode) { |
2032 anchorNode = anchorObject->node(); | 2032 anchorNode = anchorObject->node(); |
2033 anchorObject = anchorObject->parentObject(); | 2033 anchorObject = anchorObject->parentObject(); |
2034 } | 2034 } |
2035 | 2035 |
2036 Node* focusNode = nullptr; | 2036 Node* focusNode = nullptr; |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2647 if (label && label->layoutObject()) { | 2647 if (label && label->layoutObject()) { |
2648 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); | 2648 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); |
2649 result.unite(labelRect); | 2649 result.unite(labelRect); |
2650 } | 2650 } |
2651 } | 2651 } |
2652 | 2652 |
2653 return result; | 2653 return result; |
2654 } | 2654 } |
2655 | 2655 |
2656 } // namespace blink | 2656 } // namespace blink |
OLD | NEW |