| 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 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 const Element* secondElement = toElement(second); | 886 const Element* secondElement = toElement(second); |
| 887 if (!firstElement->hasTagName(secondElement->tagQName())) | 887 if (!firstElement->hasTagName(secondElement->tagQName())) |
| 888 return false; | 888 return false; |
| 889 | 889 |
| 890 return firstElement->hasEquivalentAttributes(secondElement); | 890 return firstElement->hasEquivalentAttributes(secondElement); |
| 891 } | 891 } |
| 892 | 892 |
| 893 bool isBlockFlowElement(const Node& node) | 893 bool isBlockFlowElement(const Node& node) |
| 894 { | 894 { |
| 895 RenderObject* renderer = node.renderer(); | 895 RenderObject* renderer = node.renderer(); |
| 896 return node.isElementNode() && renderer && renderer->isRenderBlockFlow(); | 896 return node.isElementNode() && renderer && renderer->isRenderParagraph(); |
| 897 } | 897 } |
| 898 | 898 |
| 899 Position adjustedSelectionStartForStyleComputation(const VisibleSelection& selec
tion) | 899 Position adjustedSelectionStartForStyleComputation(const VisibleSelection& selec
tion) |
| 900 { | 900 { |
| 901 // This function is used by range style computations to avoid bugs like: | 901 // This function is used by range style computations to avoid bugs like: |
| 902 // <rdar://problem/4017641> REGRESSION (Mail): you can only bold/unbold a se
lection starting from end of line once | 902 // <rdar://problem/4017641> REGRESSION (Mail): you can only bold/unbold a se
lection starting from end of line once |
| 903 // It is important to skip certain irrelevant content at the start of the se
lection, so we do not wind up | 903 // It is important to skip certain irrelevant content at the start of the se
lection, so we do not wind up |
| 904 // with a spurious "mixed" style. | 904 // with a spurious "mixed" style. |
| 905 | 905 |
| 906 VisiblePosition visiblePosition(selection.start()); | 906 VisiblePosition visiblePosition(selection.start()); |
| 907 if (visiblePosition.isNull()) | 907 if (visiblePosition.isNull()) |
| 908 return Position(); | 908 return Position(); |
| 909 | 909 |
| 910 // if the selection is a caret, just return the position, since the style | 910 // if the selection is a caret, just return the position, since the style |
| 911 // behind us is relevant | 911 // behind us is relevant |
| 912 if (selection.isCaret()) | 912 if (selection.isCaret()) |
| 913 return visiblePosition.deepEquivalent(); | 913 return visiblePosition.deepEquivalent(); |
| 914 | 914 |
| 915 // if the selection starts just before a paragraph break, skip over it | 915 // if the selection starts just before a paragraph break, skip over it |
| 916 if (isEndOfParagraph(visiblePosition)) | 916 if (isEndOfParagraph(visiblePosition)) |
| 917 return visiblePosition.next().deepEquivalent().downstream(); | 917 return visiblePosition.next().deepEquivalent().downstream(); |
| 918 | 918 |
| 919 // otherwise, make sure to be at the start of the first selected node, | 919 // otherwise, make sure to be at the start of the first selected node, |
| 920 // instead of possibly at the end of the last node before the selection | 920 // instead of possibly at the end of the last node before the selection |
| 921 return visiblePosition.deepEquivalent().downstream(); | 921 return visiblePosition.deepEquivalent().downstream(); |
| 922 } | 922 } |
| 923 | 923 |
| 924 } // namespace blink | 924 } // namespace blink |
| OLD | NEW |