[Cherry-pick] Remove dependency on RenderStyle from FractionalLayoutBoxExtent and...
authorJaehun Lim <ljaehun.lim@samsung.com>
Tue, 23 Apr 2013 11:02:12 +0000 (20:02 +0900)
committerJaehun Lim <ljaehun.lim@samsung.com>
Wed, 24 Apr 2013 22:16:56 +0000 (07:16 +0900)
commit2ce8edd0afae45b008c23b720c55644eb837c5e5
tree8437ec4c2c9228a040ff085d1f8cc075d07fb224
parent9ae28f5cc70af5bf5b53fdb14733e97eb41a727b
[Cherry-pick] Remove dependency on RenderStyle from FractionalLayoutBoxExtent and LayoutBox

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.

Change-Id: I71dc5d99bad23ba14f774e01a9f004d4914ace0d
14 files changed:
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