Use out-of-band messaging for RenderBox::firstLineBaseline() and RenderBox::inlineBlo...
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Mar 2015 18:22:06 +0000 (18:22 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Mar 2015 18:22:06 +0000 (18:22 +0000)
commitb2448c809167ba4ada39ff1ad6834690af37880e
tree69bdc1685b7594ca90b42a9f22d173c9542ee839
parent0e315bcb95d0b435b9272031d4aae9ac1eeb399d
Use out-of-band messaging for RenderBox::firstLineBaseline() and RenderBox::inlineBlockBaseline()
https://bugs.webkit.org/show_bug.cgi?id=142569

Reviewed by David Hyatt.

Source/WebCore:

Currently, RenderBox::firstLineBaseline() and RenderBox::inlineBlockBaseline() return -1 to mean
that its baseline should be skipped. Instead of using this sentinel value, this patch changes the
return type from int to Optional<int>.

No new tests because there is no behavior change.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::baselinePosition):
(WebCore::RenderBlock::firstLineBaseline):
(WebCore::RenderBlock::inlineBlockBaseline):
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::firstLineBaseline):
(WebCore::RenderBlockFlow::inlineBlockBaseline):
* rendering/RenderBlockFlow.h:
* rendering/RenderBox.h:
(WebCore::RenderBox::firstLineBaseline):
(WebCore::RenderBox::inlineBlockBaseline):
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::baselinePosition):
(WebCore::RenderFlexibleBox::firstLineBaseline):
(WebCore::RenderFlexibleBox::inlineBlockBaseline):
(WebCore::RenderFlexibleBox::marginBoxAscentForChild):
* rendering/RenderFlexibleBox.h:
* rendering/RenderMenuList.h:
* rendering/RenderTable.cpp:
(WebCore::RenderTable::cellAbove):
(WebCore::RenderTable::cellBelow):
(WebCore::RenderTable::cellBefore):
(WebCore::RenderTable::cellAfter):
(WebCore::RenderTable::firstLineBlock):
(WebCore::RenderTable::baselinePosition):
(WebCore::RenderTable::inlineBlockBaseline):
(WebCore::RenderTable::firstLineBaseline):
* rendering/RenderTable.h:
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::cellBaselinePosition):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::firstLineBaseline):
* rendering/RenderTableSection.h:
* rendering/RenderTextControl.h:
* rendering/mathml/RenderMathMLBlock.cpp:
(WebCore::RenderMathMLBlock::baselinePosition):
(WebCore::RenderMathMLTable::firstLineBaseline):
* rendering/mathml/RenderMathMLBlock.h:
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::firstLineBaseline):
* rendering/mathml/RenderMathMLFraction.h:
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::firstLineBaseline):
* rendering/mathml/RenderMathMLOperator.h:
* rendering/mathml/RenderMathMLRoot.cpp:
(WebCore::RenderMathMLRoot::firstLineBaseline):
(WebCore::RenderMathMLRoot::layout):
* rendering/mathml/RenderMathMLRoot.h:
* rendering/mathml/RenderMathMLRow.cpp:
(WebCore::RenderMathMLRow::layout):
* rendering/mathml/RenderMathMLScripts.cpp:
(WebCore::RenderMathMLScripts::layout):
(WebCore::RenderMathMLScripts::firstLineBaseline):
* rendering/mathml/RenderMathMLScripts.h:
* rendering/mathml/RenderMathMLSpace.cpp:
(WebCore::RenderMathMLSpace::firstLineBaseline):
* rendering/mathml/RenderMathMLSpace.h:
* rendering/mathml/RenderMathMLUnderOver.cpp:
(WebCore::RenderMathMLUnderOver::firstLineBaseline):
* rendering/mathml/RenderMathMLUnderOver.h:

Source/WTF:

Provide a callback to Optional::valueOrCompute() which is evaluated only if necessary.

* wtf/Optional.h:
(WTF::Optional::valueOrCompute):

Tools:

Test Optional::valueOrCompute().

* TestWebKitAPI/Tests/WTF/Optional.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181398 268f45cc-cd09-0410-ab3c-d52691b4dbfc
35 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/Optional.h
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBlockFlow.cpp
Source/WebCore/rendering/RenderBlockFlow.h
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
Source/WebCore/rendering/RenderFlexibleBox.cpp
Source/WebCore/rendering/RenderFlexibleBox.h
Source/WebCore/rendering/RenderMenuList.h
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTable.h
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/RenderTableSection.cpp
Source/WebCore/rendering/RenderTableSection.h
Source/WebCore/rendering/RenderTextControl.h
Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp
Source/WebCore/rendering/mathml/RenderMathMLBlock.h
Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp
Source/WebCore/rendering/mathml/RenderMathMLFraction.h
Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
Source/WebCore/rendering/mathml/RenderMathMLOperator.h
Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
Source/WebCore/rendering/mathml/RenderMathMLRoot.h
Source/WebCore/rendering/mathml/RenderMathMLRow.cpp
Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp
Source/WebCore/rendering/mathml/RenderMathMLScripts.h
Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp
Source/WebCore/rendering/mathml/RenderMathMLSpace.h
Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp
Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/Optional.cpp