| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 #include "config.h" | 24 #include "config.h" |
| 25 #include "core/dom/FirstLetterPseudoElement.h" | 25 #include "core/dom/FirstLetterPseudoElement.h" |
| 26 | 26 |
| 27 #include "core/dom/Element.h" | 27 #include "core/dom/Element.h" |
| 28 #include "core/layout/GeneratedChildren.h" | 28 #include "core/layout/GeneratedChildren.h" |
| 29 #include "core/layout/LayoutObject.h" | 29 #include "core/layout/LayoutObject.h" |
| 30 #include "core/layout/LayoutObjectInlines.h" | 30 #include "core/layout/LayoutObjectInlines.h" |
| 31 #include "core/layout/LayoutText.h" | 31 #include "core/layout/LayoutText.h" |
| 32 #include "core/layout/LayoutTextFragment.h" | 32 #include "core/layout/LayoutTextFragment.h" |
| 33 #include "platform/text/TextBreakIterator.h" |
| 33 #include "wtf/TemporaryChange.h" | 34 #include "wtf/TemporaryChange.h" |
| 34 #include "wtf/text/WTFString.h" | 35 #include "wtf/text/WTFString.h" |
| 35 #include "wtf/unicode/icu/UnicodeIcu.h" | 36 #include "wtf/unicode/icu/UnicodeIcu.h" |
| 36 | 37 |
| 37 namespace blink { | 38 namespace blink { |
| 38 | 39 |
| 39 using namespace WTF; | 40 using namespace WTF; |
| 40 using namespace Unicode; | 41 using namespace Unicode; |
| 41 | 42 |
| 42 // CSS 2.1 http://www.w3.org/TR/CSS21/selector.html#first-letter | 43 // CSS 2.1 http://www.w3.org/TR/CSS21/selector.html#first-letter |
| (...skipping 27 matching lines...) Expand all Loading... |
| 70 length++; | 71 length++; |
| 71 // Now account for leading punctuation. | 72 // Now account for leading punctuation. |
| 72 while (length < textLength && isPunctuationForFirstLetter(text[length])) | 73 while (length < textLength && isPunctuationForFirstLetter(text[length])) |
| 73 length++; | 74 length++; |
| 74 | 75 |
| 75 // Bail if we didn't find a letter before the end of the text or before a sp
ace. | 76 // Bail if we didn't find a letter before the end of the text or before a sp
ace. |
| 76 if (isSpaceForFirstLetter(text[length]) || length == textLength) | 77 if (isSpaceForFirstLetter(text[length]) || length == textLength) |
| 77 return 0; | 78 return 0; |
| 78 | 79 |
| 79 // Account the next character for first letter. | 80 // Account the next character for first letter. |
| 80 length++; | 81 length += numCharactersInGraphemeClusters(text.substring(length), 1); |
| 81 | 82 |
| 82 // Keep looking for allowed punctuation for the :first-letter. | 83 // Keep looking for allowed punctuation for the :first-letter. |
| 83 for (; length < textLength; ++length) { | 84 for (; length < textLength; ++length) { |
| 84 UChar c = text[length]; | 85 UChar c = text[length]; |
| 85 if (!isPunctuationForFirstLetter(c)) | 86 if (!isPunctuationForFirstLetter(c)) |
| 86 break; | 87 break; |
| 87 } | 88 } |
| 88 return length; | 89 return length; |
| 89 } | 90 } |
| 90 | 91 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 312 |
| 312 // We only manage the style for the generated content items. | 313 // We only manage the style for the generated content items. |
| 313 if (!child->isText() && !child->isQuote() && !child->isImage()) | 314 if (!child->isText() && !child->isQuote() && !child->isImage()) |
| 314 continue; | 315 continue; |
| 315 | 316 |
| 316 child->setPseudoStyle(layoutObject->mutableStyle()); | 317 child->setPseudoStyle(layoutObject->mutableStyle()); |
| 317 } | 318 } |
| 318 } | 319 } |
| 319 | 320 |
| 320 } // namespace blink | 321 } // namespace blink |
| OLD | NEW |