This source file includes following definitions.
- updateMidpointsForTrailingBoxes
#include "config.h"
#include "core/rendering/line/TrailingObjects.h"
#include "core/rendering/InlineIterator.h"
namespace WebCore {
void TrailingObjects::updateMidpointsForTrailingBoxes(LineMidpointState& lineMidpointState, const InlineIterator& lBreak, CollapseFirstSpaceOrNot collapseFirstSpace)
{
if (!m_whitespace)
return;
if (lineMidpointState.numMidpoints() % 2) {
int trailingSpaceMidpoint = lineMidpointState.numMidpoints() - 1;
for ( ; trailingSpaceMidpoint > 0 && lineMidpointState.midpoints()[trailingSpaceMidpoint].object() != m_whitespace; --trailingSpaceMidpoint) { }
ASSERT(trailingSpaceMidpoint >= 0);
if (collapseFirstSpace == CollapseFirstSpace)
lineMidpointState.midpoints()[trailingSpaceMidpoint].setOffset(lineMidpointState.midpoints()[trailingSpaceMidpoint].offset() -1);
size_t currentMidpoint = trailingSpaceMidpoint + 1;
for (size_t i = 0; i < m_boxes.size(); ++i) {
if (currentMidpoint >= lineMidpointState.numMidpoints()) {
lineMidpointState.ensureLineBoxInsideIgnoredSpaces(m_boxes[i]);
} else {
ASSERT(lineMidpointState.midpoints()[currentMidpoint].object() == m_boxes[i]);
ASSERT(lineMidpointState.midpoints()[currentMidpoint + 1].object() == m_boxes[i]);
}
currentMidpoint += 2;
}
} else if (!lBreak.object()) {
ASSERT(m_whitespace->isText());
ASSERT(collapseFirstSpace == CollapseFirstSpace);
unsigned length = m_whitespace->textLength();
unsigned pos = length >= 2 ? length - 2 : UINT_MAX;
InlineIterator endMid(0, m_whitespace, pos);
lineMidpointState.startIgnoringSpaces(endMid);
for (size_t i = 0; i < m_boxes.size(); ++i) {
lineMidpointState.ensureLineBoxInsideIgnoredSpaces(m_boxes[i]);
}
}
}
}