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

Unified Diff: Source/core/rendering/line/TrailingObjects.h

Issue 302233002: Revert of Empty inline elements always get a line box. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/line/TrailingObjects.h
diff --git a/Source/core/rendering/line/TrailingObjects.h b/Source/core/rendering/line/TrailingObjects.h
index 72b1369ab206dbb4aa130e24bf75bbd3d9a52cd7..9bfd378bf3408fc6541691d3b962d6dfe79b9328 100644
--- a/Source/core/rendering/line/TrailingObjects.h
+++ b/Source/core/rendering/line/TrailingObjects.h
@@ -29,7 +29,7 @@
namespace WebCore {
class InlineIterator;
-class RenderObject;
+class RenderBox;
class RenderText;
struct BidiRun;
@@ -38,19 +38,6 @@
template <class Iterator> class MidpointState;
typedef BidiResolver<InlineIterator, BidiRun> InlineBidiResolver;
typedef MidpointState<InlineIterator> LineMidpointState;
-
-// This class allows us to ensure lineboxes are created in the right place on the line when
-// an out-of-flow positioned object or an empty inline is encountered between a trailing space
-// and subsequent spaces and we want to ignore (i.e. collapse) surplus whitespace. So for example:
-// <div>X <span></span> Y</div>
-// or
-// <div>X <div style="position: absolute"></div> Y</div>
-// In both of the above snippets the inline and the positioned object occur after a trailing space
-// and before a space that will cause our line breaking algorithm to start ignoring spaces. When it
-// does that we want to ensure that the inline/positioned object gets a linebox and that it is part
-// of the collapsed whitespace. So to achieve this we use appendObjectIfNeeded() to keep track of
-// objects encountered after a trailing whitespace and updateMidpointsForTrailingObjects() to put
-// them in the right place when we start ignoring surplus whitespace.
class TrailingObjects {
public:
@@ -71,22 +58,22 @@
// Using resize(0) rather than clear() here saves 2% on
// PerformanceTests/Layout/line-layout.html because we avoid freeing and
// re-allocating the underlying buffer repeatedly.
- m_objects.resize(0);
+ m_boxes.resize(0);
}
- void appendObjectIfNeeded(RenderObject* object)
+ void appendBoxIfNeeded(RenderBox* box)
{
if (m_whitespace)
- m_objects.append(object);
+ m_boxes.append(box);
}
enum CollapseFirstSpaceOrNot { DoNotCollapseFirstSpace, CollapseFirstSpace };
- void updateMidpointsForTrailingObjects(LineMidpointState&, const InlineIterator& lBreak, CollapseFirstSpaceOrNot);
+ void updateMidpointsForTrailingBoxes(LineMidpointState&, const InlineIterator& lBreak, CollapseFirstSpaceOrNot);
private:
RenderText* m_whitespace;
- Vector<RenderObject*, 4> m_objects;
+ Vector<RenderBox*, 4> m_boxes;
};
}
« no previous file with comments | « Source/core/rendering/line/BreakingContextInlineHeaders.h ('k') | Source/core/rendering/line/TrailingObjects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698