root/trunk/WebCore/rendering/RenderFlow.h

Revision 34693, 5.3 kB (checked in by timothy@apple.com, 1 month ago)

Fixes: Bug 19679: iframes with a height of 32,768px or greater do not layout correctly

WebCore:

2008-06-19 Timothy Hatcher <timothy@apple.com>

Changed all lineHeight, baselinePosition and verticalPositionHint
calls to return int instead of short. The short was overflowing
when a value greater than 32,767 was encountered.

Fixes: iframes with a height of 32,768px or greater do not layout correctly
https://bugs.webkit.org/show_bug.cgi?id=19679

Reviewed by Dave Hyatt.

Test: fast/css/line-height-overflow.html

  • rendering/RenderBR.cpp:
    (WebCore::RenderBR::baselinePosition):
  • rendering/RenderBR.h:
  • rendering/RenderBlock.cpp:
    (WebCore::RenderBlock::lineHeight):
  • rendering/RenderBlock.h:
  • rendering/RenderFlow.cpp:
  • rendering/RenderFlow.h:
  • rendering/RenderListBox.cpp:
  • rendering/RenderListBox.h:
  • rendering/RenderListMarker.cpp:
    (WebCore::RenderListMarker::lineHeight):
  • rendering/RenderListMarker.h:
  • rendering/RenderObject.cpp:
    (WebCore::RenderObject::verticalPositionHint):
  • rendering/RenderObject.h:
    (WebCore::):
  • rendering/RenderPath.cpp:
    (WebCore::RenderPath::lineHeight):
  • rendering/RenderPath.h:
  • rendering/RenderReplaced.cpp:
    (WebCore::RenderReplaced::lineHeight):
  • rendering/RenderReplaced.h:
  • rendering/RenderSVGContainer.cpp:
    (WebCore::RenderSVGContainer::lineHeight):
  • rendering/RenderSVGContainer.h:
  • rendering/RenderSVGHiddenContainer.cpp:
    (WebCore::RenderSVGHiddenContainer::lineHeight):
  • rendering/RenderSVGHiddenContainer.h:
  • rendering/RenderSVGRoot.cpp:
    (WebCore::RenderSVGRoot::lineHeight):
  • rendering/RenderSVGRoot.h:
  • rendering/RenderSlider.cpp:
  • rendering/RenderSlider.h:
  • rendering/RenderTableCell.cpp:
  • rendering/RenderTableCell.h:
  • rendering/RenderTableCol.h:
  • rendering/RenderTableRow.h:
  • rendering/RenderTableSection.h:
  • rendering/RenderText.cpp:
  • rendering/RenderText.h:
  • rendering/RenderTextControl.cpp:
  • rendering/RenderTextControl.h:
  • rendering/RenderTheme.cpp:
  • rendering/RenderTheme.h:
  • rendering/RenderThemeMac.h:
  • rendering/RenderThemeMac.mm:
  • rendering/RenderThemeSafari.cpp:
  • rendering/RenderThemeSafari.h:

LayoutTests:

2008-06-19 Timothy Hatcher <timothy@apple.com>

Test for: iframes with a height of 32,768px or greater do not layout correctly
https://bugs.webkit.org/show_bug.cgi?id=19679

Reviewed by Dave Hyatt.

  • fast/css/line-height-overflow.html: Added.
  • platform/mac/fast/css/line-height-overflow-expected.txt: Added.
  • Property svn:eol-style set to native
Line 
1 /*
2  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
4  * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB.  If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22
23 #ifndef RenderFlow_h
24 #define RenderFlow_h
25
26 #include "RenderContainer.h"
27
28 namespace WebCore {
29
30 /**
31  * all geometry managing stuff is only in the block elements.
32  *
33  * Inline elements don't layout themselves, but the whole paragraph
34  * gets flowed by the surrounding block element. This is, because
35  * one needs to know the whole paragraph to calculate bidirectional
36  * behaviour of text, so putting the layouting routines in the inline
37  * elements is impossible.
38  */
39 class RenderFlow : public RenderContainer {
40 public:
41     RenderFlow(Node* node)
42         : RenderContainer(node)
43         , m_continuation(0)
44         , m_firstLineBox(0)
45         , m_lastLineBox(0)
46         , m_lineHeight(-1)
47         , m_childrenInline(true)
48         , m_firstLine(false)
49         , m_topMarginQuirk(false)
50         , m_bottomMarginQuirk(false)
51         , m_hasMarkupTruncation(false)
52         , m_selectionState(SelectionNone)
53         , m_hasColumns(false)
54         , m_isContinuation(false)
55     {
56     }
57 #ifndef NDEBUG
58     virtual ~RenderFlow();
59 #endif
60
61     virtual RenderFlow* continuation() const { return m_continuation; }
62     void setContinuation(RenderFlow* c) { m_continuation = c; }
63     RenderFlow* continuationBefore(RenderObject* beforeChild);
64
65     void addChildWithContinuation(RenderObject* newChild, RenderObject* beforeChild);
66     virtual void addChildToFlow(RenderObject* newChild, RenderObject* beforeChild) = 0;
67     virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
68
69     static RenderFlow* createAnonymousFlow(Document*, RenderStyle*);
70
71     void extractLineBox(InlineFlowBox*);
72     void attachLineBox(InlineFlowBox*);
73     void removeLineBox(InlineFlowBox*);
74     void deleteLineBoxes();
75     virtual void destroy();
76
77     virtual void dirtyLinesFromChangedChild(RenderObject* child);
78
79     virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;
80
81     InlineFlowBox* firstLineBox() const { return m_firstLineBox; }
82     InlineFlowBox* lastLineBox() const { return m_lastLineBox; }
83
84     virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun=false);
85     virtual void dirtyLineBoxes(bool fullLayout, bool isRootLineBox = false);
86
87     void paintLines(PaintInfo&, int tx, int ty);
88     bool hitTestLines(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
89
90     virtual IntRect absoluteClippedOverflowRect();
91
92     virtual int lowestPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
93     virtual int rightmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
94     virtual int leftmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
95
96     virtual IntRect caretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
97
98     virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
99     void paintOutlineForLine(GraphicsContext*, int tx, int ty, const IntRect& prevLine, const IntRect& thisLine, const IntRect& nextLine);
100     void paintOutline(GraphicsContext*, int tx, int ty);
101
102     virtual bool hasColumns() const { return m_hasColumns; }
103
104     void calcMargins(int containerWidth);
105
106     void checkConsistency() const;
107
108 private:
109     // An inline can be split with blocks occurring in between the inline content.
110     // When this occurs we need a pointer to our next object.  We can basically be
111     // split into a sequence of inlines and blocks.  The continuation will either be
112     // an anonymous block (that houses other blocks) or it will be an inline flow.
113     RenderFlow* m_continuation;
114
115 protected:
116     // For block flows, each box represents the root inline box for a line in the
117     // paragraph.
118     // For inline flows, each box represents a portion of that inline.
119     InlineFlowBox* m_firstLineBox;
120     InlineFlowBox* m_lastLineBox;
121
122     mutable int m_lineHeight;
123    
124     // These bitfields are moved here from subclasses to pack them together
125     // from RenderBlock
126     bool m_childrenInline : 1;
127     bool m_firstLine : 1;
128     bool m_topMarginQuirk : 1;
129     bool m_bottomMarginQuirk : 1;
130     bool m_hasMarkupTruncation : 1;
131     unsigned m_selectionState : 3; // SelectionState
132     bool m_hasColumns : 1;
133    
134     // from RenderInline
135     bool m_isContinuation : 1; // Whether or not we're a continuation of an inline.
136 };
137
138 #ifdef NDEBUG
139 inline void RenderFlow::checkConsistency() const
140 {
141 }
142 #endif
143
144 } // namespace WebCore
145
146 #endif // RenderFlow_h
147
Note: See TracBrowser for help on using the browser.