Source/WebCore: Implement the CSS3 line-box-contain property. This property provides...
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Mar 2011 19:03:50 +0000 (19:03 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Mar 2011 19:03:50 +0000 (19:03 +0000)
you can fix the height of lines and cause all line contents to be ignored. You can make lines fit to glyphs. You can ignore leading and
fit to the font size. You can ignore replaced elements, etc.

Reviewed by Simon Fraser.

Refactor the code in computeLogicalBoxHeights into helper methods on RootInlineBox. verticalPositionForBox moved over to RootInlineBox
so that it could be called from RenderBlockLineLayout. ascentAndDescentForBox is the new method that computes the appropriate box
height based off the block's line-box-contain value.

GlyphOverflow can now have a computeBounds parameter set, in which case glyph bounds will be computed and stored in the overflow struct.

RenderInline no longer returns 0 margins in the block direction, since line-box-contain can size around the margin box.

Added new tests in fast/block/lineboxcontain

* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::createLineBoxContainValue):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSLineBoxContainValue.cpp: Added.
(WebCore::CSSLineBoxContainValue::CSSLineBoxContainValue):
(WebCore::CSSLineBoxContainValue::cssText):
* css/CSSLineBoxContainValue.h: Added.
(WebCore::CSSLineBoxContainValue::create):
(WebCore::CSSLineBoxContainValue::value):
(WebCore::CSSLineBoxContainValue::isCSSLineBoxContainValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseLineBoxContain):
* css/CSSParser.h:
* css/CSSPropertyNames.in:
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
* css/CSSValue.h:
(WebCore::CSSValue::isCSSLineBoxContainValue):
* css/CSSValueKeywords.in:
* platform/graphics/Font.cpp:
(WebCore::Font::width):
* platform/graphics/Font.h:
(WebCore::GlyphOverflow::GlyphOverflow):
* platform/graphics/FontFastPath.cpp:
(WebCore::Font::floatWidthForSimpleText):
* platform/graphics/mac/FontComplexTextMac.cpp:
(WebCore::Font::floatWidthForComplexText):
* platform/graphics/win/FontWin.cpp:
(WebCore::Font::floatWidthForComplexText):
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::computeLogicalBoxHeights):
* rendering/InlineFlowBox.h:
* rendering/RenderBlock.h:
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::computeInlineDirectionPositionsForLine):
(WebCore::RenderBlock::layoutInlineChildren):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::marginLeft):
(WebCore::RenderInline::marginRight):
(WebCore::RenderInline::marginTop):
(WebCore::RenderInline::marginBottom):
(WebCore::RenderInline::marginBefore):
(WebCore::RenderInline::marginAfter):
* rendering/RenderInline.h:
* rendering/RenderText.cpp:
(WebCore::RenderText::widthFromCache):
(WebCore::RenderText::width):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::alignBoxesInBlockDirection):
(WebCore::setAscentAndDescent):
(WebCore::RootInlineBox::ascentAndDescentForBox):
(WebCore::RootInlineBox::verticalPositionForBox):
(WebCore::RootInlineBox::includeLeadingForBox):
(WebCore::RootInlineBox::includeFontForBox):
(WebCore::RootInlineBox::includeGlyphsForBox):
(WebCore::RootInlineBox::includeMarginForBox):
(WebCore::RootInlineBox::fitsToGlyphs):
(WebCore::RootInlineBox::includesRootLineBoxFontOrLeading):
* rendering/RootInlineBox.h:
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::diff):
* rendering/style/RenderStyle.h:
(WebCore::InheritedFlags::lineBoxContain):
(WebCore::InheritedFlags::setLineBoxContain):
(WebCore::InheritedFlags::initialLineBoxContain):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator==):
* rendering/style/StyleRareInheritedData.h:

LayoutTests: https://bugs.webkit.org/show_bug.cgi?id=56388

Reviewed by Simon Fraser.

Implement the CSS3 line-box-contain property. This property provides authors with more control over spacing between lines. For example,
you can fix the height of lines and cause all line contents to be ignored. You can make lines fit to glyphs. You can ignore leading and
fit to the font size. You can ignore replaced elements, etc.

Refactor the code in computeLogicalBoxHeights into helper methods on RootInlineBox. verticalPositionForBox moved over to RootInlineBox
so that it could be called from RenderBlockLineLayout. ascentAndDescentForBox is the new method that computes the appropriate box
height based off the block's line-box-contain value.

GlyphOverflow can now have a computeBounds parameter set, in which case glyph bounds will be computed and stored in the overflow struct.

RenderInline no longer returns 0 margins in the block direction, since line-box-contain can size around the margin box.

* fast/block/lineboxcontain: Added.
* fast/block/lineboxcontain/block-font.html: Added.
* fast/block/lineboxcontain/block-glyphs-replaced.html: Added.
* fast/block/lineboxcontain/block-glyphs.html: Added.
* fast/block/lineboxcontain/block-replaced.html: Added.
* fast/block/lineboxcontain/block.html: Added.
* fast/block/lineboxcontain/font-replaced.html: Added.
* fast/block/lineboxcontain/font.html: Added.
* fast/block/lineboxcontain/glyphs.html: Added.
* fast/block/lineboxcontain/inline-box-replaced.html: Added.
* fast/block/lineboxcontain/inline-box-vertical.html: Added.
* fast/block/lineboxcontain/inline-box.html: Added.
* fast/block/lineboxcontain/inline-replaced.html: Added.
* fast/block/lineboxcontain/inline.html: Added.
* fast/block/lineboxcontain/none.html: Added.
* fast/block/lineboxcontain/replaced.html: Added.
* platform/mac/fast/block/lineboxcontain: Added.
* platform/mac/fast/block/lineboxcontain/block-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/block-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/block-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/block-font-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/block-font-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/block-font-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/block-glyphs-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/block-glyphs-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/block-glyphs-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/block-replaced-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/block-replaced-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/block-replaced-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/font-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/font-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/font-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/font-replaced-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/font-replaced-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/font-replaced-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/glyphs-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/glyphs-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/glyphs-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/inline-box-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/inline-box-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/inline-box-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/inline-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/inline-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/inline-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/inline-replaced-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/inline-replaced-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/inline-replaced-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/none-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/none-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/none-expected.txt: Added.
* platform/mac/fast/block/lineboxcontain/replaced-expected.checksum: Added.
* platform/mac/fast/block/lineboxcontain/replaced-expected.png: Added.
* platform/mac/fast/block/lineboxcontain/replaced-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@81684 268f45cc-cd09-0410-ab3c-d52691b4dbfc

98 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/block/lineboxcontain/block-font.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/block-glyphs-replaced.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/block-glyphs.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/block-replaced.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/block.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/font-replaced.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/font.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/glyphs.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/inline-box-replaced.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/inline-box-vertical.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/inline-box.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/inline-replaced.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/inline.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/none.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/parsing-invalid.html [new file with mode: 0644]
LayoutTests/fast/block/lineboxcontain/replaced.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-font-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-font-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-font-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-replaced-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-replaced-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/block-replaced-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/font-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/font-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/font-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/font-replaced-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/font-replaced-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/font-replaced-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/glyphs-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/glyphs-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/glyphs-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-replaced-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-replaced-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/inline-replaced-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/none-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/none-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/none-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/parsing-invalid-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/parsing-invalid-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/parsing-invalid-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/replaced-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/replaced-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/lineboxcontain/replaced-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.pro
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSLineBoxContainValue.cpp [new file with mode: 0644]
Source/WebCore/css/CSSLineBoxContainValue.h [new file with mode: 0644]
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/CSSStyleSelector.cpp
Source/WebCore/css/CSSValue.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/platform/graphics/Font.cpp
Source/WebCore/platform/graphics/Font.h
Source/WebCore/platform/graphics/FontFastPath.cpp
Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp
Source/WebCore/platform/graphics/win/FontWin.cpp
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/InlineFlowBox.h
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBlockLineLayout.cpp
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderInline.h
Source/WebCore/rendering/RenderText.cpp
Source/WebCore/rendering/RootInlineBox.cpp
Source/WebCore/rendering/RootInlineBox.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/StyleRareInheritedData.cpp
Source/WebCore/rendering/style/StyleRareInheritedData.h

index cf4d018..ae70737 100644 (file)
@@ -1,3 +1,84 @@
+2011-03-22  David Hyatt  <hyatt@apple.com>
+
+        Reviewed by Simon Fraser.
+
+        https://bugs.webkit.org/show_bug.cgi?id=56388
+        
+        Implement the CSS3 line-box-contain property. This property provides authors with more control over spacing between lines. For example,
+        you can fix the height of lines and cause all line contents to be ignored. You can make lines fit to glyphs. You can ignore leading and
+        fit to the font size. You can ignore replaced elements, etc.
+
+        Refactor the code in computeLogicalBoxHeights into helper methods on RootInlineBox. verticalPositionForBox moved over to RootInlineBox
+        so that it could be called from RenderBlockLineLayout. ascentAndDescentForBox is the new method that computes the appropriate box
+        height based off the block's line-box-contain value.
+        
+        GlyphOverflow can now have a computeBounds parameter set, in which case glyph bounds will be computed and stored in the overflow struct.
+        
+        RenderInline no longer returns 0 margins in the block direction, since line-box-contain can size around the margin box.
+    
+        * fast/block/lineboxcontain: Added.
+        * fast/block/lineboxcontain/block-font.html: Added.
+        * fast/block/lineboxcontain/block-glyphs-replaced.html: Added.
+        * fast/block/lineboxcontain/block-glyphs.html: Added.
+        * fast/block/lineboxcontain/block-replaced.html: Added.
+        * fast/block/lineboxcontain/block.html: Added.
+        * fast/block/lineboxcontain/font-replaced.html: Added.
+        * fast/block/lineboxcontain/font.html: Added.
+        * fast/block/lineboxcontain/glyphs.html: Added.
+        * fast/block/lineboxcontain/inline-box-replaced.html: Added.
+        * fast/block/lineboxcontain/inline-box-vertical.html: Added.
+        * fast/block/lineboxcontain/inline-box.html: Added.
+        * fast/block/lineboxcontain/inline-replaced.html: Added.
+        * fast/block/lineboxcontain/inline.html: Added.
+        * fast/block/lineboxcontain/none.html: Added.
+        * fast/block/lineboxcontain/replaced.html: Added.
+        * platform/mac/fast/block/lineboxcontain: Added.
+        * platform/mac/fast/block/lineboxcontain/block-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/block-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/block-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/block-font-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/block-font-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/block-font-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/block-glyphs-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/block-glyphs-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/block-glyphs-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/block-replaced-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/block-replaced-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/block-replaced-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/font-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/font-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/font-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/font-replaced-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/font-replaced-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/font-replaced-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/glyphs-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/glyphs-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/glyphs-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-box-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-box-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-box-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-replaced-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-replaced-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/inline-replaced-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/none-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/none-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/none-expected.txt: Added.
+        * platform/mac/fast/block/lineboxcontain/replaced-expected.checksum: Added.
+        * platform/mac/fast/block/lineboxcontain/replaced-expected.png: Added.
+        * platform/mac/fast/block/lineboxcontain/replaced-expected.txt: Added.
+
 2011-03-22  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r81664.
diff --git a/LayoutTests/fast/block/lineboxcontain/block-font.html b/LayoutTests/fast/block/lineboxcontain/block-font.html
new file mode 100644 (file)
index 0000000..1253f80
--- /dev/null
@@ -0,0 +1,17 @@
+<!doctype html>
+<head>
+<title>line-box-contain: block font</title>
+<style>
+.test { -webkit-line-box-contain: block font; line-box-contain: block font; font: 64px/1em Ahem; background-color:red; width:6em; overflow:hidden }
+.goodline { color: green; line-height:12 }
+</style>
+</head>
+<body>
+You should see a green rectangle below.  If you see any red, the test has failed.
+
+<div class="test">
+<span class="goodline">xxxxx</span><span style="background-color:green; font-size:128px; padding-left:0.5em;"></span><br>
+<div style="display:inline-block; width:1em;height:2em;vertical-align:bottom;background-color:green"></div><span class="goodline">xxxxx</span>
+</div>
+
+<p style="-webkit-line-box-contain:block font;line-box-contain: block font; border:1px solid black">This line should look normal.</p>
diff --git a/LayoutTests/fast/block/lineboxcontain/block-glyphs-replaced.html b/LayoutTests/fast/block/lineboxcontain/block-glyphs-replaced.html
new file mode 100644 (file)
index 0000000..e5b14d2
--- /dev/null
@@ -0,0 +1,17 @@
+<!doctype html>
+<head>
+<title>line-box-contain: block glyphs replaced</title>
+<style>
+.test { -webkit-line-box-contain: block glyphs replaced; line-box-contain: block glyphs replaced; font: 64px/1em Ahem; background-color:red; width:6em; overflow:hidden }
+.goodline { color: green; line-height:12 }
+</style>
+</head>
+<body>
+You should see a green rectangle below.  If you see any red other than anti-aliasing, the test has failed.
+
+<div class="test">
+<span class="goodline">xxxxx</span><span style="background-color:green; font-size:128px; padding-left:0.5em;"></span><br>
+<span class="goodline" style="font-size:128px; letter-spacing:-0.5em">xxxxx</span><div style="display:inline-block; width:1em;height:2em;vertical-align:bottom;background-color:green"></div>
+</div>
+
+<p style="-webkit-line-box-contain:block glyphs;line-box-contain: block glyphs; border:1px solid black">This line should look normal.</p>
diff --git a/LayoutTests/fast/block/lineboxcontain/block-glyphs.html b/LayoutTests/fast/block/lineboxcontain/block-glyphs.html
new file mode 100644 (file)
index 0000000..19d8d45
--- /dev/null
@@ -0,0 +1,17 @@
+<!doctype html>
+<head>
+<title>line-box-contain: block glyphs</title>
+<style>
+.test { -webkit-line-box-contain: block glyphs; line-box-contain: block glyphs; font: 64px/1em Ahem; background-color:red; width:6em; overflow:hidden }
+.goodline { color: green; line-height:12 }
+</style>
+</head>
+<body>
+You should see a green rectangle below.  If you see any red, the test has failed.
+
+<div class="test">
+<span class="goodline">xxxxx</span><span style="background-color:green; font-size:128px; padding-left:0.5em;"></span><br>
+<div style="display:inline-block; width:1em;height:2em;vertical-align:bottom;background-color:green"></div><span class="goodline">xxxxx</span>
+</div>
+
+<p style="-webkit-line-box-contain:block glyphs replaced;line-box-contain: block glyphs replaced; border:1px solid black">This line should look normal.</p>
diff --git a/LayoutTests/fast/block/lineboxcontain/block-replaced.html b/LayoutTests/fast/block/lineboxcontain/block-replaced.html
new file mode 100644 (file)
index 0000000..6adcfb6
--- /dev/null
@@ -0,0 +1,15 @@
+<!doctype html>
+<head>
+<title>line-box-contain: block replaced</title>
+<style>
+.test { -webkit-line-box-contain: block replaced; line-box-contain: block replaced; font: 64px/1em Ahem; background-color:red; width:5em}
+.goodline { color: green; line-height:12 }
+</style>
+</head>
+<body>
+You should see a green rectangle below.  If you see any red, the test has failed.
+
+<div class="test">
+<span class="goodline">xxxxx</span><br>
+<div style="display:inline-block; width:5em;height:2em;vertical-align:bottom;background-color:green"></div>
+</div>
diff --git a/LayoutTests/fast/block/lineboxcontain/block.html b/LayoutTests/fast/block/lineboxcontain/block.html
new file mode 100644 (file)
index 0000000..0ca515f
--- /dev/null
@@ -0,0 +1,15 @@
+<!doctype html>
+<head>
+<title>line-box-contain:block</title>
+<style>
+.test { -webkit-line-box-contain: block; line-box-contain: block; font: 64px/1em Ahem; background-color:red; width:6em}
+.goodline { color: green; line-height:12 }
+</style>
+</head>
+<body>
+You should see a green rectangle below.  If you see any red, the test has failed.
+
+<div class="test">
+<span class="goodline">xxxxx</span><div style="display:inline-block; width:1em;height:2em;vertical-align:top;background-color:green"></div><br>
+<div style="display:inline-block; width:1em;height:2em;vertical-align:bottom;background-color:green"></div><span class="goodline">xxxxx</span>
+</div>
diff --git a/LayoutTests/fast/block/lineboxcontain/font-replaced.html b/LayoutTests/fast/block/lineboxcontain/font-replaced.html
new file mode 100644 (file)
index 0000000..c74d728
--- /dev/null
@@ -0,0 +1,17 @@
+<!doctype html>
+<head>
+<title>line-box-contain: font replaced</title>
+<style>
+.test { -webkit-line-box-contain: font replaced; line-box-contain: font replaced; font: 64px/1em Ahem; background-color:red; width:6em; overflow:hidden }
+.goodline { color: green; line-height:12 }
+</style>
+</head>
+<body>
+You should see a green rectangle below.  If you see any red, the test has failed.
+
+<div class="test">
+<span class="goodline">xxxxx</span><span style="background-color:green; font-size:128px; padding-left:0.5em;"></span><br>
+<div style="display:inline-block; width:6em;height:1em;vertical-align:bottom;background-color:green"></div>
+</div>
+
+<p style="-webkit-line-box-contain:font replaced;line-box-contain: font replaced; border:1px solid black">This line should look normal.</p>
diff --git a/LayoutTests/fast/block/lineboxcontain/font.html b/LayoutTests/fast/block/lineboxcontain/font.html
new file mode 100644 (file)
index 0000000..88b7b8c
--- /dev/null
@@ -0,0 +1,15 @@
+<!doctype html>
+<head>
+<title>line-box-contain: font</title>
+<style>
+.test { -webkit-line-box-contain: font; line-box-contain: font; font: 64px/1em Ahem; background-color:red; width:6em; overflow:hidden }
+.goodline { color: green; line-height:12 }
+</style>
+</head>
+<body>
+You should see a green rectangle below.  If you see any red, the test has failed.
+
+<div class="test">
+<span class="goodline">xxxxx</span><span style="background-color:green; font-size:128px; padding-left:0.5em;"></span><br>
+<div style="display:inline-block; width:1em;height:2em;vertical-align:bottom;background-color:green"></div><span class="goodline">xxxxx</span>
+</div>
diff --git a/LayoutTests/fast/block/lineboxcontain/glyphs.html b/LayoutTests/fast/block/lineboxcontain/glyphs.html
new file mode 100644 (file)
index 0000000..1f7cc88
--- /dev/null
@@ -0,0 +1,22 @@
+<!doctype html>
+<head>
+<title>line-box-contain: glyphs</title>
+<style>
+.test { -webkit-line-box-contain: glyphs; line-box-contain: glyphs; font: 64px/1em Ahem; background-color:red; width:6em; overflow:hidden }
+.goodline { color: green; line-height:12 }
+.contains-drop-cap::first-letter { font-size:36px; float:left; margin-right:2px; -webkit-line-box-contain:glyphs; line-box-contain:glyphs }
+</style>
+</head>
+<body>
+You should see a green rectangle below.  If you see any red, the test has failed.
+
+<div class="test">
+<span class="goodline">xxxxx</span><span style="background-color:green; font-size:128px; padding-left:0.5em;"></span><br>
+<div style="display:inline-block; width:1em;height:2em;vertical-align:bottom;background-color:green"></div><span class="goodline">xxxxx</span>
+</div>
+
+<p style="-webkit-line-box-contain:glyphs;line-box-contain: glyphs; border:1px solid black">this block should hug the lowercase glyphs.</p>
+
+<p class="contains-drop-cap">The first letter here should look nicer because it uses glyph bounds<br>This should make the top of the T
+line up with the line and not look shifted down.<br> Maybe we should do this by default for all first letters like Firefox does.
+
diff --git a/LayoutTests/fast/block/lineboxcontain/inline-box-replaced.html b/LayoutTests/fast/block/lineboxcontain/inline-box-replaced.html
new file mode 100644 (file)
index 0000000..619c779
--- /dev/null
@@ -0,0 +1,14 @@
+<!doctype html>
+<head>
+<title>line-box-contain: inline-box replaced</title>
+<style>
+.test { -webkit-line-box-contain: inline-box replaced; line-box-contain: inline-box replaced; font: 64px/1em Ahem; background-color:red; width:6em; height:3em }
+.goodline { color: green }
+</style>
+</head>
+<body>
+You should see a green rectangle below.  If you see any red, the test has failed.
+
+<div class="test">
+<span style="background-color:green; font-size:64px;padding-left:5em; padding-right:1em; padding-bottom:1em"></span><br>
+<div style="display:inline-block; width:6em;height:1em;vertical-align:bottom;background-color:green"></div></div>
diff --git a/LayoutTests/fast/block/lineboxcontain/inline-box-vertical.html b/LayoutTests/fast/block/lineboxcontain/inline-box-vertical.html
new file mode 100644 (file)
index 0000000..2f1a110
--- /dev/null
@@ -0,0 +1,16 @@
+<!doctype html>
+<html style="-webkit-writing-mode:vertical-lr">
+<head>
+<title>line-box-contain: inline-box vertical test</title>
+<style>
+.test { -webkit-line-box-contain: inline-box; line-box-contain: inline-box; font: 64px/1em Ahem; background-color:red; height:6em; width:3em }
+.goodline { color: green }
+</style>
+</head>
+<body>
+You should see a green rectangle below.  If you see any red, the test has failed.
+
+<div class="test">
+<span style="background-color:green; font-size:64px;padding-top:5em; padding-bottom:1em;margin-left:0.5em;padding-right:0.5em"></span><br>
+<div style="display:inline-block; height:6em;width:2em;vertical-align:bottom;background-color:green"></div></div>
+
diff --git a/LayoutTests/fast/block/lineboxcontain/inline-box.html b/LayoutTests/fast/block/lineboxcontain/inline-box.html
new file mode 100644 (file)
index 0000000..bbcb62b
--- /dev/null
@@ -0,0 +1,15 @@
+<!doctype html>
+<head>
+<title>line-box-contain: inline-box</title>
+<style>
+.test { -webkit-line-box-contain: inline-box; line-box-contain: inline-box; font: 64px/1em Ahem; background-color:red; width:6em; height:3em }
+.goodline { color: green }
+</style>
+</head>
+<body>
+You should see a green rectangle below.  If you see any red, the test has failed.
+
+<div class="test">
+<span style="background-color:green; font-size:64px;padding-left:5em; padding-right:1em;margin-bottom:0.5em;padding-top:0.5em"></span><br>
+<div style="display:inline-block; width:6em;height:2em;vertical-align:bottom;background-color:green"></div></div>
+
diff --git a/LayoutTests/fast/block/lineboxcontain/inline-replaced.html b/LayoutTests/fast/block/lineboxcontain/inline-replaced.html
new file mode 100644 (file)
index 0000000..af64348
--- /dev/null
@@ -0,0 +1,14 @@
+<!doctype html>
+<head>
+<title>line-box-contain: inline replaced</title>
+<style>
+.test { -webkit-line-box-contain: inline replaced; line-box-contain: inline replaced; font: 64px/1em Ahem; background-color:red; width:6em; }
+.goodline { color: green }
+</style>
+</head>
+<body>
+You should see a green rectangle below.  If you see any red, the test has failed.
+
+<div class="test">
+<span style="background-color:green; font-size:128px; line-height:normal; padding-left:2.5em; padding-right:0.5em"></span><br>
+<div style="display:inline-block; width:6em;height:2em;vertical-align:bottom;background-color:green"></div></div>
diff --git a/LayoutTests/fast/block/lineboxcontain/inline.html b/LayoutTests/fast/block/lineboxcontain/inline.html
new file mode 100644 (file)
index 0000000..47c0a4f
--- /dev/null
@@ -0,0 +1,15 @@
+<!doctype html>
+<head>
+<title>line-box-contain: inline</title>
+<style>
+.test { -webkit-line-box-contain: inline; line-box-contain: inline; font: 64px/1em Ahem; background-color:red; width:6em; }
+.goodline { color: green }
+</style>
+</head>
+<body>
+You should see a green rectangle below.  If you see any red, the test has failed.
+
+<div class="test">
+<span style="background-color:green; font-size:128px; line-height:normal; padding-left:2.5em; padding-right:0.5em"></span><br>
+<div style="display:inline-block; width:1em;height:2em;vertical-align:bottom;background-color:green"></div><span class="goodline">xxxxx</span>
+</div>
diff --git a/LayoutTests/fast/block/lineboxcontain/none.html b/LayoutTests/fast/block/lineboxcontain/none.html
new file mode 100644 (file)
index 0000000..e62b068
--- /dev/null
@@ -0,0 +1,19 @@
+<!doctype html>
+<head>
+<title>line-box-contain: none</title>
+<style>
+.test { -webkit-line-box-contain: none; line-box-contain: none; font: 64px/1em Ahem; background-color:red; margin-top:1em }
+.badline { color:red }
+.goodline { color: green }
+</style>
+</head>
+<body>
+You should see a green line below.  If you see any red, the test has failed.
+
+<div class="test">
+<span class="badline">xxxxx</span><br>
+<span class="badline">xxxxx</span><br>
+<span class="badline">xxxxx</span><br>
+<span class="badline">xxxxx</span><br>
+<span class="goodline">xxxxx</span>
+</div>
diff --git a/LayoutTests/fast/block/lineboxcontain/parsing-invalid.html b/LayoutTests/fast/block/lineboxcontain/parsing-invalid.html
new file mode 100644 (file)
index 0000000..493e1e9
--- /dev/null
@@ -0,0 +1,40 @@
+<!doctype html>
+<head>
+<title>line-box-contain parsing test</title>
+<style>
+.test { font: 64px/1em Ahem; background-color:lime; width:5em; overflow:hidden; margin:0.5em 0 }
+.goodline { color: green; line-height:2 }
+.invalid1 { -webkit-line-box-contain: block inline inline }
+.invalid2 { -webkit-line-box-contain: block block }
+.invalid3 { -webkit-line-box-contain: block replaced inline inline }
+.invalid4 { -webkit-line-box-contain: none block }
+</style>
+</head>
+<body>
+All of these blocks should look the same.
+
+<div class="test">
+<span class="goodline">xxxxx</span><br>
+<div style="display:inline-block; width:4em;background-color:lime; color:green">xxxx</div><span class="goodline">x</span>
+</div>
+
+<div class="test invalid1">
+<span class="goodline">xxxxx</span><br>
+<div style="display:inline-block; width:4em;background-color:lime; color:green">xxxx</div><span class="goodline">x</span>
+</div>
+
+<div class="test invalid2">
+<span class="goodline">xxxxx</span><br>
+<div style="display:inline-block; width:4em;background-color:lime; color:green">xxxx</div><span class="goodline">x</span>
+</div>
+
+<div class="test invalid3">
+<span class="goodline">xxxxx</span><br>
+<div style="display:inline-block; width:4em;background-color:lime; color:green">xxxx</div><span class="goodline">x</span>
+</div>
+
+<div class="test invalid4">
+<span class="goodline">xxxxx</span><br>
+<div style="display:inline-block; width:4em;background-color:lime; color:green">xxxx</div><span class="goodline">x</span>
+</div>
+
diff --git a/LayoutTests/fast/block/lineboxcontain/replaced.html b/LayoutTests/fast/block/lineboxcontain/replaced.html
new file mode 100644 (file)
index 0000000..2b286a1
--- /dev/null
@@ -0,0 +1,14 @@
+<!doctype html>
+<head>
+<title>line-box-contain: replaced</title>
+<style>
+.test { -webkit-line-box-contain: replaced; line-box-contain: replaced; font: 64px/12 Ahem; background-color:red; width:5em}
+.goodline { color: green; line-height:12 }
+</style>
+</head>
+<body>
+You should see a green rectangle below.  If you see any red, the test has failed.
+
+<div class="test">
+<div style="display:inline-block; width:5em;height:2em;vertical-align:bottom;background-color:green"></div>
+</div>
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-expected.checksum
new file mode 100644 (file)
index 0000000..b37baf4
--- /dev/null
@@ -0,0 +1 @@
+291dac8d3dffba8935aaf1442ae3c9ff
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-expected.png
new file mode 100644 (file)
index 0000000..f807f06
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-expected.txt
new file mode 100644 (file)
index 0000000..b2126e3
--- /dev/null
@@ -0,0 +1,20 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x162
+  RenderBlock {HTML} at (0,0) size 800x162
+    RenderBody {BODY} at (8,8) size 784x146
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 493x18
+          text run at (0,0) width 260: "You should see a green rectangle below. "
+          text run at (260,0) width 233: "If you see any red, the test has failed."
+      RenderBlock {DIV} at (0,18) size 384x128 [bgcolor=#FF0000]
+        RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+          RenderText {#text} at (0,0) size 320x64
+            text run at (0,0) width 320: "xxxxx"
+        RenderBlock {DIV} at (320,0) size 64x128 [bgcolor=#008000]
+        RenderBR {BR} at (384,0) size 0x64
+        RenderBlock {DIV} at (0,0) size 64x128 [bgcolor=#008000]
+        RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+          RenderText {#text} at (64,64) size 320x64
+            text run at (64,64) width 320: "xxxxx"
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-font-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-font-expected.checksum
new file mode 100644 (file)
index 0000000..a8ebc0b
--- /dev/null
@@ -0,0 +1 @@
+f4fb3978f6fca92a3a10bb329da1b49b
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-font-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-font-expected.png
new file mode 100644 (file)
index 0000000..e9da060
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-font-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-font-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-font-expected.txt
new file mode 100644 (file)
index 0000000..3439902
--- /dev/null
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x206
+  RenderBlock {HTML} at (0,0) size 800x206
+    RenderBody {BODY} at (8,8) size 784x182
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 493x18
+          text run at (0,0) width 260: "You should see a green rectangle below. "
+          text run at (260,0) width 233: "If you see any red, the test has failed."
+      RenderBlock {P} at (0,162) size 784x20 [border: (1px solid #000000)]
+        RenderText {#text} at (1,1) size 185x18
+          text run at (1,1) width 185: "This line should look normal."
+layer at (8,26) size 384x128
+  RenderBlock {DIV} at (0,18) size 384x128 [bgcolor=#FF0000]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (0,0) size 320x64
+        text run at (0,0) width 320: "xxxxx"
+    RenderInline {SPAN} at (0,0) size 64x128 [bgcolor=#008000]
+    RenderBR {BR} at (384,0) size 0x64
+    RenderBlock {DIV} at (0,0) size 64x128 [bgcolor=#008000]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (64,64) size 320x64
+        text run at (64,64) width 320: "xxxxx"
+    RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-expected.checksum
new file mode 100644 (file)
index 0000000..08a3c88
--- /dev/null
@@ -0,0 +1 @@
+71dc9ef9e95c0a56b9ecb328021224bd
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-expected.png
new file mode 100644 (file)
index 0000000..6e71b78
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-expected.txt
new file mode 100644 (file)
index 0000000..0e28d40
--- /dev/null
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x208
+  RenderBlock {HTML} at (0,0) size 800x208
+    RenderBody {BODY} at (8,8) size 784x184
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 493x18
+          text run at (0,0) width 260: "You should see a green rectangle below. "
+          text run at (260,0) width 233: "If you see any red, the test has failed."
+      RenderBlock {P} at (0,164) size 784x20 [border: (1px solid #000000)]
+        RenderText {#text} at (1,1) size 185x18
+          text run at (1,1) width 185: "This line should look normal."
+layer at (8,26) size 384x130
+  RenderBlock {DIV} at (0,18) size 384x130 [bgcolor=#FF0000]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (0,1) size 320x64
+        text run at (0,1) width 320: "xxxxx"
+    RenderInline {SPAN} at (0,0) size 64x128 [bgcolor=#008000]
+    RenderBR {BR} at (384,1) size 0x64
+    RenderBlock {DIV} at (0,2) size 64x128 [bgcolor=#008000]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (64,66) size 320x64
+        text run at (64,66) width 320: "xxxxx"
+    RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.checksum
new file mode 100644 (file)
index 0000000..1423c75
--- /dev/null
@@ -0,0 +1 @@
+c0ccf8b3dec1a570130560c9183ee5de
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.png
new file mode 100644 (file)
index 0000000..de6f4b7
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-glyphs-replaced-expected.txt
new file mode 100644 (file)
index 0000000..78cd6e6
--- /dev/null
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x272
+  RenderBlock {HTML} at (0,0) size 800x272
+    RenderBody {BODY} at (8,8) size 784x248
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 640x18
+          text run at (0,0) width 260: "You should see a green rectangle below. "
+          text run at (260,0) width 380: "If you see any red other than anti-aliasing, the test has failed."
+      RenderBlock {P} at (0,228) size 784x20 [border: (1px solid #000000)]
+        RenderText {#text} at (1,1) size 185x18
+          text run at (1,1) width 185: "This line should look normal."
+layer at (8,26) size 384x194
+  RenderBlock {DIV} at (0,18) size 384x194 [bgcolor=#FF0000]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (0,1) size 320x64
+        text run at (0,1) width 320: "xxxxx"
+    RenderInline {SPAN} at (0,0) size 64x128 [bgcolor=#008000]
+    RenderBR {BR} at (384,1) size 0x64
+    RenderInline {SPAN} at (0,0) size 320x128 [color=#008000]
+      RenderText {#text} at (0,66) size 320x128
+        text run at (0,66) width 320: "xxxxx"
+    RenderBlock {DIV} at (320,66) size 64x128 [bgcolor=#008000]
+    RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-replaced-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-replaced-expected.checksum
new file mode 100644 (file)
index 0000000..a41e473
--- /dev/null
@@ -0,0 +1 @@
+d1ad1a5fb80c7ea1d129fc6e9e619e39
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-replaced-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-replaced-expected.png
new file mode 100644 (file)
index 0000000..ac0eb79
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-replaced-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/block-replaced-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/block-replaced-expected.txt
new file mode 100644 (file)
index 0000000..7f88df5
--- /dev/null
@@ -0,0 +1,16 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x226
+  RenderBlock {HTML} at (0,0) size 800x226
+    RenderBody {BODY} at (8,8) size 784x210
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 493x18
+          text run at (0,0) width 260: "You should see a green rectangle below. "
+          text run at (260,0) width 233: "If you see any red, the test has failed."
+      RenderBlock {DIV} at (0,18) size 320x192 [bgcolor=#FF0000]
+        RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+          RenderText {#text} at (0,0) size 320x64
+            text run at (0,0) width 320: "xxxxx"
+        RenderBR {BR} at (320,0) size 0x64
+        RenderBlock {DIV} at (0,64) size 320x128 [bgcolor=#008000]
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/font-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/font-expected.checksum
new file mode 100644 (file)
index 0000000..829147c
--- /dev/null
@@ -0,0 +1 @@
+527edde18b2cd00c1206f15bbb0bd230
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/font-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/font-expected.png
new file mode 100644 (file)
index 0000000..620965f
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/font-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/font-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/font-expected.txt
new file mode 100644 (file)
index 0000000..3fdf281
--- /dev/null
@@ -0,0 +1,21 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x162
+  RenderBlock {HTML} at (0,0) size 800x162
+    RenderBody {BODY} at (8,8) size 784x146
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 493x18
+          text run at (0,0) width 260: "You should see a green rectangle below. "
+          text run at (260,0) width 233: "If you see any red, the test has failed."
+layer at (8,26) size 384x128
+  RenderBlock {DIV} at (0,18) size 384x128 [bgcolor=#FF0000]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (0,0) size 320x64
+        text run at (0,0) width 320: "xxxxx"
+    RenderInline {SPAN} at (0,0) size 64x128 [bgcolor=#008000]
+    RenderBR {BR} at (384,0) size 0x64
+    RenderBlock {DIV} at (0,0) size 64x128 [bgcolor=#008000]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (64,64) size 320x64
+        text run at (64,64) width 320: "xxxxx"
+    RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/font-replaced-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/font-replaced-expected.checksum
new file mode 100644 (file)
index 0000000..1245273
--- /dev/null
@@ -0,0 +1 @@
+67a58d271d8969bfde9186cede48b51a
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/font-replaced-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/font-replaced-expected.png
new file mode 100644 (file)
index 0000000..5753573
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/font-replaced-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/font-replaced-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/font-replaced-expected.txt
new file mode 100644 (file)
index 0000000..73f75de
--- /dev/null
@@ -0,0 +1,21 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x206
+  RenderBlock {HTML} at (0,0) size 800x206
+    RenderBody {BODY} at (8,8) size 784x182
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 493x18
+          text run at (0,0) width 260: "You should see a green rectangle below. "
+          text run at (260,0) width 233: "If you see any red, the test has failed."
+      RenderBlock {P} at (0,162) size 784x20 [border: (1px solid #000000)]
+        RenderText {#text} at (1,1) size 185x18
+          text run at (1,1) width 185: "This line should look normal."
+layer at (8,26) size 384x128 scrollHeight 141
+  RenderBlock {DIV} at (0,18) size 384x128 [bgcolor=#FF0000]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (0,0) size 320x64
+        text run at (0,0) width 320: "xxxxx"
+    RenderInline {SPAN} at (0,0) size 64x128 [bgcolor=#008000]
+    RenderBR {BR} at (384,0) size 0x64
+    RenderBlock {DIV} at (0,64) size 384x64 [bgcolor=#008000]
+    RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/glyphs-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/glyphs-expected.checksum
new file mode 100644 (file)
index 0000000..26f1d48
--- /dev/null
@@ -0,0 +1 @@
+52e80a5af0afb7ed81b61d739fcf116b
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/glyphs-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/glyphs-expected.png
new file mode 100644 (file)
index 0000000..384dce6
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/glyphs-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/glyphs-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/glyphs-expected.txt
new file mode 100644 (file)
index 0000000..caf48cd
--- /dev/null
@@ -0,0 +1,36 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x275
+  RenderBlock {HTML} at (0,0) size 800x275
+    RenderBody {BODY} at (8,8) size 784x251
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 493x18
+          text run at (0,0) width 260: "You should see a green rectangle below. "
+          text run at (260,0) width 233: "If you see any red, the test has failed."
+      RenderBlock {P} at (0,164) size 784x17 [border: (1px solid #000000)]
+        RenderText {#text} at (1,-2) size 275x18
+          text run at (1,-2) width 275: "this block should hug the lowercase glyphs."
+      RenderBlock {P} at (0,197) size 784x54
+        RenderBlock (floating) at (0,0) size 22x25
+          RenderText {#text} at (0,-8) size 22x41
+            text run at (0,-8) width 22: "T"
+        RenderText {#text} at (24,0) size 409x18
+          text run at (24,0) width 409: "he first letter here should look nicer because it uses glyph bounds"
+        RenderBR {BR} at (433,0) size 0x18
+        RenderText {#text} at (24,18) size 515x18
+          text run at (24,18) width 515: "This should make the top of the T line up with the line and not look shifted down."
+        RenderBR {BR} at (539,18) size 0x18
+        RenderText {#text} at (0,36) size 450x18
+          text run at (0,36) width 450: "Maybe we should do this by default for all first letters like Firefox does."
+layer at (8,26) size 384x130
+  RenderBlock {DIV} at (0,18) size 384x130 [bgcolor=#FF0000]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (0,1) size 320x64
+        text run at (0,1) width 320: "xxxxx"
+    RenderInline {SPAN} at (0,0) size 64x128 [bgcolor=#008000]
+    RenderBR {BR} at (384,1) size 0x64
+    RenderBlock {DIV} at (0,2) size 64x128 [bgcolor=#008000]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (64,66) size 320x64
+        text run at (64,66) width 320: "xxxxx"
+    RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-expected.checksum
new file mode 100644 (file)
index 0000000..06cef1d
--- /dev/null
@@ -0,0 +1 @@
+9a80729d03d3e07a9f17d910d94016db
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-expected.png
new file mode 100644 (file)
index 0000000..cf24c60
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-expected.txt
new file mode 100644 (file)
index 0000000..fa4f63a
--- /dev/null
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x226
+  RenderBlock {HTML} at (0,0) size 800x226
+    RenderBody {BODY} at (8,8) size 784x210
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 493x18
+          text run at (0,0) width 260: "You should see a green rectangle below. "
+          text run at (260,0) width 233: "If you see any red, the test has failed."
+      RenderBlock {DIV} at (0,18) size 384x192 [bgcolor=#FF0000]
+        RenderInline {SPAN} at (0,0) size 384x96 [bgcolor=#008000]
+        RenderBR {BR} at (384,32) size 0x64
+        RenderBlock {DIV} at (0,64) size 384x128 [bgcolor=#008000]
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.checksum
new file mode 100644 (file)
index 0000000..06cef1d
--- /dev/null
@@ -0,0 +1 @@
+9a80729d03d3e07a9f17d910d94016db
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.png
new file mode 100644 (file)
index 0000000..cf24c60
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-replaced-expected.txt
new file mode 100644 (file)
index 0000000..b726c64
--- /dev/null
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x226
+  RenderBlock {HTML} at (0,0) size 800x226
+    RenderBody {BODY} at (8,8) size 784x210
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 493x18
+          text run at (0,0) width 260: "You should see a green rectangle below. "
+          text run at (260,0) width 233: "If you see any red, the test has failed."
+      RenderBlock {DIV} at (0,18) size 384x192 [bgcolor=#FF0000]
+        RenderInline {SPAN} at (0,0) size 384x128 [bgcolor=#008000]
+        RenderBR {BR} at (384,0) size 0x64
+        RenderBlock {DIV} at (0,128) size 384x64 [bgcolor=#008000]
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.checksum
new file mode 100644 (file)
index 0000000..eeba5e6
--- /dev/null
@@ -0,0 +1 @@
+3fa52eac71f964f9c4d0a11022369b5c
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.png
new file mode 100644 (file)
index 0000000..a0a252e
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-box-vertical-expected.txt
new file mode 100644 (file)
index 0000000..c461f07
--- /dev/null
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 226x600
+  RenderBlock {HTML} at (0,0) size 226x600
+    RenderBody {BODY} at (8,8) size 210x584
+      RenderBlock (anonymous) at (0,0) size 18x584
+        RenderText {#text} at (0,0) size 18x493
+          text run at (0,0) width 260: "You should see a green rectangle below. "
+          text run at (0,260) width 233: "If you see any red, the test has failed."
+      RenderBlock {DIV} at (18,0) size 192x384 [bgcolor=#FF0000]
+        RenderInline {SPAN} at (0,0) size 96x384 [bgcolor=#008000]
+        RenderBR {BR} at (0,384) size 64x0
+        RenderBlock {DIV} at (64,0) size 128x384 [bgcolor=#008000]
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-expected.checksum
new file mode 100644 (file)
index 0000000..0e0a5f0
--- /dev/null
@@ -0,0 +1 @@
+67ad8ad4157e86d784f519ad1995f224
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-expected.png
new file mode 100644 (file)
index 0000000..cb9059e
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-expected.txt
new file mode 100644 (file)
index 0000000..bb5bed4
--- /dev/null
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x226
+  RenderBlock {HTML} at (0,0) size 800x226
+    RenderBody {BODY} at (8,8) size 784x210
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 493x18
+          text run at (0,0) width 260: "You should see a green rectangle below. "
+          text run at (260,0) width 233: "If you see any red, the test has failed."
+      RenderBlock {DIV} at (0,18) size 384x192 [bgcolor=#FF0000]
+        RenderInline {SPAN} at (0,0) size 384x128 [bgcolor=#008000]
+        RenderBR {BR} at (384,51) size 0x64
+        RenderBlock {DIV} at (0,64) size 64x128 [bgcolor=#008000]
+        RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+          RenderText {#text} at (64,128) size 320x64
+            text run at (64,128) width 320: "xxxxx"
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-replaced-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-replaced-expected.checksum
new file mode 100644 (file)
index 0000000..035d65b
--- /dev/null
@@ -0,0 +1 @@
+d05711177844dc16d5cf122739f069a4
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-replaced-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-replaced-expected.png
new file mode 100644 (file)
index 0000000..b40ac3c
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-replaced-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-replaced-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/inline-replaced-expected.txt
new file mode 100644 (file)
index 0000000..006e3ac
--- /dev/null
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x290
+  RenderBlock {HTML} at (0,0) size 800x290
+    RenderBody {BODY} at (8,8) size 784x274
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 493x18
+          text run at (0,0) width 260: "You should see a green rectangle below. "
+          text run at (260,0) width 233: "If you see any red, the test has failed."
+      RenderBlock {DIV} at (0,18) size 384x256 [bgcolor=#FF0000]
+        RenderInline {SPAN} at (0,0) size 384x128 [bgcolor=#008000]
+        RenderBR {BR} at (384,51) size 0x64
+        RenderBlock {DIV} at (0,128) size 384x128 [bgcolor=#008000]
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/none-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/none-expected.checksum
new file mode 100644 (file)
index 0000000..5fe168b
--- /dev/null
@@ -0,0 +1 @@
+415950034dd82a847e4913b665a31be4
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/none-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/none-expected.png
new file mode 100644 (file)
index 0000000..28ff431
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/none-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/none-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/none-expected.txt
new file mode 100644 (file)
index 0000000..5497896
--- /dev/null
@@ -0,0 +1,30 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x98
+  RenderBlock {HTML} at (0,0) size 800x98
+    RenderBody {BODY} at (8,8) size 784x82
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 459x18
+          text run at (0,0) width 226: "You should see a green line below. "
+          text run at (226,0) width 233: "If you see any red, the test has failed."
+      RenderBlock {DIV} at (0,82) size 784x0 [bgcolor=#FF0000]
+        RenderInline {SPAN} at (0,0) size 320x64 [color=#FF0000]
+          RenderText {#text} at (0,-51) size 320x64
+            text run at (0,-51) width 320: "xxxxx"
+        RenderBR {BR} at (320,-51) size 0x64
+        RenderInline {SPAN} at (0,0) size 320x64 [color=#FF0000]
+          RenderText {#text} at (0,-51) size 320x64
+            text run at (0,-51) width 320: "xxxxx"
+        RenderBR {BR} at (320,-51) size 0x64
+        RenderInline {SPAN} at (0,0) size 320x64 [color=#FF0000]
+          RenderText {#text} at (0,-51) size 320x64
+            text run at (0,-51) width 320: "xxxxx"
+        RenderBR {BR} at (320,-51) size 0x64
+        RenderInline {SPAN} at (0,0) size 320x64 [color=#FF0000]
+          RenderText {#text} at (0,-51) size 320x64
+            text run at (0,-51) width 320: "xxxxx"
+        RenderBR {BR} at (320,-51) size 0x64
+        RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+          RenderText {#text} at (0,-51) size 320x64
+            text run at (0,-51) width 320: "xxxxx"
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/parsing-invalid-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/parsing-invalid-expected.checksum
new file mode 100644 (file)
index 0000000..1b70ccb
--- /dev/null
@@ -0,0 +1 @@
+82800f0c13beb8af5b3290d718b30362
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/parsing-invalid-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/parsing-invalid-expected.png
new file mode 100644 (file)
index 0000000..b24ef11
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/parsing-invalid-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/parsing-invalid-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/parsing-invalid-expected.txt
new file mode 100644 (file)
index 0000000..116d591
--- /dev/null
@@ -0,0 +1,73 @@
+layer at (0,0) size 785x1498
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x1498
+  RenderBlock {HTML} at (0,0) size 785x1498
+    RenderBody {BODY} at (8,8) size 769x1458
+      RenderBlock (anonymous) at (0,0) size 769x18
+        RenderText {#text} at (0,0) size 259x18
+          text run at (0,0) width 259: "All of these blocks should look the same."
+layer at (8,58) size 320x256
+  RenderBlock {DIV} at (0,50) size 320x256 [bgcolor=#00FF00]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (0,32) size 320x64
+        text run at (0,32) width 320: "xxxxx"
+    RenderBR {BR} at (320,32) size 0x64
+    RenderBlock {DIV} at (0,160) size 256x64 [color=#008000]
+      RenderText {#text} at (0,0) size 256x64
+        text run at (0,0) width 256: "xxxx"
+    RenderInline {SPAN} at (0,0) size 64x64 [color=#008000]
+      RenderText {#text} at (256,160) size 64x64
+        text run at (256,160) width 64: "x"
+    RenderText {#text} at (0,0) size 0x0
+layer at (8,346) size 320x256
+  RenderBlock {DIV} at (0,338) size 320x256 [bgcolor=#00FF00]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (0,32) size 320x64
+        text run at (0,32) width 320: "xxxxx"
+    RenderBR {BR} at (320,32) size 0x64
+    RenderBlock {DIV} at (0,160) size 256x64 [color=#008000]
+      RenderText {#text} at (0,0) size 256x64
+        text run at (0,0) width 256: "xxxx"
+    RenderInline {SPAN} at (0,0) size 64x64 [color=#008000]
+      RenderText {#text} at (256,160) size 64x64
+        text run at (256,160) width 64: "x"
+    RenderText {#text} at (0,0) size 0x0
+layer at (8,634) size 320x256
+  RenderBlock {DIV} at (0,626) size 320x256 [bgcolor=#00FF00]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (0,32) size 320x64
+        text run at (0,32) width 320: "xxxxx"
+    RenderBR {BR} at (320,32) size 0x64
+    RenderBlock {DIV} at (0,160) size 256x64 [color=#008000]
+      RenderText {#text} at (0,0) size 256x64
+        text run at (0,0) width 256: "xxxx"
+    RenderInline {SPAN} at (0,0) size 64x64 [color=#008000]
+      RenderText {#text} at (256,160) size 64x64
+        text run at (256,160) width 64: "x"
+    RenderText {#text} at (0,0) size 0x0
+layer at (8,922) size 320x256
+  RenderBlock {DIV} at (0,914) size 320x256 [bgcolor=#00FF00]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (0,32) size 320x64
+        text run at (0,32) width 320: "xxxxx"
+    RenderBR {BR} at (320,32) size 0x64
+    RenderBlock {DIV} at (0,160) size 256x64 [color=#008000]
+      RenderText {#text} at (0,0) size 256x64
+        text run at (0,0) width 256: "xxxx"
+    RenderInline {SPAN} at (0,0) size 64x64 [color=#008000]
+      RenderText {#text} at (256,160) size 64x64
+        text run at (256,160) width 64: "x"
+    RenderText {#text} at (0,0) size 0x0
+layer at (8,1210) size 320x256
+  RenderBlock {DIV} at (0,1202) size 320x256 [bgcolor=#00FF00]
+    RenderInline {SPAN} at (0,0) size 320x64 [color=#008000]
+      RenderText {#text} at (0,32) size 320x64
+        text run at (0,32) width 320: "xxxxx"
+    RenderBR {BR} at (320,32) size 0x64
+    RenderBlock {DIV} at (0,160) size 256x64 [color=#008000]
+      RenderText {#text} at (0,0) size 256x64
+        text run at (0,0) width 256: "xxxx"
+    RenderInline {SPAN} at (0,0) size 64x64 [color=#008000]
+      RenderText {#text} at (256,160) size 64x64
+        text run at (256,160) width 64: "x"
+    RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/replaced-expected.checksum b/LayoutTests/platform/mac/fast/block/lineboxcontain/replaced-expected.checksum
new file mode 100644 (file)
index 0000000..9585dcf
--- /dev/null
@@ -0,0 +1 @@
+b6e4694a895a80a2ddabed681517d7cd
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/replaced-expected.png b/LayoutTests/platform/mac/fast/block/lineboxcontain/replaced-expected.png
new file mode 100644 (file)
index 0000000..a518fec
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/lineboxcontain/replaced-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/lineboxcontain/replaced-expected.txt b/LayoutTests/platform/mac/fast/block/lineboxcontain/replaced-expected.txt
new file mode 100644 (file)
index 0000000..ada38ee
--- /dev/null
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x162
+  RenderBlock {HTML} at (0,0) size 800x162
+    RenderBody {BODY} at (8,8) size 784x146
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 493x18
+          text run at (0,0) width 260: "You should see a green rectangle below. "
+          text run at (260,0) width 233: "If you see any red, the test has failed."
+      RenderBlock {DIV} at (0,18) size 320x128 [bgcolor=#FF0000]
+        RenderBlock {DIV} at (0,0) size 320x128 [bgcolor=#008000]
+        RenderText {#text} at (0,0) size 0x0
index 9db5a10..83b3284 100644 (file)
@@ -1,3 +1,97 @@
+2011-03-22  David Hyatt  <hyatt@apple.com>
+
+        Reviewed by Simon Fraser.
+
+        Implement the CSS3 line-box-contain property. This property provides authors with more control over spacing between lines. For example,
+        you can fix the height of lines and cause all line contents to be ignored. You can make lines fit to glyphs. You can ignore leading and
+        fit to the font size. You can ignore replaced elements, etc.
+
+        Refactor the code in computeLogicalBoxHeights into helper methods on RootInlineBox. verticalPositionForBox moved over to RootInlineBox
+        so that it could be called from RenderBlockLineLayout. ascentAndDescentForBox is the new method that computes the appropriate box
+        height based off the block's line-box-contain value.
+        
+        GlyphOverflow can now have a computeBounds parameter set, in which case glyph bounds will be computed and stored in the overflow struct.
+        
+        RenderInline no longer returns 0 margins in the block direction, since line-box-contain can size around the margin box.
+        
+        Added new tests in fast/block/lineboxcontain
+
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::createLineBoxContainValue):
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        * css/CSSLineBoxContainValue.cpp: Added.
+        (WebCore::CSSLineBoxContainValue::CSSLineBoxContainValue):
+        (WebCore::CSSLineBoxContainValue::cssText):
+        * css/CSSLineBoxContainValue.h: Added.
+        (WebCore::CSSLineBoxContainValue::create):
+        (WebCore::CSSLineBoxContainValue::value):
+        (WebCore::CSSLineBoxContainValue::isCSSLineBoxContainValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        (WebCore::CSSParser::parseLineBoxContain):
+        * css/CSSParser.h:
+        * css/CSSPropertyNames.in:
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        * css/CSSValue.h:
+        (WebCore::CSSValue::isCSSLineBoxContainValue):
+        * css/CSSValueKeywords.in:
+        * platform/graphics/Font.cpp:
+        (WebCore::Font::width):
+        * platform/graphics/Font.h:
+        (WebCore::GlyphOverflow::GlyphOverflow):
+        * platform/graphics/FontFastPath.cpp:
+        (WebCore::Font::floatWidthForSimpleText):
+        * platform/graphics/mac/FontComplexTextMac.cpp:
+        (WebCore::Font::floatWidthForComplexText):
+        * platform/graphics/win/FontWin.cpp:
+        (WebCore::Font::floatWidthForComplexText):
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::computeLogicalBoxHeights):
+        * rendering/InlineFlowBox.h:
+        * rendering/RenderBlock.h:
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::computeInlineDirectionPositionsForLine):
+        (WebCore::RenderBlock::layoutInlineChildren):
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::marginLeft):
+        (WebCore::RenderInline::marginRight):
+        (WebCore::RenderInline::marginTop):
+        (WebCore::RenderInline::marginBottom):
+        (WebCore::RenderInline::marginBefore):
+        (WebCore::RenderInline::marginAfter):
+        * rendering/RenderInline.h:
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::widthFromCache):
+        (WebCore::RenderText::width):
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::alignBoxesInBlockDirection):
+        (WebCore::setAscentAndDescent):
+        (WebCore::RootInlineBox::ascentAndDescentForBox):
+        (WebCore::RootInlineBox::verticalPositionForBox):
+        (WebCore::RootInlineBox::includeLeadingForBox):
+        (WebCore::RootInlineBox::includeFontForBox):
+        (WebCore::RootInlineBox::includeGlyphsForBox):
+        (WebCore::RootInlineBox::includeMarginForBox):
+        (WebCore::RootInlineBox::fitsToGlyphs):
+        (WebCore::RootInlineBox::includesRootLineBoxFontOrLeading):
+        * rendering/RootInlineBox.h:
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::diff):
+        * rendering/style/RenderStyle.h:
+        (WebCore::InheritedFlags::lineBoxContain):
+        (WebCore::InheritedFlags::setLineBoxContain):
+        (WebCore::InheritedFlags::initialLineBoxContain):
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+        (WebCore::StyleRareInheritedData::operator==):
+        * rendering/style/StyleRareInheritedData.h:
+
 2011-03-22  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r81653.
index a8feadb..033ef38 100644 (file)
@@ -1010,6 +1010,8 @@ webcore_sources += \
        Source/WebCore/css/CSSInheritedValue.h \
        Source/WebCore/css/CSSInitialValue.cpp \
        Source/WebCore/css/CSSInitialValue.h \
+        Source/WebCore/css/CSSLineBoxContainValue.cpp \
+       Source/WebCore/css/CSSLineBoxContainValue.h \
        Source/WebCore/css/CSSMediaRule.cpp \
        Source/WebCore/css/CSSMediaRule.h \
        Source/WebCore/css/CSSMutableStyleDeclaration.cpp \
index 3e031b8..c1237e9 100644 (file)
             'css/CSSInheritedValue.h',
             'css/CSSInitialValue.cpp',
             'css/CSSInitialValue.h',
+            'css/CSSLineBoxContainValue.cpp',
+            'css/CSSLineBoxContainValue.h',
             'css/CSSMediaRule.cpp',
             'css/CSSMediaRule.h',
             'css/CSSMutableStyleDeclaration.cpp',
index 54c0099..27f016b 100644 (file)
@@ -394,6 +394,7 @@ SOURCES += \
     css/CSSImportRule.cpp \
     css/CSSInheritedValue.cpp \
     css/CSSInitialValue.cpp \
+    css/CSSLineBoxContainValue.cpp \
     css/CSSMediaRule.cpp \
     css/CSSMutableStyleDeclaration.cpp \
     css/CSSOMUtils.cpp \
index 92ce88d..b0f6655 100755 (executable)
                                RelativePath="..\css\CSSInitialValue.h"
                                >
                        </File>
+                        <File
+                               RelativePath="..\css\CSSLineBoxContainValue.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\css\CSSLineBoxContainValue.h"
+                               >
+                       </File>
                        <File
                                RelativePath="..\css\CSSMediaRule.cpp"
                                >
index c3b1c33..5c44e50 100644 (file)
                BC772C4E0C4EB3040083285F /* MIMETypeRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC772C4C0C4EB3040083285F /* MIMETypeRegistry.cpp */; };
                BC772C4F0C4EB3040083285F /* MIMETypeRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = BC772C4D0C4EB3040083285F /* MIMETypeRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC772C5E0C4EB3440083285F /* MIMETypeRegistryMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC772C5D0C4EB3440083285F /* MIMETypeRegistryMac.mm */; };
+               BC772E131331620C001EC9CE /* CSSLineBoxContainValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC772E121331620C001EC9CE /* CSSLineBoxContainValue.h */; };
+               BC772E16133162C2001EC9CE /* CSSLineBoxContainValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC772E15133162C2001EC9CE /* CSSLineBoxContainValue.cpp */; };
                BC77CB870FEBF5AF0070887B /* HTMLDataGridColElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC77CB860FEBF5AF0070887B /* HTMLDataGridColElement.h */; };
                BC77CBAA0FEBF6C90070887B /* HTMLDataGridColElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC77CBA90FEBF6C90070887B /* HTMLDataGridColElement.cpp */; };
                BC77CBD30FEBF8310070887B /* JSHTMLDataGridColElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC77CBD10FEBF8310070887B /* JSHTMLDataGridColElement.cpp */; };
                BC772C4C0C4EB3040083285F /* MIMETypeRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MIMETypeRegistry.cpp; sourceTree = "<group>"; };
                BC772C4D0C4EB3040083285F /* MIMETypeRegistry.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MIMETypeRegistry.h; sourceTree = "<group>"; };
                BC772C5D0C4EB3440083285F /* MIMETypeRegistryMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = MIMETypeRegistryMac.mm; sourceTree = "<group>"; };
+               BC772E121331620C001EC9CE /* CSSLineBoxContainValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSLineBoxContainValue.h; sourceTree = "<group>"; };
+               BC772E15133162C2001EC9CE /* CSSLineBoxContainValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSLineBoxContainValue.cpp; sourceTree = "<group>"; };
                BC77CB860FEBF5AF0070887B /* HTMLDataGridColElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLDataGridColElement.h; sourceTree = "<group>"; };
                BC77CB880FEBF5BA0070887B /* HTMLDataGridColElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLDataGridColElement.idl; sourceTree = "<group>"; };
                BC77CBA90FEBF6C90070887B /* HTMLDataGridColElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDataGridColElement.cpp; sourceTree = "<group>"; };
                                A80E6CD70A1989CA007FB8C5 /* CSSInheritedValue.h */,
                                A80E6CD80A1989CA007FB8C5 /* CSSInitialValue.cpp */,
                                A80E6CDE0A1989CA007FB8C5 /* CSSInitialValue.h */,
+                               BC772E121331620C001EC9CE /* CSSLineBoxContainValue.h */,
+                               BC772E15133162C2001EC9CE /* CSSLineBoxContainValue.cpp */,
                                A80E6CD20A1989CA007FB8C5 /* CSSMediaRule.cpp */,
                                A80E6CD90A1989CA007FB8C5 /* CSSMediaRule.h */,
                                85C56CA20AA89C1000D95755 /* CSSMediaRule.idl */,
                                3194620413022BF1004BB3F8 /* DOMWebKitAnimationList.h in Headers */,
                                319E69B313299BBD004AC91A /* WebKitAnimation.h in Headers */,
                                319E69B613299BBD004AC91A /* WebKitAnimationList.h in Headers */,
+                               BC772E131331620C001EC9CE /* CSSLineBoxContainValue.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                319E68871327C911004AC91A /* JSWebKitAnimationCustom.cpp in Sources */,
                                319E69B213299BBD004AC91A /* WebKitAnimation.cpp in Sources */,
                                319E69B513299BBD004AC91A /* WebKitAnimationList.cpp in Sources */,
+                               BC772E16133162C2001EC9CE /* CSSLineBoxContainValue.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 4132075..8956194 100644 (file)
@@ -29,6 +29,7 @@
 #include "CounterContent.h"
 #include "CursorList.h"
 #include "CSSBorderImageValue.h"
+#include "CSSLineBoxContainValue.h"
 #include "CSSMutableStyleDeclaration.h"
 #include "CSSPrimitiveValue.h"
 #include "CSSPrimitiveValueCache.h"
@@ -200,6 +201,7 @@ static const int computedProperties[] = {
     CSSPropertyWebkitHyphenateLimitAfter,
     CSSPropertyWebkitHyphenateLimitBefore,
     CSSPropertyWebkitHyphens,
+    CSSPropertyWebkitLineBoxContain,
     CSSPropertyWebkitLineBreak,
     CSSPropertyWebkitLineClamp,
     CSSPropertyWebkitLocale,
@@ -567,6 +569,13 @@ static PassRefPtr<CSSValue> getTimingFunctionValue(const AnimationList* animList
     return list.release();
 }
 
+static PassRefPtr<CSSValue> createLineBoxContainValue(CSSPrimitiveValueCache* primitiveValueCache, unsigned lineBoxContain)
+{
+    if (!lineBoxContain)
+        return primitiveValueCache->createIdentifierValue(CSSValueNone);
+    return CSSLineBoxContainValue::create(lineBoxContain);
+}
+
 CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n, bool allowVisitedStyle, const String& pseudoElementName)
     : m_node(n)
     , m_allowVisitedStyle(allowVisitedStyle)
@@ -1636,7 +1645,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
             return primitiveValueCache->createValue(style->textCombine());
         case CSSPropertyWebkitTextOrientation:
             return CSSPrimitiveValue::create(style->fontDescription().textOrientation());
-
+        case CSSPropertyWebkitLineBoxContain:
+            return createLineBoxContainValue(primitiveValueCache, style->lineBoxContain());
         case CSSPropertyContent:
             return contentToCSSValue(style.get(), primitiveValueCache);
         case CSSPropertyCounterIncrement:
diff --git a/Source/WebCore/css/CSSLineBoxContainValue.cpp b/Source/WebCore/css/CSSLineBoxContainValue.cpp
new file mode 100644 (file)
index 0000000..b029285
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CSSLineBoxContainValue.h"
+
+#include "CSSPrimitiveValue.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+CSSLineBoxContainValue::CSSLineBoxContainValue(unsigned value)
+    : m_value(value)
+{
+}
+
+String CSSLineBoxContainValue::cssText() const
+{
+    String text("");
+
+    if (m_value & LineBoxContainBlock)
+        text += "block";
+    if (m_value & LineBoxContainInline) {
+        if (!text.isEmpty())
+            text += " ";
+        text += "inline";
+    }
+    if (m_value & LineBoxContainFont) {
+        if (!text.isEmpty())
+            text += " ";
+        text += "font";
+    }
+    if (m_value & LineBoxContainGlyphs) {
+        if (!text.isEmpty())
+            text += " ";
+        text += "glyphs";
+    }
+    if (m_value & LineBoxContainReplaced) {
+        if (!text.isEmpty())
+            text += " ";
+        text += "replaced";
+    }
+    if (m_value & LineBoxContainInlineBox) {
+        if (!text.isEmpty())
+            text += " ";
+        text += "inline-box";
+    }
+
+    return text;
+}
+
+}
diff --git a/Source/WebCore/css/CSSLineBoxContainValue.h b/Source/WebCore/css/CSSLineBoxContainValue.h
new file mode 100644 (file)
index 0000000..8d62b11
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSLineBoxContainValue_h
+#define CSSLineBoxContainValue_h
+
+#include "CSSValue.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSPrimitiveValue;
+
+enum LineBoxContainFlags { LineBoxContainNone = 0x0, LineBoxContainBlock = 0x1, LineBoxContainInline = 0x2, LineBoxContainFont = 0x4, LineBoxContainGlyphs = 0x8,
+                           LineBoxContainReplaced = 0x10, LineBoxContainInlineBox = 0x20 };
+typedef unsigned LineBoxContain;
+
+// Used for text-CSSLineBoxContain and box-CSSLineBoxContain
+class CSSLineBoxContainValue : public CSSValue {
+public:
+    static PassRefPtr<CSSLineBoxContainValue> create(LineBoxContain value)
+    {
+        return adoptRef(new CSSLineBoxContainValue(value));
+    }
+
+    virtual String cssText() const;
+
+    LineBoxContain value() const { return m_value; }
+
+private:
+    LineBoxContain m_value;
+
+private:
+    CSSLineBoxContainValue(LineBoxContain);
+    virtual bool isCSSLineBoxContainValue() const { return true; }
+};
+
+} // namespace
+
+#endif
index 537fcac..3163748 100644 (file)
@@ -36,6 +36,7 @@
 #include "CSSImportRule.h"
 #include "CSSInheritedValue.h"
 #include "CSSInitialValue.h"
+#include "CSSLineBoxContainValue.h"
 #include "CSSMediaRule.h"
 #include "CSSMutableStyleDeclaration.h"
 #include "CSSPageRule.h"
@@ -1838,6 +1839,13 @@ bool CSSParser::parseValue(int propId, bool important)
             validPrimitive = true;
         break;
 
+    case CSSPropertyWebkitLineBoxContain:
+        if (id == CSSValueNone)
+            validPrimitive = true;
+        else
+            return parseLineBoxContain(important);
+        break;
+
 #if ENABLE(SVG)
     default:
         return parseSVGValue(propId, important);
@@ -5612,6 +5620,46 @@ bool CSSParser::parseTextEmphasisStyle(bool important)
     return false;
 }
 
+bool CSSParser::parseLineBoxContain(bool important)
+{
+    LineBoxContain lineBoxContain = LineBoxContainNone;
+
+    for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) {
+        if (value->id == CSSValueBlock) {
+            if (lineBoxContain & LineBoxContainBlock)
+                return false;
+            lineBoxContain |= LineBoxContainBlock;
+        } else if (value->id == CSSValueInline) {
+            if (lineBoxContain & LineBoxContainInline)
+                return false;
+            lineBoxContain |= LineBoxContainInline;
+        } else if (value->id == CSSValueFont) {
+            if (lineBoxContain & LineBoxContainFont)
+                return false;
+            lineBoxContain |= LineBoxContainFont;
+        } else if (value->id == CSSValueGlyphs) {
+            if (lineBoxContain & LineBoxContainGlyphs)
+                return false;
+            lineBoxContain |= LineBoxContainGlyphs;
+        } else if (value->id == CSSValueReplaced) {
+            if (lineBoxContain & LineBoxContainReplaced)
+                return false;
+            lineBoxContain |= LineBoxContainReplaced;
+        } else if (value->id == CSSValueInlineBox) {
+            if (lineBoxContain & LineBoxContainInlineBox)
+                return false;
+            lineBoxContain |= LineBoxContainInlineBox;
+        } else
+            return false;
+    }
+    
+    if (!lineBoxContain)
+        return false;
+
+    addProperty(CSSPropertyWebkitLineBoxContain, CSSLineBoxContainValue::create(lineBoxContain), important);
+    return true;
+}
+
 static inline int yyerror(const char*) { return 1; }
 
 #define END_TOKEN 0
index f0efee5..658ed3a 100644 (file)
@@ -178,6 +178,8 @@ namespace WebCore {
 
         bool parseTextEmphasisStyle(bool important);
 
+        bool parseLineBoxContain(bool important);
+
         int yyparse();
 
         CSSParserSelector* createFloatingSelector();
index 3fd843e..a62d2f3 100644 (file)
@@ -231,6 +231,7 @@ z-index
 -webkit-hyphenate-limit-after
 -webkit-hyphenate-limit-before
 -webkit-hyphens
+-webkit-line-box-contain
 -webkit-line-break
 -webkit-line-clamp
 -webkit-locale
index 046f4f8..bd289ba 100644 (file)
@@ -35,6 +35,7 @@
 #include "CSSCursorImageValue.h"
 #include "CSSFontFaceRule.h"
 #include "CSSImportRule.h"
+#include "CSSLineBoxContainValue.h"
 #include "CSSMediaRule.h"
 #include "CSSPageRule.h"
 #include "CSSParser.h"
@@ -6173,6 +6174,21 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
         return;
     }
 
+    case CSSPropertyWebkitLineBoxContain: {
+        HANDLE_INHERIT_AND_INITIAL(lineBoxContain, LineBoxContain)
+        if (primitiveValue && primitiveValue->getIdent() == CSSValueNone) {
+            m_style->setLineBoxContain(LineBoxContainNone);
+            return;
+        }
+        
+        if (!value->isCSSLineBoxContainValue())
+            return;
+        
+        CSSLineBoxContainValue* lineBoxContainValue = static_cast<CSSLineBoxContainValue*>(value);
+        m_style->setLineBoxContain(lineBoxContainValue->value());
+        return;
+    }
+
     // FIXME: Move these properties to the appropriate places in this switch statement.
     case CSSPropertyColor:
     case CSSPropertyBackgroundColor:
index a101c66..de46ff9 100644 (file)
@@ -65,7 +65,8 @@ public:
     virtual bool isTimingFunctionValue() const { return false; }
     virtual bool isValueList() const { return false; }
     virtual bool isWebKitCSSTransformValue() const { return false; }
-
+    virtual bool isCSSLineBoxContainValue() const { return false; }
+    
 #if ENABLE(SVG)
     virtual bool isSVGColor() const { return false; }
     virtual bool isSVGPaint() const { return false; }
index 9e27304..ccd57b1 100644 (file)
@@ -794,3 +794,11 @@ farthest-corner
 # -webkit-text-orientation
 upright
 vertical-right
+
+# -webkit-line-box-contain
+font
+glyphs
+inline-box
+replaced
+
+
index ee85e45..72e3e3b 100644 (file)
@@ -177,7 +177,7 @@ float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo
         // If the complex text implementation cannot return fallback fonts, avoid
         // returning them for simple text as well.
         static bool returnFallbackFonts = canReturnFallbackFontsForComplexText();
-        return floatWidthForSimpleText(run, 0, returnFallbackFonts ? fallbackFonts : 0, codePathToUse == SimpleWithGlyphOverflow ? glyphOverflow : 0);
+        return floatWidthForSimpleText(run, 0, returnFallbackFonts ? fallbackFonts : 0, codePathToUse == SimpleWithGlyphOverflow || (glyphOverflow && glyphOverflow->computeBounds) ? glyphOverflow : 0);
     }
 
     return floatWidthForComplexText(run, fallbackFonts, glyphOverflow);
index 9d33f9d..554f8a0 100644 (file)
@@ -61,6 +61,7 @@ struct GlyphOverflow {
         , right(0)
         , top(0)
         , bottom(0)
+        , computeBounds(false)
     {
     }
 
@@ -68,8 +69,10 @@ struct GlyphOverflow {
     int right;
     int top;
     int bottom;
+    bool computeBounds;
 };
 
+
 class Font {
 public:
     Font();
index 7d0871b..622d08b 100644 (file)
@@ -453,8 +453,8 @@ float Font::floatWidthForSimpleText(const TextRun& run, GlyphBuffer* glyphBuffer
     it.advance(run.length(), glyphBuffer);
 
     if (glyphOverflow) {
-        glyphOverflow->top = max<int>(glyphOverflow->top, ceilf(-it.minGlyphBoundingBoxY()) - fontMetrics().ascent());
-        glyphOverflow->bottom = max<int>(glyphOverflow->bottom, ceilf(it.maxGlyphBoundingBoxY()) - fontMetrics().descent());
+        glyphOverflow->top = max<int>(glyphOverflow->top, ceilf(-it.minGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().ascent()));
+        glyphOverflow->bottom = max<int>(glyphOverflow->bottom, ceilf(it.maxGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().descent()));
         glyphOverflow->left = ceilf(it.firstGlyphOverflow());
         glyphOverflow->right = ceilf(it.lastGlyphOverflow());
     }
index eed49a5..fe2a22c 100644 (file)
@@ -111,8 +111,8 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon
 {
     ComplexTextController controller(this, run, true, fallbackFonts);
     if (glyphOverflow) {
-        glyphOverflow->top = max<int>(glyphOverflow->top, ceilf(-controller.minGlyphBoundingBoxY()) - fontMetrics().ascent());
-        glyphOverflow->bottom = max<int>(glyphOverflow->bottom, ceilf(controller.maxGlyphBoundingBoxY()) - fontMetrics().descent());
+        glyphOverflow->top = max<int>(glyphOverflow->top, ceilf(-controller.minGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().ascent()));
+        glyphOverflow->bottom = max<int>(glyphOverflow->bottom, ceilf(controller.maxGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().descent()));
         glyphOverflow->left = max<int>(0, ceilf(-controller.minGlyphBoundingBoxX()));
         glyphOverflow->right = max<int>(0, ceilf(controller.maxGlyphBoundingBoxX() - controller.totalWidth()));
     }
index 47c44bc..9e31f56 100644 (file)
@@ -127,8 +127,8 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon
     UniscribeController controller(this, run, fallbackFonts);
     controller.advance(run.length());
     if (glyphOverflow) {
-        glyphOverflow->top = max<int>(glyphOverflow->top, ceilf(-controller.minGlyphBoundingBoxY()) - fontMetrics().ascent());
-        glyphOverflow->bottom = max<int>(glyphOverflow->bottom, ceilf(controller.maxGlyphBoundingBoxY()) - fontMetrics().descent());
+        glyphOverflow->top = max<int>(glyphOverflow->top, ceilf(-controller.minGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().ascent()));
+        glyphOverflow->bottom = max<int>(glyphOverflow->bottom, ceilf(controller.maxGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0  : fontMetrics().descent()));
         glyphOverflow->left = max<int>(0, ceilf(-controller.minGlyphBoundingBoxX()));
         glyphOverflow->right = max<int>(0, ceilf(controller.maxGlyphBoundingBoxX() - controller.runWidthSoFar()));
     }
index a5f6ba6..34052fc 100644 (file)
@@ -38,7 +38,6 @@
 #include "RenderTableCell.h"
 #include "RootInlineBox.h"
 #include "Text.h"
-#include "VerticalPositionCache.h"
 
 #include <math.h>
 
@@ -385,92 +384,34 @@ void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, i
     }
 }
 
-static int verticalPositionForBox(InlineBox* box, FontBaseline baselineType, bool firstLine, VerticalPositionCache& verticalPositionCache)
-{
-    if (box->renderer()->isText())
-        return box->parent()->logicalTop();
-    
-    RenderBoxModelObject* renderer = box->boxModelObject();
-    ASSERT(renderer->isInline());
-    if (!renderer->isInline())
-        return 0;
-
-    // This method determines the vertical position for inline elements.
-    if (firstLine && !renderer->document()->usesFirstLineRules())
-        firstLine = false;
-
-    // Check the cache.
-    bool isRenderInline = renderer->isRenderInline();
-    if (isRenderInline && !firstLine) {
-        int verticalPosition = verticalPositionCache.get(renderer, baselineType);
-        if (verticalPosition != PositionUndefined)
-            return verticalPosition;
-    }
-
-    int verticalPosition = 0;
-    EVerticalAlign verticalAlign = renderer->style()->verticalAlign();
-    if (verticalAlign == TOP || verticalAlign == BOTTOM)
-        return 0;
-   
-    RenderObject* parent = renderer->parent();
-    if (parent->isRenderInline() && parent->style()->verticalAlign() != TOP && parent->style()->verticalAlign() != BOTTOM)
-        verticalPosition = box->parent()->logicalTop();
-    
-    if (verticalAlign != BASELINE) {
-        const Font& font = parent->style(firstLine)->font();
-        const FontMetrics& fontMetrics = font.fontMetrics();
-        int fontSize = font.pixelSize();
-
-        LineDirectionMode lineDirection = parent->style()->isHorizontalWritingMode() ? HorizontalLine : VerticalLine;
-
-        if (verticalAlign == SUB)
-            verticalPosition += fontSize / 5 + 1;
-        else if (verticalAlign == SUPER)
-            verticalPosition -= fontSize / 3 + 1;
-        else if (verticalAlign == TEXT_TOP)
-            verticalPosition += renderer->baselinePosition(baselineType, firstLine, lineDirection) - fontMetrics.ascent(baselineType);
-        else if (verticalAlign == MIDDLE)
-            verticalPosition += -static_cast<int>(fontMetrics.xHeight() / 2) - renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType, firstLine, lineDirection);
-        else if (verticalAlign == TEXT_BOTTOM) {
-            verticalPosition += fontMetrics.descent(baselineType);
-            // lineHeight - baselinePosition is always 0 for replaced elements (except inline blocks), so don't bother wasting time in that case.
-            if (!renderer->isReplaced() || renderer->isInlineBlockOrInlineTable())
-                verticalPosition -= (renderer->lineHeight(firstLine, lineDirection) - renderer->baselinePosition(baselineType, firstLine, lineDirection));
-        } else if (verticalAlign == BASELINE_MIDDLE)
-            verticalPosition += -renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType, firstLine, lineDirection);
-        else if (verticalAlign == LENGTH)
-            verticalPosition -= renderer->style()->verticalAlignLength().calcValue(renderer->lineHeight(firstLine, lineDirection));
-    }
-
-    // Store the cached value.
-    if (isRenderInline && !firstLine)
-        verticalPositionCache.set(renderer, baselineType, verticalPosition);
-
-    return verticalPosition;
-}
-
-void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom,
+void InlineFlowBox::computeLogicalBoxHeights(RootInlineBox* rootBox, int& maxPositionTop, int& maxPositionBottom,
                                              int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent,
                                              bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap,
                                              FontBaseline baselineType, VerticalPositionCache& verticalPositionCache)
 {
     // The primary purpose of this function is to compute the maximal ascent and descent values for
-    // a line.
+    // a line. These values are computed based off the block's line-box-contain property, which indicates
+    // what parts of descendant boxes have to fit within the line.
+    //
+    // The maxAscent value represents the distance of the highest point of any box (typically including line-height) from
+    // the root box's baseline. The maxDescent value represents the distance of the lowest point of any box
+    // (also typically including line-height) from the root box baseline. These values can be negative.
     //
-    // The maxAscent value represents the distance of the highest point of any box (including line-height) from
-    // the root box's baseline.  The maxDescent value represents the distance of the lowest point of any box
-    // (also including line-height) from the root box baseline.  These values can be negative.
+    // A secondary purpose of this function is to store the offset of every box's baseline from the root box's
+    // baseline. This information is cached in the logicalTop() of every box. We're effectively just using
+    // the logicalTop() as scratch space.
     //
-    // A secondary purpose of this function is to store the offset of very box's baseline from the root box's
-    // baseline.  This information is cached in the logicalTop() of every box. We're effectively just using
-    // the logicalTop() as scratch space. 
+    // Because a box can be positioned such that it ends up fully above or fully below the
+    // root line box, we only consider it to affect the maxAscent and maxDescent values if some
+    // part of the box (EXCLUDING leading) is above (for ascent) or below (for descent) the root box's baseline.
+    bool affectsAscent = false;
+    bool affectsDescent = false;
     if (isRootInlineBox()) {
         // Examine our root box.
-        int height = lineHeight();
-        int baseline = baselinePosition(baselineType);
+        int ascent = 0;
+        int descent = 0;
+        rootBox->ascentAndDescentForBox(rootBox, textBoxDataMap, ascent, descent, affectsAscent, affectsDescent);
         if (hasTextChildren() || strictMode) {
-            int ascent = baseline;
-            int descent = height - ascent;
             if (maxAscent < ascent || !setMaxAscent) {
                 maxAscent = ascent;
                 setMaxAscent = true;
@@ -488,75 +429,25 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi
         
         bool isInlineFlow = curr->isInlineFlowBox();
         
-        // Because a box can be positioned such that it ends up fully above or fully below the
-        // root line box, we only consider it to affect the maxAscent and maxDescent values if some
-        // part of the box (EXCLUDING line-height) is above (for ascent) or below (for descent) the root box's baseline.
         bool affectsAscent = false;
         bool affectsDescent = false;
         
         // The verticalPositionForBox function returns the distance between the child box's baseline
         // and the root box's baseline.  The value is negative if the child box's baseline is above the
         // root box's baseline, and it is positive if the child box's baseline is below the root box's baseline.
-        curr->setLogicalTop(verticalPositionForBox(curr, baselineType, m_firstLine, verticalPositionCache));
+        curr->setLogicalTop(rootBox->verticalPositionForBox(curr, verticalPositionCache));
         
-        int lineHeight;
-        int baseline;
-        Vector<const SimpleFontData*>* usedFonts = 0;
-        if (curr->isInlineTextBox()) {
-            GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(static_cast<InlineTextBox*>(curr));
-            usedFonts = it == textBoxDataMap.end() ? 0 : &it->second.first;
-        }
-
-        if (usedFonts && !usedFonts->isEmpty() && curr->renderer()->style(m_firstLine)->lineHeight().isNegative()) {
-            usedFonts->append(curr->renderer()->style(m_firstLine)->font().primaryFont());
-            bool baselineSet = false;
-            baseline = 0;
-            int baselineToBottom = 0;
-            for (size_t i = 0; i < usedFonts->size(); ++i) {
-                const FontMetrics& fontMetrics = usedFonts->at(i)->fontMetrics();
-                int halfLeading = (fontMetrics.lineSpacing() - fontMetrics.height()) / 2;
-                int usedFontBaseline = halfLeading + fontMetrics.ascent(baselineType);
-                int usedFontBaselineToBottom = fontMetrics.lineSpacing() - usedFontBaseline;
-                if (!baselineSet) {
-                    baselineSet = true;
-                    baseline = usedFontBaseline;
-                    baselineToBottom = usedFontBaselineToBottom;
-                } else {
-                    baseline = max(baseline, usedFontBaseline);
-                    baselineToBottom = max(baselineToBottom, usedFontBaselineToBottom);
-                }
-                if (!affectsAscent)
-                    affectsAscent = fontMetrics.ascent() - curr->logicalTop() > 0;
-                if (!affectsDescent)
-                    affectsDescent = fontMetrics.descent() + curr->logicalTop() > 0;
-            }
-            lineHeight = baseline + baselineToBottom;
-        } else {
-            lineHeight = curr->lineHeight();
-            baseline = curr->baselinePosition(baselineType);
-            if (curr->isText() || isInlineFlow) {
-                // Examine the font box for inline flows and text boxes to see if any part of it is above the baseline.
-                // If the top of our font box relative to the root box baseline is above the root box baseline, then
-                // we are contributing to the maxAscent value.
-                const FontMetrics& fontMetrics = curr->renderer()->style(m_firstLine)->fontMetrics();
-                affectsAscent = fontMetrics.ascent(baselineType) - curr->logicalTop() > 0;
-                
-                // Descent is similar.  If any part of our font box is below the root box's baseline, then
-                // we contribute to the maxDescent value.
-                affectsDescent = fontMetrics.descent(baselineType) + curr->logicalTop() > 0;
-            } else {
-                // Replaced elements always affect both the ascent and descent.
-                affectsAscent = true;
-                affectsDescent = true;
-            }
-        }
+        int ascent = 0;
+        int descent = 0;
+        rootBox->ascentAndDescentForBox(curr, textBoxDataMap, ascent, descent, affectsAscent, affectsDescent);
 
+        int boxHeight = ascent + descent;
         if (curr->verticalAlign() == TOP) {
-            if (maxPositionTop < lineHeight)
-                maxPositionTop = lineHeight;
+            if (maxPositionTop < ascent)
+                maxPositionTop = boxHeight;
         } else if (curr->verticalAlign() == BOTTOM) {
-            if (maxPositionBottom < lineHeight)
-                maxPositionBottom = lineHeight;
+            if (maxPositionBottom < boxHeight)
+                maxPositionBottom = boxHeight;
         } else if ((!isInlineFlow || static_cast<InlineFlowBox*>(curr)->hasTextChildren()) || curr->boxModelObject()->hasInlineDirectionBordersOrPadding() || strictMode) {
             // Note that these values can be negative.  Even though we only affect the maxAscent and maxDescent values
             // if our box (excluding line-height) was above (for ascent) or below (for descent) the root baseline, once you factor in line-height
@@ -564,12 +455,13 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi
             // means is that ascent and descent (including leading), can end up being negative.  The setMaxAscent and
             // setMaxDescent booleans are used to ensure that we're willing to initially set maxAscent/Descent to negative
             // values.
-            int ascent = baseline - curr->logicalTop();
-            int descent = lineHeight - ascent;
+            ascent -= curr->logicalTop();
+            descent += curr->logicalTop();
             if (affectsAscent && (maxAscent < ascent || !setMaxAscent)) {
                 maxAscent = ascent;
                 setMaxAscent = true;
             }
+
             if (affectsDescent && (maxDescent < descent || !setMaxDescent)) {
                 maxDescent = descent;
                 setMaxDescent = true;
@@ -577,7 +469,7 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi
         }
 
         if (curr->isInlineFlowBox())
-            static_cast<InlineFlowBox*>(curr)->computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent,
+            static_cast<InlineFlowBox*>(curr)->computeLogicalBoxHeights(rootBox, maxPositionTop, maxPositionBottom, maxAscent, maxDescent,
                                                                         setMaxAscent, setMaxDescent, strictMode, textBoxDataMap,
                                                                         baselineType, verticalPositionCache);
     }
index 918cf5d..ecb4c6c 100644 (file)
@@ -158,7 +158,7 @@ public:
     int getFlowSpacingLogicalWidth();
     bool onEndChain(RenderObject* endObject);
     float placeBoxesInInlineDirection(float logicalLeft, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&);
-    void computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom,
+    void computeLogicalBoxHeights(RootInlineBox*, int& maxPositionTop, int& maxPositionBottom,
                                   int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent,
                                   bool strictMode, GlyphOverflowAndFallbackFontsMap&, FontBaseline, VerticalPositionCache&);
     void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent,
index 64b12f3..5373679 100644 (file)
@@ -497,7 +497,7 @@ private:
     RootInlineBox* constructLine(unsigned runCount, BidiRun* firstRun, BidiRun* lastRun, bool firstLine, bool lastLine, RenderObject* endObject);
     InlineFlowBox* createLineBoxes(RenderObject*, bool firstLine);
 
-    void computeInlineDirectionPositionsForLine(RootInlineBox*, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&);
+    void computeInlineDirectionPositionsForLine(RootInlineBox*, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&);
     void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&);
     void deleteEllipsisLineBoxes();
     void checkLinesForTextOverflow();
index 90e4ec6..b5da256 100644 (file)
@@ -325,7 +325,8 @@ ETextAlign RenderBlock::textAlignmentForLine(bool endsWithSoftBreak) const
     return alignment;
 }
 
-void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
+void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd,
+                                                         GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache)
 {
     ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWithBreak());
     float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), firstLine);
@@ -358,6 +359,21 @@ void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox,
             }
             HashSet<const SimpleFontData*> fallbackFonts;
             GlyphOverflow glyphOverflow;
+            
+            // Always compute glyph overflow if the block's line-box-contain value is "glyphs".
+            if (lineBox->fitsToGlyphs()) {
+                // If we don't stick out of the root line's font box, then don't bother computing our glyph overflow. This optimization
+                // will keep us from computing glyph bounds in nearly all cases.
+                bool includeRootLine = lineBox->includesRootLineBoxFontOrLeading();
+                int baselineShift = lineBox->verticalPositionForBox(r->m_box, verticalPositionCache);
+                int rootDescent = includeRootLine ? lineBox->renderer()->style(firstLine)->font().fontMetrics().descent() : 0;
+                int rootAscent = includeRootLine ? lineBox->renderer()->style(firstLine)->font().fontMetrics().ascent() : 0;
+                int boxAscent = rt->style(firstLine)->font().fontMetrics().ascent() - baselineShift;
+                int boxDescent = rt->style(firstLine)->font().fontMetrics().descent() + baselineShift;
+                if (boxAscent > rootDescent ||  boxDescent > rootAscent)
+                    glyphOverflow.computeBounds = true; 
+            }
+
             int hyphenWidth = 0;
             if (static_cast<InlineTextBox*>(r->m_box)->hasHyphen()) {
                 const AtomicString& hyphenString = rt->style()->hyphenString();
@@ -773,10 +789,10 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintLogica
 #endif
 
                         GlyphOverflowAndFallbackFontsMap textBoxDataMap;
-
+                    
                         // Now we position all of our text runs horizontally.
                         if (!isSVGRootInlineBox)
-                            computeInlineDirectionPositionsForLine(lineBox, firstLine, resolver.firstRun(), trailingSpaceRun, end.atEnd(), textBoxDataMap);
+                            computeInlineDirectionPositionsForLine(lineBox, firstLine, resolver.firstRun(), trailingSpaceRun, end.atEnd(), textBoxDataMap, verticalPositionCache);
 
                         // Now position our text runs vertically.
                         computeBlockDirectionPositionsForLine(lineBox, resolver.firstRun(), textBoxDataMap, verticalPositionCache);
index 234d63c..b1367a9 100644 (file)
@@ -485,29 +485,21 @@ static int computeMargin(const RenderInline* renderer, const Length& margin)
 
 int RenderInline::marginLeft() const
 {
-    if (!style()->isHorizontalWritingMode())
-        return 0;
     return computeMargin(this, style()->marginLeft());
 }
 
 int RenderInline::marginRight() const
 {
-    if (!style()->isHorizontalWritingMode())
-        return 0;
     return computeMargin(this, style()->marginRight());
 }
 
 int RenderInline::marginTop() const
 {
-    if (style()->isHorizontalWritingMode())
-        return 0;
     return computeMargin(this, style()->marginTop());
 }
 
 int RenderInline::marginBottom() const
 {
-    if (style()->isHorizontalWritingMode())
-        return 0;
     return computeMargin(this, style()->marginBottom());
 }
 
@@ -521,6 +513,16 @@ int RenderInline::marginEnd() const
     return computeMargin(this, style()->marginEnd());
 }
 
+int RenderInline::marginBefore() const
+{
+    return computeMargin(this, style()->marginBefore());
+}
+
+int RenderInline::marginAfter() const
+{
+    return computeMargin(this, style()->marginAfter());
+}
+
 const char* RenderInline::renderName() const
 {
     if (isRelPositioned())
index 18b4a3c..08ac002 100644 (file)
@@ -42,8 +42,8 @@ public:
     virtual int marginRight() const;
     virtual int marginTop() const;
     virtual int marginBottom() const;
-    virtual int marginBefore() const { return 0; }
-    virtual int marginAfter() const { return 0; }
+    virtual int marginBefore() const;
+    virtual int marginAfter() const;
     virtual int marginStart() const;
     virtual int marginEnd() const;
 
index 870a4f4..5169c1c 100644 (file)
@@ -572,7 +572,7 @@ ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len
             return combineText->combinedTextWidth(f);
     }
 
-    if (f.isFixedPitch() && !f.isSmallCaps() && m_isAllASCII) {
+    if (f.isFixedPitch() && !f.isSmallCaps() && m_isAllASCII && (!glyphOverflow || !glyphOverflow->computeBounds)) {
         float monospaceCharacterWidth = f.spaceWidth();
         float tabWidth = allowTabs() ? monospaceCharacterWidth * 8 : 0;
         float w = 0;
@@ -1247,7 +1247,7 @@ float RenderText::width(unsigned from, unsigned len, const Font& f, float xPos,
 
     float w;
     if (&f == &style()->font()) {
-        if (!style()->preserveNewline() && !from && len == textLength()) {
+        if (!style()->preserveNewline() && !from && len == textLength() && (!glyphOverflow || !glyphOverflow->computeBounds)) {
             if (fallbackFonts) {
                 ASSERT(glyphOverflow);
                 if (preferredLogicalWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts) {
index 8617252..ea00bf6 100644 (file)
 #include "Frame.h"
 #include "GraphicsContext.h"
 #include "HitTestResult.h"
+#include "InlineTextBox.h"
 #include "Page.h"
 #include "PaintInfo.h"
 #include "RenderArena.h"
 #include "RenderBlock.h"
+#include "VerticalPositionCache.h"
 
 using namespace std;
 
@@ -238,7 +240,7 @@ int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAn
 
     m_baselineType = requiresIdeographicBaseline(textBoxDataMap) ? IdeographicBaseline : AlphabeticBaseline;
 
-    computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, noQuirksMode,
+    computeLogicalBoxHeights(this, maxPositionTop, maxPositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, noQuirksMode,
                              textBoxDataMap, baselineType(), verticalPositionCache);
 
     if (maxAscent + maxDescent < max(maxPositionTop, maxPositionBottom))
@@ -553,4 +555,241 @@ IntRect RootInlineBox::paddedLayoutOverflowRect(int endPadding) const
     return lineLayoutOverflow;
 }
 
+static void setAscentAndDescent(int& ascent, int& descent, int newAscent, int newDescent, bool& ascentDescentSet)
+{
+    if (!ascentDescentSet) {
+        ascentDescentSet = true;
+        ascent = newAscent;
+        descent = newDescent;
+    } else {
+        ascent = max(ascent, newAscent);
+        descent = max(descent, newDescent);
+    }
+}
+
+void RootInlineBox::ascentAndDescentForBox(InlineBox* box, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, int& ascent, int& descent,
+                                           bool& affectsAscent, bool& affectsDescent) const
+{
+    bool ascentDescentSet = false;
+
+    // Replaced boxes will return 0 for the line-height if line-box-contain says they are
+    // not to be included.
+    if (box->renderer()->isReplaced()) {
+        if (renderer()->style(m_firstLine)->lineBoxContain() & LineBoxContainReplaced) {
+            ascent = box->baselinePosition(baselineType());
+            descent = box->lineHeight() - ascent;
+            
+            // Replaced elements always affect both the ascent and descent.
+            affectsAscent = true;
+            affectsDescent = true;
+        }
+        return;
+    }
+
+    Vector<const SimpleFontData*>* usedFonts = 0;
+    GlyphOverflow* glyphOverflow = 0;
+    if (box->isText()) {
+        GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(static_cast<InlineTextBox*>(box));
+        usedFonts = it == textBoxDataMap.end() ? 0 : &it->second.first;
+        glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->second.second;
+    }
+        
+    bool includeLeading = includeLeadingForBox(box);
+    bool includeFont = includeFontForBox(box);
+    
+    bool setUsedFont = false;
+    bool setUsedFontWithLeading = false;
+
+    if (usedFonts && !usedFonts->isEmpty() && (includeFont || (box->renderer()->style(m_firstLine)->lineHeight().isNegative() && includeLeading))) {
+        usedFonts->append(box->renderer()->style(m_firstLine)->font().primaryFont());
+        for (size_t i = 0; i < usedFonts->size(); ++i) {
+            const FontMetrics& fontMetrics = usedFonts->at(i)->fontMetrics();
+            int usedFontAscent = fontMetrics.ascent(baselineType());
+            int usedFontDescent = fontMetrics.descent(baselineType());
+            int halfLeading = (fontMetrics.lineSpacing() - fontMetrics.height()) / 2;
+            int usedFontAscentAndLeading = usedFontAscent + halfLeading;
+            int usedFontDescentAndLeading = fontMetrics.lineSpacing() - usedFontAscentAndLeading;
+            if (includeFont) {
+                setAscentAndDescent(ascent, descent, usedFontAscent, usedFontDescent, ascentDescentSet);
+                setUsedFont = true;
+            }
+            if (includeLeading) {
+                setAscentAndDescent(ascent, descent, usedFontAscentAndLeading, usedFontDescentAndLeading, ascentDescentSet);
+                setUsedFontWithLeading = true;
+            }
+            if (!affectsAscent)
+                affectsAscent = usedFontAscent - box->logicalTop() > 0;
+            if (!affectsDescent)
+                affectsDescent = usedFontDescent + box->logicalTop() > 0;
+        }
+    }
+
+    // If leading is included for the box, then we compute that box.
+    if (includeLeading && !setUsedFontWithLeading) {
+        int ascentWithLeading = box->baselinePosition(baselineType());
+        int descentWithLeading = box->lineHeight() - ascentWithLeading;
+        setAscentAndDescent(ascent, descent, ascentWithLeading, descentWithLeading, ascentDescentSet);
+        
+        // Examine the font box for inline flows and text boxes to see if any part of it is above the baseline.
+        // If the top of our font box relative to the root box baseline is above the root box baseline, then
+        // we are contributing to the maxAscent value. Descent is similar. If any part of our font box is below
+        // the root box's baseline, then we contribute to the maxDescent value.
+        affectsAscent = ascentWithLeading - box->logicalTop() > 0;
+        affectsDescent = descentWithLeading + box->logicalTop() > 0; 
+    }
+    
+    if (includeFontForBox(box) && !setUsedFont) {
+        int fontAscent = box->renderer()->style(m_firstLine)->fontMetrics().ascent();
+        int fontDescent = box->renderer()->style(m_firstLine)->fontMetrics().descent();
+        setAscentAndDescent(ascent, descent, fontAscent, fontDescent, ascentDescentSet);
+        affectsAscent = fontAscent - box->logicalTop() > 0;
+        affectsDescent = fontDescent + box->logicalTop() > 0; 
+    }
+
+    if (includeGlyphsForBox(box) && glyphOverflow && glyphOverflow->computeBounds) {
+        setAscentAndDescent(ascent, descent, glyphOverflow->top, glyphOverflow->bottom, ascentDescentSet);
+        affectsAscent = glyphOverflow->top - box->logicalTop() > 0;
+        affectsDescent = glyphOverflow->bottom + box->logicalTop() > 0; 
+        glyphOverflow->top = min(glyphOverflow->top, max(0, glyphOverflow->top - box->renderer()->style(m_firstLine)->fontMetrics().ascent()));
+        glyphOverflow->bottom = min(glyphOverflow->bottom, max(0, glyphOverflow->bottom - box->renderer()->style(m_firstLine)->fontMetrics().descent()));
+    }
+
+    if (includeMarginForBox(box)) {
+        int ascentWithMargin = box->renderer()->style(m_firstLine)->fontMetrics().ascent();
+        int descentWithMargin = box->renderer()->style(m_firstLine)->fontMetrics().descent();
+        if (box->parent() && !box->renderer()->isText()) {
+            ascentWithMargin += box->boxModelObject()->borderBefore() + box->boxModelObject()->paddingBefore() + box->boxModelObject()->marginBefore();
+            descentWithMargin += box->boxModelObject()->borderAfter() + box->boxModelObject()->paddingAfter() + box->boxModelObject()->marginAfter();
+        }
+        setAscentAndDescent(ascent, descent, ascentWithMargin, descentWithMargin, ascentDescentSet);
+        
+        // Treat like a replaced element, since we're using the margin box.
+        affectsAscent = true;
+        affectsDescent = true;
+    }
+}
+
+int RootInlineBox::verticalPositionForBox(InlineBox* box, VerticalPositionCache& verticalPositionCache)
+{
+    if (box->renderer()->isText())
+        return box->parent()->logicalTop();
+    
+    RenderBoxModelObject* renderer = box->boxModelObject();
+    ASSERT(renderer->isInline());
+    if (!renderer->isInline())
+        return 0;
+
+    // This method determines the vertical position for inline elements.
+    bool firstLine = m_firstLine;
+    if (firstLine && !renderer->document()->usesFirstLineRules())
+        firstLine = false;
+
+    // Check the cache.
+    bool isRenderInline = renderer->isRenderInline();
+    if (isRenderInline && !firstLine) {
+        int verticalPosition = verticalPositionCache.get(renderer, baselineType());
+        if (verticalPosition != PositionUndefined)
+            return verticalPosition;
+    }
+
+    int verticalPosition = 0;
+    EVerticalAlign verticalAlign = renderer->style()->verticalAlign();
+    if (verticalAlign == TOP || verticalAlign == BOTTOM)
+        return 0;
+   
+    RenderObject* parent = renderer->parent();
+    if (parent->isRenderInline() && parent->style()->verticalAlign() != TOP && parent->style()->verticalAlign() != BOTTOM)
+        verticalPosition = box->parent()->logicalTop();
+    
+    if (verticalAlign != BASELINE) {
+        const Font& font = parent->style(firstLine)->font();
+        const FontMetrics& fontMetrics = font.fontMetrics();
+        int fontSize = font.pixelSize();
+
+        LineDirectionMode lineDirection = parent->style()->isHorizontalWritingMode() ? HorizontalLine : VerticalLine;
+
+        if (verticalAlign == SUB)
+            verticalPosition += fontSize / 5 + 1;
+        else if (verticalAlign == SUPER)
+            verticalPosition -= fontSize / 3 + 1;
+        else if (verticalAlign == TEXT_TOP)
+            verticalPosition += renderer->baselinePosition(baselineType(), firstLine, lineDirection) - fontMetrics.ascent(baselineType());
+        else if (verticalAlign == MIDDLE)
+            verticalPosition += -static_cast<int>(fontMetrics.xHeight() / 2) - renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType(), firstLine, lineDirection);
+        else if (verticalAlign == TEXT_BOTTOM) {
+            verticalPosition += fontMetrics.descent(baselineType());
+            // lineHeight - baselinePosition is always 0 for replaced elements (except inline blocks), so don't bother wasting time in that case.
+            if (!renderer->isReplaced() || renderer->isInlineBlockOrInlineTable())
+                verticalPosition -= (renderer->lineHeight(firstLine, lineDirection) - renderer->baselinePosition(baselineType(), firstLine, lineDirection));
+        } else if (verticalAlign == BASELINE_MIDDLE)
+            verticalPosition += -renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType(), firstLine, lineDirection);
+        else if (verticalAlign == LENGTH)
+            verticalPosition -= renderer->style()->verticalAlignLength().calcValue(renderer->lineHeight(firstLine, lineDirection));
+    }
+
+    // Store the cached value.
+    if (isRenderInline && !firstLine)
+        verticalPositionCache.set(renderer, baselineType(), verticalPosition);
+
+    return verticalPosition;
+}
+
+bool RootInlineBox::includeLeadingForBox(InlineBox* box) const
+{
+    if (box->renderer()->isReplaced() || (box->renderer()->isText() && !box->isText()))
+        return false;
+
+    LineBoxContain lineBoxContain = renderer()->style()->lineBoxContain();
+    return (lineBoxContain & LineBoxContainInline) || (box == this && (lineBoxContain & LineBoxContainBlock));
+}
+
+bool RootInlineBox::includeFontForBox(InlineBox* box) const
+{
+    if (box->renderer()->isReplaced() || (box->renderer()->isText() && !box->isText()))
+        return false;
+    
+    if (!box->isText() && box->isInlineFlowBox() && !static_cast<InlineFlowBox*>(box)->hasTextChildren())
+        return false;
+
+    // For now map "glyphs" to "font" in vertical text mode until the bounds returned by glyphs aren't garbage.
+    LineBoxContain lineBoxContain = renderer()->style()->lineBoxContain();
+    return (lineBoxContain & LineBoxContainFont) || (!isHorizontal() && (lineBoxContain & LineBoxContainGlyphs));
+}
+
+bool RootInlineBox::includeGlyphsForBox(InlineBox* box) const
+{
+    if (box->renderer()->isReplaced() || (box->renderer()->isText() && !box->isText()))
+        return false;
+    
+    if (!box->isText() && box->isInlineFlowBox() && !static_cast<InlineFlowBox*>(box)->hasTextChildren())
+        return false;
+
+    // FIXME: We can't fit to glyphs yet for vertical text, since the bounds returned are garbage.
+    LineBoxContain lineBoxContain = renderer()->style()->lineBoxContain();
+    return isHorizontal() && (lineBoxContain & LineBoxContainGlyphs);
+}
+
+bool RootInlineBox::includeMarginForBox(InlineBox* box) const
+{
+    if (box->renderer()->isReplaced() || (box->renderer()->isText() && !box->isText()))
+        return false;
+
+    LineBoxContain lineBoxContain = renderer()->style()->lineBoxContain();
+    return lineBoxContain & LineBoxContainInlineBox;
+}
+
+
+bool RootInlineBox::fitsToGlyphs() const
+{
+    // FIXME: We can't fit to glyphs yet for vertical text, since the bounds returned are garbage.
+    LineBoxContain lineBoxContain = renderer()->style()->lineBoxContain();
+    return isHorizontal() && (lineBoxContain & LineBoxContainGlyphs);
+}
+
+bool RootInlineBox::includesRootLineBoxFontOrLeading() const
+{
+    LineBoxContain lineBoxContain = renderer()->style()->lineBoxContain();
+    return (lineBoxContain & LineBoxContainBlock) || (lineBoxContain & LineBoxContainInline) || (lineBoxContain & LineBoxContainFont);
+}
+
 } // namespace WebCore
index 1a9f0a8..5ab51f2 100644 (file)
@@ -133,6 +133,15 @@ public:
 
     IntRect paddedLayoutOverflowRect(int endPadding) const;
 
+    void ascentAndDescentForBox(InlineBox*, GlyphOverflowAndFallbackFontsMap&, int& ascent, int& descent, bool& affectsAscent, bool& affectsDescent) const;
+    int verticalPositionForBox(InlineBox*, VerticalPositionCache&);
+    bool includeLeadingForBox(InlineBox*) const;
+    bool includeFontForBox(InlineBox*) const;
+    bool includeGlyphsForBox(InlineBox*) const;
+    bool includeMarginForBox(InlineBox*) const;
+    bool fitsToGlyphs() const;
+    bool includesRootLineBoxFontOrLeading() const;
+
 private:
     bool hasEllipsisBox() const { return m_hasEllipsisBoxOrHyphen; }
     void setHasEllipsisBox(bool hasEllipsisBox) { m_hasEllipsisBoxOrHyphen = hasEllipsisBox; }
index c9c6e30..a9994a1 100644 (file)
@@ -396,7 +396,8 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
             rareInheritedData->locale != other->rareInheritedData->locale ||
             rareInheritedData->textEmphasisMark != other->rareInheritedData->textEmphasisMark ||
             rareInheritedData->textEmphasisPosition != other->rareInheritedData->textEmphasisPosition ||
-            rareInheritedData->textEmphasisCustomMark != other->rareInheritedData->textEmphasisCustomMark)
+            rareInheritedData->textEmphasisCustomMark != other->rareInheritedData->textEmphasisCustomMark ||
+            rareInheritedData->m_lineBoxContain != other->rareInheritedData->m_lineBoxContain)
             return StyleDifferenceLayout;
 
         if (!rareInheritedData->shadowDataEquivalent(*other->rareInheritedData.get()))
index 77a12d1..7b4468f 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "AnimationList.h"
 #include "BorderValue.h"
+#include "CSSLineBoxContainValue.h"
 #include "CSSPrimitiveValue.h"
 #include "CSSPropertyNames.h"
 #include "Color.h"
@@ -772,6 +773,7 @@ public:
     bool isRunningAcceleratedAnimation() const { return rareNonInheritedData->m_runningAcceleratedAnimation; }
 #endif
 
+    LineBoxContain lineBoxContain() const { return rareInheritedData->m_lineBoxContain; }
     const LineClampValue& lineClamp() const { return rareNonInheritedData->lineClamp; }
     bool textSizeAdjust() const { return rareInheritedData->textSizeAdjust; }
     ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); }
@@ -1116,6 +1118,7 @@ public:
     void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_runningAcceleratedAnimation, b); }
 #endif
 
+    void setLineBoxContain(LineBoxContain c) { SET_VAR(rareInheritedData, m_lineBoxContain, c); }
     void setLineClamp(LineClampValue c) { SET_VAR(rareNonInheritedData, lineClamp, c); }
     void setTextSizeAdjust(bool b) { SET_VAR(rareInheritedData, textSizeAdjust, b); }
     void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(rareInheritedData, textSecurity, aTextSecurity); }
@@ -1307,6 +1310,7 @@ public:
     static TextEmphasisMark initialTextEmphasisMark() { return TextEmphasisMarkNone; }
     static const AtomicString& initialTextEmphasisCustomMark() { return nullAtom; }
     static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver; }
+    static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
 
     // Keep these at the end.
     static LineClampValue initialLineClamp() { return LineClampValue(); }
index a032dd8..a6a19ea 100644 (file)
@@ -52,6 +52,7 @@ StyleRareInheritedData::StyleRareInheritedData()
     , textEmphasisFill(TextEmphasisFillFilled)
     , textEmphasisMark(TextEmphasisMarkNone)
     , textEmphasisPosition(TextEmphasisPositionOver)
+    , m_lineBoxContain(RenderStyle::initialLineBoxContain())
     , hyphenationLimitBefore(-1)
     , hyphenationLimitAfter(-1)
 {
@@ -85,6 +86,7 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
     , textEmphasisFill(o.textEmphasisFill)
     , textEmphasisMark(o.textEmphasisMark)
     , textEmphasisPosition(o.textEmphasisPosition)
+    , m_lineBoxContain(o.m_lineBoxContain)
     , hyphenationString(o.hyphenationString)
     , hyphenationLimitBefore(o.hyphenationLimitBefore)
     , hyphenationLimitAfter(o.hyphenationLimitAfter)
@@ -137,6 +139,7 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
         && textEmphasisFill == o.textEmphasisFill
         && textEmphasisMark == o.textEmphasisMark
         && textEmphasisPosition == o.textEmphasisPosition
+        && m_lineBoxContain == o.m_lineBoxContain
         && hyphenationString == o.hyphenationString
         && locale == o.locale
         && textEmphasisCustomMark == o.textEmphasisCustomMark
index 1a8af79..bf28f29 100644 (file)
@@ -84,6 +84,7 @@ public:
     unsigned textEmphasisFill : 1; // TextEmphasisFill
     unsigned textEmphasisMark : 3; // TextEmphasisMark
     unsigned textEmphasisPosition : 1; // TextEmphasisPosition
+    unsigned m_lineBoxContain: 7; // LineBoxContain
 
     AtomicString hyphenationString;
     short hyphenationLimitBefore;