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

Side by Side Diff: Source/core/rendering/InlineIterator.h

Issue 23483035: Fast increment to the next inline renderer when the current renderer is isolated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Proposed Patch V2 Created 7 years, 3 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 | « no previous file | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | 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 Apple Inc. All right r eserved. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All right r eserved.
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 17 matching lines...) Expand all
28 #include "core/rendering/RenderText.h" 28 #include "core/rendering/RenderText.h"
29 #include "wtf/StdLibExtras.h" 29 #include "wtf/StdLibExtras.h"
30 30
31 namespace WebCore { 31 namespace WebCore {
32 32
33 // This class is used to RenderInline subtrees, stepping by character within the 33 // This class is used to RenderInline subtrees, stepping by character within the
34 // text children. InlineIterator will use bidiNext to find the next RenderText 34 // text children. InlineIterator will use bidiNext to find the next RenderText
35 // optionally notifying a BidiResolver every time it steps into/out of a RenderI nline. 35 // optionally notifying a BidiResolver every time it steps into/out of a RenderI nline.
36 class InlineIterator { 36 class InlineIterator {
37 public: 37 public:
38 enum IncrementRule {
39 FastIncrementInlineRenderer,
40 FastIncrementInTextNode
41 };
42
38 InlineIterator() 43 InlineIterator()
39 : m_root(0) 44 : m_root(0)
40 , m_obj(0) 45 , m_obj(0)
41 , m_pos(0) 46 , m_pos(0)
42 , m_nextBreakablePosition(-1) 47 , m_nextBreakablePosition(-1)
43 { 48 {
44 } 49 }
45 50
46 InlineIterator(RenderObject* root, RenderObject* o, unsigned p) 51 InlineIterator(RenderObject* root, RenderObject* o, unsigned p)
47 : m_root(root) 52 : m_root(root)
(...skipping 15 matching lines...) Expand all
63 m_obj = object; 68 m_obj = object;
64 m_pos = offset; 69 m_pos = offset;
65 m_nextBreakablePosition = nextBreak; 70 m_nextBreakablePosition = nextBreak;
66 } 71 }
67 72
68 RenderObject* object() const { return m_obj; } 73 RenderObject* object() const { return m_obj; }
69 unsigned offset() const { return m_pos; } 74 unsigned offset() const { return m_pos; }
70 RenderObject* root() const { return m_root; } 75 RenderObject* root() const { return m_root; }
71 76
72 void fastIncrementInTextNode(); 77 void fastIncrementInTextNode();
73 void increment(InlineBidiResolver* = 0); 78 void increment(InlineBidiResolver* = 0, IncrementRule = FastIncrementInTextN ode);
74 bool atEnd() const; 79 bool atEnd() const;
75 80
76 inline bool atTextParagraphSeparator() 81 inline bool atTextParagraphSeparator()
77 { 82 {
78 return m_obj && m_obj->preservesNewline() && m_obj->isText() && toRender Text(m_obj)->textLength() 83 return m_obj && m_obj->preservesNewline() && m_obj->isText() && toRender Text(m_obj)->textLength()
79 && !toRenderText(m_obj)->isWordBreak() && toRenderText(m_obj)->chara cterAt(m_pos) == '\n'; 84 && !toRenderText(m_obj)->isWordBreak() && toRenderText(m_obj)->chara cterAt(m_pos) == '\n';
80 } 85 }
81 86
82 inline bool atParagraphSeparator() 87 inline bool atParagraphSeparator()
83 { 88 {
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // FIXME: Support SkipEmptyInlines and observer parameters. 350 // FIXME: Support SkipEmptyInlines and observer parameters.
346 m_current = bidiNextIncludingEmptyInlines(m_root, m_current, &m_atEndOfI nline); 351 m_current = bidiNextIncludingEmptyInlines(m_root, m_current, &m_atEndOfI nline);
347 return m_current; 352 return m_current;
348 } 353 }
349 private: 354 private:
350 RenderObject* m_root; 355 RenderObject* m_root;
351 RenderObject* m_current; 356 RenderObject* m_current;
352 bool m_atEndOfInline; 357 bool m_atEndOfInline;
353 }; 358 };
354 359
355 inline void InlineIterator::increment(InlineBidiResolver* resolver) 360 inline void InlineIterator::increment(InlineBidiResolver* resolver, IncrementRul e rule)
356 { 361 {
357 if (!m_obj) 362 if (!m_obj)
358 return; 363 return;
359 if (m_obj->isText()) { 364 if (m_obj->isText() && rule == FastIncrementInTextNode) {
360 fastIncrementInTextNode(); 365 fastIncrementInTextNode();
361 if (m_pos < toRenderText(m_obj)->textLength()) 366 if (m_pos < toRenderText(m_obj)->textLength())
362 return; 367 return;
363 } 368 }
364 // bidiNext can return 0, so use moveTo instead of moveToStartOf 369 // bidiNext can return 0, so use moveTo instead of moveToStartOf
365 moveTo(bidiNextSkippingEmptyInlines(m_root, m_obj, resolver), 0); 370 moveTo(bidiNextSkippingEmptyInlines(m_root, m_obj, resolver), 0);
366 } 371 }
367 372
368 inline bool InlineIterator::atEnd() const 373 inline bool InlineIterator::atEnd() const
369 { 374 {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 m_sor = m_eor; 547 m_sor = m_eor;
543 } 548 }
544 549
545 m_direction = WTF::Unicode::OtherNeutral; 550 m_direction = WTF::Unicode::OtherNeutral;
546 m_status.eor = WTF::Unicode::OtherNeutral; 551 m_status.eor = WTF::Unicode::OtherNeutral;
547 } 552 }
548 553
549 } 554 }
550 555
551 #endif // InlineIterator_h 556 #endif // InlineIterator_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698