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

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

Issue 11820059: Merge 138654 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « LayoutTests/platform/mac/editing/execCommand/selectAll-expected.txt ('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 * 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 2668 matching lines...) Expand 10 before | Expand all | Expand 10 after
2679 wordMeasurement.endOffset = lBreak.m_pos; 2679 wordMeasurement.endOffset = lBreak.m_pos;
2680 } 2680 }
2681 if (lBreak.m_obj && lBreak.m_pos && lBreak.m_obj->is Text() && toRenderText(lBreak.m_obj)->textLength() && toRenderText(lBreak.m_obj) ->characterAt(lBreak.m_pos - 1) == softHyphen && style->hyphens() != HyphensNone ) 2681 if (lBreak.m_obj && lBreak.m_pos && lBreak.m_obj->is Text() && toRenderText(lBreak.m_obj)->textLength() && toRenderText(lBreak.m_obj) ->characterAt(lBreak.m_pos - 1) == softHyphen && style->hyphens() != HyphensNone )
2682 m_hyphenated = true; 2682 m_hyphenated = true;
2683 if (lBreak.m_pos && lBreak.m_pos != (unsigned)wordMe asurement.endOffset && !wordMeasurement.width) { 2683 if (lBreak.m_pos && lBreak.m_pos != (unsigned)wordMe asurement.endOffset && !wordMeasurement.width) {
2684 if (charWidth) { 2684 if (charWidth) {
2685 wordMeasurement.endOffset = lBreak.m_pos; 2685 wordMeasurement.endOffset = lBreak.m_pos;
2686 wordMeasurement.width = charWidth; 2686 wordMeasurement.width = charWidth;
2687 } 2687 }
2688 } 2688 }
2689 goto end; // Didn't fit. Jump to the end. 2689 // Didn't fit. Jump to the end unless there's still an opportunity to collapse whitespace.
2690 if (ignoringSpaces || !currentStyle->collapseWhiteSp ace() || !currentCharacterIsSpace || !previousCharacterIsSpace)
2691 goto end;
2690 } else { 2692 } else {
2691 if (!betweenWords || (midWordBreak && !autoWrap)) 2693 if (!betweenWords || (midWordBreak && !autoWrap))
2692 width.addUncommittedWidth(-additionalTmpW); 2694 width.addUncommittedWidth(-additionalTmpW);
2693 if (hyphenWidth) { 2695 if (hyphenWidth) {
2694 // Subtract the width of the soft hyphen out sin ce we fit on a line. 2696 // Subtract the width of the soft hyphen out sin ce we fit on a line.
2695 width.addUncommittedWidth(-hyphenWidth); 2697 width.addUncommittedWidth(-hyphenWidth);
2696 hyphenWidth = 0; 2698 hyphenWidth = 0;
2697 } 2699 }
2698 } 2700 }
2699 } 2701 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2806 2808
2807 if (m_hyphenated) 2809 if (m_hyphenated)
2808 goto end; 2810 goto end;
2809 } 2811 }
2810 } else 2812 } else
2811 ASSERT_NOT_REACHED(); 2813 ASSERT_NOT_REACHED();
2812 2814
2813 bool checkForBreak = autoWrap; 2815 bool checkForBreak = autoWrap;
2814 if (width.committedWidth() && !width.fitsOnLine() && lBreak.m_obj && cur rWS == NOWRAP) 2816 if (width.committedWidth() && !width.fitsOnLine() && lBreak.m_obj && cur rWS == NOWRAP)
2815 checkForBreak = true; 2817 checkForBreak = true;
2816 else if (next && current.m_obj->isText() && next->isText() && !next->isB R() && (autoWrap || (next->style()->autoWrap()))) { 2818 else if (next && current.m_obj->isText() && next->isText() && !next->isB R() && (autoWrap || next->style()->autoWrap())) {
2817 if (currentCharacterIsSpace) 2819 if (autoWrap && currentCharacterIsSpace)
2818 checkForBreak = true; 2820 checkForBreak = true;
2819 else { 2821 else {
2820 RenderText* nextText = toRenderText(next); 2822 RenderText* nextText = toRenderText(next);
2821 if (nextText->textLength()) { 2823 if (nextText->textLength()) {
2822 UChar c = nextText->characterAt(0); 2824 UChar c = nextText->characterAt(0);
2823 checkForBreak = (c == ' ' || c == '\t' || (c == '\n' && !nex t->preservesNewline()));
2824 // If the next item on the line is text, and if we did not e nd with 2825 // If the next item on the line is text, and if we did not e nd with
2825 // a space, then the next text run continues our word (and s o it needs to 2826 // a space, then the next text run continues our word (and s o it needs to
2826 // keep adding to |tmpW|. Just update and continue. 2827 // keep adding to the uncommitted width. Just update and con tinue.
2828 checkForBreak = !currentCharacterIsSpace && (c == ' ' || c = = '\t' || (c == '\n' && !next->preservesNewline()));
2827 } else if (nextText->isWordBreak()) 2829 } else if (nextText->isWordBreak())
2828 checkForBreak = true; 2830 checkForBreak = true;
2829 2831
2830 if (!width.fitsOnLine() && !width.committedWidth()) 2832 if (!width.fitsOnLine() && !width.committedWidth())
2831 width.fitBelowFloats(); 2833 width.fitBelowFloats();
2832 2834
2833 bool canPlaceOnLine = width.fitsOnLine() || !autoWrapWasEverTrue OnLine; 2835 bool canPlaceOnLine = width.fitsOnLine() || !autoWrapWasEverTrue OnLine;
2834 if (canPlaceOnLine && checkForBreak) { 2836 if (canPlaceOnLine && checkForBreak) {
2835 width.commit(); 2837 width.commit();
2836 lBreak.moveToStartOf(next); 2838 lBreak.moveToStartOf(next);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2871 current.moveToStartOf(next); 2873 current.moveToStartOf(next);
2872 atStart = false; 2874 atStart = false;
2873 } 2875 }
2874 2876
2875 if (width.fitsOnLine() || lastWS == NOWRAP) 2877 if (width.fitsOnLine() || lastWS == NOWRAP)
2876 lBreak.clear(); 2878 lBreak.clear();
2877 2879
2878 end: 2880 end:
2879 if (lBreak == resolver.position() && (!lBreak.m_obj || !lBreak.m_obj->isBR() )) { 2881 if (lBreak == resolver.position() && (!lBreak.m_obj || !lBreak.m_obj->isBR() )) {
2880 // we just add as much as possible 2882 // we just add as much as possible
2881 if (blockStyle->whiteSpace() == PRE) { 2883 if (blockStyle->whiteSpace() == PRE && !current.m_pos) {
2882 // FIXME: Don't really understand this case. 2884 lBreak.moveTo(last, last->isText() ? last->length() : 0);
2883 if (current.m_pos) {
2884 // FIXME: This should call moveTo which would clear m_nextBreaka blePosition
2885 // this code as-is is likely wrong.
2886 lBreak.m_obj = current.m_obj;
2887 lBreak.m_pos = current.m_pos - 1;
2888 } else
2889 lBreak.moveTo(last, last->isText() ? last->length() : 0);
2890 } else if (lBreak.m_obj) { 2885 } else if (lBreak.m_obj) {
2891 // Don't ever break in the middle of a word if we can help it. 2886 // Don't ever break in the middle of a word if we can help it.
2892 // There's no room at all. We just have to be on this line, 2887 // There's no room at all. We just have to be on this line,
2893 // even though we'll spill out. 2888 // even though we'll spill out.
2894 lBreak.moveTo(current.m_obj, current.m_pos); 2889 lBreak.moveTo(current.m_obj, current.m_pos);
2895 } 2890 }
2896 } 2891 }
2897 2892
2898 // make sure we consume at least one char/object. 2893 // make sure we consume at least one char/object.
2899 if (lBreak == resolver.position()) 2894 if (lBreak == resolver.position())
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
3086 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache); 3081 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache);
3087 3082
3088 setLineGridBox(lineGridBox); 3083 setLineGridBox(lineGridBox);
3089 3084
3090 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying 3085 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying
3091 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping 3086 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping
3092 // to this grid. 3087 // to this grid.
3093 } 3088 }
3094 3089
3095 } 3090 }
OLDNEW
« no previous file with comments | « LayoutTests/platform/mac/editing/execCommand/selectAll-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698