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

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

Issue 255323004: Rendering text-justify:distribute for 8 bit characters. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: patch for landing 2 Created 6 years 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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 continue; // Positioned objects are only participating to figure out their 595 continue; // Positioned objects are only participating to figure out their
596 // correct static x position. They have no effect on the width. 596 // correct static x position. They have no effect on the width.
597 // Similarly, line break boxes have no effect on the width . 597 // Similarly, line break boxes have no effect on the width .
598 if (r->m_object->isText()) { 598 if (r->m_object->isText()) {
599 RenderText* rt = toRenderText(r->m_object); 599 RenderText* rt = toRenderText(r->m_object);
600 if (textAlign == JUSTIFY && r != trailingSpaceRun && textJustify != TextJustifyNone) { 600 if (textAlign == JUSTIFY && r != trailingSpaceRun && textJustify != TextJustifyNone) {
601 if (!isAfterExpansion) 601 if (!isAfterExpansion)
602 toInlineTextBox(r->m_box)->setCanHaveLeadingExpansion(true); 602 toInlineTextBox(r->m_box)->setCanHaveLeadingExpansion(true);
603 unsigned opportunitiesInRun; 603 unsigned opportunitiesInRun;
604 if (rt->is8Bit()) 604 if (rt->is8Bit())
605 opportunitiesInRun = Character::expansionOpportunityCount(rt ->characters8() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), isA fterExpansion); 605 opportunitiesInRun = Character::expansionOpportunityCount(rt ->characters8() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), isA fterExpansion, textJustify);
606 else 606 else
607 opportunitiesInRun = Character::expansionOpportunityCount(rt ->characters16() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), is AfterExpansion); 607 opportunitiesInRun = Character::expansionOpportunityCount(rt ->characters16() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), is AfterExpansion, textJustify);
608 expansionOpportunities.append(opportunitiesInRun); 608 expansionOpportunities.append(opportunitiesInRun);
609 expansionOpportunityCount += opportunitiesInRun; 609 expansionOpportunityCount += opportunitiesInRun;
610 } 610 }
611 611
612 if (rt->textLength()) { 612 if (rt->textLength()) {
613 if (!r->m_start && needsWordSpacing && isSpaceOrNewline(rt->char acterAt(r->m_start))) 613 if (!r->m_start && needsWordSpacing && isSpaceOrNewline(rt->char acterAt(r->m_start)))
614 totalLogicalWidth += rt->style(lineInfo.isFirstLine())->font ().fontDescription().wordSpacing(); 614 totalLogicalWidth += rt->style(lineInfo.isFirstLine())->font ().fontDescription().wordSpacing();
615 needsWordSpacing = !isSpaceOrNewline(rt->characterAt(r->m_stop - 1)); 615 needsWordSpacing = !isSpaceOrNewline(rt->characterAt(r->m_stop - 1));
616 } 616 }
617 617
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat (); 2049 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat ();
2050 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft; 2050 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft;
2051 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2051 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2052 2052
2053 if (!style()->isLeftToRightDirection()) 2053 if (!style()->isLeftToRightDirection())
2054 return logicalWidth() - logicalLeft; 2054 return logicalWidth() - logicalLeft;
2055 return logicalLeft; 2055 return logicalLeft;
2056 } 2056 }
2057 2057
2058 } 2058 }
OLDNEW
« no previous file with comments | « Source/core/rendering/InlineTextBox.cpp ('k') | Source/core/rendering/style/RenderStyleConstants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698