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

Side by Side Diff: third_party/WebKit/Source/core/layout/line/TrailingObjects.cpp

Issue 2393693002: Reformat comments in core/layout/line (Closed)
Patch Set: Created 4 years, 2 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
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.
4 * All right reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * Copyright (C) 2014 Adobe Systems Inc. 6 * Copyright (C) 2014 Adobe Systems Inc.
6 * 7 *
7 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
11 * 12 *
12 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 15 matching lines...) Expand all
29 30
30 namespace blink { 31 namespace blink {
31 32
32 void TrailingObjects::updateMidpointsForTrailingObjects( 33 void TrailingObjects::updateMidpointsForTrailingObjects(
33 LineMidpointState& lineMidpointState, 34 LineMidpointState& lineMidpointState,
34 const InlineIterator& lBreak, 35 const InlineIterator& lBreak,
35 CollapseFirstSpaceOrNot collapseFirstSpace) { 36 CollapseFirstSpaceOrNot collapseFirstSpace) {
36 if (!m_whitespace) 37 if (!m_whitespace)
37 return; 38 return;
38 39
39 // This object is either going to be part of the last midpoint, or it is going to be the actual endpoint. 40 // This object is either going to be part of the last midpoint, or it is going
40 // In both cases we just decrease our pos by 1 level to exclude the space, all owing it to - in effect - collapse into the newline. 41 // to be the actual endpoint. In both cases we just decrease our pos by 1
42 // level to exclude the space, allowing it to - in effect - collapse into the
43 // newline.
41 if (lineMidpointState.numMidpoints() % 2) { 44 if (lineMidpointState.numMidpoints() % 2) {
42 // Find the trailing space object's midpoint. 45 // Find the trailing space object's midpoint.
43 int trailingSpaceMidpoint = lineMidpointState.numMidpoints() - 1; 46 int trailingSpaceMidpoint = lineMidpointState.numMidpoints() - 1;
44 for (; trailingSpaceMidpoint > 0 && 47 for (; trailingSpaceMidpoint > 0 &&
45 lineMidpointState.midpoints()[trailingSpaceMidpoint] 48 lineMidpointState.midpoints()[trailingSpaceMidpoint]
46 .getLineLayoutItem() != m_whitespace; 49 .getLineLayoutItem() != m_whitespace;
47 --trailingSpaceMidpoint) { 50 --trailingSpaceMidpoint) {
48 } 51 }
49 ASSERT(trailingSpaceMidpoint >= 0); 52 ASSERT(trailingSpaceMidpoint >= 0);
50 if (collapseFirstSpace == CollapseFirstSpace) 53 if (collapseFirstSpace == CollapseFirstSpace)
51 lineMidpointState.midpoints()[trailingSpaceMidpoint].setOffset( 54 lineMidpointState.midpoints()[trailingSpaceMidpoint].setOffset(
52 lineMidpointState.midpoints()[trailingSpaceMidpoint].offset() - 1); 55 lineMidpointState.midpoints()[trailingSpaceMidpoint].offset() - 1);
53 56
54 // Now make sure every single trailingPositionedBox following the trailingSp aceMidpoint properly stops and starts 57 // Now make sure every single trailingPositionedBox following the
55 // ignoring spaces. 58 // trailingSpaceMidpoint properly stops and starts ignoring spaces.
56 size_t currentMidpoint = trailingSpaceMidpoint + 1; 59 size_t currentMidpoint = trailingSpaceMidpoint + 1;
57 for (size_t i = 0; i < m_objects.size(); ++i) { 60 for (size_t i = 0; i < m_objects.size(); ++i) {
58 if (currentMidpoint >= lineMidpointState.numMidpoints()) { 61 if (currentMidpoint >= lineMidpointState.numMidpoints()) {
59 // We don't have a midpoint for this box yet. 62 // We don't have a midpoint for this box yet.
60 ensureLineBoxInsideIgnoredSpaces(&lineMidpointState, 63 ensureLineBoxInsideIgnoredSpaces(&lineMidpointState,
61 LineLayoutItem(m_objects[i])); 64 LineLayoutItem(m_objects[i]));
62 } else { 65 } else {
63 ASSERT(lineMidpointState.midpoints()[currentMidpoint] 66 ASSERT(lineMidpointState.midpoints()[currentMidpoint]
64 .getLineLayoutItem() == m_objects[i]); 67 .getLineLayoutItem() == m_objects[i]);
65 ASSERT(lineMidpointState.midpoints()[currentMidpoint + 1] 68 ASSERT(lineMidpointState.midpoints()[currentMidpoint + 1]
66 .getLineLayoutItem() == m_objects[i]); 69 .getLineLayoutItem() == m_objects[i]);
67 } 70 }
68 currentMidpoint += 2; 71 currentMidpoint += 2;
69 } 72 }
70 } else if (!lBreak.getLineLayoutItem()) { 73 } else if (!lBreak.getLineLayoutItem()) {
71 ASSERT(collapseFirstSpace == CollapseFirstSpace); 74 ASSERT(collapseFirstSpace == CollapseFirstSpace);
72 // Add a new end midpoint that stops right at the very end. 75 // Add a new end midpoint that stops right at the very end.
73 unsigned length = m_whitespace.textLength(); 76 unsigned length = m_whitespace.textLength();
74 unsigned pos = length >= 2 ? length - 2 : UINT_MAX; 77 unsigned pos = length >= 2 ? length - 2 : UINT_MAX;
75 InlineIterator endMid(0, m_whitespace, pos); 78 InlineIterator endMid(0, m_whitespace, pos);
76 lineMidpointState.startIgnoringSpaces(endMid); 79 lineMidpointState.startIgnoringSpaces(endMid);
77 for (size_t i = 0; i < m_objects.size(); ++i) { 80 for (size_t i = 0; i < m_objects.size(); ++i) {
78 ensureLineBoxInsideIgnoredSpaces(&lineMidpointState, m_objects[i]); 81 ensureLineBoxInsideIgnoredSpaces(&lineMidpointState, m_objects[i]);
79 } 82 }
80 } 83 }
81 } 84 }
82 85
83 } // namespace blink 86 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698