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

Side by Side Diff: Source/core/editing/htmlediting.cpp

Issue 602423002: Mixing content editable and non-editable in direction RTL (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added isEnclosingBoxHasLeftToRightDirection in place of directionOfEnclosingBlock Created 6 years, 2 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
« no previous file with comments | « Source/core/editing/htmlediting.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 return toElement(n); 344 return toElement(n);
345 } 345 }
346 return 0; 346 return 0;
347 } 347 }
348 348
349 bool inSameContainingBlockFlowElement(Node* a, Node* b) 349 bool inSameContainingBlockFlowElement(Node* a, Node* b)
350 { 350 {
351 return a && b && enclosingBlockFlowElement(*a) == enclosingBlockFlowElement( *b); 351 return a && b && enclosingBlockFlowElement(*a) == enclosingBlockFlowElement( *b);
352 } 352 }
353 353
354 TextDirection directionOfEnclosingBlock(const Position& position) 354 bool isEnclosingBoxHasLeftToRightDirection(const Position& position)
355 { 355 {
356 Element* enclosingBlockElement = enclosingBlock(position.containerNode()); 356 Element* enclosingBlockElement = enclosingBlock(position.containerNode());
357 if (!enclosingBlockElement) 357 if (!enclosingBlockElement)
358 return LTR; 358 return true;
359 RenderObject* renderer = enclosingBlockElement->renderer(); 359 RenderObject* renderer = enclosingBlockElement->renderer();
360 return renderer ? renderer->style()->direction() : LTR; 360 return renderer ? (renderer->style()->direction() == LTR) : true;
yosin 2014/10/01 08:00:11 nit: We don't need to use "?" operator here. We co
Habib Virji 2014/10/01 15:56:16 Done.
361 } 361 }
362 362
363 // This method is used to create positions in the DOM. It returns the maximum va lid offset 363 // This method is used to create positions in the DOM. It returns the maximum va lid offset
364 // in a node. It returns 1 for some elements even though they do not have childr en, which 364 // in a node. It returns 1 for some elements even though they do not have childr en, which
365 // creates technically invalid DOM Positions. Be sure to call parentAnchoredEqui valent 365 // creates technically invalid DOM Positions. Be sure to call parentAnchoredEqui valent
366 // on a Position before using it to create a DOM Range, or an exception will be thrown. 366 // on a Position before using it to create a DOM Range, or an exception will be thrown.
367 int lastOffsetForEditing(const Node* node) 367 int lastOffsetForEditing(const Node* node)
368 { 368 {
369 ASSERT(node); 369 ASSERT(node);
370 if (!node) 370 if (!node)
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 // if the selection starts just before a paragraph break, skip over it 1225 // if the selection starts just before a paragraph break, skip over it
1226 if (isEndOfParagraph(visiblePosition)) 1226 if (isEndOfParagraph(visiblePosition))
1227 return visiblePosition.next().deepEquivalent().downstream(); 1227 return visiblePosition.next().deepEquivalent().downstream();
1228 1228
1229 // otherwise, make sure to be at the start of the first selected node, 1229 // otherwise, make sure to be at the start of the first selected node,
1230 // instead of possibly at the end of the last node before the selection 1230 // instead of possibly at the end of the last node before the selection
1231 return visiblePosition.deepEquivalent().downstream(); 1231 return visiblePosition.deepEquivalent().downstream();
1232 } 1232 }
1233 1233
1234 } // namespace blink 1234 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/htmlediting.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698