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

Side by Side Diff: Source/core/layout/LayoutBlockFlowLine.cpp

Issue 1207803002: Fix the adjustment to include overflow of negative spacing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 * 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } 428 }
429 } 429 }
430 430
431 // Don't put this into 'else' part of the above 'if' because canUseSimpleFon tCodePath may be modified in the 'if' block. 431 // Don't put this into 'else' part of the above 'if' because canUseSimpleFon tCodePath may be modified in the 'if' block.
432 if (!canUseSimpleFontCodePath) 432 if (!canUseSimpleFontCodePath)
433 measuredWidth = layoutText->width(run->m_start, run->m_stop - run->m_sta rt, xPos, run->direction(), lineInfo.isFirstLine(), &fallbackFonts, &glyphBounds ); 433 measuredWidth = layoutText->width(run->m_start, run->m_stop - run->m_sta rt, xPos, run->direction(), lineInfo.isFirstLine(), &fallbackFonts, &glyphBounds );
434 434
435 // Negative word-spacing and/or letter-spacing may cause some glyphs to over flow the left boundary and result 435 // Negative word-spacing and/or letter-spacing may cause some glyphs to over flow the left boundary and result
436 // negative measured width. Reset measured width to 0 and adjust glyph bound s accordingly to cover the overflow. 436 // negative measured width. Reset measured width to 0 and adjust glyph bound s accordingly to cover the overflow.
437 if (measuredWidth < 0) { 437 if (measuredWidth < 0) {
438 glyphBounds.move(measuredWidth, 0); 438 if (measuredWidth < glyphBounds.x()) {
439 glyphBounds.expand(glyphBounds.x() - measuredWidth, 0);
440 glyphBounds.setX(measuredWidth);
441 }
439 measuredWidth = 0; 442 measuredWidth = 0;
440 } 443 }
441 444
442 glyphOverflow.setFromBounds(glyphBounds, font.fontMetrics().floatAscent(), f ont.fontMetrics().floatDescent(), measuredWidth); 445 glyphOverflow.setFromBounds(glyphBounds, font.fontMetrics().floatAscent(), f ont.fontMetrics().floatDescent(), measuredWidth);
443 446
444 run->m_box->setLogicalWidth(measuredWidth + hyphenWidth); 447 run->m_box->setLogicalWidth(measuredWidth + hyphenWidth);
445 if (!fallbackFonts.isEmpty()) { 448 if (!fallbackFonts.isEmpty()) {
446 ASSERT(run->m_box->isText()); 449 ASSERT(run->m_box->isText());
447 GlyphOverflowAndFallbackFontsMap::ValueType* it = textBoxDataMap.add(toI nlineTextBox(run->m_box), std::make_pair(Vector<const SimpleFontData*>(), GlyphO verflow())).storedValue; 450 GlyphOverflowAndFallbackFontsMap::ValueType* it = textBoxDataMap.add(toI nlineTextBox(run->m_box), std::make_pair(Vector<const SimpleFontData*>(), GlyphO verflow())).storedValue;
448 ASSERT(it->value.first.isEmpty()); 451 ASSERT(it->value.first.isEmpty());
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); 2068 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false);
2066 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight() , false) - logicalLeft; 2069 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight() , false) - logicalLeft;
2067 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2070 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2068 2071
2069 if (!style()->isLeftToRightDirection()) 2072 if (!style()->isLeftToRightDirection())
2070 return logicalWidth() - logicalLeft; 2073 return logicalWidth() - logicalLeft;
2071 return logicalLeft; 2074 return logicalLeft;
2072 } 2075 }
2073 2076
2074 } 2077 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698