Remove dependency on RenderStyle from FractionalLayoutBoxExtent and LayoutBox
authoreae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2012 16:21:57 +0000 (16:21 +0000)
committereae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2012 16:21:57 +0000 (16:21 +0000)
commitaa8561ce34aa7cecfdf5ce4e7617a6997d238a89
tree9d7bb8e61849f0ca66bbc5c82117f7d8eaf74bff
parent8b8fd2d1bbdce3c05d1a8b8f83cb2c48a3576698
Remove dependency on RenderStyle from FractionalLayoutBoxExtent and LayoutBox
https://bugs.webkit.org/show_bug.cgi?id=94146

Reviewed by Eric Seidel.

FractionalLayoutBoxExtent and LayoutBox currently have a dependency on
RenderStyle to resolve writing mode and text direction.
This is undesirable and breaks encapsulation.

Change FractionalLayoutBoxExtent and LengthBox to take a writing mode
parameter, and text direction as needed, instead of a pointer to a
RenderStyle object.

No new tests, no change in functionality.

* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
Add new WritingMode.h file.

* css/CSSPrimitiveValueMappings.h:
* css/CSSProperty.h:
* css/CSSToStyleMap.h:
Change includes as needed.

* platform/LengthBox.h:
* platform/LengthBox.cpp:
(WebCore::LengthBox::logicalLeft):
(WebCore::LengthBox::logicalRight):
(WebCore::LengthBox::before):
(WebCore::LengthBox::after):
Change methods to take a WirtingMode parameter instead of a RenderStyle pointer.

(WebCore::LengthBox::start):
(WebCore::LengthBox::end):
Change methods to take WritingMode and TextDirection parameters instead of a RenderStyle pointer.

* platform/graphics/FractionalLayoutBoxExtent.h:
* platform/graphics/FractionalLayoutBoxExtent.cpp:
(WebCore::FractionalLayoutBoxExtent::logicalTop):
(WebCore::FractionalLayoutBoxExtent::logicalBottom):
(WebCore::FractionalLayoutBoxExtent::logicalLeft):
(WebCore::FractionalLayoutBoxExtent::logicalRight):
(WebCore::FractionalLayoutBoxExtent::before):
(WebCore::FractionalLayoutBoxExtent::after):
(WebCore::FractionalLayoutBoxExtent::setBefore):
(WebCore::FractionalLayoutBoxExtent::setAfter):
(WebCore::FractionalLayoutBoxExtent::mutableLogicalLeft):
(WebCore::FractionalLayoutBoxExtent::mutableLogicalRight):
(WebCore::FractionalLayoutBoxExtent::mutableBefore):
(WebCore::FractionalLayoutBoxExtent::mutableAfter):
Change methods to take a WritingMode parameter instead of a RenderStyle pointer.

(WebCore::FractionalLayoutBoxExtent::start):
(WebCore::FractionalLayoutBoxExtent::end):
(WebCore::FractionalLayoutBoxExtent::setStart):
(WebCore::FractionalLayoutBoxExtent::setEnd):
Change methods to take WritingMode and TextDirection parameters instead of a RenderStyle pointer.

* platform/text/TextDirection.h:
(WebCore::isLeftToRightDirection):
Add convenience method.

* platform/text/WritingMode.h: Added.
Move WritingMode enum from RenderStyleConstants to new file.

(WebCore::isHorizontalWritingMode):
(WebCore::isFlippedLinesWritingMode):
(WebCore::isFlippedBlocksWritingMode):
Add convenience methods for working with writing modes.

* rendering/InlineFlowBox.cpp:
* rendering/RenderBox.cpp:
* rendering/RenderBox.h:
* rendering/style/RenderStyle.h:
Update calls to FractionalLayoutBoxExtent/LengthBox to pass WritingMode/
TextDirection as needed.

* rendering/style/RenderStyleConstants.h:
Remove WritingMode enum as it is now in a dedicated file.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126437 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSProperty.h
Source/WebCore/css/CSSToStyleMap.h
Source/WebCore/platform/LengthBox.cpp
Source/WebCore/platform/LengthBox.h
Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp
Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h
Source/WebCore/platform/text/TextDirection.h
Source/WebCore/platform/text/WritingMode.h [new file with mode: 0644]
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.h