- Revision
- 176507
- Author
- [email protected]
- Date
- 2014-11-22 11:37:08 -0800 (Sat, 22 Nov 2014)
Log Message
Make locale part of the SimpleLineLayout::FlowContent::Style
https://bugs.webkit.org/show_bug.cgi?id=139004
Reviewed by Zalan Bujtas.
That's the only part of style not extracted out of RenderStyle in the constructor.
* rendering/SimpleLineLayoutFlowContents.cpp:
(WebCore::SimpleLineLayout::FlowContents::Style::Style):
(WebCore::SimpleLineLayout::FlowContents::FlowContents):
(WebCore::SimpleLineLayout::FlowContents::appendNextRendererContentIfNeeded):
* rendering/SimpleLineLayoutFlowContents.h:
Also remove RenderBlockFlow member since it is now unused.
(WebCore::SimpleLineLayout::FlowContents::Style::Style): Deleted.
Move to cpp.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (176506 => 176507)
--- trunk/Source/WebCore/ChangeLog 2014-11-22 19:07:26 UTC (rev 176506)
+++ trunk/Source/WebCore/ChangeLog 2014-11-22 19:37:08 UTC (rev 176507)
@@ -1,3 +1,24 @@
+2014-11-22 Antti Koivisto <[email protected]>
+
+ Make locale part of the SimpleLineLayout::FlowContent::Style
+ https://bugs.webkit.org/show_bug.cgi?id=139004
+
+ Reviewed by Zalan Bujtas.
+
+ That's the only part of style not extracted out of RenderStyle in the constructor.
+
+ * rendering/SimpleLineLayoutFlowContents.cpp:
+ (WebCore::SimpleLineLayout::FlowContents::Style::Style):
+ (WebCore::SimpleLineLayout::FlowContents::FlowContents):
+ (WebCore::SimpleLineLayout::FlowContents::appendNextRendererContentIfNeeded):
+ * rendering/SimpleLineLayoutFlowContents.h:
+
+ Also remove RenderBlockFlow member since it is now unused.
+
+ (WebCore::SimpleLineLayout::FlowContents::Style::Style): Deleted.
+
+ Move to cpp.
+
2014-11-22 Joanmarie Diggs <[email protected]>
AX: [ATK] Accessible names missing for imagemap images and links
Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp (176506 => 176507)
--- trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp 2014-11-22 19:07:26 UTC (rev 176506)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp 2014-11-22 19:37:08 UTC (rev 176507)
@@ -33,16 +33,28 @@
namespace WebCore {
namespace SimpleLineLayout {
+FlowContents::Style::Style(const RenderStyle& style)
+ : font(style.font())
+ , textAlign(style.textAlign())
+ , collapseWhitespace(style.collapseWhiteSpace())
+ , preserveNewline(style.preserveNewline())
+ , wrapLines(style.autoWrap())
+ , breakWordOnOverflow(style.overflowWrap() == BreakOverflowWrap && (wrapLines || preserveNewline))
+ , spaceWidth(font.width(TextRun(&space, 1)))
+ , tabWidth(collapseWhitespace ? 0 : style.tabSize())
+ , locale(style.locale())
+{
+}
+
FlowContents::FlowContents(const RenderBlockFlow& flow)
- : m_flow(flow)
- , m_style(flow.style())
+ : m_style(flow.style())
, m_lineBreakIterator(downcast<RenderText>(*flow.firstChild()).text(), flow.style().locale())
, m_lastRendererIndex(0)
{
unsigned startPosition = 0;
- for (const RenderText* textRenderer = downcast<RenderText>(m_flow.firstChild()); textRenderer; textRenderer = downcast<RenderText>(textRenderer->nextSibling())) {
- unsigned contentLength = textRenderer->text()->length();
- m_textRanges.append(std::make_pair(startPosition, textRenderer));
+ for (auto& textChild : childrenOfType<RenderText>(flow)) {
+ unsigned contentLength = textChild.text()->length();
+ m_textRanges.append(std::make_pair(startPosition, &textChild));
startPosition += contentLength;
}
// End item.
@@ -157,7 +169,7 @@
return false;
++m_lastRendererIndex;
- m_lineBreakIterator.resetStringAndReleaseIterator(string + String(nextRenderer->text()), m_flow.style().locale(), LineBreakIteratorModeUAX14);
+ m_lineBreakIterator.resetStringAndReleaseIterator(string + String(nextRenderer->text()), m_style.locale, LineBreakIteratorModeUAX14);
return true;
}
Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h (176506 => 176507)
--- trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h 2014-11-22 19:07:26 UTC (rev 176506)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h 2014-11-22 19:37:08 UTC (rev 176507)
@@ -51,19 +51,8 @@
bool resolveRendererPositions(const RenderText&, unsigned& startPosition, unsigned& endPosition) const;
const RenderText* renderer(unsigned position, unsigned* startPosition = nullptr) const;
- class Style {
- public:
- Style(const RenderStyle& style)
- : font(style.font())
- , textAlign(style.textAlign())
- , collapseWhitespace(style.collapseWhiteSpace())
- , preserveNewline(style.preserveNewline())
- , wrapLines(style.autoWrap())
- , breakWordOnOverflow(style.overflowWrap() == BreakOverflowWrap && (wrapLines || preserveNewline))
- , spaceWidth(font.width(TextRun(&space, 1)))
- , tabWidth(collapseWhitespace ? 0 : style.tabSize())
- {
- }
+ struct Style {
+ explicit Style(const RenderStyle&);
const Font& font;
ETextAlign textAlign;
@@ -73,6 +62,7 @@
bool breakWordOnOverflow;
float spaceWidth;
unsigned tabWidth;
+ AtomicString locale;
};
const Style& style() const { return m_style; }
@@ -81,7 +71,6 @@
unsigned nextNonWhitespacePosition(unsigned position, unsigned& spaceCount) const;
float runWidth(const RenderText&, unsigned from, unsigned to, float xPosition) const;
- const RenderBlockFlow& m_flow;
const Style m_style;
mutable LazyLineBreakIterator m_lineBreakIterator;
Vector<std::pair<unsigned, const RenderText*>> m_textRanges;