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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1006 BidiRun* RenderBlockFlow::computeInlineDirectionPositionsForSegment(RootInlineBo x* lineBox, const LineInfo& lineInfo, ETextAlign textAlign, float& logicalLeft, | 1006 BidiRun* RenderBlockFlow::computeInlineDirectionPositionsForSegment(RootInlineBo x* lineBox, const LineInfo& lineInfo, ETextAlign textAlign, float& logicalLeft, |
1007 float& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingSpaceRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& vertica lPositionCache, | 1007 float& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingSpaceRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& vertica lPositionCache, |
1008 WordMeasurements& wordMeasurements) | 1008 WordMeasurements& wordMeasurements) |
1009 { | 1009 { |
1010 bool needsWordSpacing = false; | 1010 bool needsWordSpacing = false; |
1011 float totalLogicalWidth = lineBox->getFlowSpacingLogicalWidth(); | 1011 float totalLogicalWidth = lineBox->getFlowSpacingLogicalWidth(); |
1012 unsigned expansionOpportunityCount = 0; | 1012 unsigned expansionOpportunityCount = 0; |
1013 bool isAfterExpansion = true; | 1013 bool isAfterExpansion = true; |
1014 Vector<unsigned, 16> expansionOpportunities; | 1014 Vector<unsigned, 16> expansionOpportunities; |
1015 RenderObject* previousObject = 0; | 1015 RenderObject* previousObject = 0; |
1016 TextJustify textJustify = style()->textJustify(); | |
leviw_travelin_and_unemployed
2013/10/31 00:01:11
I'd rather see this as a boolean. isTextJustifyNon
dw.im
2013/10/31 00:16:33
After sometime, we need to check text-justify:dist
| |
1016 | 1017 |
1017 BidiRun* r = firstRun; | 1018 BidiRun* r = firstRun; |
1018 for (; r; r = r->next()) { | 1019 for (; r; r = r->next()) { |
1019 // Once we have reached the start of the next segment, we have finished | 1020 // Once we have reached the start of the next segment, we have finished |
1020 // computing the positions for this segment's contents. | 1021 // computing the positions for this segment's contents. |
1021 if (r->m_startsSegment) | 1022 if (r->m_startsSegment) |
1022 break; | 1023 break; |
1023 if (!r->m_box || r->m_object->isOutOfFlowPositioned() || r->m_box->isLin eBreak()) | 1024 if (!r->m_box || r->m_object->isOutOfFlowPositioned() || r->m_box->isLin eBreak()) |
1024 continue; // Positioned objects are only participating to figure out their | 1025 continue; // Positioned objects are only participating to figure out their |
1025 // correct static x position. They have no effect on the width. | 1026 // correct static x position. They have no effect on the width. |
1026 // Similarly, line break boxes have no effect on the width . | 1027 // Similarly, line break boxes have no effect on the width . |
1027 if (r->m_object->isText()) { | 1028 if (r->m_object->isText()) { |
1028 RenderText* rt = toRenderText(r->m_object); | 1029 RenderText* rt = toRenderText(r->m_object); |
1029 if (textAlign == JUSTIFY && r != trailingSpaceRun) { | 1030 if (textAlign == JUSTIFY && r != trailingSpaceRun && textJustify != TextJustifyNone) { |
1030 if (!isAfterExpansion) | 1031 if (!isAfterExpansion) |
1031 toInlineTextBox(r->m_box)->setCanHaveLeadingExpansion(true); | 1032 toInlineTextBox(r->m_box)->setCanHaveLeadingExpansion(true); |
1032 unsigned opportunitiesInRun; | 1033 unsigned opportunitiesInRun; |
1033 if (rt->is8Bit()) | 1034 if (rt->is8Bit()) |
1034 opportunitiesInRun = Font::expansionOpportunityCount(rt->cha racters8() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), isAfterE xpansion); | 1035 opportunitiesInRun = Font::expansionOpportunityCount(rt->cha racters8() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), isAfterE xpansion); |
1035 else | 1036 else |
1036 opportunitiesInRun = Font::expansionOpportunityCount(rt->cha racters16() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), isAfter Expansion); | 1037 opportunitiesInRun = Font::expansionOpportunityCount(rt->cha racters16() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), isAfter Expansion); |
1037 expansionOpportunities.append(opportunitiesInRun); | 1038 expansionOpportunities.append(opportunitiesInRun); |
1038 expansionOpportunityCount += opportunitiesInRun; | 1039 expansionOpportunityCount += opportunitiesInRun; |
1039 } | 1040 } |
(...skipping 13 matching lines...) Expand all Loading... | |
1053 setMarginsForRubyRun(r, toRenderRubyRun(renderBox), previous Object, lineInfo); | 1054 setMarginsForRubyRun(r, toRenderRubyRun(renderBox), previous Object, lineInfo); |
1054 r->m_box->setLogicalWidth(logicalWidthForChild(renderBox)); | 1055 r->m_box->setLogicalWidth(logicalWidthForChild(renderBox)); |
1055 totalLogicalWidth += marginStartForChild(renderBox) + marginEndF orChild(renderBox); | 1056 totalLogicalWidth += marginStartForChild(renderBox) + marginEndF orChild(renderBox); |
1056 } | 1057 } |
1057 } | 1058 } |
1058 | 1059 |
1059 totalLogicalWidth += r->m_box->logicalWidth(); | 1060 totalLogicalWidth += r->m_box->logicalWidth(); |
1060 previousObject = r->m_object; | 1061 previousObject = r->m_object; |
1061 } | 1062 } |
1062 | 1063 |
1063 if (isAfterExpansion && !expansionOpportunities.isEmpty()) { | 1064 if (textJustify != TextJustifyNone && isAfterExpansion && !expansionOpportun ities.isEmpty()) { |
leviw_travelin_and_unemployed
2013/10/31 00:01:11
Is this necessary? Won't it be covered by the exis
dw.im
2013/10/31 00:16:33
Hmm. yes. It seems expansionOpportunities would be
| |
1064 expansionOpportunities.last()--; | 1065 expansionOpportunities.last()--; |
1065 expansionOpportunityCount--; | 1066 expansionOpportunityCount--; |
1066 } | 1067 } |
1067 | 1068 |
1068 updateLogicalWidthForAlignment(textAlign, lineBox, trailingSpaceRun, logical Left, totalLogicalWidth, availableLogicalWidth, expansionOpportunityCount); | 1069 updateLogicalWidthForAlignment(textAlign, lineBox, trailingSpaceRun, logical Left, totalLogicalWidth, availableLogicalWidth, expansionOpportunityCount); |
1069 | 1070 |
1070 computeExpansionForJustifiedText(firstRun, trailingSpaceRun, expansionOpport unities, expansionOpportunityCount, totalLogicalWidth, availableLogicalWidth); | 1071 computeExpansionForJustifiedText(firstRun, trailingSpaceRun, expansionOpport unities, expansionOpportunityCount, totalLogicalWidth, availableLogicalWidth); |
1071 | 1072 |
1072 return r; | 1073 return r; |
1073 } | 1074 } |
(...skipping 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3522 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache); | 3523 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache); |
3523 | 3524 |
3524 setLineGridBox(lineGridBox); | 3525 setLineGridBox(lineGridBox); |
3525 | 3526 |
3526 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying | 3527 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying |
3527 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping | 3528 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping |
3528 // to this grid. | 3529 // to this grid. |
3529 } | 3530 } |
3530 | 3531 |
3531 } | 3532 } |
OLD | NEW |