Skip to content
Permalink
Browse files
Move ExpansionBehaviorFlags and TextDirection to their own file
https://bugs.webkit.org/show_bug.cgi?id=143273

Reviewed by Simon Fraser.

This is a mechanical change. It just moves code around.

This is getting ready for https://bugs.webkit.org/show_bug.cgi?id=142608

Source/WebCore:

No new tests because there is no behavior change.

* Modules/notifications/Notification.h:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSPrimitiveValueMappings.h:
* css/CSSProperty.h:
* dom/Position.h:
* editing/VisiblePosition.h:
* editing/VisibleUnits.h:
* editing/htmlediting.h:
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::drawTextInternal):
* html/canvas/CanvasRenderingContext2D.h:
* platform/LengthBox.h:
* platform/PopupMenuStyle.h:
* platform/graphics/FontCascade.h:
* platform/graphics/LayoutBoxExtent.h:
* platform/graphics/TextRun.h:
* platform/ios/SelectionRect.h:
* platform/text/BidiResolver.h:
* platform/text/StringWithDirection.h:
* platform/text/TextHelpers.h: Renamed from Source/WebCore/platform/text/TextDirection.h.
(WebCore::isLeftToRightDirection):
* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenuWin::paint):
* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::paint):
(WebCore::EllipsisBox::selectionRect):
(WebCore::EllipsisBox::paintSelection):
* rendering/HitTestLocation.h:
* rendering/HitTestResult.h:
* rendering/InlineBox.h:
* rendering/InlineTextBox.h:
(WebCore::InlineTextBox::expansionBehavior):
* rendering/RenderBlock.cpp:
(WebCore::constructTextRunInternal):
(WebCore::RenderBlock::constructTextRun):
* rendering/RenderBlock.h:
* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::paintObject):
(WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::updateFromElement):
(WebCore::RenderListBox::paintItemForeground):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::computePreferredLogicalWidths):
(WebCore::RenderListMarker::getRelativeMarkerRect):
* rendering/RenderMenuList.cpp:
(RenderMenuList::updateOptionsWidth):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::getAverageCharWidth):
* rendering/RenderThemeIOS.mm:
* rendering/style/RenderStyle.h:
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::constructTextRun):
* rendering/svg/SVGTextMetrics.cpp:
(WebCore::SVGTextMetrics::constructTextRun):

Source/WebKit/ios:

* WebCoreSupport/WebFrameIOS.mm:
* WebCoreSupport/WebVisiblePosition.mm:

Source/WebKit2:

* Shared/WebPopupItem.h:
* UIProcess/API/C/efl/WKAPICastEfl.h:
* UIProcess/API/efl/EwkView.h:
* UIProcess/WebPopupMenuProxy.h:
* UIProcess/efl/WebUIPopupMenuClient.h:

Canonical link: https://commits.webkit.org/161307@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182207 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
litherum committed Mar 31, 2015
1 parent e4f44df commit bce4f25de48b1b0cddcc6554e17a95f5b5144059
Showing 48 changed files with 183 additions and 81 deletions.
@@ -1,3 +1,74 @@
2015-03-31 Myles C. Maxfield <mmaxfield@apple.com>

Move ExpansionBehaviorFlags and TextDirection to their own file
https://bugs.webkit.org/show_bug.cgi?id=143273

Reviewed by Simon Fraser.

This is a mechanical change. It just moves code around.

This is getting ready for https://bugs.webkit.org/show_bug.cgi?id=142608

No new tests because there is no behavior change.

* Modules/notifications/Notification.h:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSPrimitiveValueMappings.h:
* css/CSSProperty.h:
* dom/Position.h:
* editing/VisiblePosition.h:
* editing/VisibleUnits.h:
* editing/htmlediting.h:
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::drawTextInternal):
* html/canvas/CanvasRenderingContext2D.h:
* platform/LengthBox.h:
* platform/PopupMenuStyle.h:
* platform/graphics/FontCascade.h:
* platform/graphics/LayoutBoxExtent.h:
* platform/graphics/TextRun.h:
* platform/ios/SelectionRect.h:
* platform/text/BidiResolver.h:
* platform/text/StringWithDirection.h:
* platform/text/TextHelpers.h: Renamed from Source/WebCore/platform/text/TextDirection.h.
(WebCore::isLeftToRightDirection):
* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenuWin::paint):
* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::paint):
(WebCore::EllipsisBox::selectionRect):
(WebCore::EllipsisBox::paintSelection):
* rendering/HitTestLocation.h:
* rendering/HitTestResult.h:
* rendering/InlineBox.h:
* rendering/InlineTextBox.h:
(WebCore::InlineTextBox::expansionBehavior):
* rendering/RenderBlock.cpp:
(WebCore::constructTextRunInternal):
(WebCore::RenderBlock::constructTextRun):
* rendering/RenderBlock.h:
* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::paintObject):
(WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::updateFromElement):
(WebCore::RenderListBox::paintItemForeground):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::computePreferredLogicalWidths):
(WebCore::RenderListMarker::getRelativeMarkerRect):
* rendering/RenderMenuList.cpp:
(RenderMenuList::updateOptionsWidth):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::getAverageCharWidth):
* rendering/RenderThemeIOS.mm:
* rendering/style/RenderStyle.h:
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::constructTextRun):
* rendering/svg/SVGTextMetrics.cpp:
(WebCore::SVGTextMetrics::constructTextRun):

2015-03-31 Yusuke Suzuki <utatane.tea@gmail.com>

Clean up Identifier factories to clarify the meaning of StringImpl*
@@ -37,7 +37,7 @@
#include "EventTarget.h"
#include "URL.h"
#include "NotificationClient.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include "ThreadableLoaderClient.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -20358,7 +20358,7 @@
<ClInclude Include="..\platform\text\TextCodecUserDefined.h" />
<ClInclude Include="..\platform\text\TextCodecUTF16.h" />
<ClInclude Include="..\platform\text\TextCodecUTF8.h" />
<ClInclude Include="..\platform\text\TextDirection.h" />
<ClInclude Include="..\platform\text\TextFlags.h" />
<ClInclude Include="..\platform\text\TextEncoding.h" />
<ClInclude Include="..\platform\text\TextEncodingDetector.h" />
<ClInclude Include="..\platform\text\TextEncodingRegistry.h" />
@@ -8973,7 +8973,7 @@
<ClInclude Include="..\platform\text\TextCodecUTF8.h">
<Filter>platform\text</Filter>
</ClInclude>
<ClInclude Include="..\platform\text\TextDirection.h">
<ClInclude Include="..\platform\text\TextFlags.h">
<Filter>platform\text</Filter>
</ClInclude>
<ClInclude Include="..\platform\text\TextEncoding.h">
@@ -4776,7 +4776,7 @@
B2C3DA400D006C1D00EF6F26 /* TextCodecUserDefined.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA100D006C1D00EF6F26 /* TextCodecUserDefined.h */; settings = {ATTRIBUTES = (Private, ); }; };
B2C3DA410D006C1D00EF6F26 /* TextCodecUTF16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA110D006C1D00EF6F26 /* TextCodecUTF16.cpp */; };
B2C3DA420D006C1D00EF6F26 /* TextCodecUTF16.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA120D006C1D00EF6F26 /* TextCodecUTF16.h */; settings = {ATTRIBUTES = (Private, ); }; };
B2C3DA450D006C1D00EF6F26 /* TextDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA150D006C1D00EF6F26 /* TextDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
B2C3DA450D006C1D00EF6F26 /* TextFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA150D006C1D00EF6F26 /* TextFlags.h */; settings = {ATTRIBUTES = (Private, ); }; };
B2C3DA460D006C1D00EF6F26 /* TextEncoding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA160D006C1D00EF6F26 /* TextEncoding.cpp */; };
B2C3DA470D006C1D00EF6F26 /* TextEncoding.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA170D006C1D00EF6F26 /* TextEncoding.h */; settings = {ATTRIBUTES = (Private, ); }; };
B2C3DA480D006C1D00EF6F26 /* TextEncodingRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA180D006C1D00EF6F26 /* TextEncodingRegistry.cpp */; };
@@ -12249,7 +12249,7 @@
B2C3DA100D006C1D00EF6F26 /* TextCodecUserDefined.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextCodecUserDefined.h; sourceTree = "<group>"; };
B2C3DA110D006C1D00EF6F26 /* TextCodecUTF16.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TextCodecUTF16.cpp; sourceTree = "<group>"; };
B2C3DA120D006C1D00EF6F26 /* TextCodecUTF16.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextCodecUTF16.h; sourceTree = "<group>"; };
B2C3DA150D006C1D00EF6F26 /* TextDirection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextDirection.h; sourceTree = "<group>"; };
B2C3DA150D006C1D00EF6F26 /* TextFlags.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextFlags.h; sourceTree = "<group>"; };
B2C3DA160D006C1D00EF6F26 /* TextEncoding.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TextEncoding.cpp; sourceTree = "<group>"; };
B2C3DA170D006C1D00EF6F26 /* TextEncoding.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextEncoding.h; sourceTree = "<group>"; };
B2C3DA180D006C1D00EF6F26 /* TextEncodingRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TextEncodingRegistry.cpp; sourceTree = "<group>"; };
@@ -20906,7 +20906,7 @@
B2C3DA120D006C1D00EF6F26 /* TextCodecUTF16.h */,
9343CB7F12F25E510033C5EE /* TextCodecUTF8.cpp */,
9343CB8012F25E510033C5EE /* TextCodecUTF8.h */,
B2C3DA150D006C1D00EF6F26 /* TextDirection.h */,
B2C3DA150D006C1D00EF6F26 /* TextFlags.h */,
B2C3DA160D006C1D00EF6F26 /* TextEncoding.cpp */,
B2C3DA170D006C1D00EF6F26 /* TextEncoding.h */,
C105DA630F3AA6B8001DD44F /* TextEncodingDetector.h */,
@@ -26770,7 +26770,7 @@
B2C3DA420D006C1D00EF6F26 /* TextCodecUTF16.h in Headers */,
9343CB8212F25E510033C5EE /* TextCodecUTF8.h in Headers */,
142B97CA13138943008BEF4B /* TextControlInnerElements.h in Headers */,
B2C3DA450D006C1D00EF6F26 /* TextDirection.h in Headers */,
B2C3DA450D006C1D00EF6F26 /* TextFlags.h in Headers */,
97BC84B412371180000C6161 /* TextDocument.h in Headers */,
97BC84841236FD93000C6161 /* TextDocumentParser.h in Headers */,
B2C3DA470D006C1D00EF6F26 /* TextEncoding.h in Headers */,
@@ -45,7 +45,7 @@
#include "Path.h"
#include "RenderStyleConstants.h"
#include "SVGRenderStyleDefs.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include "TextRenderingMode.h"
#include "ThemeTypes.h"
#include "UnicodeBidi.h"
@@ -25,7 +25,7 @@
#include "CSSPropertyNames.h"
#include "CSSValue.h"
#include "RenderStyleConstants.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include "WritingMode.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
@@ -29,7 +29,7 @@
#include "ContainerNode.h"
#include "EditingBoundary.h"
#include "TextAffinity.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include <wtf/Assertions.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
@@ -28,7 +28,7 @@

#include "EditingBoundary.h"
#include "Position.h"
#include "TextDirection.h"
#include "TextFlags.h"

namespace WebCore {

@@ -27,7 +27,7 @@
#define VisibleUnits_h

#include "EditingBoundary.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include "VisibleSelection.h"

namespace WebCore {
@@ -28,7 +28,7 @@

#include "EditingBoundary.h"
#include "Position.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include <wtf/Forward.h>
#include <wtf/unicode/CharacterNames.h>

@@ -2305,7 +2305,7 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
bool isRTL = direction == RTL;
bool override = computedStyle ? isOverride(computedStyle->unicodeBidi()) : false;

TextRun textRun(normalizedText, 0, 0, TextRun::AllowTrailingExpansion, direction, override, true, TextRun::NoRounding);
TextRun textRun(normalizedText, 0, 0, AllowTrailingExpansion, direction, override, true, TextRun::NoRounding);
// Draw the item text at the correct point.
FloatPoint location(x, y);
switch (state().m_textBaseline) {
@@ -2326,7 +2326,7 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
break;
}

float fontWidth = font.width(TextRun(normalizedText, 0, 0, TextRun::AllowTrailingExpansion, direction, override));
float fontWidth = font.width(TextRun(normalizedText, 0, 0, AllowTrailingExpansion, direction, override));

useMaxWidth = (useMaxWidth && maxWidth < fontWidth);
float width = useMaxWidth ? maxWidth : fontWidth;
@@ -38,7 +38,7 @@
#include "ImageBuffer.h"
#include "Path.h"
#include "PlatformLayer.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>

@@ -23,7 +23,7 @@
#define LengthBox_h

#include "Length.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include "WritingMode.h"

namespace WebCore {
@@ -29,7 +29,7 @@
#include "Color.h"
#include "FontCascade.h"
#include "Length.h"
#include "TextDirection.h"
#include "TextFlags.h"

namespace WebCore {

@@ -30,7 +30,7 @@
#include "FontCascadeFonts.h"
#include "FontDescription.h"
#include "Path.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include "TypesettingFeatures.h"
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
@@ -32,7 +32,7 @@
#define LayoutBoxExtent_h

#include "LayoutUnit.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include "WritingMode.h"

namespace WebCore {
@@ -24,7 +24,7 @@
#ifndef TextRun_h
#define TextRun_h

#include "TextDirection.h"
#include "TextFlags.h"
#include <wtf/RefCounted.h>
#include <wtf/text/StringView.h>

@@ -44,15 +44,6 @@ struct WidthIterator;
class TextRun {
WTF_MAKE_FAST_ALLOCATED;
public:
enum ExpansionBehaviorFlags {
ForbidTrailingExpansion = 0 << 0,
AllowTrailingExpansion = 1 << 0,
ForbidLeadingExpansion = 0 << 1,
AllowLeadingExpansion = 1 << 1,
};

typedef unsigned ExpansionBehavior;

enum RoundingHackFlags {
NoRounding = 0,
RunRounding = 1 << 0,
@@ -27,7 +27,7 @@
#define SelectionRect_h

#include "IntRect.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include <wtf/FastMalloc.h>

namespace WebCore {
@@ -24,7 +24,7 @@

#include "BidiContext.h"
#include "BidiRunList.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include <wtf/Noncopyable.h>
#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>
@@ -31,7 +31,7 @@
#ifndef StringWithDirection_h
#define StringWithDirection_h

#include "TextDirection.h"
#include "TextFlags.h"
#include <wtf/text/WTFString.h>

namespace WebCore {
@@ -23,15 +23,24 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef TextDirection_h
#define TextDirection_h
#ifndef TextFlags_h
#define TextFlags_h

namespace WebCore {

enum TextDirection { RTL, LTR };

inline bool isLeftToRightDirection(TextDirection direction) { return direction == LTR; }

enum ExpansionBehaviorFlags {
ForbidTrailingExpansion = 0 << 0,
AllowTrailingExpansion = 1 << 0,
ForbidLeadingExpansion = 0 << 1,
AllowLeadingExpansion = 1 << 1,
};

typedef unsigned ExpansionBehavior;

}

#endif
@@ -638,7 +638,7 @@ void PopupMenuWin::paint(const IntRect& damageRect, HDC hdc)

String itemText = client()->itemText(index);

TextRun textRun(itemText, 0, 0, TextRun::AllowTrailingExpansion, itemStyle.textDirection(), itemStyle.hasTextDirectionOverride());
TextRun textRun(itemText, 0, 0, AllowTrailingExpansion, itemStyle.textDirection(), itemStyle.hasTextDirectionOverride());
context.setFillColor(optionTextColor, ColorSpaceDeviceRGB);

FontCascade itemFont = client()->menuStyle().font();
@@ -65,7 +65,7 @@ void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, La
}

// FIXME: Why is this always LTR? Fix by passing correct text run flags below.
context->drawText(font, RenderBlock::constructTextRun(&blockFlow(), font, m_str, lineStyle, TextRun::AllowTrailingExpansion), LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + lineStyle.fontMetrics().ascent()));
context->drawText(font, RenderBlock::constructTextRun(&blockFlow(), font, m_str, lineStyle, AllowTrailingExpansion), LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + lineStyle.fontMetrics().ascent()));

// Restore the regular fill color.
if (textColor != context->fillColor())
@@ -114,7 +114,7 @@ IntRect EllipsisBox::selectionRect()
const RootInlineBox& rootBox = root();
// FIXME: Why is this always LTR? Fix by passing correct text run flags below.
LayoutRect selectionRect = LayoutRect(x(), y() + rootBox.selectionTopAdjustedForPrecedingBlock(), 0, rootBox.selectionHeightAdjustedForPrecedingBlock());
font.adjustSelectionRectForText(RenderBlock::constructTextRun(&blockFlow(), font, m_str, lineStyle, TextRun::AllowTrailingExpansion), selectionRect);
font.adjustSelectionRectForText(RenderBlock::constructTextRun(&blockFlow(), font, m_str, lineStyle, AllowTrailingExpansion), selectionRect);
// FIXME: use directional pixel snapping instead.
return enclosingIntRect(selectionRect);
}
@@ -135,7 +135,7 @@ void EllipsisBox::paintSelection(GraphicsContext* context, const LayoutPoint& pa
GraphicsContextStateSaver stateSaver(*context);
// FIXME: Why is this always LTR? Fix by passing correct text run flags below.
LayoutRect selectionRect = LayoutRect(x() + paintOffset.x(), y() + paintOffset.y() + rootBox.selectionTop(), 0, rootBox.selectionHeight());
TextRun run = RenderBlock::constructTextRun(&blockFlow(), font, m_str, style, TextRun::AllowTrailingExpansion);
TextRun run = RenderBlock::constructTextRun(&blockFlow(), font, m_str, style, AllowTrailingExpansion);
font.adjustSelectionRectForText(run, selectionRect, 0, -1);
context->fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), run.ltr()), c, style.colorSpace());
}
@@ -27,7 +27,7 @@
#include "HitTestRequest.h"
#include "LayoutRect.h"
#include "RoundedRect.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include <wtf/Forward.h>
#include <wtf/ListHashSet.h>
#include <wtf/RefPtr.h>
@@ -27,7 +27,7 @@
#include "HitTestLocation.h"
#include "HitTestRequest.h"
#include "LayoutRect.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include <memory>
#include <wtf/Forward.h>
#include <wtf/ListHashSet.h>
@@ -23,7 +23,7 @@

#include "RenderBoxModelObject.h"
#include "RenderText.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include <wtf/TypeCasts.h>

namespace WebCore {

0 comments on commit bce4f25

Please sign in to comment.