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

Side by Side Diff: Source/core/rendering/RenderBlockLineLayout.cpp

Issue 54743004: Rendering text-justify:distribute for 8 bit characters. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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 * 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 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 continue; // Positioned objects are only participating to figure out their 1050 continue; // Positioned objects are only participating to figure out their
1051 // correct static x position. They have no effect on the width. 1051 // correct static x position. They have no effect on the width.
1052 // Similarly, line break boxes have no effect on the width . 1052 // Similarly, line break boxes have no effect on the width .
1053 if (r->m_object->isText()) { 1053 if (r->m_object->isText()) {
1054 RenderText* rt = toRenderText(r->m_object); 1054 RenderText* rt = toRenderText(r->m_object);
1055 if (textAlign == JUSTIFY && r != trailingSpaceRun && textJustify != TextJustifyNone) { 1055 if (textAlign == JUSTIFY && r != trailingSpaceRun && textJustify != TextJustifyNone) {
1056 if (!isAfterExpansion) 1056 if (!isAfterExpansion)
1057 toInlineTextBox(r->m_box)->setCanHaveLeadingExpansion(true); 1057 toInlineTextBox(r->m_box)->setCanHaveLeadingExpansion(true);
1058 unsigned opportunitiesInRun; 1058 unsigned opportunitiesInRun;
1059 if (rt->is8Bit()) 1059 if (rt->is8Bit())
1060 opportunitiesInRun = Font::expansionOpportunityCount(rt->cha racters8() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), isAfterE xpansion); 1060 opportunitiesInRun = Font::expansionOpportunityCount(rt->cha racters8() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), isAfterE xpansion, (textJustify == TextJustifyDistribute));
leviw_travelin_and_unemployed 2013/11/04 19:37:58 I still think this is really ugly :-/ If the conce
dw.im 2013/11/05 10:26:10 Hmm... I'm not sure what could I do for this.. 1s
leviw_travelin_and_unemployed 2013/11/05 19:07:24 I won't block this patch for this, I just think it
1061 else 1061 else
1062 opportunitiesInRun = Font::expansionOpportunityCount(rt->cha racters16() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), isAfter Expansion); 1062 opportunitiesInRun = Font::expansionOpportunityCount(rt->cha racters16() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), isAfter Expansion, (textJustify == TextJustifyDistribute));
1063 expansionOpportunities.append(opportunitiesInRun); 1063 expansionOpportunities.append(opportunitiesInRun);
1064 expansionOpportunityCount += opportunitiesInRun; 1064 expansionOpportunityCount += opportunitiesInRun;
1065 } 1065 }
1066 1066
1067 if (int length = rt->textLength()) { 1067 if (int length = rt->textLength()) {
1068 if (!r->m_start && needsWordSpacing && isSpaceOrNewline(rt->char acterAt(r->m_start))) 1068 if (!r->m_start && needsWordSpacing && isSpaceOrNewline(rt->char acterAt(r->m_start)))
1069 totalLogicalWidth += rt->style(lineInfo.isFirstLine())->font ().wordSpacing(); 1069 totalLogicalWidth += rt->style(lineInfo.isFirstLine())->font ().wordSpacing();
1070 needsWordSpacing = !isSpaceOrNewline(rt->characterAt(r->m_stop - 1)) && r->m_stop == length; 1070 needsWordSpacing = !isSpaceOrNewline(rt->characterAt(r->m_stop - 1)) && r->m_stop == length;
1071 } 1071 }
1072 1072
(...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after
3548 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache); 3548 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache);
3549 3549
3550 setLineGridBox(lineGridBox); 3550 setLineGridBox(lineGridBox);
3551 3551
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 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
3553 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping 3553 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping
3554 // to this grid. 3554 // to this grid.
3555 } 3555 }
3556 3556
3557 } 3557 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698