Commit b3466afc authored by hyatt@apple.com's avatar hyatt@apple.com

2009-06-12 David Hyatt <hyatt@apple.com>

        Reviewed by Dan Bernstein.

        https://bugs.webkit.org/show_bug.cgi?id=26367

        Remove the global variables in bidi.cpp.  Make a new struct, MidpointState, that holds all of the
        midpoint information.  Add the remaining global variables as arguments passed down through functions
        as needed.

        * platform/text/BidiResolver.h:
        (WebCore::MidpointState::MidpointState):
        (WebCore::MidpointState::reset):
        (WebCore::BidiResolver::midpointState):
        * rendering/RenderBlock.h:
        * rendering/bidi.cpp:
        (WebCore::BidiRun::operator delete):
        (WebCore::chopMidpointsAt):
        (WebCore::checkMidpoints):
        (WebCore::addMidpoint):
        (WebCore::appendRunsForObject):
        (WebCore::RenderBlock::bidiReorderLine):
        (WebCore::RenderBlock::layoutInlineChildren):
        (WebCore::RenderBlock::determineStartPosition):
        (WebCore::skipNonBreakingSpace):
        (WebCore::shouldCollapseWhiteSpace):
        (WebCore::requiresLineBox):
        (WebCore::RenderBlock::generatesLineBoxesForInlineChild):
        (WebCore::RenderBlock::skipTrailingWhitespace):
        (WebCore::RenderBlock::skipLeadingWhitespace):
        (WebCore::shouldSkipWhitespaceAfterStartObject):
        (WebCore::RenderBlock::findNextLineBreak):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44649 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2eeb97b5
2009-06-12 David Hyatt <hyatt@apple.com>
Reviewed by Dan Bernstein.
https://bugs.webkit.org/show_bug.cgi?id=26367
Remove the global variables in bidi.cpp. Make a new struct, MidpointState, that holds all of the
midpoint information. Add the remaining global variables as arguments passed down through functions
as needed.
* platform/text/BidiResolver.h:
(WebCore::MidpointState::MidpointState):
(WebCore::MidpointState::reset):
(WebCore::BidiResolver::midpointState):
* rendering/RenderBlock.h:
* rendering/bidi.cpp:
(WebCore::BidiRun::operator delete):
(WebCore::chopMidpointsAt):
(WebCore::checkMidpoints):
(WebCore::addMidpoint):
(WebCore::appendRunsForObject):
(WebCore::RenderBlock::bidiReorderLine):
(WebCore::RenderBlock::layoutInlineChildren):
(WebCore::RenderBlock::determineStartPosition):
(WebCore::skipNonBreakingSpace):
(WebCore::shouldCollapseWhiteSpace):
(WebCore::requiresLineBox):
(WebCore::RenderBlock::generatesLineBoxesForInlineChild):
(WebCore::RenderBlock::skipTrailingWhitespace):
(WebCore::RenderBlock::skipLeadingWhitespace):
(WebCore::shouldSkipWhitespaceAfterStartObject):
(WebCore::RenderBlock::findNextLineBreak):
2009-06-12 Holger Hans Peter Freyther <zecke@selfish.org>
Build fix for Qt. After recent ImageDeocder.h changes. I want
......@@ -29,6 +29,30 @@
namespace WebCore {
template <class Iterator> class MidpointState
{
public:
MidpointState()
{
reset();
}
void reset()
{
m_numMidpoints = 0;
m_currentMidpoint = 0;
m_betweenMidpoints = false;
}
// The goal is to reuse the line state across multiple
// lines so we just keep an array around for midpoints and never clear it across multiple
// lines. We track the number of items and position using the two other variables.
Vector<Iterator> m_midpoints;
unsigned m_numMidpoints;
unsigned m_currentMidpoint;
bool m_betweenMidpoints;
};
// The BidiStatus at a given position (typically the end of a line) can
// be cached and then used to restart bidi resolution at that position.
struct BidiStatus {
......@@ -135,6 +159,8 @@ public :
const BidiStatus& status() const { return m_status; }
void setStatus(const BidiStatus s) { m_status = s; }
MidpointState<Iterator>& midpointState() { return m_midpointState; }
void embed(WTF::Unicode::Direction);
void commitExplicitEmbedding();
......@@ -172,6 +198,7 @@ protected:
Run* m_lastRun;
Run* m_logicallyLastRun;
unsigned m_runCount;
MidpointState<Iterator> m_midpointState;
private:
void raiseExplicitEmbeddingLevel(WTF::Unicode::Direction from, WTF::Unicode::Direction to);
......
......@@ -24,7 +24,6 @@
#ifndef RenderBlock_h
#define RenderBlock_h
#include "DeprecatedPtrList.h"
#include "GapRects.h"
#include "RenderBox.h"
......@@ -42,7 +41,9 @@ class RootInlineBox;
struct BidiRun;
template <class Iterator, class Run> class BidiResolver;
template <class Iterator> class MidpointState;
typedef BidiResolver<InlineIterator, BidiRun> InlineBidiResolver;
typedef MidpointState<InlineIterator> LineMidpointState;
enum CaretType { CursorCaret, DragCaret };
......@@ -157,18 +158,19 @@ public:
IntRect rect;
};
void bidiReorderLine(InlineBidiResolver&, const InlineIterator& end);
RootInlineBox* determineStartPosition(bool& firstLine, bool& fullLayout, InlineBidiResolver&, Vector<FloatWithRect>& floats, unsigned& numCleanFloats);
void bidiReorderLine(InlineBidiResolver&, const InlineIterator& end, bool previousLineBrokeCleanly);
RootInlineBox* determineStartPosition(bool& firstLine, bool& fullLayout, bool& previousLineBrokeCleanly,
InlineBidiResolver&, Vector<FloatWithRect>& floats, unsigned& numCleanFloats);
RootInlineBox* determineEndPosition(RootInlineBox* startBox, InlineIterator& cleanLineStart,
BidiStatus& cleanLineBidiStatus,
int& yPos);
bool matchedEndLine(const InlineBidiResolver&, const InlineIterator& endLineStart, const BidiStatus& endLineStatus,
RootInlineBox*& endLine, int& endYPos, int& repaintBottom, int& repaintTop);
bool generatesLineBoxesForInlineChild(RenderObject*);
void skipTrailingWhitespace(InlineIterator&);
int skipLeadingWhitespace(InlineBidiResolver&, bool firstLine);
bool generatesLineBoxesForInlineChild(RenderObject*, bool isLineEmpty = true, bool previousLineBrokeCleanly = true);
void skipTrailingWhitespace(InlineIterator&, bool isLineEmpty, bool previousLineBrokeCleanly);
int skipLeadingWhitespace(InlineBidiResolver&, bool firstLine, bool isLineEmpty, bool previousLineBrokeCleanly);
void fitBelowFloats(int widthToFit, bool firstLine, int& availableWidth);
InlineIterator findNextLineBreak(InlineBidiResolver&, bool firstLine, EClear* clear = 0);
InlineIterator findNextLineBreak(InlineBidiResolver&, bool firstLine, bool& isLineEmpty, bool& previousLineBrokeCleanly, EClear* clear = 0);
RootInlineBox* constructLine(unsigned runCount, BidiRun* firstRun, BidiRun* lastRun, bool firstLine, bool lastLine, RenderObject* endObject);
InlineFlowBox* createLineBoxes(RenderObject*, bool firstLine);
void computeHorizontalPositionsForLine(RootInlineBox*, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd);
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment