// FIXME: isolatedRuns() could be a hash of object->run and then we could cheaply
// ASSERT here that we didn't create multiple objects for the same inline.
resolver.isolatedRuns().append(isolatedRun);
+ resolver.setMidpointForIsolatedRun(isolatedRun, resolver.midpointState().currentMidpoint());
}
class IsolateTracker {
void embed(UCharDirection, BidiEmbeddingSource) { }
void commitExplicitEmbedding() { }
- void addFakeRunIfNecessary(RenderObject& obj, unsigned pos, InlineBidiResolver& resolver)
+ void addFakeRunIfNecessary(RenderObject& obj, unsigned pos, unsigned end, InlineBidiResolver& resolver)
{
// We only need to add a fake run for a given isolated span once during each call to createBidiRunsForLine.
// We'll be called for every span inside the isolated span so we just ignore subsequent calls.
// We also avoid creating a fake run until we hit a child that warrants one, e.g. we skip floats.
- if (m_haveAddedFakeRunForRootIsolate || RenderBlock::shouldSkipCreatingRunsForObject(&obj))
+ if (RenderBlock::shouldSkipCreatingRunsForObject(obj))
return;
- m_haveAddedFakeRunForRootIsolate = true;
- // obj and pos together denote a single position in the inline, from which the parsing of the isolate will start.
- // We don't need to mark the end of the run because this is implicit: it is either endOfLine or the end of the
- // isolate, when we call createBidiRunsForLine it will stop at whichever comes first.
- addPlaceholderRunForIsolatedInline(resolver, obj, pos);
- // FIXME: Inline isolates don't work properly with collapsing whitespace, see webkit.org/b/109624
- // For now, if we enter an isolate between midpoints, we increment our current midpoint or else
- // we'll leave the isolate and ignore the content that follows.
- MidpointState<InlineIterator>& midpointState = resolver.midpointState();
- if (midpointState.betweenMidpoints() && midpointState.midpoints()[midpointState.currentMidpoint()].renderer() == &obj) {
- midpointState.setBetweenMidpoints(false);
- midpointState.incrementCurrentMidpoint();
+ if (!m_haveAddedFakeRunForRootIsolate) {
+ // obj and pos together denote a single position in the inline, from which the parsing of the isolate will start.
+ // We don't need to mark the end of the run because this is implicit: it is either endOfLine or the end of the
+ // isolate, when we call createBidiRunsForLine it will stop at whichever comes first.
+ addPlaceholderRunForIsolatedInline(resolver, obj, pos);
}
+ m_haveAddedFakeRunForRootIsolate = true;
+ RenderBlockFlow::appendRunsForObject(nullptr, pos, end, obj, resolver);
}
private:
RenderObject* obj = m_sor.renderer();
while (obj && obj != m_eor.renderer() && obj != endOfLine.renderer()) {
if (isolateTracker.inIsolate())
- isolateTracker.addFakeRunIfNecessary(*obj, start, *this);
+ isolateTracker.addFakeRunIfNecessary(*obj, start, obj->length(), *this);
else
- RenderBlockFlow::appendRunsForObject(m_runs, start, obj->length(), obj, *this);
+ RenderBlockFlow::appendRunsForObject(&m_runs, start, obj->length(), *obj, *this);
// FIXME: start/obj should be an InlineIterator instead of two separate variables.
start = 0;
obj = bidiNextSkippingEmptyInlines(*m_sor.root(), obj, &isolateTracker);
// It's OK to add runs for zero-length RenderObjects, just don't make the run larger than it should be
int end = obj->length() ? pos + 1 : 0;
if (isolateTracker.inIsolate())
- isolateTracker.addFakeRunIfNecessary(*obj, start, *this);
+ isolateTracker.addFakeRunIfNecessary(*obj, start, obj->length(), *this);
else
- RenderBlockFlow::appendRunsForObject(m_runs, start, end, obj, *this);
+ RenderBlockFlow::appendRunsForObject(&m_runs, start, end, *obj, *this);
}
m_eor.increment();