Changeset 72235 in webkit


Ignore:
Timestamp:
Nov 17, 2010 12:55:40 PM (13 years ago)
Author:
hyatt@apple.com
Message:

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

Reviewed by Sam Weinig.

WebCore:

Fonts with no vertical metrics should synthesize baselines when they appear
on lines that do use fonts with vertical metrics. Basically we want to make
sure that English text behaves like vertical-align:middle, i.e., its baseline
should be treated as though it cuts through the middle of the ascent+descent.

The way this works is that each line in the line box tree is labeled as having
a baseline type that is either ideographic or alphabetic for the purposes of
vertical alignment. A line becomes ideographic if any font with vertical tables
is either explicitly specified as the primary font or in any of the used fonts
in the text on that line.

This baselineType is passed down to computeLogicalBoxHeights and placeBoxesInBlockDirection,
and passed to the ascent and descent methods of the fonts that are examined.
The underlying Font code selects an appropriate baseline given the type passed in.

This patch also rewrites vertical alignment to lop 4 bytes off all RenderInlines and
to instead carry around the cached vertical positions for RenderInlines in a new
VerticalPositionCache object. This cache only lives for a single layout
operation, but it does cache information across all the lines built and placed during the
layout.

This matches the old behavior, since every call to layoutInlineChildren invalidated
all of the vertical positions in all of the RenderInlines anyway.

The VerticalPositionCache consists of two HashMaps, and it caches vertical alignment
positions for both alphabetic and ideographic baseline types.

The vertical-align computation has now been moved out of RenderBoxModelObject and
RenderInline and just placed right into verticalPositionForBox in InlineFlowBox.
This function has been changed to no longer be recursive when checking parents,
and it now relies on the fact that the parent vertical alignment computation result
has already been stored in the logicalTop() of that parent's line box. By checking
the line box logicalTop() value instead of recurring, the performance of first lines
now significantly improves to no longer have O(n2) behavior in the depth of the line
box tree on the first line.

All of the baselinePosition functions on the various RenderObjects have been amended
to take a FontBaseline as the first argument. This patch does not attempt to fix up
MathML or form controls yet and just hardcodes AlphabeticBaselines for those renderers.

The RenderTableCell baselinePosition virtual method has been made non-virtual and had
all arguments removed, since it actually had no real connection with the rest of the
baseline positioning system. Cell baseline positioning works by calling firstLineBoxBaseline,
and that method has been patched to use the cached baselineType for the first line box
when computing the baseline of that line.

Added fast/blockflow/vertical-baseline-alignment.html and fast/blockflow/vertical-align-table-baseline.html.

  • WebCore.xcodeproj/project.pbxproj:
  • mathml/RenderMathMLFraction.cpp:

(WebCore::RenderMathMLFraction::baselinePosition):

  • mathml/RenderMathMLFraction.h:
  • mathml/RenderMathMLOperator.cpp:

(WebCore::RenderMathMLOperator::baselinePosition):

  • mathml/RenderMathMLOperator.h:
  • mathml/RenderMathMLRow.cpp:

(WebCore::RenderMathMLRow::baselinePosition):

  • mathml/RenderMathMLRow.h:
  • mathml/RenderMathMLSubSup.cpp:

(WebCore::RenderMathMLSubSup::baselinePosition):

  • mathml/RenderMathMLSubSup.h:
  • mathml/RenderMathMLUnderOver.cpp:

(WebCore::RenderMathMLUnderOver::layout):
(WebCore::RenderMathMLUnderOver::baselinePosition):

  • mathml/RenderMathMLUnderOver.h:
  • platform/graphics/SimpleFontData.h:
  • rendering/InlineBox.h:

(WebCore::InlineBox::baselinePosition):

  • rendering/InlineFlowBox.cpp:

(WebCore::verticalPositionForBox):
(WebCore::InlineFlowBox::computeLogicalBoxHeights):
(WebCore::InlineFlowBox::placeBoxesInBlockDirection):

  • rendering/InlineFlowBox.h:
  • rendering/InlineTextBox.cpp:

(WebCore::InlineTextBox::baselinePosition):

  • rendering/InlineTextBox.h:
  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::baselinePosition):
(WebCore::RenderBlock::firstLineBoxBaseline):
(WebCore::RenderBlock::lastLineBoxBaseline):

  • rendering/RenderBlock.h:
  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlock::computeBlockDirectionPositionsForLine):
(WebCore::RenderBlock::layoutInlineChildren):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::baselinePosition):

  • rendering/RenderBox.h:
  • rendering/RenderBoxModelObject.cpp:
  • rendering/RenderBoxModelObject.h:
  • rendering/RenderFileUploadControl.cpp:

(WebCore::RenderFileUploadControl::paintObject):

  • rendering/RenderInline.cpp:

(WebCore::RenderInline::RenderInline):
(WebCore::RenderInline::baselinePosition):

  • rendering/RenderInline.h:
  • rendering/RenderListBox.cpp:

(WebCore::RenderListBox::baselinePosition):

  • rendering/RenderListBox.h:
  • rendering/RenderListMarker.cpp:

(WebCore::RenderListMarker::baselinePosition):

  • rendering/RenderListMarker.h:
  • rendering/RenderSlider.cpp:

(WebCore::RenderSlider::baselinePosition):

  • rendering/RenderSlider.h:
  • rendering/RenderTableCell.cpp:

(WebCore::RenderTableCell::baselinePosition):

  • rendering/RenderTableCell.h:
  • rendering/RenderTextControlMultiLine.cpp:

(WebCore::RenderTextControlMultiLine::baselinePosition):

  • rendering/RenderTextControlMultiLine.h:
  • rendering/RootInlineBox.cpp:

(WebCore::RootInlineBox::alignBoxesInBlockDirection):

  • rendering/RootInlineBox.h:

(WebCore::RootInlineBox::baselinePosition):

  • rendering/VerticalPositionCache.h: Added.

(WebCore::VerticalPositionCache::VerticalPositionCache):
(WebCore::VerticalPositionCache::get):
(WebCore::VerticalPositionCache::set):

  • rendering/svg/SVGInlineTextBox.cpp:

(WebCore::SVGInlineTextBox::calculateBoundaries):

LayoutTests:

Fonts with no vertical metrics should synthesize baselines when they appear
on lines that do use fonts with vertical metrics. Basically we want to make
sure that English text behaves like vertical-align:middle, i.e., its baseline
should be treated as though it cuts through the middle of the ascent+descent.

The way this works is that each line in the line box tree is labeled as having
a baseline type that is either ideographic or alphabetic for the purposes of
vertical alignment. A line becomes ideographic if any font with vertical tables
is either explicitly specified as the primary font or in any of the used fonts
in the text on that line.

This baselineType is passed down to computeLogicalBoxHeights and placeBoxesInBlockDirection,
and passed to the ascent and descent methods of the fonts that are examined.
The underlying Font code selects an appropriate baseline given the type passed in.

This patch also rewrites vertical alignment to lop 4 bytes off all RenderInlines and
to instead carry around the cached vertical positions for RenderInlines in a new
VerticalPositionCache object. This cache only lives for a single layout
operation, but it does cache information across all the lines built and placed during the
layout.

This matches the old behavior, since every call to layoutInlineChildren invalidated
all of the vertical positions in all of the RenderInlines anyway.

The VerticalPositionCache consists of two HashMaps, and it caches vertical alignment
positions for both alphabetic and ideographic baseline types.

The vertical-align computation has now been moved out of RenderBoxModelObject and
RenderInline and just placed right into verticalPositionForBox in InlineFlowBox.
This function has been changed to no longer be recursive when checking parents,
and it now relies on the fact that the parent vertical alignment computation result
has already been stored in the logicalTop() of that parent's line box. By checking
the line box logicalTop() value instead of recurring, the performance of first lines
now significantly improves to no longer have O(n2) behavior in the depth of the line
box tree on the first line.

All of the baselinePosition functions on the various RenderObjects have been amended
to take a FontBaseline as the first argument. This patch does not attempt to fix up
MathML or form controls yet and just hardcodes AlphabeticBaselines for those renderers.

The RenderTableCell baselinePosition virtual method has been made non-virtual and had
all arguments removed, since it actually had no real connection with the rest of the
baseline positioning system. Cell baseline positioning works by calling firstLineBoxBaseline,
and that method has been patched to use the cached baselineType for the first line box
when computing the baseline of that line.

Added fast/blockflow/vertical-baseline-alignment.html and fast/blockflow/vertical-align-table-baseline.html

  • fast/blockflow/vertical-align-table-baseline.html: Added.
  • fast/blockflow/vertical-baseline-alignment.html: Added.
  • platform/mac/fast/blockflow/vertical-align-table-baseline-expected.checksum: Added.
  • platform/mac/fast/blockflow/vertical-align-table-baseline-expected.png: Added.
  • platform/mac/fast/blockflow/vertical-align-table-baseline-expected.txt: Added.
  • platform/mac/fast/blockflow/vertical-baseline-alignment-expected.checksum: Added.
  • platform/mac/fast/blockflow/vertical-baseline-alignment-expected.png: Added.
  • platform/mac/fast/blockflow/vertical-baseline-alignment-expected.txt: Added.
  • platform/mac/fast/blockflow/vertical-font-fallback-expected.checksum:
  • platform/mac/fast/blockflow/vertical-font-fallback-expected.png:
  • platform/mac/fast/blockflow/vertical-font-fallback-expected.txt:
  • platform/mac/fast/repaint/repaint-across-writing-mode-boundary-expected.checksum:
  • platform/mac/fast/repaint/repaint-across-writing-mode-boundary-expected.png:
  • platform/mac/fast/repaint/repaint-across-writing-mode-boundary-expected.txt:
Location:
trunk
Files:
9 added
48 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r72231 r72235  
     12010-11-17  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=48537
     6
     7        Fonts with no vertical metrics should synthesize baselines when they appear
     8        on lines that do use fonts with vertical metrics.  Basically we want to make
     9        sure that English text behaves like vertical-align:middle, i.e., its baseline
     10        should be treated as though it cuts through the middle of the ascent+descent.
     11       
     12        The way this works is that each line in the line box tree is labeled as having
     13        a baseline type that is either ideographic or alphabetic for the purposes of
     14        vertical alignment.  A line becomes ideographic if any font with vertical tables
     15        is either explicitly specified as the primary font or in any of the used fonts
     16        in the text on that line.
     17       
     18        This baselineType is passed down to computeLogicalBoxHeights and placeBoxesInBlockDirection,
     19        and passed to the ascent and descent methods of the fonts that are examined.
     20        The underlying Font code selects an appropriate baseline given the type passed in.
     21       
     22        This patch also rewrites vertical alignment to lop 4 bytes off all RenderInlines and
     23        to instead carry around the cached vertical positions for RenderInlines in a new
     24        VerticalPositionCache object.  This cache only lives for a single layout
     25        operation, but it does cache information across all the lines built and placed during the
     26        layout.
     27       
     28        This matches the old behavior, since every call to layoutInlineChildren invalidated
     29        all of the vertical positions in all of the RenderInlines anyway.
     30       
     31        The VerticalPositionCache consists of two HashMaps, and it caches vertical alignment
     32        positions for both alphabetic and ideographic baseline types.
     33       
     34        The vertical-align computation has now been moved out of RenderBoxModelObject and
     35        RenderInline and just placed right into verticalPositionForBox in InlineFlowBox.
     36        This function has been changed to no longer be recursive when checking parents,
     37        and it now relies on the fact that the parent vertical alignment computation result
     38        has already been stored in the logicalTop() of that parent's line box.  By checking
     39        the line box logicalTop() value instead of recurring, the performance of first lines
     40        now significantly improves to no longer have O(n^2) behavior in the depth of the line
     41        box tree on the first line.
     42       
     43        All of the baselinePosition functions on the various RenderObjects have been amended
     44        to take a FontBaseline as the first argument.  This patch does not attempt to fix up
     45        MathML or form controls yet and just hardcodes AlphabeticBaselines for those renderers.
     46       
     47        The RenderTableCell baselinePosition virtual method has been made non-virtual and had
     48        all arguments removed, since it actually had no real connection with the rest of the
     49        baseline positioning system.  Cell baseline positioning works by calling firstLineBoxBaseline,
     50        and that method has been patched to use the cached baselineType for the first line box
     51        when computing the baseline of that line.
     52         
     53        Added fast/blockflow/vertical-baseline-alignment.html and fast/blockflow/vertical-align-table-baseline.html
     54
     55        * fast/blockflow/vertical-align-table-baseline.html: Added.
     56        * fast/blockflow/vertical-baseline-alignment.html: Added.
     57        * platform/mac/fast/blockflow/vertical-align-table-baseline-expected.checksum: Added.
     58        * platform/mac/fast/blockflow/vertical-align-table-baseline-expected.png: Added.
     59        * platform/mac/fast/blockflow/vertical-align-table-baseline-expected.txt: Added.
     60        * platform/mac/fast/blockflow/vertical-baseline-alignment-expected.checksum: Added.
     61        * platform/mac/fast/blockflow/vertical-baseline-alignment-expected.png: Added.
     62        * platform/mac/fast/blockflow/vertical-baseline-alignment-expected.txt: Added.
     63        * platform/mac/fast/blockflow/vertical-font-fallback-expected.checksum:
     64        * platform/mac/fast/blockflow/vertical-font-fallback-expected.png:
     65        * platform/mac/fast/blockflow/vertical-font-fallback-expected.txt:
     66        * platform/mac/fast/repaint/repaint-across-writing-mode-boundary-expected.checksum:
     67        * platform/mac/fast/repaint/repaint-across-writing-mode-boundary-expected.png:
     68        * platform/mac/fast/repaint/repaint-across-writing-mode-boundary-expected.txt:
     69
    1702010-11-17  Martin Robinson  <mrobinson@igalia.com>
    271
  • trunk/LayoutTests/platform/mac/fast/blockflow/vertical-font-fallback-expected.checksum

    r72173 r72235  
    1 1a38c793aeaed823708cc6bd9330c2d3
     13c29af017e24ccc90fe35bd1d4377664
  • trunk/LayoutTests/platform/mac/fast/blockflow/vertical-font-fallback-expected.txt

    r72173 r72235  
    55    RenderBody {BODY} at (50,50) size 700x277
    66      RenderBlock {DIV} at (0,0) size 556x277 [bgcolor=#EEEEEE]
    7         RenderBlock {DIV} at (1,1) size 277x127 [bgcolor=#FFEEEE]
    8           RenderBlock {P} at (14,28) size 249x22 [bgcolor=#FFAAAA] [border: (20px solid #FF8888) none (20px solid #FF8888)]
    9             RenderText {#text} at (21,0) size 181x23
    10               text run at (21,0) width 181: "\x{7B2C}\x{4E00}\x{6BB5}\x{843D} paragraph 1"
    11           RenderBlock {P} at (14,77) size 249x22 [bgcolor=#FFAAAA] [border: (20px solid #FF8888) none (20px solid #FF8888)]
    12             RenderText {#text} at (21,0) size 181x23
    13               text run at (21,0) width 181: "\x{7B2C}\x{4E8C}\x{6BB5}\x{843D} paragraph 2"
     7        RenderBlock {DIV} at (1,1) size 277x129 [bgcolor=#FFEEEE]
     8          RenderBlock {P} at (14,28) size 249x23 [bgcolor=#FFAAAA] [border: (20px solid #FF8888) none (20px solid #FF8888)]
     9            RenderText {#text} at (21,1) size 181x23
     10              text run at (21,1) width 181: "\x{7B2C}\x{4E00}\x{6BB5}\x{843D} paragraph 1"
     11          RenderBlock {P} at (14,78) size 249x23 [bgcolor=#FFAAAA] [border: (20px solid #FF8888) none (20px solid #FF8888)]
     12            RenderText {#text} at (21,1) size 181x23
     13              text run at (21,1) width 181: "\x{7B2C}\x{4E8C}\x{6BB5}\x{843D} paragraph 2"
    1414        RenderBlock {DIV} at (278,1) size 277x275 [bgcolor=#FFFFEE]
    1515          RenderBlock {P} at (14,28) size 62x219 [bgcolor=#FFAAAA] [border: (20px solid #FF8888) none (20px solid #FF8888)]
  • trunk/LayoutTests/platform/mac/fast/repaint/repaint-across-writing-mode-boundary-expected.checksum

    r72173 r72235  
    1 7df50cf92359b0a4f0ba95b803db77aa
     114415853860aa0e125353aa6fcdd7c35
  • trunk/LayoutTests/platform/mac/fast/repaint/repaint-across-writing-mode-boundary-expected.txt

    r72173 r72235  
    55    RenderBody {BODY} at (50,50) size 700x277
    66      RenderBlock {DIV} at (0,0) size 556x277 [bgcolor=#EEEEEE]
    7         RenderBlock {DIV} at (1,1) size 277x127 [bgcolor=#FFEEEE]
    8           RenderBlock {P} at (14,28) size 249x22 [bgcolor=#FFAAAA] [border: (20px solid #FF8888) none (20px solid #FF8888)]
    9             RenderText {#text} at (21,0) size 181x23
    10               text run at (21,0) width 181: "\x{7B2C}\x{4E00}\x{6BB5}\x{843D} paragraph 1"
    11           RenderBlock {P} at (14,77) size 249x22 [bgcolor=#FFAAAA] [border: (20px solid #FF8888) none (20px solid #FF8888)]
    12             RenderText {#text} at (21,0) size 181x23
    13               text run at (21,0) width 181: "\x{7B2C}\x{4E8C}\x{6BB5}\x{843D} paragraph 2"
     7        RenderBlock {DIV} at (1,1) size 277x129 [bgcolor=#FFEEEE]
     8          RenderBlock {P} at (14,28) size 249x23 [bgcolor=#FFAAAA] [border: (20px solid #FF8888) none (20px solid #FF8888)]
     9            RenderText {#text} at (21,1) size 181x23
     10              text run at (21,1) width 181: "\x{7B2C}\x{4E00}\x{6BB5}\x{843D} paragraph 1"
     11          RenderBlock {P} at (14,78) size 249x23 [bgcolor=#FFAAAA] [border: (20px solid #FF8888) none (20px solid #FF8888)]
     12            RenderText {#text} at (21,1) size 181x23
     13              text run at (21,1) width 181: "\x{7B2C}\x{4E8C}\x{6BB5}\x{843D} paragraph 2"
    1414        RenderBlock {DIV} at (278,1) size 277x275 [bgcolor=#FFFFEE]
    1515          RenderBlock {P} at (14,28) size 62x219 [bgcolor=#FFAAAA] [border: (20px solid #FF8888) none (20px solid #FF8888)]
  • trunk/WebCore/ChangeLog

    r72232 r72235  
     12010-11-17  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=48537
     6
     7        Fonts with no vertical metrics should synthesize baselines when they appear
     8        on lines that do use fonts with vertical metrics.  Basically we want to make
     9        sure that English text behaves like vertical-align:middle, i.e., its baseline
     10        should be treated as though it cuts through the middle of the ascent+descent.
     11       
     12        The way this works is that each line in the line box tree is labeled as having
     13        a baseline type that is either ideographic or alphabetic for the purposes of
     14        vertical alignment.  A line becomes ideographic if any font with vertical tables
     15        is either explicitly specified as the primary font or in any of the used fonts
     16        in the text on that line.
     17       
     18        This baselineType is passed down to computeLogicalBoxHeights and placeBoxesInBlockDirection,
     19        and passed to the ascent and descent methods of the fonts that are examined.
     20        The underlying Font code selects an appropriate baseline given the type passed in.
     21       
     22        This patch also rewrites vertical alignment to lop 4 bytes off all RenderInlines and
     23        to instead carry around the cached vertical positions for RenderInlines in a new
     24        VerticalPositionCache object.  This cache only lives for a single layout
     25        operation, but it does cache information across all the lines built and placed during the
     26        layout.
     27       
     28        This matches the old behavior, since every call to layoutInlineChildren invalidated
     29        all of the vertical positions in all of the RenderInlines anyway.
     30       
     31        The VerticalPositionCache consists of two HashMaps, and it caches vertical alignment
     32        positions for both alphabetic and ideographic baseline types.
     33       
     34        The vertical-align computation has now been moved out of RenderBoxModelObject and
     35        RenderInline and just placed right into verticalPositionForBox in InlineFlowBox.
     36        This function has been changed to no longer be recursive when checking parents,
     37        and it now relies on the fact that the parent vertical alignment computation result
     38        has already been stored in the logicalTop() of that parent's line box.  By checking
     39        the line box logicalTop() value instead of recurring, the performance of first lines
     40        now significantly improves to no longer have O(n^2) behavior in the depth of the line
     41        box tree on the first line.
     42       
     43        All of the baselinePosition functions on the various RenderObjects have been amended
     44        to take a FontBaseline as the first argument.  This patch does not attempt to fix up
     45        MathML or form controls yet and just hardcodes AlphabeticBaselines for those renderers.
     46       
     47        The RenderTableCell baselinePosition virtual method has been made non-virtual and had
     48        all arguments removed, since it actually had no real connection with the rest of the
     49        baseline positioning system.  Cell baseline positioning works by calling firstLineBoxBaseline,
     50        and that method has been patched to use the cached baselineType for the first line box
     51        when computing the baseline of that line.
     52         
     53        Added fast/blockflow/vertical-baseline-alignment.html and fast/blockflow/vertical-align-table-baseline.html.
     54
     55        * WebCore.xcodeproj/project.pbxproj:
     56        * mathml/RenderMathMLFraction.cpp:
     57        (WebCore::RenderMathMLFraction::baselinePosition):
     58        * mathml/RenderMathMLFraction.h:
     59        * mathml/RenderMathMLOperator.cpp:
     60        (WebCore::RenderMathMLOperator::baselinePosition):
     61        * mathml/RenderMathMLOperator.h:
     62        * mathml/RenderMathMLRow.cpp:
     63        (WebCore::RenderMathMLRow::baselinePosition):
     64        * mathml/RenderMathMLRow.h:
     65        * mathml/RenderMathMLSubSup.cpp:
     66        (WebCore::RenderMathMLSubSup::baselinePosition):
     67        * mathml/RenderMathMLSubSup.h:
     68        * mathml/RenderMathMLUnderOver.cpp:
     69        (WebCore::RenderMathMLUnderOver::layout):
     70        (WebCore::RenderMathMLUnderOver::baselinePosition):
     71        * mathml/RenderMathMLUnderOver.h:
     72        * platform/graphics/SimpleFontData.h:
     73        * rendering/InlineBox.h:
     74        (WebCore::InlineBox::baselinePosition):
     75        * rendering/InlineFlowBox.cpp:
     76        (WebCore::verticalPositionForBox):
     77        (WebCore::InlineFlowBox::computeLogicalBoxHeights):
     78        (WebCore::InlineFlowBox::placeBoxesInBlockDirection):
     79        * rendering/InlineFlowBox.h:
     80        * rendering/InlineTextBox.cpp:
     81        (WebCore::InlineTextBox::baselinePosition):
     82        * rendering/InlineTextBox.h:
     83        * rendering/RenderBlock.cpp:
     84        (WebCore::RenderBlock::baselinePosition):
     85        (WebCore::RenderBlock::firstLineBoxBaseline):
     86        (WebCore::RenderBlock::lastLineBoxBaseline):
     87        * rendering/RenderBlock.h:
     88        * rendering/RenderBlockLineLayout.cpp:
     89        (WebCore::RenderBlock::computeBlockDirectionPositionsForLine):
     90        (WebCore::RenderBlock::layoutInlineChildren):
     91        * rendering/RenderBox.cpp:
     92        (WebCore::RenderBox::baselinePosition):
     93        * rendering/RenderBox.h:
     94        * rendering/RenderBoxModelObject.cpp:
     95        * rendering/RenderBoxModelObject.h:
     96        * rendering/RenderFileUploadControl.cpp:
     97        (WebCore::RenderFileUploadControl::paintObject):
     98        * rendering/RenderInline.cpp:
     99        (WebCore::RenderInline::RenderInline):
     100        (WebCore::RenderInline::baselinePosition):
     101        * rendering/RenderInline.h:
     102        * rendering/RenderListBox.cpp:
     103        (WebCore::RenderListBox::baselinePosition):
     104        * rendering/RenderListBox.h:
     105        * rendering/RenderListMarker.cpp:
     106        (WebCore::RenderListMarker::baselinePosition):
     107        * rendering/RenderListMarker.h:
     108        * rendering/RenderSlider.cpp:
     109        (WebCore::RenderSlider::baselinePosition):
     110        * rendering/RenderSlider.h:
     111        * rendering/RenderTableCell.cpp:
     112        (WebCore::RenderTableCell::baselinePosition):
     113        * rendering/RenderTableCell.h:
     114        * rendering/RenderTextControlMultiLine.cpp:
     115        (WebCore::RenderTextControlMultiLine::baselinePosition):
     116        * rendering/RenderTextControlMultiLine.h:
     117        * rendering/RootInlineBox.cpp:
     118        (WebCore::RootInlineBox::alignBoxesInBlockDirection):
     119        * rendering/RootInlineBox.h:
     120        (WebCore::RootInlineBox::baselinePosition):
     121        * rendering/VerticalPositionCache.h: Added.
     122        (WebCore::VerticalPositionCache::VerticalPositionCache):
     123        (WebCore::VerticalPositionCache::get):
     124        (WebCore::VerticalPositionCache::set):
     125        * rendering/svg/SVGInlineTextBox.cpp:
     126        (WebCore::SVGInlineTextBox::calculateBoundaries):
     127
    11282010-11-17  Sam Weinig  <sam@webkit.org>
    2129
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r72232 r72235  
    50175017                BCA169A20BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA169A00BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp */; };
    50185018                BCA169A30BFD55B40019CA76 /* JSHTMLTableCaptionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA169A10BFD55B40019CA76 /* JSHTMLTableCaptionElement.h */; };
     5019                BCA257151293C010007A263D /* VerticalPositionCache.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA257141293C010007A263D /* VerticalPositionCache.h */; };
    50195020                BCA2B061105047600043BD1C /* UserScript.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA2B0601050475F0043BD1C /* UserScript.h */; settings = {ATTRIBUTES = (Private, ); }; };
    50205021                BCA2B08B10505BCD0043BD1C /* UserScriptTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA2B08A10505BCD0043BD1C /* UserScriptTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1105111052                BCA169A00BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLTableCaptionElement.cpp; sourceTree = "<group>"; };
    1105211053                BCA169A10BFD55B40019CA76 /* JSHTMLTableCaptionElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLTableCaptionElement.h; sourceTree = "<group>"; };
     11054                BCA257141293C010007A263D /* VerticalPositionCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VerticalPositionCache.h; sourceTree = "<group>"; };
    1105311055                BCA2B0601050475F0043BD1C /* UserScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserScript.h; sourceTree = "<group>"; };
    1105411056                BCA2B08A10505BCD0043BD1C /* UserScriptTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserScriptTypes.h; sourceTree = "<group>"; };
     
    1810518107                                0F500AB00F54DB3100EEF928 /* TransformState.cpp */,
    1810618108                                0F500AAE0F54DB1B00EEF928 /* TransformState.h */,
     18109                                BCA257141293C010007A263D /* VerticalPositionCache.h */,
    1810718110                        );
    1810818111                        path = rendering;
     
    2133721340                                3888F6EF128C9889000CA8E0 /* InspectorFileSystemAgent.h in Headers */,
    2133821341                                BCB92D4F1293550B00C8387F /* FontBaseline.h in Headers */,
     21342                                BCA257151293C010007A263D /* VerticalPositionCache.h in Headers */,
    2133921343                                BCAE1FA712939DB7004CB026 /* ScrollAnimatorMac.h in Headers */,
    2134021344                        );
  • trunk/WebCore/mathml/RenderMathMLFraction.cpp

    r70221 r72235  
    168168}
    169169
    170 int RenderMathMLFraction::baselinePosition(bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const
     170int RenderMathMLFraction::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const
    171171{
    172172    if (firstChild() && firstChild()->isRenderMathMLBlock()) {
     
    178178        return numerator->offsetHeight() + style()->fontSize() / 3;
    179179    }
    180     return RenderBlock::baselinePosition(firstLine, lineDirection, linePositionMode);
     180    return RenderBlock::baselinePosition(AlphabeticBaseline, firstLine, lineDirection, linePositionMode);
    181181}
    182182
  • trunk/WebCore/mathml/RenderMathMLFraction.h

    r70072 r72235  
    3939    virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
    4040    virtual void updateFromElement();
    41     virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
     41    virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    4242    virtual void paint(PaintInfo&, int tx, int ty);
    4343protected:
  • trunk/WebCore/mathml/RenderMathMLOperator.cpp

    r70221 r72235  
    333333}
    334334
    335 int RenderMathMLOperator::baselinePosition(bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const
     335int RenderMathMLOperator::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const
    336336{
    337337    if (m_isStacked)
    338338        return m_stretchHeight * 2 / 3 - (m_stretchHeight - static_cast<int>(m_stretchHeight / gOperatorExpansion)) / 2;   
    339     return RenderBlock::baselinePosition(firstLine, lineDirection, linePositionMode);
     339    return RenderBlock::baselinePosition(AlphabeticBaseline, firstLine, lineDirection, linePositionMode);
    340340}
    341341   
  • trunk/WebCore/mathml/RenderMathMLOperator.h

    r70072 r72235  
    4242    virtual void updateFromElement();
    4343    virtual bool isChildAllowed(RenderObject*, RenderStyle*) const;
    44     virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
     44    virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    4545       
    4646protected:
  • trunk/WebCore/mathml/RenderMathMLRow.cpp

    r70221 r72235  
    120120}   
    121121
    122 int RenderMathMLRow::baselinePosition(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
     122int RenderMathMLRow::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
    123123{
    124124    if (firstChild() && firstChild()->isRenderMathMLBlock()) {
    125125        RenderMathMLBlock* block = toRenderMathMLBlock(firstChild());
    126126        if (block->isRenderMathMLOperator())
    127             return block->y() + block->baselinePosition(firstLine, direction, linePositionMode);
     127            return block->y() + block->baselinePosition(AlphabeticBaseline, firstLine, direction, linePositionMode);
    128128    }
    129129   
    130     return RenderBlock::baselinePosition(firstLine, direction, linePositionMode);
     130    return RenderBlock::baselinePosition(AlphabeticBaseline, firstLine, direction, linePositionMode);
    131131}
    132132   
  • trunk/WebCore/mathml/RenderMathMLRow.h

    r70221 r72235  
    3838    virtual bool isRenderMathMLRow() const { return true; }
    3939    virtual int nonOperatorHeight() const;
    40     virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;   
     40    virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;   
    4141    virtual void stretchToHeight(int) {}
    4242protected:
  • trunk/WebCore/mathml/RenderMathMLSubSup.cpp

    r70221 r72235  
    174174}
    175175
    176 int RenderMathMLSubSup::baselinePosition(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
     176int RenderMathMLSubSup::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
    177177{
    178178    RenderObject* base = firstChild();
     
    195195            // The baseline is top spacing of the base + the baseline of the base + adjusted space for zoom
    196196            float zoomFactor = style()->effectiveZoom();
    197             return topAdjust + box->baselinePosition(firstLine, direction, linePositionMode) + static_cast<int>((zoomFactor > 1.25 ? 2 : 3) * zoomFactor);
     197            return topAdjust + box->baselinePosition(AlphabeticBaseline, firstLine, direction, linePositionMode) + static_cast<int>((zoomFactor > 1.25 ? 2 : 3) * zoomFactor);
    198198        }
    199199        break;
     
    201201    case Sub:
    202202        RenderBoxModelObject* box = toRenderBoxModelObject(base);
    203         baseline = box->baselinePosition(firstLine, direction, linePositionMode);
     203        baseline = box->baselinePosition(AlphabeticBaseline, firstLine, direction, linePositionMode);
    204204        break;
    205205    }
  • trunk/WebCore/mathml/RenderMathMLSubSup.h

    r70072 r72235  
    4242    virtual int nonOperatorHeight() const;
    4343    virtual void stretchToHeight(int pixelHeight);
    44     virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
     44    virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    4545
    4646protected:
  • trunk/WebCore/mathml/RenderMathMLUnderOver.cpp

    r70221 r72235  
    159159                break;
    160160           
    161             int overSpacing = static_cast<int>(gOverSpacingAdjustment * (getOffsetHeight(over) - toRenderBoxModelObject(over->firstChild())->baselinePosition(true, HorizontalLine)));
     161            int overSpacing = static_cast<int>(gOverSpacingAdjustment * (getOffsetHeight(over) - toRenderBoxModelObject(over->firstChild())->baselinePosition(AlphabeticBaseline, true, HorizontalLine)));
    162162           
    163163            // base row wrapper
     
    189189            // FIXME: We need to look at the space between a single maximum height of
    190190            //        the line boxes and the baseline and squeeze them together
    191             int underSpacing = baseHeight - toRenderBoxModelObject(base)->baselinePosition(true, HorizontalLine);
     191            int underSpacing = baseHeight - toRenderBoxModelObject(base)->baselinePosition(AlphabeticBaseline, true, HorizontalLine);
    192192           
    193193            // adjust the base's intrusion into the under
     
    210210            if (!over->firstChild()->isBoxModelObject())
    211211                break;
    212             int overSpacing = static_cast<int>(gOverSpacingAdjustment * (getOffsetHeight(over) - toRenderBoxModelObject(over->firstChild())->baselinePosition(true, HorizontalLine)));
     212            int overSpacing = static_cast<int>(gOverSpacingAdjustment * (getOffsetHeight(over) - toRenderBoxModelObject(over->firstChild())->baselinePosition(AlphabeticBaseline, true, HorizontalLine)));
    213213           
    214214            // base row wrapper
     
    230230                // FIXME: We need to look at the space between a single maximum height of
    231231                //        the line boxes and the baseline and squeeze them together
    232                 int underSpacing = baseHeight - toRenderBoxModelObject(base)->baselinePosition(true, HorizontalLine);
     232                int underSpacing = baseHeight - toRenderBoxModelObject(base)->baselinePosition(AlphabeticBaseline, true, HorizontalLine);
    233233               
    234234                RenderObject* under = lastChild();
     
    244244}
    245245
    246 int RenderMathMLUnderOver::baselinePosition(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
     246int RenderMathMLUnderOver::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
    247247{
    248248    RenderObject* current = firstChild();
    249249    if (!current)
    250         return RenderBlock::baselinePosition(firstLine, direction, linePositionMode);
     250        return RenderBlock::baselinePosition(AlphabeticBaseline, firstLine, direction, linePositionMode);
    251251
    252252    int baseline = 0;
     
    261261            if (!base || !base->isBoxModelObject())
    262262                break;
    263             baseline += toRenderBoxModelObject(base)->baselinePosition(firstLine, HorizontalLine, linePositionMode);
     263            baseline += toRenderBoxModelObject(base)->baselinePosition(AlphabeticBaseline, firstLine, HorizontalLine, linePositionMode);
    264264            // added the negative top margin
    265265            baseline += current->style()->marginTop().value();
     
    269269        RenderObject* base = current->firstChild();
    270270        if (base && base->isBoxModelObject())
    271             baseline += toRenderBoxModelObject(base)->baselinePosition(true, HorizontalLine);
     271            baseline += toRenderBoxModelObject(base)->baselinePosition(AlphabeticBaseline, true, HorizontalLine);
    272272    }
    273273
  • trunk/WebCore/mathml/RenderMathMLUnderOver.h

    r70072 r72235  
    4141    virtual bool hasBase() const { return true; }
    4242    virtual int nonOperatorHeight() const;
    43     virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;   
     43    virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;   
    4444    virtual void stretchToHeight(int pixelHeight);
    4545private:
  • trunk/WebCore/platform/graphics/SimpleFontData.h

    r72165 r72235  
    8181    SimpleFontData* brokenIdeographFontData() const;
    8282   
    83     // vertical metrics
     83    // FIXME: Use the actual metrics for fonts with vertical tables instead of just hard-coding.  If the font is horizontally oriented or
     84    // a broken ideographic font, then just hard-code to split ascent/descent down the middle.  Otherwise we should actually use the metrics
     85    // from the font itself.
    8486    int ascent(FontBaseline baselineType = AlphabeticBaseline) const { return baselineType == AlphabeticBaseline ? m_ascent : height() - height() / 2; }
    8587    int descent(FontBaseline baselineType = AlphabeticBaseline) const { return baselineType == AlphabeticBaseline ? m_descent : height() / 2; }
  • trunk/WebCore/rendering/InlineBox.h

    r71700 r72235  
    256256    int logicalHeight() const;
    257257
    258     virtual int baselinePosition() const { return boxModelObject()->baselinePosition(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine); }
     258    virtual int baselinePosition(FontBaseline baselineType) const { return boxModelObject()->baselinePosition(baselineType, m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine); }
    259259    virtual int lineHeight() const { return boxModelObject()->lineHeight(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine); }
    260260   
  • trunk/WebCore/rendering/InlineFlowBox.cpp

    r72173 r72235  
    3636#include "RootInlineBox.h"
    3737#include "Text.h"
     38#include "VerticalPositionCache.h"
    3839
    3940#include <math.h>
     
    425426}
    426427
    427 static int verticalPositionForBox(InlineBox* curr, bool firstLine)
    428 {
    429     if (curr->renderer()->isText())
    430         return curr->parent()->logicalTop();
    431     if (curr->renderer()->isBox())
    432         return toRenderBox(curr->renderer())->verticalPosition(firstLine);
    433     return toRenderInline(curr->renderer())->verticalPositionFromCache(firstLine);
     428static int verticalPositionForBox(InlineBox* box, FontBaseline baselineType, bool firstLine, VerticalPositionCache& verticalPositionCache)
     429{
     430    if (box->renderer()->isText())
     431        return box->parent()->logicalTop();
     432   
     433    RenderBoxModelObject* renderer = box->boxModelObject();
     434    ASSERT(renderer->isInline());
     435    if (!renderer->isInline())
     436        return 0;
     437
     438    // This method determines the vertical position for inline elements.
     439    if (firstLine && !renderer->document()->usesFirstLineRules())
     440        firstLine = false;
     441
     442    // Check the cache.
     443    bool isRenderInline = renderer->isRenderInline();
     444    if (isRenderInline && !firstLine) {
     445        int verticalPosition = verticalPositionCache.get(renderer, baselineType);
     446        if (verticalPosition != PositionUndefined)
     447            return verticalPosition;
     448    }
     449
     450    int verticalPosition = 0;
     451    EVerticalAlign verticalAlign = renderer->style()->verticalAlign();
     452    if (verticalAlign == TOP)
     453        verticalPosition = PositionTop;
     454    else if (verticalAlign == BOTTOM)
     455        verticalPosition = PositionBottom;
     456    else {
     457        RenderObject* parent = renderer->parent();
     458        if (parent->isRenderInline() && parent->style()->verticalAlign() != TOP && parent->style()->verticalAlign() != BOTTOM)
     459            verticalPosition = box->parent()->logicalTop();
     460       
     461        if (verticalAlign != BASELINE) {
     462            const Font& font = parent->style(firstLine)->font();
     463            int fontSize = font.pixelSize();
     464
     465            LineDirectionMode lineDirection = parent->style()->isHorizontalWritingMode() ? HorizontalLine : VerticalLine;
     466
     467            if (verticalAlign == SUB)
     468                verticalPosition += fontSize / 5 + 1;
     469            else if (verticalAlign == SUPER)
     470                verticalPosition -= fontSize / 3 + 1;
     471            else if (verticalAlign == TEXT_TOP)
     472                verticalPosition += renderer->baselinePosition(baselineType, firstLine, lineDirection) - font.ascent(baselineType);
     473            else if (verticalAlign == MIDDLE)
     474                verticalPosition += -static_cast<int>(font.xHeight() / 2) - renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType, firstLine, lineDirection);
     475            else if (verticalAlign == TEXT_BOTTOM) {
     476                verticalPosition += font.descent(baselineType);
     477                // lineHeight - baselinePosition is always 0 for replaced elements (except inline blocks), so don't bother wasting time in that case.
     478                if (!renderer->isReplaced() || renderer->isInlineBlockOrInlineTable())
     479                    verticalPosition -= (renderer->lineHeight(firstLine, lineDirection) - renderer->baselinePosition(baselineType, firstLine, lineDirection));
     480            } else if (verticalAlign == BASELINE_MIDDLE)
     481                verticalPosition += -renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType, firstLine, lineDirection);
     482            else if (verticalAlign == LENGTH)
     483                verticalPosition -= renderer->style()->verticalAlignLength().calcValue(renderer->lineHeight(firstLine, lineDirection));
     484        }
     485    }
     486
     487    // Store the cached value.
     488    if (isRenderInline && !firstLine)
     489        verticalPositionCache.set(renderer, baselineType, verticalPosition);
     490
     491    return verticalPosition;
    434492}
    435493
    436494void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom,
    437495                                             int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent,
    438                                              bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
     496                                             bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap,
     497                                             FontBaseline baselineType, VerticalPositionCache& verticalPositionCache)
    439498{
    440499    // The primary purpose of this function is to compute the maximal ascent and descent values for
     
    451510        // Examine our root box.
    452511        int height = lineHeight();
    453         int baseline = baselinePosition();
     512        int baseline = baselinePosition(baselineType);
    454513        if (hasTextChildren() || strictMode) {
    455514            int ascent = baseline;
     
    481540        // and the root box's baseline.  The value is negative if the child box's baseline is above the
    482541        // root box's baseline, and it is positive if the child box's baseline is below the root box's baseline.
    483         curr->setLogicalTop(verticalPositionForBox(curr, m_firstLine));
     542        curr->setLogicalTop(verticalPositionForBox(curr, baselineType, m_firstLine, verticalPositionCache));
    484543       
    485544        int lineHeight;
     
    498557            int baselineToBottom = 0;
    499558            for (size_t i = 0; i < usedFonts->size(); ++i) {
    500                 int halfLeading = (usedFonts->at(i)->lineSpacing() - usedFonts->at(i)->ascent() - usedFonts->at(i)->descent()) / 2;
    501                 int usedFontAscent = halfLeading + usedFonts->at(i)->ascent();
     559                int halfLeading = (usedFonts->at(i)->lineSpacing() - usedFonts->at(i)->height()) / 2;
     560                int usedFontAscent = halfLeading + usedFonts->at(i)->ascent(baselineType);
    502561                int usedFontDescent = usedFonts->at(i)->lineSpacing() - usedFontAscent;
    503562                if (!baselineSet) {
     
    513572        } else {
    514573            lineHeight = curr->lineHeight();
    515             baseline = curr->baselinePosition();
     574            baseline = curr->baselinePosition(baselineType);
    516575            if (curr->isText() || isInlineFlow) {
    517576                // Examine the font box for inline flows and text boxes to see if any part of it is above the baseline.
    518577                // If the top of our font box relative to the root box baseline is above the root box baseline, then
    519578                // we are contributing to the maxAscent value.
    520                 affectsAscent = curr->renderer()->style(m_firstLine)->font().ascent() - curr->logicalTop() > 0;
     579                affectsAscent = curr->renderer()->style(m_firstLine)->font().ascent(baselineType) - curr->logicalTop() > 0;
    521580               
    522581                // Descent is similar.  If any part of our font box is below the root box's baseline, then
    523582                // we contribute to the maxDescent value.
    524                 affectsDescent = curr->renderer()->style(m_firstLine)->font().descent() + curr->logicalTop() > 0;
     583                affectsDescent = curr->renderer()->style(m_firstLine)->font().descent(baselineType) + curr->logicalTop() > 0;
    525584            } else {
    526585                // Replaced elements always affect both the ascent and descent.
     
    556615
    557616        if (curr->isInlineFlowBox())
    558             static_cast<InlineFlowBox*>(curr)->computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, strictMode, textBoxDataMap);
    559     }
    560 }
    561 
    562 void InlineFlowBox::placeBoxesInBlockDirection(int top, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom, bool& setLineTop)
     617            static_cast<InlineFlowBox*>(curr)->computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent,
     618                                                                        setMaxAscent, setMaxDescent, strictMode, textBoxDataMap,
     619                                                                        baselineType, verticalPositionCache);
     620    }
     621}
     622
     623void InlineFlowBox::placeBoxesInBlockDirection(int top, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom, bool& setLineTop, FontBaseline baselineType)
    563624{
    564625    if (isRootInlineBox())
    565         setLogicalTop(top + maxAscent - baselinePosition()); // Place our root box.
     626        setLogicalTop(top + maxAscent - baselinePosition(baselineType)); // Place our root box.
    566627
    567628    for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
     
    573634        bool isInlineFlow = curr->isInlineFlowBox();
    574635        if (isInlineFlow)
    575             static_cast<InlineFlowBox*>(curr)->placeBoxesInBlockDirection(top, maxHeight, maxAscent, strictMode, lineTop, lineBottom, setLineTop);
     636            static_cast<InlineFlowBox*>(curr)->placeBoxesInBlockDirection(top, maxHeight, maxAscent, strictMode, lineTop, lineBottom, setLineTop, baselineType);
    576637
    577638        bool childAffectsTopBottomPos = true;
     
    583644            if ((isInlineFlow && !static_cast<InlineFlowBox*>(curr)->hasTextChildren()) && !curr->boxModelObject()->hasInlineDirectionBordersOrPadding() && !strictMode)
    584645                childAffectsTopBottomPos = false;
    585             int posAdjust = maxAscent - curr->baselinePosition();
     646            int posAdjust = maxAscent - curr->baselinePosition(baselineType);
    586647            curr->setLogicalTop(curr->logicalTop() + top + posAdjust);
    587648        }
     
    590651        if (curr->isText() || curr->isInlineFlowBox()) {
    591652            const Font& font = curr->renderer()->style(m_firstLine)->font();
    592             newLogicalTop += curr->baselinePosition() - font.ascent();
     653            newLogicalTop += curr->baselinePosition(baselineType) - font.ascent(baselineType);
    593654            if (curr->isInlineFlowBox()) {
    594655                RenderBoxModelObject* boxObject = toRenderBoxModelObject(curr->renderer());
     
    616677    if (isRootInlineBox()) {
    617678        const Font& font = renderer()->style(m_firstLine)->font();
    618         setLogicalTop(logicalTop() + baselinePosition() - font.ascent());
     679        setLogicalTop(logicalTop() + baselinePosition(baselineType) - font.ascent(baselineType));
    619680       
    620681        if (hasTextChildren() || strictMode) {
  • trunk/WebCore/rendering/InlineFlowBox.h

    r72168 r72235  
    3131class InlineTextBox;
    3232class RenderLineBoxList;
     33class VerticalPositionCache;
    3334
    3435typedef HashMap<const InlineTextBox*, pair<Vector<const SimpleFontData*>, GlyphOverflow> > GlyphOverflowAndFallbackFontsMap;
     
    157158    void computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom,
    158159                                  int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent,
    159                                   bool strictMode, GlyphOverflowAndFallbackFontsMap&);
     160                                  bool strictMode, GlyphOverflowAndFallbackFontsMap&, FontBaseline, VerticalPositionCache&);
    160161    void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent,
    161162                                   int maxPositionTop, int maxPositionBottom);
    162     void placeBoxesInBlockDirection(int logicalTop, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom, bool& setLineTop);
     163    void placeBoxesInBlockDirection(int logicalTop, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom, bool& setLineTop, FontBaseline);
    163164    void flipLinesInBlockDirection(int lineTop, int lineBottom);
    164165    void computeBlockDirectionOverflow(int lineTop, int lineBottom, bool strictMode, GlyphOverflowAndFallbackFontsMap&);
  • trunk/WebCore/rendering/InlineTextBox.cpp

    r71851 r72235  
    4444namespace WebCore {
    4545
    46 int InlineTextBox::baselinePosition() const
     46int InlineTextBox::baselinePosition(FontBaseline baselineType) const
    4747{
    4848    if (!isText() || !parent())
    4949        return 0;
    50     return parent()->baselinePosition();
     50    return parent()->baselinePosition(baselineType);
    5151}
    5252   
  • trunk/WebCore/rendering/InlineTextBox.h

    r71465 r72235  
    7171
    7272   
    73     virtual int baselinePosition() const;
     73    virtual int baselinePosition(FontBaseline) const;
    7474    virtual int lineHeight() const;
    7575
  • trunk/WebCore/rendering/RenderBlock.cpp

    r71851 r72235  
    52585258}
    52595259
    5260 int RenderBlock::baselinePosition(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
     5260int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
    52615261{
    52625262    // Inline blocks are replaced elements. Otherwise, just pass off to
     
    52875287            return direction == HorizontalLine ? marginTop() + baselinePos : marginRight() + baselinePos;
    52885288           
    5289         return RenderBox::baselinePosition(firstLine, direction, linePositionMode);
     5289        return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
    52905290    }
    52915291
    52925292    const Font& f = style(firstLine)->font();
    5293     return f.ascent() + (lineHeight(firstLine, direction, linePositionMode) - f.height()) / 2;
     5293    return f.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - f.height()) / 2;
    52945294}
    52955295
     
    53015301    if (childrenInline()) {
    53025302        if (firstLineBox())
    5303             return firstLineBox()->logicalTop() + style(true)->font().ascent();
     5303            return firstLineBox()->logicalTop() + style(true)->font().ascent(firstRootBox()->baselineType());
    53045304        else
    53055305            return -1;
     
    53315331        }
    53325332        if (lastLineBox())
    5333             return lastLineBox()->logicalTop() + style(lastLineBox() == firstLineBox())->font().ascent();
     5333            return lastLineBox()->logicalTop() + style(lastLineBox() == firstLineBox())->font().ascent(lastRootBox()->baselineType());
    53345334        return -1;
    53355335    } else {
  • trunk/WebCore/rendering/RenderBlock.h

    r71465 r72235  
    5959    // These two functions are overridden for inline-block.
    6060    virtual int lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    61     virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
     61    virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    6262
    6363    RenderLineBoxList* lineBoxes() { return &m_lineBoxes; }
     
    459459    InlineFlowBox* createLineBoxes(RenderObject*, bool firstLine);
    460460    void computeInlineDirectionPositionsForLine(RootInlineBox*, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&);
    461     void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOverflowAndFallbackFontsMap&);
     461    void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&);
    462462    void deleteEllipsisLineBoxes();
    463463    void checkLinesForTextOverflow();
  • trunk/WebCore/rendering/RenderBlockLineLayout.cpp

    r71851 r72235  
    3636#include "Settings.h"
    3737#include "TrailingFloatsRootInlineBox.h"
     38#include "VerticalPositionCache.h"
    3839#include "break_lines.h"
    3940#include <wtf/AlwaysInline.h>
     
    471472}
    472473
    473 void RenderBlock::computeBlockDirectionPositionsForLine(RootInlineBox* lineBox, BidiRun* firstRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
    474 {
    475     setLogicalHeight(lineBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap));
     474void RenderBlock::computeBlockDirectionPositionsForLine(RootInlineBox* lineBox, BidiRun* firstRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap,
     475                                                        VerticalPositionCache& verticalPositionCache)
     476{
     477    setLogicalHeight(lineBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, verticalPositionCache));
    476478    lineBox->setBlockLogicalHeight(logicalHeight());
    477479
     
    568570                    dirtyLineBoxesForRenderer(o, fullLayout);
    569571                o->setNeedsLayout(false);
    570                 if (!o->isText())
    571                     toRenderInline(o)->invalidateVerticalPosition(); // FIXME: Should do better here and not always invalidate everything.
    572572            }
    573573            o = bidiNext(this, o, 0, false, &endOfInline);
     
    648648        bool isLineEmpty = true;
    649649        bool paginated = view()->layoutState() && view()->layoutState()->isPaginated();
     650
     651        VerticalPositionCache verticalPositionCache;
    650652
    651653        while (!end.atEnd()) {
     
    749751
    750752                        // Now position our text runs vertically.
    751                         computeBlockDirectionPositionsForLine(lineBox, resolver.firstRun(), textBoxDataMap);
     753                        computeBlockDirectionPositionsForLine(lineBox, resolver.firstRun(), textBoxDataMap, verticalPositionCache);
    752754
    753755#if ENABLE(SVG)
     
    879881                trailingFloatsLineBox->setConstructed();
    880882                GlyphOverflowAndFallbackFontsMap textBoxDataMap;
    881                 trailingFloatsLineBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap);
     883                VerticalPositionCache verticalPositionCache;
     884                trailingFloatsLineBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, verticalPositionCache);
    882885                trailingFloatsLineBox->setBlockDirectionOverflowPositions(logicalHeight(), bottomLayoutOverflow, logicalHeight(), bottomVisualOverflow);
    883886                trailingFloatsLineBox->setBlockLogicalHeight(logicalHeight());
  • trunk/WebCore/rendering/RenderBox.cpp

    r71980 r72235  
    31903190}
    31913191
    3192 int RenderBox::baselinePosition(bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const
    3193 {
    3194     if (isReplaced())
    3195         return direction == HorizontalLine ? m_marginTop + height() + m_marginBottom : m_marginRight + width() + m_marginLeft;
     3192int RenderBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const
     3193{
     3194    if (isReplaced()) {
     3195        int result = direction == HorizontalLine ? m_marginTop + height() + m_marginBottom : m_marginRight + width() + m_marginLeft;
     3196        if (baselineType == AlphabeticBaseline)
     3197            return result;
     3198        return result - result / 2;
     3199    }
    31963200    return 0;
    31973201}
  • trunk/WebCore/rendering/RenderBox.h

    r71851 r72235  
    379379   
    380380    virtual int lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    381     virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
     381    virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    382382
    383383    enum FlippingAdjustment { ChildToParentFlippingAdjustment, ParentToChildFlippingAdjustment };
  • trunk/WebCore/rendering/RenderBoxModelObject.cpp

    r71055 r72235  
    846846}
    847847
    848 int RenderBoxModelObject::verticalPosition(bool firstLine) const
    849 {
    850     // This method determines the vertical position for inline elements.
    851     ASSERT(isInline());
    852     if (!isInline())
    853         return 0;
    854 
    855     int vpos = 0;
    856     EVerticalAlign va = style()->verticalAlign();
    857     if (va == TOP)
    858         vpos = PositionTop;
    859     else if (va == BOTTOM)
    860         vpos = PositionBottom;
    861     else {
    862         bool checkParent = parent()->isRenderInline() && parent()->style()->verticalAlign() != TOP && parent()->style()->verticalAlign() != BOTTOM;
    863         vpos = checkParent ? toRenderInline(parent())->verticalPositionFromCache(firstLine) : 0;
    864         // don't allow elements nested inside text-top to have a different valignment.
    865         if (va == BASELINE)
    866             return vpos;
    867 
    868         const Font& f = parent()->style(firstLine)->font();
    869         int fontsize = f.pixelSize();
    870 
    871         LineDirectionMode lineDirection = parent()->style()->isHorizontalWritingMode() ? HorizontalLine : VerticalLine;
    872 
    873         if (va == SUB)
    874             vpos += fontsize / 5 + 1;
    875         else if (va == SUPER)
    876             vpos -= fontsize / 3 + 1;
    877         else if (va == TEXT_TOP)
    878             vpos += baselinePosition(firstLine, lineDirection) - f.ascent();
    879         else if (va == MIDDLE)
    880             vpos += -static_cast<int>(f.xHeight() / 2) - lineHeight(firstLine, lineDirection) / 2 + baselinePosition(firstLine, lineDirection);
    881         else if (va == TEXT_BOTTOM) {
    882             vpos += f.descent();
    883             // lineHeight - baselinePosition is always 0 for replaced elements (except inline blocks), so don't bother wasting time in that case.
    884             if (!isReplaced() || style()->display() == INLINE_BLOCK)
    885                 vpos -= (lineHeight(firstLine, lineDirection) - baselinePosition(firstLine, lineDirection));
    886         } else if (va == BASELINE_MIDDLE)
    887             vpos += -lineHeight(firstLine, lineDirection) / 2 + baselinePosition(firstLine, lineDirection);
    888         else if (va == LENGTH)
    889             vpos -= style()->verticalAlignLength().calcValue(lineHeight(firstLine, lineDirection));
    890     }
    891 
    892     return vpos;
    893 }
    894 
    895848bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, int tx, int ty, int w, int h, const RenderStyle* style,
    896849                                               const NinePieceImage& ninePieceImage, CompositeOperator op)
  • trunk/WebCore/rendering/RenderBoxModelObject.h

    r70843 r72235  
    2828
    2929namespace WebCore {
    30 
    31 // Values for vertical alignment.
    32 const int PositionTop = -0x7fffffff;
    33 const int PositionBottom = 0x7fffffff;
    34 const int PositionUndefined = 0x80000000;
    3530
    3631// Modes for some of the line-related functions.
     
    114109    void paintBoxShadow(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
    115110    void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, int tx, int ty, int width, int height, InlineFlowBox* = 0, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
    116 
    117     // The difference between this inline's baseline position and the line's baseline position.
    118     int verticalPosition(bool firstLine) const;
    119111   
    120112    // Overridden by subclasses to determine line height and baseline position.
    121113    virtual int lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
    122     virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
     114    virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
    123115
    124116    // Called by RenderObject::destroy() (and RenderWidget::destroy()) and is the only way layers should ever be destroyed
  • trunk/WebCore/rendering/RenderFileUploadControl.cpp

    r70072 r72235  
    232232        int textY = buttonRenderer->absoluteBoundingBoxRect().y()
    233233            + buttonRenderer->marginTop() + buttonRenderer->borderTop() + buttonRenderer->paddingTop()
    234             + buttonRenderer->baselinePosition(true, HorizontalLine, PositionOnContainingLine);
     234            + buttonRenderer->baselinePosition(AlphabeticBaseline, true, HorizontalLine, PositionOnContainingLine);
    235235
    236236        paintInfo.context->setFillColor(style()->visitedDependentColor(CSSPropertyColor), style()->colorSpace());
  • trunk/WebCore/rendering/RenderInline.cpp

    r71851 r72235  
    4949    , m_continuation(0)
    5050    , m_lineHeight(-1)
    51     , m_verticalPosition(PositionUndefined)
    5251{
    5352    setChildrenInline(true);
     
    904903}
    905904
    906 int RenderInline::baselinePosition(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
     905int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
    907906{
    908907    const Font& f = style(firstLine)->font();
    909     return f.ascent() + (lineHeight(firstLine, direction, linePositionMode) - f.height()) / 2;
    910 }
    911 
    912 int RenderInline::verticalPositionFromCache(bool firstLine) const
    913 {
    914     if (firstLine) // We're only really a first-line style if the document actually uses first-line rules.
    915         firstLine = document()->usesFirstLineRules();
    916     int vpos = m_verticalPosition;
    917     if (m_verticalPosition == PositionUndefined || firstLine) {
    918         vpos = verticalPosition(firstLine);
    919         if (!firstLine)
    920             m_verticalPosition = vpos;
    921     }
    922     return vpos;
     908    return f.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - f.height()) / 2;
    923909}
    924910
  • trunk/WebCore/rendering/RenderInline.h

    r70072 r72235  
    7878    void paintOutline(GraphicsContext*, int tx, int ty);
    7979
    80     int verticalPositionFromCache(bool firstLine) const;
    81     void invalidateVerticalPosition() { m_verticalPosition = PositionUndefined; }
    82 
    8380protected:
    8481    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
     
    135132
    136133    virtual int lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    137     virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
     134    virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    138135   
    139136    virtual void childBecameNonInline(RenderObject* child);
     
    160157                                          // <b> will just have an inline as its continuation.
    161158    mutable int m_lineHeight;
    162     mutable int m_verticalPosition;
    163159};
    164160
  • trunk/WebCore/rendering/RenderListBox.cpp

    r70072 r72235  
    239239}
    240240
    241 int RenderListBox::baselinePosition(bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const
    242 {
    243     return RenderBox::baselinePosition(firstLine, lineDirection, linePositionMode) - baselineAdjustment;
     241int RenderListBox::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const
     242{
     243    return RenderBox::baselinePosition(baselineType, firstLine, lineDirection, linePositionMode) - baselineAdjustment;
    244244}
    245245
  • trunk/WebCore/rendering/RenderListBox.h

    r70072 r72235  
    7272
    7373    virtual void computePreferredLogicalWidths();
    74     virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
     74    virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    7575    virtual void computeLogicalHeight();
    7676
  • trunk/WebCore/rendering/RenderListMarker.cpp

    r71700 r72235  
    15311531}
    15321532
    1533 int RenderListMarker::baselinePosition(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
     1533int RenderListMarker::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
    15341534{
    15351535    if (!isImage())
    1536         return m_listItem->baselinePosition(firstLine, direction, PositionOfInteriorLineBoxes);
    1537     return RenderBox::baselinePosition(firstLine, direction, linePositionMode);
     1536        return m_listItem->baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes);
     1537    return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
    15381538}
    15391539
  • trunk/WebCore/rendering/RenderListMarker.h

    r70072 r72235  
    6060
    6161    virtual int lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    62     virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
     62    virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    6363
    6464    bool isImage() const;
  • trunk/WebCore/rendering/RenderSlider.cpp

    r71851 r72235  
    156156}
    157157
    158 int RenderSlider::baselinePosition(bool /*firstLine*/, LineDirectionMode, LinePositionMode) const
    159 {
     158int RenderSlider::baselinePosition(FontBaseline, bool /*firstLine*/, LineDirectionMode, LinePositionMode) const
     159{
     160    // FIXME: Patch this function for writing-mode.
    160161    return height() + marginTop();
    161162}
  • trunk/WebCore/rendering/RenderSlider.h

    r70072 r72235  
    4343        virtual bool isSlider() const { return true; }
    4444
    45         virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
     45        virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    4646        virtual void computePreferredLogicalWidths();
    4747        virtual void layout();
  • trunk/WebCore/rendering/RenderTableCell.cpp

    r71251 r72235  
    291291}
    292292
    293 int RenderTableCell::baselinePosition(bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const
    294 {
    295     // FIXME: This function still needs to be patched for writing-mode.
    296     if (linePositionMode == PositionOfInteriorLineBoxes)
    297         return RenderBlock::baselinePosition(firstLine, lineDirection, linePositionMode);
    298 
     293int RenderTableCell::baselinePosition() const
     294{
    299295    // <http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout>: The baseline of a cell is the baseline of
    300296    // the first in-flow line box in the cell, or the first in-flow table-row in the cell, whichever comes first. If there
     
    303299    if (firstLineBaseline != -1)
    304300        return firstLineBaseline;
    305     return paddingTop() + borderTop() + contentHeight();
     301    return paddingBefore() + borderBefore() + contentLogicalHeight();
    306302}
    307303
  • trunk/WebCore/rendering/RenderTableCell.h

    r71251 r72235  
    9999    void paintBackgroundsBehindCell(PaintInfo&, int tx, int ty, RenderObject* backgroundObject);
    100100
    101     virtual int baselinePosition(bool firstLine = false, LineDirectionMode = HorizontalLine, LinePositionMode = PositionOnContainingLine) const;
     101    int baselinePosition() const;
    102102
    103103    void setIntrinsicPaddingBefore(int p) { m_intrinsicPaddingBefore = p; }
  • trunk/WebCore/rendering/RenderTextControlMultiLine.cpp

    r72052 r72235  
    9595}
    9696
    97 int RenderTextControlMultiLine::baselinePosition(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
     97int RenderTextControlMultiLine::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
    9898{
    99     return RenderBox::baselinePosition(firstLine, direction, linePositionMode);
     99    return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
    100100}
    101101
  • trunk/WebCore/rendering/RenderTextControlMultiLine.h

    r72052 r72235  
    4444    virtual int preferredContentWidth(float charWidth) const;
    4545    virtual void adjustControlHeightBasedOnLineHeight(int lineHeight);
    46     virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
     46    virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
    4747
    4848    virtual void updateFromElement();
  • trunk/WebCore/rendering/RootInlineBox.cpp

    r72168 r72235  
    216216}
    217217
    218 int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
     218int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache)
    219219{
    220220#if ENABLE(SVG)
     
    236236    m_baselineType = requiresIdeographicBaseline(textBoxDataMap) ? IdeographicBaseline : AlphabeticBaseline;
    237237
    238     computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, noQuirksMode, textBoxDataMap);
     238    computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, noQuirksMode,
     239                             textBoxDataMap, m_baselineType, verticalPositionCache);
    239240
    240241    if (maxAscent + maxDescent < max(maxPositionTop, maxPositionBottom))
     
    245246    int lineBottom = heightOfBlock;
    246247    bool setLineTop = false;
    247     placeBoxesInBlockDirection(heightOfBlock, maxHeight, maxAscent, noQuirksMode, lineTop, lineBottom, setLineTop);
     248    placeBoxesInBlockDirection(heightOfBlock, maxHeight, maxAscent, noQuirksMode, lineTop, lineBottom, setLineTop, m_baselineType);
    248249    computeBlockDirectionOverflow(lineTop, lineBottom, noQuirksMode, textBoxDataMap);
    249250    setLineTopBottomPositions(lineTop, lineBottom);
  • trunk/WebCore/rendering/RootInlineBox.h

    r72168 r72235  
    5858    int selectionHeight() const { return max(0, selectionBottom() - selectionTop()); }
    5959
    60     int alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAndFallbackFontsMap&);
     60    int alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&);
    6161    void setLineTopBottomPositions(int top, int bottom);
    6262
     
    8989    virtual void clearTruncation();
    9090
    91     virtual int baselinePosition() const { return boxModelObject()->baselinePosition(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); }
     91    virtual int baselinePosition(FontBaseline baselineType) const { return boxModelObject()->baselinePosition(baselineType, m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); }
    9292    virtual int lineHeight() const { return boxModelObject()->lineHeight(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); }
    9393
  • trunk/WebCore/rendering/svg/SVGInlineTextBox.cpp

    r71067 r72235  
    589589    ASSERT(style);
    590590
    591     int baseline = baselinePosition();
     591    int baseline = baselinePosition(AlphabeticBaseline);
    592592    int heightDifference = baseline - style->font().ascent();
    593593
Note: See TracChangeset for help on using the changeset viewer.