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

Unified Diff: Source/core/editing/EditingUtilities.cpp

Issue 1303163006: Introduce composed tree version of directionOfEnclosingBlock() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-28T14:44:15 Follow review comments Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/EditingUtilities.h ('k') | Source/core/editing/EditingUtilitiesTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/EditingUtilities.cpp
diff --git a/Source/core/editing/EditingUtilities.cpp b/Source/core/editing/EditingUtilities.cpp
index 24dc578225bebd0fab33b54f51ab60d72ce62135..10e9586950e1d05fd1d47f36e3fcf9a4bd09b1c0 100644
--- a/Source/core/editing/EditingUtilities.cpp
+++ b/Source/core/editing/EditingUtilities.cpp
@@ -693,15 +693,26 @@ bool nodeIsUserSelectNone(Node* node)
return node && node->layoutObject() && !node->layoutObject()->isSelectable();
}
-TextDirection directionOfEnclosingBlock(const Position& position)
+template <typename Strategy>
+TextDirection directionOfEnclosingBlockAlgorithm(const PositionAlgorithm<Strategy>& position)
{
- Element* enclosingBlockElement = enclosingBlock(position.computeContainerNode());
yoichio 2015/08/28 05:55:23 enclosingBlock has DOM/InComposition overrides so
yosin_UTC9 2015/08/28 06:22:58 PS#1 does |enclosingBlock(position)|, however as y
+ Element* enclosingBlockElement = enclosingBlock(PositionAlgorithm<Strategy>::firstPositionInOrBeforeNode(position.computeContainerNode()), CannotCrossEditingBoundary);
if (!enclosingBlockElement)
return LTR;
LayoutObject* layoutObject = enclosingBlockElement->layoutObject();
return layoutObject ? layoutObject->style()->direction() : LTR;
}
+TextDirection directionOfEnclosingBlock(const Position& position)
+{
+ return directionOfEnclosingBlockAlgorithm<EditingStrategy>(position);
+}
+
+TextDirection directionOfEnclosingBlock(const PositionInComposedTree& position)
+{
+ return directionOfEnclosingBlockAlgorithm<EditingInComposedTreeStrategy>(position);
+}
+
TextDirection primaryDirectionOf(const Node& node)
{
TextDirection primaryDirection = LTR;
« no previous file with comments | « Source/core/editing/EditingUtilities.h ('k') | Source/core/editing/EditingUtilitiesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698