OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 | 58 |
59 struct RenderTextInfo { | 59 struct RenderTextInfo { |
60 // Destruction of m_layout requires TextLayout to be a complete type, so the constructor and destructor are made non-inline to avoid compilation errors. | 60 // Destruction of m_layout requires TextLayout to be a complete type, so the constructor and destructor are made non-inline to avoid compilation errors. |
61 RenderTextInfo(); | 61 RenderTextInfo(); |
62 ~RenderTextInfo(); | 62 ~RenderTextInfo(); |
63 | 63 |
64 RenderText* m_text; | 64 RenderText* m_text; |
65 OwnPtr<TextLayout> m_layout; | 65 OwnPtr<TextLayout> m_layout; |
66 LazyLineBreakIterator m_lineBreakIterator; | 66 LazyLineBreakIterator m_lineBreakIterator; |
67 const Font* m_font; | 67 const Font* m_font; |
68 | |
69 void createLayout(RenderText* renderText, float xPos, bool collapseWhiteSpac e) | |
70 { | |
71 #if OS(MACOSX) | |
72 m_layout = m_font.createLayout(RenderBlockFlow::constructTextRun(renderT ext, m_font, renderText, renderText->style()), renderText->textLength(), xPos, c ollapseWhiteSpace); | |
73 #else | |
74 m_layout = nullptr; | |
eae
2013/11/12 17:00:30
This doesn't seem right, why would createLayout be
| |
75 #endif | |
76 } | |
68 }; | 77 }; |
69 | 78 |
70 class TrailingObjects { | 79 class TrailingObjects { |
71 public: | 80 public: |
72 TrailingObjects(); | 81 TrailingObjects(); |
73 void setTrailingWhitespace(RenderText*); | 82 void setTrailingWhitespace(RenderText*); |
74 void clear(); | 83 void clear(); |
75 void appendBoxIfNeeded(RenderBox*); | 84 void appendBoxIfNeeded(RenderBox*); |
76 | 85 |
77 enum CollapseFirstSpaceOrNot { DoNotCollapseFirstSpace, CollapseFirstSpace } ; | 86 enum CollapseFirstSpaceOrNot { DoNotCollapseFirstSpace, CollapseFirstSpace } ; |
(...skipping 2886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2964 | 2973 |
2965 if (renderText->isWordBreak()) { | 2974 if (renderText->isWordBreak()) { |
2966 m_width.commit(); | 2975 m_width.commit(); |
2967 m_lineBreak.moveToStartOf(m_current.m_obj); | 2976 m_lineBreak.moveToStartOf(m_current.m_obj); |
2968 ASSERT(m_current.m_pos == renderText->textLength()); | 2977 ASSERT(m_current.m_pos == renderText->textLength()); |
2969 } | 2978 } |
2970 | 2979 |
2971 if (m_renderTextInfo.m_text != renderText) { | 2980 if (m_renderTextInfo.m_text != renderText) { |
2972 m_renderTextInfo.m_text = renderText; | 2981 m_renderTextInfo.m_text = renderText; |
2973 m_renderTextInfo.m_font = &font; | 2982 m_renderTextInfo.m_font = &font; |
2974 m_renderTextInfo.m_layout = font.createLayout(renderText, m_width.curren tWidth(), m_collapseWhiteSpace); | 2983 m_renderTextInfo.createLayout(renderText, m_width.currentWidth(), m_coll apseWhiteSpace); |
2975 m_renderTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator(rende rText->text(), style->locale()); | 2984 m_renderTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator(rende rText->text(), style->locale()); |
2976 } else if (m_renderTextInfo.m_layout && m_renderTextInfo.m_font != &font) { | 2985 } else if (m_renderTextInfo.m_layout && m_renderTextInfo.m_font != &font) { |
2977 m_renderTextInfo.m_font = &font; | 2986 m_renderTextInfo.m_font = &font; |
2978 m_renderTextInfo.m_layout = font.createLayout(renderText, m_width.curren tWidth(), m_collapseWhiteSpace); | 2987 m_renderTextInfo.createLayout(renderText, m_width.currentWidth(), m_coll apseWhiteSpace); |
2979 } | 2988 } |
2980 | 2989 |
2981 TextLayout* textLayout = m_renderTextInfo.m_layout.get(); | 2990 TextLayout* textLayout = m_renderTextInfo.m_layout.get(); |
2982 | 2991 |
2983 // Non-zero only when kerning is enabled and TextLayout isn't used, in which case we measure | 2992 // Non-zero only when kerning is enabled and TextLayout isn't used, in which case we measure |
2984 // words with their trailing space, then subtract its width. | 2993 // words with their trailing space, then subtract its width. |
2985 float wordTrailingSpaceWidth = (font.typesettingFeatures() & Kerning) && !te xtLayout ? font.width(RenderBlockFlow::constructTextRun(renderText, font, &space , 1, style)) + wordSpacing : 0; | 2994 float wordTrailingSpaceWidth = (font.typesettingFeatures() & Kerning) && !te xtLayout ? font.width(RenderBlockFlow::constructTextRun(renderText, font, &space , 1, style)) + wordSpacing : 0; |
2986 | 2995 |
2987 UChar lastCharacter = m_renderTextInfo.m_lineBreakIterator.lastCharacter(); | 2996 UChar lastCharacter = m_renderTextInfo.m_lineBreakIterator.lastCharacter(); |
2988 UChar secondToLastCharacter = m_renderTextInfo.m_lineBreakIterator.secondToL astCharacter(); | 2997 UChar secondToLastCharacter = m_renderTextInfo.m_lineBreakIterator.secondToL astCharacter(); |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3548 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache); | 3557 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache); |
3549 | 3558 |
3550 setLineGridBox(lineGridBox); | 3559 setLineGridBox(lineGridBox); |
3551 | 3560 |
3552 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying | 3561 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying |
3553 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping | 3562 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping |
3554 // to this grid. | 3563 // to this grid. |
3555 } | 3564 } |
3556 | 3565 |
3557 } | 3566 } |
OLD | NEW |