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

Side by Side Diff: Source/core/rendering/line/BreakingContextInlineHeaders.h

Issue 68483006: Remove ComplexTextController dependency on core (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Try one more time Created 7 years, 1 month 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/platform/graphics/mac/ComplexTextController.cpp ('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) 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 * Copyright (C) 2013 Adobe Systems Incorporated. 5 * Copyright (C) 2013 Adobe Systems Incorporated.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 struct RenderTextInfo { 46 struct RenderTextInfo {
47 // Destruction of m_layout requires TextLayout to be a complete type, so the constructor and destructor are made non-inline to avoid compilation errors. 47 // Destruction of m_layout requires TextLayout to be a complete type, so the constructor and destructor are made non-inline to avoid compilation errors.
48 RenderTextInfo(); 48 RenderTextInfo();
49 ~RenderTextInfo(); 49 ~RenderTextInfo();
50 50
51 RenderText* m_text; 51 RenderText* m_text;
52 OwnPtr<TextLayout> m_layout; 52 OwnPtr<TextLayout> m_layout;
53 LazyLineBreakIterator m_lineBreakIterator; 53 LazyLineBreakIterator m_lineBreakIterator;
54 const Font* m_font; 54 const Font* m_font;
55
56 void createLayout(RenderText* renderText, float xPos, bool collapseWhiteSpac e)
57 {
58 #if OS(MACOSX)
59 m_layout = m_font->createLayoutForMacComplexText(RenderBlockFlow::constr uctTextRun(renderText, *m_font, renderText, renderText->style()), renderText->te xtLength(), xPos, collapseWhiteSpace);
60 #else
61 m_layout = nullptr;
62 #endif
63 }
55 }; 64 };
56 65
57 class WordMeasurement { 66 class WordMeasurement {
58 public: 67 public:
59 WordMeasurement() 68 WordMeasurement()
60 : renderer(0) 69 : renderer(0)
61 , width(0) 70 , width(0)
62 , startOffset(0) 71 , startOffset(0)
63 , endOffset(0) 72 , endOffset(0)
64 { 73 {
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 762
754 if (renderText->isWordBreak()) { 763 if (renderText->isWordBreak()) {
755 m_width.commit(); 764 m_width.commit();
756 m_lineBreak.moveToStartOf(m_current.m_obj); 765 m_lineBreak.moveToStartOf(m_current.m_obj);
757 ASSERT(m_current.m_pos == renderText->textLength()); 766 ASSERT(m_current.m_pos == renderText->textLength());
758 } 767 }
759 768
760 if (m_renderTextInfo.m_text != renderText) { 769 if (m_renderTextInfo.m_text != renderText) {
761 m_renderTextInfo.m_text = renderText; 770 m_renderTextInfo.m_text = renderText;
762 m_renderTextInfo.m_font = &font; 771 m_renderTextInfo.m_font = &font;
763 m_renderTextInfo.m_layout = font.createLayout(renderText, m_width.curren tWidth(), m_collapseWhiteSpace); 772 m_renderTextInfo.createLayout(renderText, m_width.currentWidth(), m_coll apseWhiteSpace);
764 m_renderTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator(rende rText->text(), style->locale()); 773 m_renderTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator(rende rText->text(), style->locale());
765 } else if (m_renderTextInfo.m_layout && m_renderTextInfo.m_font != &font) { 774 } else if (m_renderTextInfo.m_layout && m_renderTextInfo.m_font != &font) {
766 m_renderTextInfo.m_font = &font; 775 m_renderTextInfo.m_font = &font;
767 m_renderTextInfo.m_layout = font.createLayout(renderText, m_width.curren tWidth(), m_collapseWhiteSpace); 776 m_renderTextInfo.createLayout(renderText, m_width.currentWidth(), m_coll apseWhiteSpace);
768 } 777 }
769 778
770 TextLayout* textLayout = m_renderTextInfo.m_layout.get(); 779 TextLayout* textLayout = m_renderTextInfo.m_layout.get();
771 780
772 // Non-zero only when kerning is enabled and TextLayout isn't used, in which case we measure 781 // Non-zero only when kerning is enabled and TextLayout isn't used, in which case we measure
773 // words with their trailing space, then subtract its width. 782 // words with their trailing space, then subtract its width.
774 float wordTrailingSpaceWidth = (font.typesettingFeatures() & Kerning) && !te xtLayout ? font.width(RenderBlockFlow::constructTextRun(renderText, font, &space , 1, style)) + wordSpacing : 0; 783 float wordTrailingSpaceWidth = (font.typesettingFeatures() & Kerning) && !te xtLayout ? font.width(RenderBlockFlow::constructTextRun(renderText, font, &space , 1, style)) + wordSpacing : 0;
775 784
776 UChar lastCharacter = m_renderTextInfo.m_lineBreakIterator.lastCharacter(); 785 UChar lastCharacter = m_renderTextInfo.m_lineBreakIterator.lastCharacter();
777 UChar secondToLastCharacter = m_renderTextInfo.m_lineBreakIterator.secondToL astCharacter(); 786 UChar secondToLastCharacter = m_renderTextInfo.m_lineBreakIterator.secondToL astCharacter();
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 m_lineBreak.m_pos--; 1132 m_lineBreak.m_pos--;
1124 m_lineBreak.increment(); 1133 m_lineBreak.increment();
1125 } 1134 }
1126 1135
1127 return m_lineBreak; 1136 return m_lineBreak;
1128 } 1137 }
1129 1138
1130 } 1139 }
1131 1140
1132 #endif // BreakingContextInlineHeaders_h 1141 #endif // BreakingContextInlineHeaders_h
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/mac/ComplexTextController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698