Title: [105771] trunk/Source/WebCore
- Revision
- 105771
- Author
- [email protected]
- Date
- 2012-01-24 12:22:00 -0800 (Tue, 24 Jan 2012)
Log Message
RenderInline: Skip caching the computed line height.
<http://webkit.org/b/76929>
Reviewed by David Hyatt.
Stop caching the computed line height on RenderInline and make retrieving it from
RenderStyle slightly cheaper, freeing up 4 bytes per RenderInline instance.
This appears to be mostly performance neutral, I don't get more than the occasional
sample hit when instrumenting heavier web pages.
This reduces memory consumption by 228 kB (both 32/64-bit) when viewing the full
HTML5 spec at <http://whatwg.org/c>.
* rendering/RenderInline.cpp:
(WebCore::RenderInline::RenderInline):
(WebCore::RenderInline::styleDidChange):
(WebCore::RenderInline::lineHeight):
* rendering/RenderInline.h:
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::computedLineHeight):
Optimize computedLineHeight() to mitigate some of the damage of calling
it more often.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (105770 => 105771)
--- trunk/Source/WebCore/ChangeLog 2012-01-24 20:10:27 UTC (rev 105770)
+++ trunk/Source/WebCore/ChangeLog 2012-01-24 20:22:00 UTC (rev 105771)
@@ -1,3 +1,29 @@
+2012-01-24 Andreas Kling <[email protected]>
+
+ RenderInline: Skip caching the computed line height.
+ <http://webkit.org/b/76929>
+
+ Reviewed by David Hyatt.
+
+ Stop caching the computed line height on RenderInline and make retrieving it from
+ RenderStyle slightly cheaper, freeing up 4 bytes per RenderInline instance.
+ This appears to be mostly performance neutral, I don't get more than the occasional
+ sample hit when instrumenting heavier web pages.
+
+ This reduces memory consumption by 228 kB (both 32/64-bit) when viewing the full
+ HTML5 spec at <http://whatwg.org/c>.
+
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::RenderInline):
+ (WebCore::RenderInline::styleDidChange):
+ (WebCore::RenderInline::lineHeight):
+ * rendering/RenderInline.h:
+ * rendering/style/RenderStyle.h:
+ (WebCore::RenderStyle::computedLineHeight):
+
+ Optimize computedLineHeight() to mitigate some of the damage of calling
+ it more often.
+
2012-01-24 Abhishek Arya <[email protected]>
Crash when rendering -webkit-column-span.
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (105770 => 105771)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2012-01-24 20:10:27 UTC (rev 105770)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2012-01-24 20:22:00 UTC (rev 105771)
@@ -47,7 +47,6 @@
RenderInline::RenderInline(Node* node)
: RenderBoxModelObject(node)
- , m_lineHeight(-1)
, m_alwaysCreateLineBoxes(false)
{
setChildrenInline(true);
@@ -145,8 +144,6 @@
currCont->setContinuation(nextCont);
}
- m_lineHeight = -1;
-
if (!m_alwaysCreateLineBoxes) {
bool alwaysCreateLineBoxes = hasSelfPaintingLayer() || hasBoxDecorations() || newStyle->hasPadding() || newStyle->hasMargin() || hasOutline();
if (oldStyle && alwaysCreateLineBoxes) {
@@ -1269,11 +1266,8 @@
if (s != style())
return s->computedLineHeight();
}
-
- if (m_lineHeight == -1)
- m_lineHeight = style()->computedLineHeight();
-
- return m_lineHeight;
+
+ return style()->computedLineHeight();
}
LayoutUnit RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
Modified: trunk/Source/WebCore/rendering/RenderInline.h (105770 => 105771)
--- trunk/Source/WebCore/rendering/RenderInline.h 2012-01-24 20:10:27 UTC (rev 105770)
+++ trunk/Source/WebCore/rendering/RenderInline.h 2012-01-24 20:22:00 UTC (rev 105771)
@@ -168,7 +168,6 @@
RenderObjectChildList m_children;
RenderLineBoxList m_lineBoxes; // All of the line boxes created for this inline flow. For example, <i>Hello<br>world.</i> will have two <i> line boxes.
- mutable LayoutUnit m_lineHeight;
bool m_alwaysCreateLineBoxes : 1;
};
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (105770 => 105771)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2012-01-24 20:10:27 UTC (rev 105770)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2012-01-24 20:22:00 UTC (rev 105771)
@@ -615,7 +615,7 @@
Length lineHeight() const { return inherited->line_height; }
int computedLineHeight() const
{
- Length lh = lineHeight();
+ const Length& lh = inherited->line_height;
// Negative value means the line height is not set. Use the font's built-in spacing.
if (lh.isNegative())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes