| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 } | 949 } |
| 950 | 950 |
| 951 template <typename Strategy> | 951 template <typename Strategy> |
| 952 TextDirection directionOfEnclosingBlockAlgorithm( | 952 TextDirection directionOfEnclosingBlockAlgorithm( |
| 953 const PositionTemplate<Strategy>& position) { | 953 const PositionTemplate<Strategy>& position) { |
| 954 Element* enclosingBlockElement = | 954 Element* enclosingBlockElement = |
| 955 enclosingBlock(PositionTemplate<Strategy>::firstPositionInOrBeforeNode( | 955 enclosingBlock(PositionTemplate<Strategy>::firstPositionInOrBeforeNode( |
| 956 position.computeContainerNode()), | 956 position.computeContainerNode()), |
| 957 CannotCrossEditingBoundary); | 957 CannotCrossEditingBoundary); |
| 958 if (!enclosingBlockElement) | 958 if (!enclosingBlockElement) |
| 959 return TextDirection::Ltr; | 959 return TextDirection::kLtr; |
| 960 LayoutObject* layoutObject = enclosingBlockElement->layoutObject(); | 960 LayoutObject* layoutObject = enclosingBlockElement->layoutObject(); |
| 961 return layoutObject ? layoutObject->style()->direction() : TextDirection::Ltr; | 961 return layoutObject ? layoutObject->style()->direction() |
| 962 : TextDirection::kLtr; |
| 962 } | 963 } |
| 963 | 964 |
| 964 TextDirection directionOfEnclosingBlock(const Position& position) { | 965 TextDirection directionOfEnclosingBlock(const Position& position) { |
| 965 return directionOfEnclosingBlockAlgorithm<EditingStrategy>(position); | 966 return directionOfEnclosingBlockAlgorithm<EditingStrategy>(position); |
| 966 } | 967 } |
| 967 | 968 |
| 968 TextDirection directionOfEnclosingBlock(const PositionInFlatTree& position) { | 969 TextDirection directionOfEnclosingBlock(const PositionInFlatTree& position) { |
| 969 return directionOfEnclosingBlockAlgorithm<EditingInFlatTreeStrategy>( | 970 return directionOfEnclosingBlockAlgorithm<EditingInFlatTreeStrategy>( |
| 970 position); | 971 position); |
| 971 } | 972 } |
| 972 | 973 |
| 973 TextDirection primaryDirectionOf(const Node& node) { | 974 TextDirection primaryDirectionOf(const Node& node) { |
| 974 TextDirection primaryDirection = TextDirection::Ltr; | 975 TextDirection primaryDirection = TextDirection::kLtr; |
| 975 for (const LayoutObject* r = node.layoutObject(); r; r = r->parent()) { | 976 for (const LayoutObject* r = node.layoutObject(); r; r = r->parent()) { |
| 976 if (r->isLayoutBlockFlow()) { | 977 if (r->isLayoutBlockFlow()) { |
| 977 primaryDirection = r->style()->direction(); | 978 primaryDirection = r->style()->direction(); |
| 978 break; | 979 break; |
| 979 } | 980 } |
| 980 } | 981 } |
| 981 | 982 |
| 982 return primaryDirection; | 983 return primaryDirection; |
| 983 } | 984 } |
| 984 | 985 |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1586 | 1587 |
| 1587 HTMLSpanElement* createTabSpanElement(Document& document) { | 1588 HTMLSpanElement* createTabSpanElement(Document& document) { |
| 1588 return createTabSpanElement(document, nullptr); | 1589 return createTabSpanElement(document, nullptr); |
| 1589 } | 1590 } |
| 1590 | 1591 |
| 1591 bool isNodeRendered(const Node& node) { | 1592 bool isNodeRendered(const Node& node) { |
| 1592 LayoutObject* layoutObject = node.layoutObject(); | 1593 LayoutObject* layoutObject = node.layoutObject(); |
| 1593 if (!layoutObject) | 1594 if (!layoutObject) |
| 1594 return false; | 1595 return false; |
| 1595 | 1596 |
| 1596 return layoutObject->style()->visibility() == EVisibility::Visible; | 1597 return layoutObject->style()->visibility() == EVisibility::kVisible; |
| 1597 } | 1598 } |
| 1598 | 1599 |
| 1599 // return first preceding DOM position rendered at a different location, or | 1600 // return first preceding DOM position rendered at a different location, or |
| 1600 // "this" | 1601 // "this" |
| 1601 static Position previousCharacterPosition(const Position& position, | 1602 static Position previousCharacterPosition(const Position& position, |
| 1602 TextAffinity affinity) { | 1603 TextAffinity affinity) { |
| 1603 DCHECK(!needsLayoutTreeUpdate(position)); | 1604 DCHECK(!needsLayoutTreeUpdate(position)); |
| 1604 if (position.isNull()) | 1605 if (position.isNull()) |
| 1605 return Position(); | 1606 return Position(); |
| 1606 | 1607 |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 return InputType::DeleteWordBackward; | 2143 return InputType::DeleteWordBackward; |
| 2143 if (granularity == LineBoundary) | 2144 if (granularity == LineBoundary) |
| 2144 return InputType::DeleteLineBackward; | 2145 return InputType::DeleteLineBackward; |
| 2145 return InputType::DeleteContentBackward; | 2146 return InputType::DeleteContentBackward; |
| 2146 default: | 2147 default: |
| 2147 return InputType::None; | 2148 return InputType::None; |
| 2148 } | 2149 } |
| 2149 } | 2150 } |
| 2150 | 2151 |
| 2151 } // namespace blink | 2152 } // namespace blink |
| OLD | NEW |