+2006-10-30 Sam Weinig <sam.weinig@gmail.com>
+
+ Reviewed by Mitz.
+
+ Fix for http://bugs.webkit.org/show_bug.cgi?id=11441
+ More rendering code cleaning
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * rendering/RenderApplet.cpp:
+ (WebCore::RenderApplet::RenderApplet):
+ (WebCore::RenderApplet::createWidgetIfNecessary):
+ * rendering/RenderApplet.h:
+ * rendering/RenderArena.cpp:
+ (WebCore::):
+ (WebCore::RenderArena::RenderArena):
+ (WebCore::RenderArena::allocate):
+ (WebCore::RenderArena::free):
+ * rendering/RenderArena.h:
+ * rendering/RenderBR.cpp:
+ (WebCore::RenderBR::RenderBR):
+ (WebCore::RenderBR::baselinePosition):
+ (WebCore::RenderBR::lineHeight):
+ (WebCore::RenderBR::setStyle):
+ (WebCore::RenderBR::caretMinOffset):
+ (WebCore::RenderBR::positionForCoordinates):
+ (WebCore::RenderBR::inlineBox):
+ * rendering/RenderBR.h:
+ * rendering/RenderBlock.cpp:
+ * rendering/RenderBlock.h:
+ (WebCore::RenderBlock::maxTopMargin):
+ (WebCore::RenderBlock::maxBottomMargin):
+ (WebCore::RenderBlock::initMaxMarginValues):
+ (WebCore::RenderBlock::containsFloats):
+ (WebCore::RenderBlock::setHasMarkupTruncation):
+ (WebCore::RenderBlock::BlockSelectionInfo::BlockSelectionInfo):
+ (WebCore::RenderBlock::BlockSelectionInfo::block):
+ (WebCore::RenderBlock::BlockSelectionInfo::state):
+ (WebCore::RenderBlock::FloatingObject::FloatingObject):
+ (WebCore::RenderBlock::CompactInfo::clear):
+ * rendering/RenderButton.cpp:
+ (WebCore::RenderButton::removeChild):
+ (WebCore::RenderButton::paintObject):
+ * rendering/RenderButton.h:
+ (WebCore::RenderButton::renderName):
+ (WebCore::RenderButton::removeLeftoverAnonymousBoxes):
+ * rendering/RenderContainer.cpp:
+ (WebCore::RenderContainer::RenderContainer):
+ * rendering/RenderContainer.h:
+ (WebCore::RenderContainer::firstChild):
+ (WebCore::RenderContainer::lastChild):
+ (WebCore::RenderContainer::calcMinMaxWidth):
+ * rendering/RenderCounter.cpp:
+ (WebCore::RenderCounter::RenderCounter):
+ (WebCore::toRoman):
+ (WebCore::toHebrew):
+ (WebCore::RenderCounter::calcMinMaxWidth):
+ * rendering/RenderCounter.h:
+ * rendering/RenderFieldset.cpp:
+ (WebCore::RenderFieldset::paintBoxDecorations):
+ (WebCore::RenderFieldset::paintBorderMinusLegend):
+ (WebCore::RenderFieldset::setStyle):
+ * rendering/RenderFileUploadControl.cpp:
+ (WebCore::RenderFileUploadControl::~RenderFileUploadControl):
+ (WebCore::RenderFileUploadControl::setStyle):
+ (WebCore::RenderFileUploadControl::paintObject):
+ (WebCore::RenderFileUploadControl::calcMinMaxWidth):
+ * rendering/RenderFileUploadControl.h:
+ (WebCore::RenderFileUploadControl::renderName):
+ * rendering/RenderFlexibleBox.h:
+ * rendering/RenderFlow.cpp:
+ * rendering/RenderFlow.h:
+ * rendering/RenderForeignObject.cpp:
+ (WebCore::RenderForeignObject::RenderForeignObject):
+ (WebCore::RenderForeignObject::paint):
+ (WebCore::RenderForeignObject::computeAbsoluteRepaintRect):
+ (WebCore::RenderForeignObject::layout):
+ (WebCore::RenderForeignObject::nodeAtPoint):
+ * rendering/RenderForeignObject.h:
+ (WebCore::RenderForeignObject::renderName):
+ * rendering/RenderFormElement.cpp:
+ (WebCore::RenderFormElement::setStyle):
+ (WebCore::RenderFormElement::layout):
+ (WebCore::RenderFormElement::textAlignment):
+ * rendering/RenderFormElement.h:
+ * rendering/RenderFrame.cpp:
+ * rendering/RenderFrame.h:
+ (WebCore::RenderFrame::element):
+ * rendering/RenderFrameSet.cpp:
+ * rendering/RenderFrameSet.h:
+ (WebCore::RenderFrameSet::element):
+ * rendering/RenderHTMLCanvas.cpp:
+ (WebCore::RenderHTMLCanvas::RenderHTMLCanvas):
+ (WebCore::RenderHTMLCanvas::paint):
+ * rendering/RenderHTMLCanvas.h:
+ (WebCore::RenderHTMLCanvas::renderName):
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::RenderImage):
+ (WebCore::RenderImage::setStyle):
+ (WebCore::RenderImage::setContentObject):
+ (WebCore::RenderImage::setCachedImage):
+ (WebCore::RenderImage::imageChanged):
+ (WebCore::RenderImage::paint):
+ (WebCore::RenderImage::layout):
+ (WebCore::RenderImage::updateAltText):
+ * rendering/RenderImage.h:
+ (WebCore::RenderImage::element):
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::RenderInline):
+ (WebCore::RenderInline::~RenderInline):
+ (WebCore::RenderInline::setStyle):
+ (WebCore::RenderInline::addChildToFlow):
+ (WebCore::RenderInline::cloneInline):
+ (WebCore::RenderInline::splitInlines):
+ (WebCore::RenderInline::splitFlow):
+ (WebCore::RenderInline::paint):
+ (WebCore::RenderInline::absoluteRects):
+ (WebCore::RenderInline::calcMinMaxWidth):
+ (WebCore::RenderInline::requiresLayer):
+ (WebCore::RenderInline::width):
+ (WebCore::RenderInline::height):
+ (WebCore::RenderInline::renderName):
+ (WebCore::RenderInline::nodeAtPoint):
+ (WebCore::RenderInline::positionForCoordinates):
+ * rendering/RenderInline.h:
+ (WebCore::RenderInline::layout):
+ * rendering/RenderLayer.cpp:
+ * rendering/RenderLayer.h:
+ (WebCore::ClipRects::ClipRects):
+ (WebCore::RenderLayer::nextSibling):
+ (WebCore::RenderLayer::root):
+ (WebCore::RenderLayer::setPos):
+ (WebCore::RenderLayer::height):
+ (WebCore::RenderLayer::relativePositionOffset):
+ * rendering/RenderLineEdit.cpp:
+ (WebCore::RenderLineEdit::setStyle):
+ (WebCore::RenderLineEdit::updateFromElement):
+ (WebCore::RenderLineEdit::selectionStart):
+ (WebCore::RenderLineEdit::selectionEnd):
+ (WebCore::RenderLineEdit::setSelectionStart):
+ (WebCore::RenderLineEdit::setSelectionEnd):
+ (WebCore::RenderLineEdit::setSelectionRange):
+ * rendering/RenderLineEdit.h:
+ * rendering/RenderListBox.cpp:
+ * rendering/RenderListBox.h:
+ (WebCore::RenderListBox::renderName):
+ * rendering/RenderListItem.cpp:
+ (WebCore::RenderListItem::setStyle):
+ (WebCore::getParentOfFirstLineBox):
+ (WebCore::RenderListItem::updateMarkerLocation):
+ (WebCore::RenderListItem::positionListMarker):
+ (WebCore::RenderListItem::paint):
+ * rendering/RenderListItem.h:
+ * rendering/RenderListMarker.cpp:
+ * rendering/RenderListMarker.h:
+ (WebCore::RenderListMarker::renderName):
+ (WebCore::RenderListMarker::isListMarker):
+
2006-10-30 Timothy Hatcher <timothy@apple.com>
Reviewed by Hyatt.
F523D2F302DE443B018635CA /* rendering */ = {
isa = PBXGroup;
children = (
- ABB5419C0ACDDFE4002820EB /* RenderListBox.cpp */,
- ABB5419D0ACDDFE4002820EB /* RenderListBox.h */,
A8CFF04B0A154F09000A4234 /* AutoTableLayout.cpp */,
A8CFF0490A154F09000A4234 /* AutoTableLayout.h */,
BCEA4813097D93020094C9E4 /* bidi.cpp */,
A8EA73BD0A1900E300A8EF5F /* RenderLegend.h */,
A8EA73BE0A1900E300A8EF5F /* RenderLineEdit.cpp */,
A8EA73B10A1900E300A8EF5F /* RenderLineEdit.h */,
+ ABB5419C0ACDDFE4002820EB /* RenderListBox.cpp */,
+ ABB5419D0ACDDFE4002820EB /* RenderListBox.h */,
A8EA7A480A191A5200A8EF5F /* RenderListItem.cpp */,
A8EA7A4C0A191A5200A8EF5F /* RenderListItem.h */,
A8EA7A4B0A191A5200A8EF5F /* RenderListMarker.cpp */,
using namespace HTMLNames;
RenderApplet::RenderApplet(HTMLAppletElement* applet, const HashMap<String, String>& args)
- : RenderWidget(applet), m_args(args)
+ : RenderWidget(applet)
+ , m_args(args)
{
setInline(true);
}
m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight();
int height = style()->height().isFixed() ? style()->height().value() :
m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom();
- for (Node* child = node()->firstChild(); child; child = child->nextSibling())
+ for (Node* child = node()->firstChild(); child; child = child->nextSibling()) {
if (child->hasTagName(paramTag)) {
HTMLParamElement* p = static_cast<HTMLParamElement*>(child);
if (!p->name().isEmpty())
m_args.set(p->name(), p->value());
}
-
+ }
+
Frame* frame = document()->frame();
ASSERT(frame);
setWidget(frame->createJavaAppletWidget(IntSize(width, height), static_cast<Element*>(node()), m_args));
setNeedsLayout(false);
}
-}
+} // namespace WebCore
public:
RenderApplet(HTMLAppletElement*, const HashMap<String, String>& args);
virtual ~RenderApplet();
+
virtual const char* renderName() const { return "RenderApplet"; }
+
virtual bool isApplet() const { return true; }
+
virtual void layout();
virtual int intrinsicWidth() const;
virtual int intrinsicHeight() const;
HashMap<String, String> m_args;
};
-}
+} // namespace WebCore
-#endif
+#endif // RenderApplet_h
#include "RenderArena.h"
#include <assert.h>
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
#define ROUNDUP(x,y) ((((x)+((y)-1))/(y))*(y))
const int signatureDead = 0xDBA00AED;
typedef struct {
- RenderArena *arena;
+ RenderArena* arena;
size_t size;
int signature;
} RenderArenaDebugHeader;
#endif
-RenderArena::RenderArena(unsigned int arenaSize)
+RenderArena::RenderArena(unsigned arenaSize)
{
// Initialize the arena pool
INIT_ARENA_POOL(&m_pool, "RenderArena", arenaSize);
#ifndef NDEBUG
// Use standard malloc so that memory debugging tools work.
assert(this);
- void *block = ::malloc(sizeof(RenderArenaDebugHeader) + size);
- RenderArenaDebugHeader *header = (RenderArenaDebugHeader *)block;
+ void* block = ::malloc(sizeof(RenderArenaDebugHeader) + size);
+ RenderArenaDebugHeader* header = (RenderArenaDebugHeader*)block;
header->arena = this;
header->size = size;
header->signature = signature;
// Check recyclers first
if (size < gMaxRecycledSize) {
- const int index = size >> 2;
-
+ const int index = size >> 2;
+
result = m_recyclers[index];
if (result) {
// Need to move to the next object
m_recyclers[index] = next;
}
}
-
+
if (!result) {
// Allocate a new chunk from the arena
ARENA_ALLOCATE(result, &m_pool, size);
{
#ifndef NDEBUG
// Use standard free so that memory debugging tools work.
- RenderArenaDebugHeader *header = (RenderArenaDebugHeader *)ptr - 1;
+ RenderArenaDebugHeader* header = (RenderArenaDebugHeader*)ptr - 1;
assert(header->signature == signature);
assert(header->size == size);
assert(header->arena == this);
// See if it's a size that we recycle
if (size < gMaxRecycledSize) {
- const int index = size >> 2;
- void* currentTop = m_recyclers[index];
+ const int index = size >> 2;
+ void* currentTop = m_recyclers[index];
m_recyclers[index] = ptr;
*((void**)ptr) = currentTop;
}
#endif
}
-}
+} // namespace WebCore
* version of this file under any of the LGPL, the MPL or the GPL.
*/
-#ifndef RENDERARENA_H
-#define RENDERARENA_H
+#ifndef RenderArena_h
+#define RenderArena_h
#include "Arena.h"
class RenderArena {
public:
- RenderArena(unsigned int arenaSize = 4096);
+ RenderArena(unsigned arenaSize = 4096);
~RenderArena();
- // Memory management functions
- void* allocate(size_t size);
- void free(size_t size, void* ptr);
+ // Memory management functions
+ void* allocate(size_t);
+ void free(size_t, void*);
private:
- // Underlying arena pool
- ArenaPool m_pool;
+ // Underlying arena pool
+ ArenaPool m_pool;
- // The recycler array is sparse with the indices being multiples of 4,
- // i.e., 0, 4, 8, 12, 16, 20, ...
- void* m_recyclers[gMaxRecycledSize >> 2];
+ // The recycler array is sparse with the indices being multiples of 4,
+ // i.e., 0, 4, 8, 12, 16, 20, ...
+ void* m_recyclers[gMaxRecycledSize >> 2];
};
-}
+} // namespace WebCore
-#endif
+#endif // RenderArena_h
namespace WebCore {
RenderBR::RenderBR(Node* node)
- : RenderText(node, new StringImpl("\n")), m_lineHeight(-1)
+ : RenderText(node, new StringImpl("\n"))
+ , m_lineHeight(-1)
{
}
return box;
}
-short RenderBR::baselinePosition( bool firstLine, bool isRootLineBox) const
+short RenderBR::baselinePosition(bool firstLine, bool isRootLineBox) const
{
if (firstTextBox() && !firstTextBox()->isText())
return 0;
return lh.calcMinValue(s->fontSize());
return lh.value();
}
-
+
if (m_lineHeight == -1)
m_lineHeight = RenderObject::lineHeight(false);
return m_lineHeight;
}
-void RenderBR::setStyle(RenderStyle* _style)
+void RenderBR::setStyle(RenderStyle* newStyle)
{
- RenderText::setStyle(_style);
+ RenderText::setStyle(newStyle);
m_lineHeight = -1;
}
int RenderBR::caretMinOffset() const
{
- return 0;
+ return 0;
}
int RenderBR::caretMaxOffset() const
return 1;
}
-VisiblePosition RenderBR::positionForCoordinates(int _x, int _y)
+VisiblePosition RenderBR::positionForCoordinates(int /*x*/, int /*y*/)
{
return VisiblePosition(element(), 0, DOWNSTREAM);
}
-InlineBox *RenderBR::inlineBox(int offset, EAffinity affinity)
+InlineBox* RenderBR::inlineBox(int /*offset*/, EAffinity /*affinity*/)
{
return firstTextBox();
}
-}
+} // namespace WebCore
* Boston, MA 02111-1307, USA.
*
*/
-#ifndef RENDER_BR_H
-#define RENDER_BR_H
+
+#ifndef RenderBR_h
+#define RenderBR_h
#include "RenderText.h"
virtual int caretMinOffset() const;
virtual int caretMaxOffset() const;
virtual unsigned caretMaxRenderedOffset() const;
-
+
virtual VisiblePosition positionForCoordinates(int x, int y);
- virtual InlineBox* inlineBox(int offset, EAffinity affinity = UPSTREAM);
-
+ virtual InlineBox* inlineBox(int offset, EAffinity = UPSTREAM);
+
private:
mutable short m_lineHeight;
-
};
} // namespace WebCore
-#endif // RENDER_BR_H
+#endif // RenderBR_h
#include "Element.h"
#include "Frame.h"
#include "GraphicsContext.h"
-#include "InlineTextBox.h"
+#include "HTMLNames.h"
#include "HitTestResult.h"
+#include "InlineTextBox.h"
#include "RenderTableCell.h"
#include "RenderTextFragment.h"
-#include "SelectionController.h"
-#include "HTMLNames.h"
-#include "RenderView.h"
#include "RenderTheme.h"
+#include "RenderView.h"
+#include "SelectionController.h"
#include "TextStream.h"
using namespace std;
#endif
} // namespace WebCore
-
* Boston, MA 02111-1307, USA.
*/
-#ifndef RenderBlock_H
-#define RenderBlock_H
+#ifndef RenderBlock_h
+#define RenderBlock_h
#include "GapRects.h"
#include "RenderFlow.h"
virtual const char* renderName() const;
// These two functions are overridden for inline-block.
- virtual short lineHeight(bool b, bool isRootLineBox=false) const;
- virtual short baselinePosition(bool b, bool isRootLineBox=false) const;
-
+ virtual short lineHeight(bool firstLine, bool isRootLineBox = false) const;
+ virtual short baselinePosition(bool firstLine, bool isRootLineBox = false) const;
+
virtual bool isRenderBlock() const { return true; }
virtual bool isBlockFlow() const { return (!isInline() || isReplaced()) && !isTable(); }
virtual bool isInlineFlow() const { return isInline() && !isReplaced(); }
virtual bool isInlineBlockOrInlineTable() const { return isInline() && isReplaced(); }
-
+
virtual bool childrenInline() const { return m_childrenInline; }
virtual void setChildrenInline(bool b) { m_childrenInline = b; }
void makeChildrenNonInline(RenderObject* insertionPoint = 0);
// The height (and width) of a block when you include overflow spillage out of the bottom
// of the block (e.g., a <div style="height:25px"> that has a 100px tall image inside
// it would have an overflow height of borderTop() + paddingTop() + 100px.
- virtual int overflowHeight(bool includeInterior=true) const;
- virtual int overflowWidth(bool includeInterior=true) const;
- virtual int overflowLeft(bool includeInterior=true) const;
- virtual int overflowTop(bool includeInterior=true) const;
- virtual IntRect overflowRect(bool includeInterior=true) const;
+ virtual int overflowHeight(bool includeInterior = true) const;
+ virtual int overflowWidth(bool includeInterior = true) const;
+ virtual int overflowLeft(bool includeInterior = true) const;
+ virtual int overflowTop(bool includeInterior = true) const;
+ virtual IntRect overflowRect(bool includeInterior = true) const;
virtual void setOverflowHeight(int h) { m_overflowHeight = h; }
virtual void setOverflowWidth(int w) { m_overflowWidth = w; }
-
+
virtual bool isSelfCollapsingBlock() const;
virtual bool isTopMarginQuirk() const { return m_topMarginQuirk; }
virtual bool isBottomMarginQuirk() const { return m_bottomMarginQuirk; }
- virtual int maxTopMargin(bool positive) const {
- if (positive)
- return m_maxTopPosMargin;
- else
- return m_maxTopNegMargin;
- }
- virtual int maxBottomMargin(bool positive) const {
- if (positive)
- return m_maxBottomPosMargin;
- else
- return m_maxBottomNegMargin;
- }
+ virtual int maxTopMargin(bool positive) const { return positive ? m_maxTopPosMargin : m_maxTopNegMargin; }
+ virtual int maxBottomMargin(bool positive) const { return positive ? m_maxBottomPosMargin : m_maxBottomNegMargin; }
- void initMaxMarginValues() {
+ void initMaxMarginValues()
+ {
if (m_marginTop >= 0) {
m_maxTopPosMargin = m_marginTop;
m_maxTopNegMargin = 0;
// Called to lay out the legend for a fieldset.
virtual RenderObject* layoutLegend(bool relayoutChildren) { return 0; };
-
+
// the implementation of the following functions is in bidi.cpp
void bidiReorderLine(const BidiIterator& start, const BidiIterator& end, BidiState& bidi);
RootInlineBox* determineStartPosition(bool fullLayout, BidiIterator& start, BidiState& bidi);
bool matchedEndLine(const BidiIterator& start, const BidiStatus& status, BidiContext* context,
const BidiIterator& endLineStart, const BidiStatus& endLineStatus, BidiContext* endLineContext,
RootInlineBox*& endLine, int& endYPos, int& repaintBottom, int& repaintTop);
- int skipWhitespace(BidiIterator& , BidiState &);
- BidiIterator findNextLineBreak(BidiIterator& start, BidiState &info );
+ int skipWhitespace(BidiIterator&, BidiState&);
+ BidiIterator findNextLineBreak(BidiIterator& start, BidiState& info);
RootInlineBox* constructLine(const BidiIterator& start, const BidiIterator& end);
InlineFlowBox* createLineBoxes(RenderObject*);
int tabWidth(bool isWhitespacePre);
void deleteEllipsisLineBoxes();
void checkLinesForTextOverflow();
// end bidi.cpp functions
+
+ virtual void paint(PaintInfo&, int tx, int ty);
+ virtual void paintObject(PaintInfo&, int tx, int ty);
+ void paintFloats(PaintInfo&, int tx, int ty, bool paintSelection = false);
+ void paintChildren(PaintInfo&, int tx, int ty);
+ void paintEllipsisBoxes(PaintInfo&, int tx, int ty);
+ void paintSelection(PaintInfo&, int tx, int ty);
+ void paintCaret(PaintInfo&, CaretType);
- virtual void paint(PaintInfo& i, int tx, int ty);
- virtual void paintObject(PaintInfo& i, int tx, int ty);
- void paintFloats(PaintInfo& i, int _tx, int _ty, bool paintSelection = false);
- void paintChildren(PaintInfo& i, int _tx, int _ty);
- void paintEllipsisBoxes(PaintInfo& i, int _tx, int _ty);
- void paintSelection(PaintInfo& i, int _tx, int _ty);
- void paintCaret(PaintInfo& i, CaretType);
-
- void insertFloatingObject(RenderObject *o);
- void removeFloatingObject(RenderObject *o);
+ void insertFloatingObject(RenderObject*);
+ void removeFloatingObject(RenderObject*);
void setPaintsFloatingObject(RenderObject*, bool);
// called from lineWidth, to position the floats added in the last line.
void positionNewFloats();
void clearFloats();
- int getClearDelta(RenderObject *child);
+ int getClearDelta(RenderObject* child);
virtual void markAllDescendantsWithFloatsForLayout(RenderObject* floatToRemove = 0);
void markPositionedObjectsForLayout();
// FIXME: containsFloats() should not return true if the floating objects list
// is empty. However, layoutInlineChildren() relies on the current behavior.
// http://bugzilla.opendarwin.org/show_bug.cgi?id=7395#c3
- virtual bool containsFloats() { return m_floatingObjects!=0; }
- virtual bool containsFloat(RenderObject* o);
+ virtual bool containsFloats() { return m_floatingObjects; }
+ virtual bool containsFloat(RenderObject*);
virtual bool hasOverhangingFloats() { return floatBottom() > m_height; }
void addIntrudingFloats(RenderBlock* prev, int xoffset, int yoffset);
virtual IntRect floatRect() const;
virtual int lineWidth(int y) const;
- virtual int lowestPosition(bool includeOverflowInterior=true, bool includeSelf=true) const;
- virtual int rightmostPosition(bool includeOverflowInterior=true, bool includeSelf=true) const;
- virtual int leftmostPosition(bool includeOverflowInterior=true, bool includeSelf=true) const;
+ virtual int lowestPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
+ virtual int rightmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
+ virtual int leftmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
int rightOffset() const;
- int rightRelOffset(int y, int fixedOffset, bool applyTextIndent = true,
- int *heightRemaining = 0) const;
+ int rightRelOffset(int y, int fixedOffset, bool applyTextIndent = true, int* heightRemaining = 0) const;
int rightOffset(int y) const { return rightRelOffset(y, rightOffset(), true); }
int leftOffset() const;
- int leftRelOffset(int y, int fixedOffset, bool applyTextIndent = true,
- int *heightRemaining = 0) const;
+ int leftRelOffset(int y, int fixedOffset, bool applyTextIndent = true, int* heightRemaining = 0) const;
int leftOffset(int y) const { return leftRelOffset(y, leftOffset(), true); }
- virtual bool nodeAtPoint(HitTestResult&, int x, int y, int tx, int ty, HitTestAction hitTestAction);
+ virtual bool nodeAtPoint(HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
virtual bool isPointInScrollbar(HitTestResult&, int x, int y, int tx, int ty);
// children.
virtual RenderBlock* firstLineBlock() const;
virtual void updateFirstLetter();
-
+
bool inRootBlockContext() const;
- void setHasMarkupTruncation(bool b=true) { m_hasMarkupTruncation = b; }
+ void setHasMarkupTruncation(bool b = true) { m_hasMarkupTruncation = b; }
bool hasMarkupTruncation() const { return m_hasMarkupTruncation; }
virtual bool hasSelectedChildren() const { return m_selectionState != SelectionNone; }
GapRects m_rects;
SelectionState m_state;
- BlockSelectionInfo() { m_block = 0; m_state = SelectionNone; }
- BlockSelectionInfo(RenderBlock* b) {
- m_block = b;
- m_state = m_block->selectionState();
- m_rects = m_block->selectionGapRects();
+ BlockSelectionInfo()
+ : m_block(0)
+ , m_state(SelectionNone)
+ {
}
-
+
+ BlockSelectionInfo(RenderBlock* b)
+ : m_block(b)
+ , m_rects(b->selectionGapRects())
+ , m_state(b->selectionState())
+ {
+ }
+
+ RenderBlock* block() const { return m_block; }
GapRects rects() const { return m_rects; }
SelectionState state() const { return m_state; }
- RenderBlock* block() const { return m_block; }
};
-
+
virtual IntRect selectionRect() { return selectionGapRects(); }
GapRects selectionGapRects();
virtual bool shouldPaintSelectionGaps() const;
bool isSelectionRoot() const;
- GapRects fillSelectionGaps(RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty,
- int& lastTop, int& lastLeft, int& lastRight, const PaintInfo* i = 0);
+ GapRects fillSelectionGaps(RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty,
+ int& lastTop, int& lastLeft, int& lastRight, const PaintInfo* = 0);
GapRects fillInlineSelectionGaps(RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty,
- int& lastTop, int& lastLeft, int& lastRight, const PaintInfo* i);
+ int& lastTop, int& lastLeft, int& lastRight, const PaintInfo*);
GapRects fillBlockSelectionGaps(RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty,
- int& lastTop, int& lastLeft, int& lastRight, const PaintInfo* i);
- IntRect fillVerticalSelectionGap(int lastTop, int lastLeft, int lastRight,
- int bottomY, RenderBlock* rootBlock, int blockX, int blockY, const PaintInfo* i);
- IntRect fillLeftSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty, const PaintInfo* i);
- IntRect fillRightSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty, const PaintInfo* i);
- IntRect fillHorizontalSelectionGap(RenderObject* selObj, int xPos, int yPos, int width, int height, const PaintInfo* i);
-
- void getHorizontalSelectionGapInfo(SelectionState state, bool& leftGap, bool& rightGap);
+ int& lastTop, int& lastLeft, int& lastRight, const PaintInfo*);
+ IntRect fillVerticalSelectionGap(int lastTop, int lastLeft, int lastRight, int bottomY, RenderBlock* rootBlock,
+ int blockX, int blockY, const PaintInfo*);
+ IntRect fillLeftSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock,
+ int blockX, int blockY, int tx, int ty, const PaintInfo*);
+ IntRect fillRightSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock,
+ int blockX, int blockY, int tx, int ty, const PaintInfo*);
+ IntRect fillHorizontalSelectionGap(RenderObject* selObj, int xPos, int yPos, int width, int height, const PaintInfo*);
+
+ void getHorizontalSelectionGapInfo(SelectionState, bool& leftGap, bool& rightGap);
int leftSelectionOffset(RenderBlock* rootBlock, int y);
int rightSelectionOffset(RenderBlock* rootBlock, int y);
#ifndef NDEBUG
- virtual void dump(TextStream *stream, DeprecatedString ind = "") const;
+ virtual void dump(TextStream*, DeprecatedString ind = "") const;
#endif
// Helper methods for computing line counts and heights for line counts.
- RootInlineBox* lineAtIndex(int i);
+ RootInlineBox* lineAtIndex(int);
int lineCount();
- int heightForLineCount(int l);
+ int heightForLineCount(int);
void clearTruncation();
protected:
virtual bool hasLineIfEmpty() const;
private:
- Position positionForBox(InlineBox *box, bool start=true) const;
- Position positionForRenderer(RenderObject *renderer, bool start=true) const;
+ Position positionForBox(InlineBox*, bool start = true) const;
+ Position positionForRenderer(RenderObject*, bool start = true) const;
protected:
struct FloatingObject {
FloatRight
};
- FloatingObject(Type type) {
- node = 0;
- startY = 0;
- endY = 0;
- m_type = type;
- left = 0;
- width = 0;
- noPaint = false;
+ FloatingObject(Type type)
+ : node(0)
+ , startY(0)
+ , endY(0)
+ , left(0)
+ , width(0)
+ , m_type(type)
+ , noPaint(false)
+ {
}
-
+
Type type() { return static_cast<Type>(m_type); }
RenderObject* node;
unsigned m_type : 1; // Type (left or right aligned)
bool noPaint : 1;
};
-
+
// The following helper functions and structs are used by layoutBlockChildren.
class CompactInfo {
// A compact child that needs to be collapsed into the margin of the following block.
RenderObject* m_compact;
-
+
// The block with the open margin that the compact child is going to place itself within.
RenderObject* m_block;
RenderObject* compact() const { return m_compact; }
RenderObject* block() const { return m_block; }
bool matches(RenderObject* child) const { return m_compact && m_block == child; }
-
- void clear() { set(0, 0); }
+
+ void clear() { set(0, 0); }
void set(RenderObject* c, RenderObject* b) { m_compact = c; m_block = b; }
-
+
CompactInfo() { clear(); }
};
bool m_canCollapseWithChildren : 1;
bool m_canCollapseTopWithChildren : 1;
bool m_canCollapseBottomWithChildren : 1;
-
+
// Whether or not we are a quirky container, i.e., do we collapse away top and bottom
// margins in our container. Table cells and the body are the common examples. We
// also have a custom style property for Safari RSS to deal with TypePad blog articles.
// If our last normal flow child was a self-collapsing block that cleared a float,
// we track it in this variable.
bool m_selfCollapsingBlockClearedFloat : 1;
-
+
// These variables are used to detect quirky margins that we need to collapse away (in table cells
// and in the body element).
bool m_topQuirk : 1;
public:
MarginInfo(RenderBlock* b, int top, int bottom);
-
+
void setAtTopOfBlock(bool b) { m_atTopOfBlock = b; }
void setAtBottomOfBlock(bool b) { m_atBottomOfBlock = b; }
void clearMargin() { m_posMargin = m_negMargin = 0; }
int negMargin() const { return m_negMargin; }
int margin() const { return m_posMargin - m_negMargin; }
};
-
- void adjustPositionedBlock(RenderObject* child, const MarginInfo& marginInfo);
- void adjustFloatingBlock(const MarginInfo& marginInfo);
- RenderObject* handleSpecialChild(RenderObject* child, const MarginInfo& marginInfo, CompactInfo& compactInfo, bool& handled);
- RenderObject* handleFloatingChild(RenderObject* child, const MarginInfo& marginInfo, bool& handled);
- RenderObject* handlePositionedChild(RenderObject* child, const MarginInfo& marginInfo, bool& handled);
- RenderObject* handleCompactChild(RenderObject* child, CompactInfo& compactInfo, bool& handled);
+
+ void adjustPositionedBlock(RenderObject* child, const MarginInfo&);
+ void adjustFloatingBlock(const MarginInfo&);
+ RenderObject* handleSpecialChild(RenderObject* child, const MarginInfo&, CompactInfo&, bool& handled);
+ RenderObject* handleFloatingChild(RenderObject* child, const MarginInfo&, bool& handled);
+ RenderObject* handlePositionedChild(RenderObject* child, const MarginInfo&, bool& handled);
+ RenderObject* handleCompactChild(RenderObject* child, CompactInfo&, bool& handled);
RenderObject* handleRunInChild(RenderObject* child, bool& handled);
- void collapseMargins(RenderObject* child, MarginInfo& marginInfo, int yPosEstimate);
- void clearFloatsIfNeeded(RenderObject* child, MarginInfo& marginInfo, int oldTopPosMargin, int oldTopNegMargin);
- void insertCompactIfNeeded(RenderObject* child, CompactInfo& compactInfo);
- int estimateVerticalPosition(RenderObject* child, const MarginInfo& info);
+ void collapseMargins(RenderObject* child, MarginInfo&, int yPosEstimate);
+ void clearFloatsIfNeeded(RenderObject* child, MarginInfo&, int oldTopPosMargin, int oldTopNegMargin);
+ void insertCompactIfNeeded(RenderObject* child, CompactInfo&);
+ int estimateVerticalPosition(RenderObject* child, const MarginInfo&);
void determineHorizontalPosition(RenderObject* child);
- void handleBottomOfBlock(int top, int bottom, MarginInfo& marginInfo);
- void setCollapsedBottomMargin(const MarginInfo& marginInfo);
+ void handleBottomOfBlock(int top, int bottom, MarginInfo&);
+ void setCollapsedBottomMargin(const MarginInfo&);
// End helper functions and structs used by layoutBlockChildren.
protected:
DeprecatedPtrList<FloatingObject>* m_floatingObjects;
DeprecatedPtrList<RenderObject>* m_positionedObjects;
-
+
bool m_childrenInline : 1;
bool m_firstLine : 1;
unsigned m_clearStatus : 2; // EClear
// How much content overflows out of our block vertically or horizontally (all we support
// for now is spillage out of the bottom and the right, which are the common cases).
- // XXX Generalize to work with top and left as well.
+ // FIXME: Generalize to work with top and left as well.
int m_overflowHeight;
int m_overflowWidth;
-
+
// Left and top overflow. Does not affect scrolling dimensions, but we do at least use it
// when dirty rect checking and hit testing.
int m_overflowLeft;
int m_overflowTop;
-
+
// full width of a tab character
int m_tabWidth;
};
} // namespace WebCore
-#endif // RenderBlock_H
+#endif // RenderBlock_h
#include "Document.h"
#include "GraphicsContext.h"
#include "HTMLInputElement.h"
-#include "RenderText.h"
#include "HTMLNames.h"
+#include "RenderText.h"
namespace WebCore {
if (oldChild == m_inner || !m_inner) {
RenderFlexibleBox::removeChild(oldChild);
m_inner = 0;
- }
- else
+ } else
m_inner->removeChild(oldChild);
}
updatePseudoChildForObject(type, this);
}
-void RenderButton::paintObject(PaintInfo& i, int _tx, int _ty)
+void RenderButton::paintObject(PaintInfo& paintInfo, int tx, int ty)
{
// Push a clip.
- if (m_inner && i.phase == PaintPhaseForeground) {
- IntRect clipRect(_tx + borderLeft(), _ty + borderTop(),
+ if (m_inner && paintInfo.phase == PaintPhaseForeground) {
+ IntRect clipRect(tx + borderLeft(), ty + borderTop(),
width() - borderLeft() - borderRight(), height() - borderBottom() - borderTop());
if (clipRect.width() == 0 || clipRect.height() == 0)
return;
- i.p->save();
- i.p->clip(clipRect);
+ paintInfo.p->save();
+ paintInfo.p->clip(clipRect);
}
-
+
// Paint the children.
- RenderBlock::paintObject(i, _tx, _ty);
-
+ RenderBlock::paintObject(paintInfo, tx, ty);
+
// Pop the clip.
- if (m_inner && i.phase == PaintPhaseForeground)
- i.p->restore();
+ if (m_inner && paintInfo.phase == PaintPhaseForeground)
+ paintInfo.p->restore();
}
-}
+} // namespace WebCore
*
*/
-#ifndef RenderButton_H
-#define RenderButton_H
+#ifndef RenderButton_h
+#define RenderButton_h
#include "RenderFlexibleBox.h"
// RenderButtons are just like normal flexboxes except that they will generate an anonymous block child.
// For inputs, they will also generate an anonymous RenderText and keep its style and content up
// to date as the button changes.
-class RenderButton : public RenderFlexibleBox
-{
+class RenderButton : public RenderFlexibleBox {
public:
RenderButton(Node*);
+ virtual const char* renderName() const { return "RenderButton"; }
+
virtual void addChild(RenderObject* newChild, RenderObject *beforeChild = 0);
- virtual void removeChild(RenderObject* oldChild);
- virtual void removeLeftoverAnonymousBoxes() {}
+ virtual void removeChild(RenderObject*);
+ virtual void removeLeftoverAnonymousBoxes() { }
virtual bool createsAnonymousWrapper() const { return true; }
virtual void setStyle(RenderStyle*);
void setText(const String&);
- virtual const char* renderName() const { return "RenderButton"; }
-
protected:
virtual bool hasLineIfEmpty() const { return true; }
RenderBlock* m_inner;
};
-}
+} // namespace WebCore
-#endif
+#endif // RenderButton_h
#include "config.h"
#include "RenderContainer.h"
-#include "htmlediting.h"
+#include "AXObjectCache.h"
+#include "Document.h"
#include "RenderCounter.h"
+#include "RenderImage.h"
#include "RenderListItem.h"
#include "RenderTable.h"
#include "RenderTextFragment.h"
-#include "RenderImage.h"
#include "RenderView.h"
-#include "Document.h"
-
-// For accessibility
-#include "AXObjectCache.h"
+#include "htmlediting.h"
namespace WebCore {
RenderContainer::RenderContainer(Node* node)
: RenderBox(node)
+ , m_first(0)
+ , m_last(0)
{
- m_first = 0;
- m_last = 0;
}
-
RenderContainer::~RenderContainer()
{
}
#undef DEBUG_LAYOUT
-}
+} // namespace WebCore
* Boston, MA 02111-1307, USA.
*/
-#ifndef RenderContainer_H
-#define RenderContainer_H
+#ifndef RenderContainer_h
+#define RenderContainer_h
#include "RenderBox.h"
/**
* Base class for rendering objects that can have children
*/
-class RenderContainer : public RenderBox
-{
+class RenderContainer : public RenderBox {
public:
RenderContainer(Node*);
virtual ~RenderContainer();
- RenderObject *firstChild() const { return m_first; }
- RenderObject *lastChild() const { return m_last; }
+ RenderObject* firstChild() const { return m_first; }
+ RenderObject* lastChild() const { return m_last; }
virtual bool canHaveChildren() const;
- virtual void addChild(RenderObject *newChild, RenderObject *beforeChild = 0);
- virtual void removeChild(RenderObject *oldChild);
+ virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
+ virtual void removeChild(RenderObject*);
virtual void destroy();
void destroyLeftoverChildren();
-
- virtual RenderObject* removeChildNode(RenderObject* child);
- virtual void appendChildNode(RenderObject* child);
+
+ virtual RenderObject* removeChildNode(RenderObject*);
+ virtual void appendChildNode(RenderObject*);
virtual void insertChildNode(RenderObject* child, RenderObject* before);
virtual void layout();
- virtual void calcMinMaxWidth() { setMinMaxKnown( true ); }
+ virtual void calcMinMaxWidth() { setMinMaxKnown(true); }
virtual void removeLeftoverAnonymousBoxes();
void updatePseudoChildForObject(RenderStyle::PseudoId, RenderObject*);
virtual VisiblePosition positionForCoordinates(int x, int y);
-
+
virtual void lineBoxRects(Vector<IntRect>&);
protected:
void setFirstChild(RenderObject* first) { m_first = first; }
void setLastChild(RenderObject* last) { m_last = last; }
-protected:
- RenderObject *m_first;
- RenderObject *m_last;
+ RenderObject* m_first;
+ RenderObject* m_last;
};
-}
-#endif
+} // namespace WebCore
+
+#endif // RenderContainer_h
const int cMarkerPadding = 7;
RenderCounter::RenderCounter(Node* node, CounterData* counter)
- : RenderText(node, 0), m_counter(counter), m_counterNode(0)
+ : RenderText(node, 0)
+ , m_counter(counter)
+ , m_counterNode(0)
{
}
int d = 0;
do {
int num = number % 10;
- if (num % 5 < 4)
+ if (num % 5 < 4) {
for (int i = num % 5; i > 0; i--)
roman.insert(&digits[d], 1, 0);
+ }
if (num >= 4 && num <= 8)
roman.insert(&digits[d + 1], 1, 0);
if (num == 9)
{
if (number < 1)
return String::number(number);
-
+
static const UChar tenDigit[] = {1497, 1499, 1500, 1502, 1504, 1505, 1506, 1508, 1510};
String letter;
int value = m_counterNode->count();
if (m_counterNode->isReset())
value = m_counterNode->value();
-
+
int total = value;
if (m_counterNode->parent())
total = m_counterNode->parent()->total();
-
+
m_item = convertValueToType(value, total, m_counter->listStyle());
if (hasSeparator) {
while (counter->parent() && (first || !(counter->isReset() && counter->parent()->isRoot()))) {
value = counter->count() ? counter->count() : 1;
total = counter->parent()->total();
- m_item = convertValueToType(value, total, m_counter->listStyle())
- + m_counter->separator() + m_item;
+ m_item = convertValueToType(value, total, m_counter->listStyle()) + m_counter->separator() + m_item;
counter = counter->parent();
first = false;
}
}
str = new StringImpl(m_item.characters(), m_item.length());
-
+
RenderText::calcMinMaxWidth();
}
* Boston, MA 02111-1307, USA.
*
*/
-#ifndef RENDER_COUNTER_H_
-#define RENDER_COUNTER_H_
+#ifndef RenderCounter_h
+#define RenderCounter_h
#include "RenderText.h"
namespace WebCore {
- class CounterNode;
-// -----------------------------------------------------------------------------
+class CounterNode;
class RenderCounter : public RenderText {
-
public:
RenderCounter(Node*, CounterData*);
-
+
virtual const char* renderName() const { return "RenderCounter"; }
virtual bool isCounter() const { return true; }
+
virtual void layout();
virtual void calcMinMaxWidth();
CounterNode* m_counterNode;
};
-} //namespace
+} // namespace WebCore
-#endif
+#endif // RenderCounter_h
return 0;
}
-void RenderFieldset::paintBoxDecorations(PaintInfo& i, int _tx, int _ty)
+void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
{
int w = width();
int h = height() + borderTopExtra() + borderBottomExtra();
RenderObject* legend = findLegend();
if (!legend)
- return RenderBlock::paintBoxDecorations(i, _tx, _ty);
+ return RenderBlock::paintBoxDecorations(paintInfo, tx, ty);
- int yOff = (legend->yPos() > 0) ? 0 : (legend->height()-borderTop())/2;
+ int yOff = (legend->yPos() > 0) ? 0 : (legend->height() - borderTop()) / 2;
h -= yOff;
- _ty += yOff - borderTopExtra();
+ ty += yOff - borderTopExtra();
- int my = max(_ty, i.r.y());
- int end = min(i.r.bottom(), _ty + h);
+ int my = max(ty, paintInfo.r.y());
+ int end = min(paintInfo.r.bottom(), ty + h);
int mh = end - my;
- paintBackground(i.p, style()->backgroundColor(), style()->backgroundLayers(), my, mh, _tx, _ty, w, h);
+ paintBackground(paintInfo.p, style()->backgroundColor(), style()->backgroundLayers(), my, mh, tx, ty, w, h);
if (style()->hasBorder())
- paintBorderMinusLegend(i.p, _tx, _ty, w, h, style(), legend->xPos(), legend->width());
+ paintBorderMinusLegend(paintInfo.p, tx, ty, w, h, style(), legend->xPos(), legend->width());
}
-void RenderFieldset::paintBorderMinusLegend(GraphicsContext* p, int _tx, int _ty, int w, int h,
+void RenderFieldset::paintBorderMinusLegend(GraphicsContext* graphicsContext, int tx, int ty, int w, int h,
const RenderStyle* style, int lx, int lw)
{
bool render_b = bs > BHIDDEN;
if (render_t) {
- drawBorder(p, _tx, _ty, _tx + lx, _ty + style->borderTopWidth(), BSTop, tc, style->color(), ts,
- (render_l && (ls == DOTTED || ls == DASHED || ls == DOUBLE)?style->borderLeftWidth():0), 0);
- drawBorder(p, _tx+lx+lw, _ty, _tx + w, _ty + style->borderTopWidth(), BSTop, tc, style->color(), ts,
- 0, (render_r && (rs == DOTTED || rs == DASHED || rs == DOUBLE)?style->borderRightWidth():0));
+ drawBorder(graphicsContext, tx, ty, tx + lx, ty + style->borderTopWidth(), BSTop, tc, style->color(), ts,
+ (render_l && (ls == DOTTED || ls == DASHED || ls == DOUBLE) ? style->borderLeftWidth() : 0), 0);
+ drawBorder(graphicsContext, tx + lx + lw, ty, tx + w, ty + style->borderTopWidth(), BSTop, tc, style->color(), ts,
+ 0, (render_r && (rs == DOTTED || rs == DASHED || rs == DOUBLE) ? style->borderRightWidth() : 0));
}
if (render_b)
- drawBorder(p, _tx, _ty + h - style->borderBottomWidth(), _tx + w, _ty + h, BSBottom, bc, style->color(), bs,
- (render_l && (ls == DOTTED || ls == DASHED || ls == DOUBLE)?style->borderLeftWidth():0),
- (render_r && (rs == DOTTED || rs == DASHED || rs == DOUBLE)?style->borderRightWidth():0));
+ drawBorder(graphicsContext, tx, ty + h - style->borderBottomWidth(), tx + w, ty + h, BSBottom, bc, style->color(), bs,
+ (render_l && (ls == DOTTED || ls == DASHED || ls == DOUBLE) ? style->borderLeftWidth() : 0),
+ (render_r && (rs == DOTTED || rs == DASHED || rs == DOUBLE) ? style->borderRightWidth() : 0));
if (render_l) {
const Color& lc = style->borderLeftColor();
(ls >= OUTSET) &&
(bs == DOTTED || bs == DASHED || bs == SOLID || bs == INSET);
- drawBorder(p, _tx, _ty, _tx + style->borderLeftWidth(), _ty + h, BSLeft, lc, style->color(), ls,
- ignore_top?0:style->borderTopWidth(),
- ignore_bottom?0:style->borderBottomWidth());
+ drawBorder(graphicsContext, tx, ty, tx + style->borderLeftWidth(), ty + h, BSLeft, lc, style->color(), ls,
+ ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth());
}
if (render_r) {
(rs >= DOTTED || rs == INSET) &&
(bs == DOTTED || bs == DASHED || bs == SOLID || bs == INSET);
- drawBorder(p, _tx + w - style->borderRightWidth(), _ty, _tx + w, _ty + h, BSRight, rc, style->color(), rs,
- ignore_top?0:style->borderTopWidth(),
- ignore_bottom?0:style->borderBottomWidth());
+ drawBorder(graphicsContext, tx + w - style->borderRightWidth(), ty, tx + w, ty + h, BSRight, rc, style->color(), rs,
+ ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth());
}
}
-void RenderFieldset::setStyle(RenderStyle* _style)
+void RenderFieldset::setStyle(RenderStyle* newStyle)
{
- RenderBlock::setStyle(_style);
+ RenderBlock::setStyle(newStyle);
// WinIE renders fieldsets with display:inline like they're inline-blocks. For us,
// an inline-block is just a block element with replaced set to true and inline set
virtual Node* shadowParentNode() { return m_shadowParent; }
private:
- Node* m_shadowParent;
+ Node* m_shadowParent;
};
RenderFileUploadControl::RenderFileUploadControl(Node* node)
{
if (m_button)
m_button->detach();
- if (m_fileChooser) {
+ if (m_fileChooser)
m_fileChooser->disconnectUploadControl();
- }
}
-void RenderFileUploadControl::setStyle(RenderStyle* s)
+void RenderFileUploadControl::setStyle(RenderStyle* newStyle)
{
// Force text-align to match the direction
- if (s->direction() == LTR)
- s->setTextAlign(LEFT);
+ if (newStyle->direction() == LTR)
+ newStyle->setTextAlign(LEFT);
else
- s->setTextAlign(RIGHT);
-
- RenderBlock::setStyle(s);
+ newStyle->setTextAlign(RIGHT);
+
+ RenderBlock::setStyle(newStyle);
if (m_button)
- m_button->renderer()->setStyle(createButtonStyle(s));
+ m_button->renderer()->setStyle(createButtonStyle(newStyle));
setReplaced(isInline());
}
return style;
}
-void RenderFileUploadControl::paintObject(PaintInfo& i, int tx, int ty)
+void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, int tx, int ty)
{
// Push a clip.
- if (i.phase == PaintPhaseForeground || i.phase == PaintPhaseChildBlockBackgrounds) {
+ if (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseChildBlockBackgrounds) {
IntRect clipRect(tx + borderLeft(), ty + borderTop(),
width() - borderLeft() - borderRight(), height() - borderBottom() - borderTop());
if (clipRect.width() == 0 || clipRect.height() == 0)
return;
- i.p->save();
- i.p->clip(clipRect);
+ paintInfo.p->save();
+ paintInfo.p->clip(clipRect);
}
-
- if (i.phase == PaintPhaseForeground) {
+
+ if (paintInfo.phase == PaintPhaseForeground) {
const String& displayedFilename = m_fileChooser->basenameForWidth(maxFilenameWidth());
TextRun textRun(displayedFilename.characters(), displayedFilename.length());
-
+
// Determine where the filename should be placed
int contentLeft = tx + borderLeft() + paddingLeft();
int buttonAndIconWidth = m_button->renderer()->width() + afterButtonSpacing + (m_fileChooser->icon() ? iconWidth + iconFilenameSpacing : 0);
// We want to match the button's baseline
RenderButton* buttonRenderer = static_cast<RenderButton*>(m_button->renderer());
int textY = buttonRenderer->absoluteBoundingBoxRect().y() + buttonRenderer->marginTop() + buttonRenderer->borderTop() + buttonRenderer->paddingTop() + buttonRenderer->baselinePosition(true, false);
-
- i.p->setFont(style()->font());
- i.p->setPen(style()->color());
-
+
+ paintInfo.p->setFont(style()->font());
+ paintInfo.p->setPen(style()->color());
+
// Draw the filename
- i.p->drawText(textRun, IntPoint(textX, textY));
-
+ paintInfo.p->drawText(textRun, IntPoint(textX, textY));
+
if (m_fileChooser->icon()) {
// Determine where the icon should be placed
int iconY = ty + borderTop() + paddingTop() + (contentHeight() - iconHeight) / 2;
iconX = contentLeft + m_button->renderer()->width() + afterButtonSpacing;
else
iconX = contentLeft + contentWidth() - m_button->renderer()->width() - afterButtonSpacing - iconWidth;
-
+
// Draw the file icon
- m_fileChooser->icon()->paint(i.p, IntRect(iconX, iconY, iconWidth, iconHeight));
+ m_fileChooser->icon()->paint(paintInfo.p, IntRect(iconX, iconY, iconWidth, iconHeight));
}
}
-
+
// Paint the children.
- RenderBlock::paintObject(i, tx, ty);
-
+ RenderBlock::paintObject(paintInfo, tx, ty);
+
// Pop the clip.
- if (i.phase == PaintPhaseForeground || i.phase == PaintPhaseChildBlockBackgrounds)
- i.p->restore();
+ if (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseChildBlockBackgrounds)
+ paintInfo.p->restore();
}
void RenderFileUploadControl::calcMinMaxWidth()
{
m_minWidth = 0;
m_maxWidth = 0;
-
+
if (style()->width().isFixed() && style()->width().value() > 0)
m_minWidth = m_maxWidth = calcContentBoxWidth(style()->width().value());
else {
float charWidth = style()->font().floatWidth(TextRun(&ch, 1), TextStyle(0, 0, 0, false, false, false));
m_maxWidth = (int)ceilf(charWidth * defaultWidthNumChars);
}
-
+
if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
m_maxWidth = max(m_maxWidth, calcContentBoxWidth(style()->minWidth().value()));
m_minWidth = max(m_minWidth, calcContentBoxWidth(style()->minWidth().value()));
m_minWidth = 0;
else
m_minWidth = m_maxWidth;
-
+
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
m_maxWidth = min(m_maxWidth, calcContentBoxWidth(style()->maxWidth().value()));
m_minWidth = min(m_minWidth, calcContentBoxWidth(style()->maxWidth().value()));
}
-
+
int toAdd = paddingLeft() + paddingRight() + borderLeft() + borderRight();
m_minWidth += toAdd;
m_maxWidth += toAdd;
-
+
setMinMaxKnown();
}
return HTMLInputElement::createRenderer(arena, style);
}
-}
+} // namespace WebCore
*
*/
-#ifndef RenderFileUploadControl_H
-#define RenderFileUploadControl_H
-
-#include "RenderBlock.h"
+#ifndef RenderFileUploadControl_h
+#define RenderFileUploadControl_h
#include "FileChooser.h"
#include "HTMLInputElement.h"
+#include "RenderBlock.h"
#include "Shared.h"
namespace WebCore {
RenderFileUploadControl(Node*);
~RenderFileUploadControl();
+ virtual const char* renderName() const { return "RenderFileUploadControl"; }
+
virtual void setStyle(RenderStyle*);
virtual void updateFromElement();
virtual void calcMinMaxWidth();
void valueChanged();
- virtual const char* renderName() const { return "RenderFileUploadControl"; }
-
protected:
int maxFilenameWidth();
RenderStyle* createButtonStyle(RenderStyle* parentStyle = 0);
-
+
RefPtr<HTMLFileUploadInnerButtonElement> m_button;
RefPtr<FileChooser> m_fileChooser;
};
-}
+} // namespace WebCore
-#endif
+#endif // RenderFileUploadControl_h
*
*/
-#ifndef RenderFlexibleBox_H
-#define RenderFlexibleBox_H
+#ifndef RenderFlexibleBox_h
+#define RenderFlexibleBox_h
#include "RenderBlock.h"
RenderFlexibleBox(Node*);
virtual ~RenderFlexibleBox();
+ virtual const char* renderName() const;
+
virtual void calcMinMaxWidth();
void calcHorizontalMinMaxWidth();
void calcVerticalMinMaxWidth();
virtual bool isFlexingChildren() const { return m_flexingChildren; }
virtual bool isStretchingChildren() const { return m_stretchingChildren; }
- virtual const char* renderName() const;
-
void placeChild(RenderObject* child, int x, int y);
protected:
} // namespace WebCore
-#endif // RenderFlexibleBox_H
+#endif // RenderFlexibleBox_h
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-// -------------------------------------------------------------------------
#include "config.h"
#include "RenderFlow.h"
#include "Document.h"
#include "GraphicsContext.h"
-#include "InlineTextBox.h"
#include "HTMLNames.h"
+#include "InlineTextBox.h"
#include "RenderArena.h"
-#include "RenderView.h"
#include "RenderInline.h"
+#include "RenderView.h"
using namespace std;
ow);
}
-}
+} // namespace WebCore
*
*/
-#ifndef RenderFlow_H
-#define RenderFlow_H
+#ifndef RenderFlow_h
+#define RenderFlow_h
#include "RenderContainer.h"
virtual RenderFlow* continuation() const { return m_continuation; }
void setContinuation(RenderFlow* c) { m_continuation = c; }
RenderFlow* continuationBefore(RenderObject* beforeChild);
-
+
void addChildWithContinuation(RenderObject* newChild, RenderObject* beforeChild);
virtual void addChildToFlow(RenderObject* newChild, RenderObject* beforeChild) = 0;
- virtual void addChild(RenderObject *newChild, RenderObject *beforeChild = 0);
+ virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
- static RenderFlow* createAnonymousFlow(Document* doc, RenderStyle* style);
+ static RenderFlow* createAnonymousFlow(Document*, RenderStyle*);
- void extractLineBox(InlineFlowBox* lineBox);
- void attachLineBox(InlineFlowBox* lineBox);
- void removeLineBox(InlineFlowBox* lineBox);
+ void extractLineBox(InlineFlowBox*);
+ void attachLineBox(InlineFlowBox*);
+ void removeLineBox(InlineFlowBox*);
void deleteLineBoxes();
virtual void destroy();
virtual void dirtyLinesFromChangedChild(RenderObject* child);
-
- virtual short lineHeight(bool firstLine, bool isRootLineBox=false) const;
-
+
+ virtual short lineHeight(bool firstLine, bool isRootLineBox = false) const;
+
InlineFlowBox* firstLineBox() const { return m_firstLineBox; }
InlineFlowBox* lastLineBox() const { return m_lastLineBox; }
virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun=false);
virtual void dirtyLineBoxes(bool fullLayout, bool isRootLineBox = false);
-
- void paintLines(PaintInfo&, int _tx, int _ty);
+
+ void paintLines(PaintInfo&, int tx, int ty);
bool hitTestLines(HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
virtual IntRect getAbsoluteRepaintRect();
-
- virtual int lowestPosition(bool includeOverflowInterior=true, bool includeSelf=true) const;
- virtual int rightmostPosition(bool includeOverflowInterior=true, bool includeSelf=true) const;
- virtual int leftmostPosition(bool includeOverflowInterior=true, bool includeSelf=true) const;
-
- virtual IntRect caretRect(int offset, EAffinity affinity = UPSTREAM, int *extraWidthToEndOfLine = 0);
-
- virtual void addFocusRingRects(GraphicsContext*, int _tx, int _ty);
- void paintOutlineForLine(GraphicsContext*, int tx, int ty, const IntRect &prevLine, const IntRect &thisLine, const IntRect &nextLine);
+
+ virtual int lowestPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
+ virtual int rightmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
+ virtual int leftmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
+
+ virtual IntRect caretRect(int offset, EAffinity = UPSTREAM, int* extraWidthToEndOfLine = 0);
+
+ virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
+ void paintOutlineForLine(GraphicsContext*, int tx, int ty, const IntRect& prevLine, const IntRect& thisLine, const IntRect& nextLine);
void paintOutline(GraphicsContext*, int tx, int ty);
protected:
// For inline flows, each box represents a portion of that inline.
InlineFlowBox* m_firstLineBox;
InlineFlowBox* m_lastLineBox;
-
+
mutable short m_lineHeight;
};
} // namespace WebCore
-#endif // RenderFlow_H
+#endif // RenderFlow_h
*/
#include "config.h"
+
#ifdef SVG_SUPPORT
+
#include "RenderForeignObject.h"
#include "GraphicsContext.h"
#include "KRenderingDevice.h"
-#include "SVGLength.h"
#include "SVGForeignObjectElement.h"
+#include "SVGLength.h"
namespace WebCore {
-RenderForeignObject::RenderForeignObject(SVGForeignObjectElement *node)
+RenderForeignObject::RenderForeignObject(SVGForeignObjectElement* node)
: RenderBlock(node)
{
}
if (paintInfo.p->paintingDisabled())
return;
- KRenderingDevice *device = renderingDevice();
+ KRenderingDevice* device = renderingDevice();
KRenderingDeviceContext* context = device->currentContext();
bool shouldPopContext = false;
if (!context) {
if (opacity < 1.0f)
paintInfo.p->endTransparencyLayer();
-
+
if (shouldPopContext) {
device->popContext();
delete context;
{
AffineTransform transform = translationForAttributes() * localTransform();
r = transform.mapRect(r);
-
+
RenderBlock::computeAbsoluteRepaintRect(r, f);
}
if (checkForRepaint)
repaintAfterLayoutIfNeeded(oldBounds, oldBounds);
-
+
setNeedsLayout(false);
}
totalTransform *= translationForAttributes();
double localX, localY;
totalTransform.invert().map(x, y, &localX, &localY);
- return RenderBlock::nodeAtPoint(result, (int)localX, (int)localY, tx, ty, hitTestAction);
+ return RenderBlock::nodeAtPoint(result, static_cast<int>(localX), static_cast<int>(localY), tx, ty, hitTestAction);
}
-}
+} // namespace WebCore
#endif // SVG_SUPPORT
*
*/
-#ifndef RenderForeignObject_H
-#define RenderForeignObject_H
+#ifndef RenderForeignObject_h
+#define RenderForeignObject_h
#ifdef SVG_SUPPORT
-#include "RenderBlock.h"
#include "AffineTransform.h"
+#include "RenderBlock.h"
namespace WebCore {
class SVGForeignObjectElement;
-class RenderForeignObject : public RenderBlock
-{
+class RenderForeignObject : public RenderBlock {
public:
- RenderForeignObject(SVGForeignObjectElement *node);
-
- virtual const char *renderName() const { return "RenderForeignObject"; }
- virtual void paint(PaintInfo& paintInfo, int parentX, int parentY);
-
+ RenderForeignObject(SVGForeignObjectElement*);
+
+ virtual const char* renderName() const { return "RenderForeignObject"; }
+
+ virtual void paint(PaintInfo&, int parentX, int parentY);
+
virtual AffineTransform localTransform() const { return m_transform; }
virtual void setLocalTransform(const AffineTransform& transform) { m_transform = transform; }
-
- virtual void computeAbsoluteRepaintRect(IntRect& r, bool f);
+
+ virtual void computeAbsoluteRepaintRect(IntRect&, bool fixed);
virtual bool requiresLayer();
virtual void layout();
private:
AffineTransform translationForAttributes();
+
AffineTransform m_transform;
IntRect m_absoluteBounds;
};
-}
+} // namespace WebCore
#endif // SVG_SUPPORT
-#endif
+#endif // RenderForeignObject_h
return marginTop() + widget()->baselinePosition(m_height);
}
-void RenderFormElement::setStyle(RenderStyle* s)
+void RenderFormElement::setStyle(RenderStyle* newStyle)
{
- RenderWidget::setStyle(s);
+ RenderWidget::setStyle(newStyle);
// Do not paint a background or border for Aqua form elements
setShouldPaintBackgroundOrBorder(false);
calcWidth();
calcHeight();
-
+
setNeedsLayout(false);
}
case TAAUTO:
return style()->direction() == RTL ? AlignRight : AlignLeft;
}
- ASSERT(false); // Should never be reached.
+ ASSERT_NOT_REACHED();
return AlignLeft;
}
#ifndef RenderFormElement_h
#define RenderFormElement_h
-#include "RenderWidget.h"
#include "GraphicsTypes.h"
+#include "RenderWidget.h"
namespace WebCore {
* Boston, MA 02111-1307, USA.
*
*/
+
#include "config.h"
#include "RenderFrame.h"
*
*/
-#ifndef RenderFrame_H
-#define RenderFrame_H
+#ifndef RenderFrame_h
+#define RenderFrame_h
-#include "RenderPart.h"
#include "HTMLFrameElement.h"
+#include "RenderPart.h"
namespace WebCore {
-class RenderFrame : public RenderPart
-{
+class RenderFrame : public RenderPart {
public:
RenderFrame(HTMLFrameElement*);
virtual const char* renderName() const { return "RenderFrame"; }
- HTMLFrameElement* element() const
- { return static_cast<HTMLFrameElement*>(RenderPart::element()); }
+ HTMLFrameElement* element() const { return static_cast<HTMLFrameElement*>(RenderPart::element()); }
virtual void viewCleared();
};
-}
+} // namespace WebCore
-#endif
+#endif // RenderFrame_h
* Boston, MA 02111-1307, USA.
*
*/
+
#include "config.h"
#include "RenderFrameSet.h"
#include "GraphicsContext.h"
#include "HTMLFrameSetElement.h"
#include "HTMLNames.h"
-#include "TextStream.h"
-#include "MouseEvent.h"
#include "HitTestResult.h"
+#include "MouseEvent.h"
#include "RenderFrame.h"
#include "RenderView.h"
+#include "TextStream.h"
namespace WebCore {
}
#endif
-}
+} // namespace WebCore
*
*/
-#ifndef RenderFrameSet_H
-#define RenderFrameSet_H
+#ifndef RenderFrameSet_h
+#define RenderFrameSet_h
-#include "RenderContainer.h"
#include "HTMLFrameSetElement.h"
-
+#include "RenderContainer.h"
namespace WebCore {
class HTMLFrameSetElement;
class MouseEvent;
-class RenderFrameSet : public RenderContainer
-{
+class RenderFrameSet : public RenderContainer {
friend class HTMLFrameSetElement;
public:
RenderFrameSet(HTMLFrameSetElement*);
virtual bool nodeAtPoint(HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
- HTMLFrameSetElement* element() const
- { return static_cast<HTMLFrameSetElement*>(RenderContainer::element()); }
+ HTMLFrameSetElement* element() const { return static_cast<HTMLFrameSetElement*>(RenderContainer::element()); }
#ifndef NDEBUG
virtual void dump(TextStream* stream, DeprecatedString ind = "") const;
bool m_clientResizing;
};
-}
+} // namespace WebCore
-#endif
+#endif // RenderFrameSet_h
using namespace HTMLNames;
-RenderHTMLCanvas::RenderHTMLCanvas(Node* n)
- : RenderReplaced(n)
+RenderHTMLCanvas::RenderHTMLCanvas(Node* node)
+ : RenderReplaced(node)
{
}
-const char* RenderHTMLCanvas::renderName() const
+void RenderHTMLCanvas::paint(PaintInfo& paintInfo, int tx, int ty)
{
- return "RenderHTMLCanvas";
-}
-
-void RenderHTMLCanvas::paint(PaintInfo& i, int tx, int ty)
-{
- if (!shouldPaint(i, tx, ty))
+ if (!shouldPaint(paintInfo, tx, ty))
return;
int x = tx + m_x;
int y = ty + m_y;
- if (shouldPaintBackgroundOrBorder() && (i.phase == PaintPhaseForeground || i.phase == PaintPhaseSelection))
- paintBoxDecorations(i, x, y);
+ if (shouldPaintBackgroundOrBorder() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
+ paintBoxDecorations(paintInfo, x, y);
- if ((i.phase == PaintPhaseOutline || i.phase == PaintPhaseSelfOutline) && style()->outlineWidth() && style()->visibility() == VISIBLE)
- paintOutline(i.p, x, y, width(), height(), style());
-
- if (i.phase != PaintPhaseForeground && i.phase != PaintPhaseSelection)
+ if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth() && style()->visibility() == VISIBLE)
+ paintOutline(paintInfo.p, x, y, width(), height(), style());
+
+ if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)
return;
- if (!shouldPaintWithinRoot(i))
+ if (!shouldPaintWithinRoot(paintInfo))
return;
bool drawSelectionTint = selectionState() != SelectionNone && !document()->printing();
- if (i.phase == PaintPhaseSelection) {
+ if (paintInfo.phase == PaintPhaseSelection) {
if (selectionState() == SelectionNone)
return;
drawSelectionTint = false;
}
if (element() && element()->hasTagName(canvasTag))
- static_cast<HTMLCanvasElement*>(element())->paint(i.p,
+ static_cast<HTMLCanvasElement*>(element())->paint(paintInfo.p,
IntRect(x + borderLeft() + paddingLeft(), y + borderTop() + paddingTop(), contentWidth(), contentHeight()));
if (drawSelectionTint)
- i.p->fillRect(selectionRect(), selectionBackgroundColor());
+ paintInfo.p->fillRect(selectionRect(), selectionBackgroundColor());
}
void RenderHTMLCanvas::layout()
setNeedsLayout(false);
}
-}
+} // namespace WebCore
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef RenderHTMLCanvas_H
-#define RenderHTMLCanvas_H
+#ifndef RenderHTMLCanvas_h
+#define RenderHTMLCanvas_h
#include "RenderReplaced.h"
class RenderHTMLCanvas : public RenderReplaced {
public:
RenderHTMLCanvas(Node*);
- virtual const char* renderName() const;
+
+ virtual const char* renderName() const { return "RenderHTMLCanvas"; }
+
virtual void paint(PaintInfo&, int tx, int ty);
virtual void layout();
};
-} //namespace
+} // namespace WebCore
-#endif
+#endif // RenderHTMLCanvas_h
using namespace HTMLNames;
-RenderImage::RenderImage(Node* n)
- : RenderReplaced(n)
+RenderImage::RenderImage(Node* node)
+ : RenderReplaced(node)
, m_cachedImage(0)
+ , m_isAnonymousImage(0)
{
m_selectionState = SelectionNone;
setIntrinsicWidth(0);
setIntrinsicHeight(0);
- m_isAnonymousImage = 0;
updateAltText();
}
m_cachedImage->deref(this);
}
-void RenderImage::setStyle(RenderStyle* _style)
+void RenderImage::setStyle(RenderStyle* newStyle)
{
- RenderReplaced::setStyle(_style);
-
+ RenderReplaced::setStyle(newStyle);
setShouldPaintBackgroundOrBorder(true);
}
-void RenderImage::setContentObject(CachedResource* co)
+void RenderImage::setContentObject(CachedResource* cachedResource)
{
- if (co && m_cachedImage != co) {
+ if (cachedResource && m_cachedImage != cachedResource) {
if (m_cachedImage)
m_cachedImage->deref(this);
- m_cachedImage = static_cast<CachedImage*>(co);
+ m_cachedImage = static_cast<CachedImage*>(cachedResource);
if (m_cachedImage)
m_cachedImage->ref(this);
}
{
if (isAnonymousImage())
return;
-
+
if (m_cachedImage != newImage) {
if (m_cachedImage)
m_cachedImage->deref(this);
}
}
-void RenderImage::imageChanged(CachedImage* o)
+void RenderImage::imageChanged(CachedImage* newImage)
{
if (documentBeingDestroyed())
return;
- if (o != m_cachedImage) {
- RenderReplaced::imageChanged(o);
+ if (newImage != m_cachedImage) {
+ RenderReplaced::imageChanged(newImage);
return;
}
- bool iwchanged = false;
+ bool imageSizeChanged = false;
- if (o->isErrorImage()) {
- int iw = o->image()->width() + 4;
- int ih = o->image()->height() + 4;
+ if (newImage->isErrorImage()) {
+ int imageWidth = newImage->image()->width() + 4;
+ int imageHeight = newImage->image()->height() + 4;
// we have an alt and the user meant it (its not a text we invented)
if (!m_altText.isEmpty()) {
const Font& font = style()->font();
- iw = max(iw, min(font.width(TextRun(m_altText.characters(), m_altText.length())), 1024));
- ih = max(ih, min(font.height(), 256));
+ imageWidth = max(imageWidth, min(font.width(TextRun(m_altText.characters(), m_altText.length())), 1024));
+ imageHeight = max(imageHeight, min(font.height(), 256));
}
- if (iw != intrinsicWidth()) {
- setIntrinsicWidth(iw);
- iwchanged = true;
+ if (imageWidth != intrinsicWidth()) {
+ setIntrinsicWidth(imageWidth);
+ imageSizeChanged = true;
}
- if (ih != intrinsicHeight()) {
- setIntrinsicHeight(ih);
- iwchanged = true;
+ if (imageHeight != intrinsicHeight()) {
+ setIntrinsicHeight(imageHeight);
+ imageSizeChanged = true;
}
}
- bool needlayout = false;
+ bool ensureLayout = false;
// Image dimensions have been changed, see what needs to be done
- if ((o->imageSize().width() != intrinsicWidth() || o->imageSize().height() != intrinsicHeight() || iwchanged)) {
- if(!o->isErrorImage()) {
- setIntrinsicWidth(o->imageSize().width());
- setIntrinsicHeight(o->imageSize().height());
+ if (newImage->imageSize().width() != intrinsicWidth() || newImage->imageSize().height() != intrinsicHeight() || imageSizeChanged) {
+ if (!newImage->isErrorImage()) {
+ setIntrinsicWidth(newImage->imageSize().width());
+ setIntrinsicHeight(newImage->imageSize().height());
}
// In the case of generated image content using :before/:after, we might not be in the
calcWidth();
calcHeight();
- if(iwchanged || m_width != oldwidth || m_height != oldheight)
- needlayout = true;
-
+ if (imageSizeChanged || m_width != oldwidth || m_height != oldheight)
+ ensureLayout = true;
+
m_width = oldwidth;
m_height = oldheight;
}
}
- if (needlayout) {
+ if (ensureLayout) {
if (!selfNeedsLayout())
setNeedsLayout(true);
if (minMaxKnown())
setMinMaxKnown(false);
- }
- else
+ } else
// FIXME: We always just do a complete repaint, since we always pass in the full image
// rect at the moment anyway.
- repaintRectangle(IntRect(borderLeft()+paddingLeft(), borderTop()+paddingTop(), contentWidth(), contentHeight()));
+ repaintRectangle(IntRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), contentWidth(), contentHeight()));
}
void RenderImage::resetAnimation()
}
}
-void RenderImage::paint(PaintInfo& i, int _tx, int _ty)
+void RenderImage::paint(PaintInfo& paintInfo, int tx, int ty)
{
- if (!shouldPaint(i, _tx, _ty)) return;
+ if (!shouldPaint(paintInfo, tx, ty))
+ return;
- _tx += m_x;
- _ty += m_y;
+ tx += m_x;
+ ty += m_y;
- if (shouldPaintBackgroundOrBorder() && i.phase != PaintPhaseOutline && i.phase != PaintPhaseSelfOutline)
- paintBoxDecorations(i, _tx, _ty);
+ if (shouldPaintBackgroundOrBorder() && paintInfo.phase != PaintPhaseOutline && paintInfo.phase != PaintPhaseSelfOutline)
+ paintBoxDecorations(paintInfo, tx, ty);
- GraphicsContext* p = i.p;
-
- if ((i.phase == PaintPhaseOutline || i.phase == PaintPhaseSelfOutline) && style()->outlineWidth() && style()->visibility() == VISIBLE)
- paintOutline(p, _tx, _ty, width(), height(), style());
-
- if (i.phase != PaintPhaseForeground && i.phase != PaintPhaseSelection)
+ GraphicsContext* p = paintInfo.p;
+
+ if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth() && style()->visibility() == VISIBLE)
+ paintOutline(p, tx, ty, width(), height(), style());
+
+ if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)
return;
- if (!shouldPaintWithinRoot(i))
+ if (!shouldPaintWithinRoot(paintInfo))
return;
bool isPrinting = document()->printing();
bool drawSelectionTint = isSelected() && !isPrinting;
- if (i.phase == PaintPhaseSelection) {
+ if (paintInfo.phase == PaintPhaseSelection) {
if (selectionState() == SelectionNone)
return;
drawSelectionTint = false;
return;
if (!m_cachedImage || image()->isNull() || errorOccurred()) {
- if (i.phase == PaintPhaseSelection)
+ if (paintInfo.phase == PaintPhaseSelection)
return;
if (cWidth > 2 && cHeight > 2) {
if (!errorOccurred()) {
p->setPen(Color::lightGray);
p->setFillColor(Color::transparent);
- p->drawRect(IntRect(_tx + leftBorder + leftPad, _ty + topBorder + topPad, cWidth, cHeight));
+ p->drawRect(IntRect(tx + leftBorder + leftPad, ty + topBorder + topPad, cWidth, cHeight));
}
-
+
bool errorPictureDrawn = false;
- int imageX = 0, imageY = 0;
+ int imageX = 0;
+ int imageY = 0;
int usableWidth = cWidth;
int usableHeight = cHeight;
-
+
if (errorOccurred() && !image()->isNull() && (usableWidth >= image()->width()) && (usableHeight >= image()->height())) {
// Center the error image, accounting for border and padding.
- int centerX = (usableWidth - image()->width())/2;
+ int centerX = (usableWidth - image()->width()) / 2;
if (centerX < 0)
centerX = 0;
- int centerY = (usableHeight - image()->height())/2;
+ int centerY = (usableHeight - image()->height()) / 2;
if (centerY < 0)
centerY = 0;
imageX = leftBorder + leftPad + centerX;
imageY = topBorder + topPad + centerY;
- p->drawImage(image(), IntPoint(_tx + imageX, _ty + imageY));
+ p->drawImage(image(), IntPoint(tx + imageX, ty + imageY));
errorPictureDrawn = true;
}
-
+
if (!m_altText.isEmpty()) {
DeprecatedString text = m_altText.deprecatedString();
text.replace('\\', backslashAsCurrencySymbol());
p->setFont(style()->font());
p->setPen(style()->color());
- int ax = _tx + leftBorder + leftPad;
- int ay = _ty + topBorder + topPad;
+ int ax = tx + leftBorder + leftPad;
+ int ay = ty + topBorder + topPad;
const Font& font = style()->font();
int ascent = font.ascent();
}
} else if (m_cachedImage) {
#if PLATFORM(MAC)
- if (style()->highlight() != nullAtom && !i.p->paintingDisabled())
- paintCustomHighlight(_tx - m_x, _ty - m_y, style()->highlight(), true);
+ if (style()->highlight() != nullAtom && !paintInfo.p->paintingDisabled())
+ paintCustomHighlight(tx - m_x, ty - m_y, style()->highlight(), true);
#endif
- IntRect rect(IntPoint(_tx + leftBorder + leftPad, _ty + topBorder + topPad), IntSize(cWidth, cHeight));
-
+ IntRect rect(IntPoint(tx + leftBorder + leftPad, ty + topBorder + topPad), IntSize(cWidth, cHeight));
+
HTMLImageElement* imageElt = (element() && element()->hasTagName(imgTag)) ? static_cast<HTMLImageElement*>(element()) : 0;
CompositeOperator compositeOperator = imageElt ? imageElt->compositeOperator() : CompositeSourceOver;
p->drawImage(image(), rect, compositeOperator);
void RenderImage::layout()
{
ASSERT(needsLayout());
- ASSERT( minMaxKnown() );
+ ASSERT(minMaxKnown());
IntRect oldBounds;
bool checkForRepaint = checkForRepaintDuringLayout();
{
if (!element())
return;
-
+
if (element()->hasTagName(inputTag))
m_altText = static_cast<HTMLInputElement*>(element())->altText();
else if (element()->hasTagName(imgTag))
return &sharedNullImage;
}
-}
+} // namespace WebCore
*
*/
-#ifndef RENDER_IMAGE_H
-#define RENDER_IMAGE_H
+#ifndef RenderImage_h
+#define RenderImage_h
#include "CachedImage.h"
#include "HTMLElement.h"
class DocLoader;
class HTMLMapElement;
-class RenderImage : public RenderReplaced
-{
+class RenderImage : public RenderReplaced {
public:
RenderImage(Node*);
virtual ~RenderImage();
virtual void layout();
virtual void imageChanged(CachedImage*);
-
+
// don't even think about making this method virtual!
- HTMLElement* element() const
- { return static_cast<HTMLElement*>(RenderReplaced::element()); }
+ HTMLElement* element() const { return static_cast<HTMLElement*>(RenderReplaced::element()); }
// hook to keep RendeObject::m_inline() up to date
- virtual void setStyle(RenderStyle *style);
+ virtual void setStyle(RenderStyle*);
void updateAltText();
-
+
void setIsAnonymousImage(bool anon) { m_isAnonymousImage = anon; }
bool isAnonymousImage() { return m_isAnonymousImage; }
-
+
void setCachedImage(CachedImage*);
CachedImage* cachedImage() const { return m_cachedImage; }
-
+
Image* image() { return m_cachedImage ? m_cachedImage->image() : nullImage(); }
virtual bool nodeAtPoint(HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
-
+
virtual int calcReplacedWidth() const;
virtual int calcReplacedHeight() const;
// Called to set generated content images (e.g., :before/:after generated images).
void setContentObject(CachedResource*);
-
+
bool errorOccurred() const { return m_cachedImage && m_cachedImage->isErrorImage(); }
-
+
HTMLMapElement* imageMap();
void resetAnimation();
static Image* nullImage();
};
-} //namespace
+} // namespace WebCore
-#endif
+#endif // RenderImage_h
namespace WebCore {
RenderInline::RenderInline(Node* node)
-:RenderFlow(node), m_isContinuation(false)
-{}
+ : RenderFlow(node)
+ , m_isContinuation(false)
+{
+}
RenderInline::~RenderInline()
-{}
+{
+}
-void RenderInline::setStyle(RenderStyle* _style)
+void RenderInline::setStyle(RenderStyle* newStyle)
{
- RenderFlow::setStyle(_style);
+ RenderFlow::setStyle(newStyle);
setInline(true);
// Ensure that all of the split inlines pick up the new style. We
}
m_lineHeight = -1;
-
+
// Update pseudos for :before and :after now.
updatePseudoChild(RenderStyle::BEFORE);
updatePseudoChild(RenderStyle::AFTER);
// inline into continuations. This involves creating an anonymous block box to hold
// |newChild|. We then make that block box a continuation of this inline. We take all of
// the children after |beforeChild| and put them in a clone of this object.
- RenderStyle *newStyle = new (renderArena()) RenderStyle();
+ RenderStyle* newStyle = new (renderArena()) RenderStyle();
newStyle->inheritFrom(style());
newStyle->setDisplay(BLOCK);
- RenderBlock *newBox = new (renderArena()) RenderBlock(document() /* anonymous box */);
+ RenderBlock* newBox = new (renderArena()) RenderBlock(document() /* anonymous box */);
newBox->setStyle(newStyle);
RenderFlow* oldContinuation = continuation();
setContinuation(newBox);
if (isLastChild && beforeChild != lastChild())
beforeChild = 0; // We destroyed the last child, so now we need to update our insertion
// point to be 0. It's just a straight append now.
-
+
splitFlow(beforeChild, newBox, newChild, oldContinuation);
return;
}
RenderInline* RenderInline::cloneInline(RenderFlow* src)
{
- RenderInline *o = new (src->renderArena()) RenderInline(src->element());
+ RenderInline* o = new (src->renderArena()) RenderInline(src->element());
o->m_isContinuation = true;
o->setStyle(src->style());
return o;
// Create a clone of this inline.
RenderInline* clone = cloneInline(this);
clone->setContinuation(oldCont);
-
+
// Now take all of the children from beforeChild to the end and remove
// them from |this| and place them in the clone.
RenderObject* o = beforeChild;
// has to move into the inline continuation. Call updatePseudoChild to ensure that the inline's :after
// content gets properly destroyed.
curr->updatePseudoChild(RenderStyle::AFTER);
-
+
// Now we need to take all of the children starting from the first child
// *after* currChild and append them all to the clone.
o = currChild->nextSibling();
}
RenderBlock* post = block->createAnonymousBlock();
-
+
RenderObject* boxFirst = madeNewBeforeBlock ? block->firstChild() : pre->nextSibling();
if (madeNewBeforeBlock)
block->insertChildNode(pre, boxFirst);
if (madeNewBeforeBlock) {
RenderObject* o = boxFirst;
- while (o)
- {
+ while (o) {
RenderObject* no = o;
o = no->nextSibling();
pre->appendChildNode(block->removeChildNode(no));
// connected, thus allowing newChild access to a renderArena should it need
// to wrap itself in additional boxes (e.g., table construction).
newBlockBox->addChildToFlow(newChild, 0);
-
+
// Always just do a full layout in order to ensure that line boxes (especially wrappers for images)
// get deleted properly. Because objects moves from the pre block into the post block, we want to
// make new line boxes instead of leaving the old line boxes around.
post->setNeedsLayoutAndMinMaxRecalc();
}
-void RenderInline::paint(PaintInfo& i, int _tx, int _ty)
+void RenderInline::paint(PaintInfo& paintInfo, int tx, int ty)
{
- paintLines(i, _tx, _ty);
+ paintLines(paintInfo, tx, ty);
}
void RenderInline::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
{
for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox())
rects.append(IntRect(tx + curr->xPos(), ty + curr->yPos(), curr->width(), curr->height()));
-
- for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling())
+
+ for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) {
if (!curr->isText())
curr->absoluteRects(rects, tx + curr->xPos(), ty + curr->yPos());
-
+ }
+
if (continuation())
continuation()->absoluteRects(rects,
tx - containingBlock()->xPos() + continuation()->xPos(),
void RenderInline::calcMinMaxWidth()
{
- ASSERT( !minMaxKnown() );
-
-#ifdef DEBUG_LAYOUT
- kdDebug( 6040 ) << renderName() << "(RenderInline)::calcMinMaxWidth() this=" << this << endl;
-#endif
+ ASSERT(!minMaxKnown());
// Irrelevant, since some enclosing block will actually measure us and our children.
m_minWidth = 0;
setMinMaxKnown();
}
-bool RenderInline::requiresLayer() {
+bool RenderInline::requiresLayer()
+{
return isRoot() || isRelPositioned() || style()->opacity() < 1.0f;
}
if (curr == firstLineBox() || curr->xPos() + curr->width() > rightSide)
rightSide = curr->xPos() + curr->width();
}
-
+
return rightSide - leftSide;
}
int RenderInline::height() const
{
- int h = 0;
if (firstLineBox())
- h = lastLineBox()->yPos() + lastLineBox()->height() - firstLineBox()->yPos();
- return h;
+ return lastLineBox()->yPos() + lastLineBox()->height() - firstLineBox()->yPos();
+ return 0;
}
int RenderInline::offsetLeft() const
return y;
}
-const char *RenderInline::renderName() const
+const char* RenderInline::renderName() const
{
if (isRelPositioned())
return "RenderInline (relative positioned)";
return "RenderInline";
}
-bool RenderInline::nodeAtPoint(HitTestResult& result, int _x, int _y, int _tx, int _ty,
- HitTestAction hitTestAction)
+bool RenderInline::nodeAtPoint(HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction)
{
- return hitTestLines(result, _x, _y, _tx, _ty, hitTestAction);
+ return hitTestLines(result, x, y, tx, ty, hitTestAction);
}
VisiblePosition RenderInline::positionForCoordinates(int x, int y)
{
- for (RenderObject *c = continuation(); c; c = c->continuation()) {
+ for (RenderObject* c = continuation(); c; c = c->continuation()) {
if (c->isInline() || c->firstChild())
return c->positionForCoordinates(x, y);
}
return RenderFlow::positionForCoordinates(x, y);
}
-}
+} // namespace WebCore
*
*/
-#ifndef RENDER_INLINE_H
-#define RENDER_INLINE_H
+#ifndef RenderInline_h
+#define RenderInline_h
#include "RenderFlow.h"
namespace WebCore {
- class Position;
-}
-namespace WebCore {
+class Position;
-class RenderInline : public RenderFlow
-{
+class RenderInline : public RenderFlow {
public:
RenderInline(Node*);
virtual ~RenderInline();
- virtual const char *renderName() const;
+ virtual const char* renderName() const;
virtual bool isRenderInline() const { return true; }
virtual bool isInlineFlow() const { return true; }
virtual bool childrenInline() const { return true; }
virtual bool isInlineContinuation() const;
-
+
virtual void addChildToFlow(RenderObject* newChild, RenderObject* beforeChild);
void splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, RenderBlock* middleBlock,
RenderObject* beforeChild, RenderFlow* oldCont);
void splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox,
RenderObject* newChild, RenderFlow* oldCont);
-
+
virtual void setStyle(RenderStyle*);
- virtual void layout() {} // Do nothing for layout()
-
+ virtual void layout() { } // Do nothing for layout()
+
virtual void paint(PaintInfo&, int tx, int ty);
- virtual bool nodeAtPoint(HitTestResult&, int _x, int _y, int _tx, int _ty, HitTestAction);
-
+ virtual bool nodeAtPoint(HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
virtual void calcMinMaxWidth();
// overrides RenderObject
virtual int width() const;
virtual int height() const;
-
+
// used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow) to return
// the remaining width on a given line (and the height of a single line).
virtual int offsetLeft() const;
void absoluteRects(Vector<IntRect>&, int tx, int ty);
virtual VisiblePosition positionForCoordinates(int x, int y);
-
+
protected:
static RenderInline* cloneInline(RenderFlow* src);
bool m_isContinuation : 1; // Whether or not we're a continuation of an inline.
};
-} // namespace
-
-#endif
+} // namespace WebCore
+#endif // RenderInline_h
#include "HitTestResult.h"
#include "OverflowEvent.h"
#include "PlatformMouseEvent.h"
+#include "PlatformScrollBar.h"
#include "RenderArena.h"
#include "RenderInline.h"
#include "RenderTheme.h"
#include "RenderView.h"
#include "SelectionController.h"
-#include "PlatformScrollBar.h"
#ifdef SVG_SUPPORT
#include "SVGNames.h"
}
}
-}
+} // namespace WebCore
* version of this file under any of the LGPL, the MPL or the GPL.
*/
-#ifndef render_layer_h
-#define render_layer_h
+#ifndef RenderLayer_h
+#define RenderLayer_h
#include "RenderObject.h"
-#include "Timer.h"
#include "ScrollBar.h"
+#include "Timer.h"
namespace WebCore {
class CachedResource;
class HitTestResult;
-class RenderView;
+class PlatformScrollbar;
class RenderFrameSet;
class RenderObject;
class RenderStyle;
class RenderTable;
class RenderText;
-class PlatformScrollbar;
+class RenderView;
class ClipRects {
public:
- ClipRects(const IntRect& r) :m_overflowClipRect(r), m_fixedClipRect(r), m_posClipRect(r), m_refCnt(0) {}
+ ClipRects(const IntRect& r)
+ : m_overflowClipRect(r)
+ , m_fixedClipRect(r)
+ , m_posClipRect(r)
+ , m_refCnt(0)
+ {
+ }
+
ClipRects(const IntRect& o, const IntRect& f, const IntRect& p)
- :m_overflowClipRect(o), m_fixedClipRect(f), m_posClipRect(p), m_refCnt(0) {}
+ : m_overflowClipRect(o)
+ , m_fixedClipRect(f)
+ , m_posClipRect(p)
+ , m_refCnt(0)
+ {
+ }
const IntRect& overflowClipRect() { return m_overflowClipRect; }
const IntRect& fixedClipRect() { return m_fixedClipRect; }
void ref() { m_refCnt++; }
void deref(RenderArena* renderArena) { if (--m_refCnt == 0) destroy(renderArena); }
-
- void destroy(RenderArena* renderArena);
+
+ void destroy(RenderArena*);
// Overloaded new operator.
- void* operator new(size_t sz, RenderArena* renderArena) throw();
+ void* operator new(size_t, RenderArena*) throw();
// Overridden to prevent the normal delete from being called.
- void operator delete(void* ptr, size_t sz);
+ void operator delete(void*, size_t);
private:
// The normal operator new is disallowed on all render objects.
- void* operator new(size_t sz) throw();
+ void* operator new(size_t) throw();
private:
IntRect m_overflowClipRect;
unsigned m_refCnt;
};
+
+// FIXME: move this to its own file
// This class handles the auto-scrolling of layers with overflow: marquee.
-class Marquee
-{
+class Marquee {
public:
Marquee(RenderLayer*);
int speed() const { return m_speed; }
int marqueeSpeed() const;
+
EMarqueeDirection reverseDirection() const { return static_cast<EMarqueeDirection>(-direction()); }
EMarqueeDirection direction() const;
int unfurlPos() const { return m_unfurlPos; }
EWhiteSpace whiteSpace() { return static_cast<EWhiteSpace>(m_whiteSpace); }
-
- int computePosition(EMarqueeDirection dir, bool stopAtClientEdge);
+
+ int computePosition(EMarqueeDirection, bool stopAtClientEdge);
void setEnd(int end) { m_end = end; }
static const ScrollAlignment gAlignCenterAlways;
static const ScrollAlignment gAlignTopAlways;
static const ScrollAlignment gAlignBottomAlways;
-
+
static ScrollBehavior getVisibleBehavior(const ScrollAlignment& s) { return s.m_rectVisible; }
static ScrollBehavior getPartialBehavior(const ScrollAlignment& s) { return s.m_rectPartial; }
static ScrollBehavior getHiddenBehavior(const ScrollAlignment& s) { return s.m_rectHidden; }
-
+
RenderLayer(RenderObject*);
~RenderLayer();
-
+
RenderObject* renderer() const { return m_object; }
RenderLayer* parent() const { return m_parent; }
RenderLayer* previousSibling() const { return m_previous; }
RenderLayer* nextSibling() const { return m_next; }
-
RenderLayer* firstChild() const { return m_first; }
RenderLayer* lastChild() const { return m_last; }
void insertOnlyThisLayer();
void repaintIncludingDescendants();
-
+
void styleChanged();
-
+
Marquee* marquee() const { return m_marquee; }
void suspendMarquees();
bool isOverflowOnly() const { return m_isOverflowOnly; }
-
+
bool isTransparent() const;
RenderLayer* transparentAncestor();
void beginTransparencyLayers(GraphicsContext*, const IntRect&);
-
- const RenderLayer* root() const {
+
+ const RenderLayer* root() const
+ {
const RenderLayer* curr = this;
- while (curr->parent()) curr = curr->parent();
+ while (curr->parent())
+ curr = curr->parent();
return curr;
}
int xPos() const { return m_x; }
int yPos() const { return m_y; }
+ void setPos(int xPos, int yPos)
+ {
+ m_x = xPos;
+ m_y = yPos;
+ }
+
int width() const { return m_width; }
int height() const { return m_height; }
-
void setWidth(int w) { m_width = w; }
void setHeight(int h) { m_height = h; }
int scrollWidth();
int scrollHeight();
-
- void setPos( int xPos, int yPos ) {
- m_x = xPos;
- m_y = yPos;
- }
// Scrolling methods for layers that can scroll their overflow.
void scrollOffset(int& x, int& y);
void scrollToOffset(int x, int y, bool updateScrollbars = true, bool repaint = true);
void scrollToXOffset(int x) { scrollToOffset(x, m_scrollY); }
void scrollToYOffset(int y) { scrollToOffset(m_scrollX + m_scrollOriginX, y); }
- void scrollRectToVisible(const IntRect &r, const ScrollAlignment& alignX = gAlignCenterIfNeeded, const ScrollAlignment& alignY = gAlignCenterIfNeeded);
- IntRect getRectToExpose(const IntRect &visibleRect, const IntRect &exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY);
+ void scrollRectToVisible(const IntRect&, const ScrollAlignment& alignX = gAlignCenterIfNeeded, const ScrollAlignment& alignY = gAlignCenterIfNeeded);
+
+ IntRect getRectToExpose(const IntRect& visibleRect, const IntRect& exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY);
+
void setHasHorizontalScrollbar(bool);
void setHasVerticalScrollbar(bool);
+
PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
void destroyScrollbar(ScrollbarOrientation);
+
Scrollbar* horizontalScrollbar() { return m_hBar.get(); }
Scrollbar* verticalScrollbar() { return m_vBar.get(); }
+
PlatformScrollbar* horizontaScrollbarWidget() const;
PlatformScrollbar* verticalScrollbarWidget() const;
+
int verticalScrollbarWidth() const;
int horizontalScrollbarHeight() const;
+
void positionOverflowControls();
bool isPointInResizeControl(const IntPoint&);
IntSize offsetFromResizeCorner(const IntPoint&) const;
+
void paintOverflowControls(GraphicsContext*, int tx, int ty, const IntRect& damageRect);
+
void updateScrollInfoAfterLayout();
- bool scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier=1.0);
+
+ bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f);
void autoscroll();
+
void resize(const PlatformMouseEvent&, const IntSize&);
bool inResizeMode() const { return m_inResizeMode; }
void setInResizeMode(bool b) { m_inResizeMode = b; }
void updateLayerPosition();
- void updateLayerPositions(bool doFullRepaint = false, bool checkForRepaint=true);
+ void updateLayerPositions(bool doFullRepaint = false, bool checkForRepaint = true);
void checkForRepaintOnResize();
- void relativePositionOffset(int& relX, int& relY) {
- relX += m_relX; relY += m_relY;
- }
-
+
+ void relativePositionOffset(int& relX, int& relY) { relX += m_relX; relY += m_relY; }
+
void clearClipRects();
void clearClipRect();
void updateZOrderLists();
Vector<RenderLayer*>* posZOrderList() const { return m_posZOrderList; }
Vector<RenderLayer*>* negZOrderList() const { return m_negZOrderList; }
-
+
void dirtyOverflowList();
void updateOverflowList();
Vector<RenderLayer*>* overflowList() const { return m_overflowList; }
-
+
bool hasVisibleContent() const { return m_hasVisibleContent; }
- void setHasVisibleContent(bool b);
+ void setHasVisibleContent(bool);
void dirtyVisibleContentStatus();
// Gets the nearest enclosing positioned ancestor layer (also includes
// the <html> layer and the root layer).
RenderLayer* enclosingPositionedAncestor() const;
-
+
void convertToLayerCoords(const RenderLayer* ancestorLayer, int& x, int& y) const;
-
+
bool hasAutoZIndex() const { return renderer()->style()->hasAutoZIndex(); }
int zIndex() const { return renderer()->style()->zIndex(); }
IntRect absoluteBoundingBox() const;
void updateHoverActiveState(HitTestResult&);
-
+
IntRect repaintRect() const { return m_repaintRect; }
- void destroy(RenderArena* renderArena);
+ void destroy(RenderArena*);
// Overloaded new operator. Derived classes must override operator new
// in order to allocate out of the RenderArena.
- void* operator new(size_t sz, RenderArena* renderArena) throw();
+ void* operator new(size_t, RenderArena*) throw();
// Overridden to prevent the normal delete from being called.
- void operator delete(void* ptr, size_t sz);
+ void operator delete(void*, size_t);
private:
// The normal operator new is disallowed on all render objects.
- void* operator new(size_t sz) throw();
+ void* operator new(size_t) throw();
private:
void setNextSibling(RenderLayer* next) { m_next = next; }
void collectLayers(Vector<RenderLayer*>*&, Vector<RenderLayer*>*&);
void paintLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect,
- bool haveTransparency, PaintRestriction, RenderObject* paintingRoot);
+ bool haveTransparency, PaintRestriction, RenderObject* paintingRoot);
RenderLayer* hitTestLayer(RenderLayer* rootLayer, HitTestResult&, const IntRect& hitTestRect);
void computeScrollDimensions(bool* needHBar = 0, bool* needVBar = 0);
virtual IntRect windowClipRect() const;
void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
-
+
void childVisibilityChanged(bool newVisibility);
void dirtyVisibleDescendantStatus();
void updateVisibilityStatus();
-
+
protected:
RenderObject* m_object;
-
+
RenderLayer* m_parent;
RenderLayer* m_previous;
RenderLayer* m_next;
-
RenderLayer* m_first;
RenderLayer* m_last;
// The layer's width/height
int m_width;
int m_height;
-
+
// Our scroll offsets if the view is scrolled.
int m_scrollX;
int m_scrollY;
int m_scrollOriginX;
int m_scrollLeftOverflow;
-
+
// The width/height of our scrolled area.
int m_scrollWidth;
int m_scrollHeight;
-
+
// For layers with overflow, we have a pair of scrollbars.
RefPtr<Scrollbar> m_hBar;
RefPtr<Scrollbar> m_vBar;
-
+
// Keeps track of whether the layer is currently resizing, so events can cause resizing to start and stop.
bool m_inResizeMode;
// z-indices.
Vector<RenderLayer*>* m_posZOrderList;
Vector<RenderLayer*>* m_negZOrderList;
-
+
// This list contains our overflow child layers.
Vector<RenderLayer*>* m_overflowList;
bool m_hasVisibleContent : 1;
bool m_visibleDescendantStatusDirty : 1;
bool m_hasVisibleDescendant : 1;
-
+
Marquee* m_marquee; // Used by layers with overflow:marquee
};
-} // namespace
+} // namespace WebCore
-#endif
+#endif // RenderLayer_h
RenderFormElement::calcMinMaxWidth();
}
-void RenderLineEdit::setStyle(RenderStyle *s)
+void RenderLineEdit::setStyle(RenderStyle* newStyle)
{
- RenderFormElement::setStyle(s);
+ RenderFormElement::setStyle(newStyle);
TextField* w = static_cast<TextField*>(widget());
w->setAlignment(textAlignment());
}
w->setReadOnly(e->isReadOnlyControl());
-
+
// Handle updating the search attributes.
w->setPlaceholderString(e->getAttribute(placeholderAttr).deprecatedString());
if (w->type() == TextField::Search) {
int RenderLineEdit::selectionStart()
{
- TextField *lineEdit = static_cast<TextField *>(m_widget);
+ TextField* lineEdit = static_cast<TextField*>(m_widget);
int start = lineEdit->selectionStart();
if (start == -1)
start = lineEdit->cursorPosition();
int RenderLineEdit::selectionEnd()
{
- TextField *lineEdit = static_cast<TextField *>(m_widget);
+ TextField* lineEdit = static_cast<TextField*>(m_widget);
int start = lineEdit->selectionStart();
if (start == -1)
return lineEdit->cursorPosition();
- return start + (int)lineEdit->selectedText().length();
+ return start + static_cast<int>(lineEdit->selectedText().length());
}
void RenderLineEdit::setSelectionStart(int start)
{
int realStart = max(start, 0);
int length = max(selectionEnd() - realStart, 0);
- static_cast<TextField *>(m_widget)->setSelection(realStart, length);
+ static_cast<TextField*>(m_widget)->setSelection(realStart, length);
}
void RenderLineEdit::setSelectionEnd(int end)
start = realEnd;
length = 0;
}
- static_cast<TextField *>(m_widget)->setSelection(start, length);
+ static_cast<TextField*>(m_widget)->setSelection(start, length);
}
void RenderLineEdit::select()
{
int realStart = max(start, 0);
int length = max(end - realStart, 0);
- static_cast<TextField *>(m_widget)->setSelection(realStart, length);
+ static_cast<TextField*>(m_widget)->setSelection(realStart, length);
}
} // namespace WebCore
int selectionEnd();
void setSelectionStart(int);
void setSelectionEnd(int);
-
+
bool isEdited() const;
void setEdited(bool);
bool isTextField() const { return true; }
#include "FrameView.h"
#include "GraphicsContext.h"
#include "HTMLNames.h"
-#include "HTMLOptionElement.h"
#include "HTMLOptGroupElement.h"
+#include "HTMLOptionElement.h"
#include "HTMLSelectElement.h"
#include "HitTestResult.h"
#include "PlatformScrollBar.h"
return view()->frameView()->windowClipRectForLayer(enclosingLayer(), true);
}
-}
+} // namespace WebCore
*
*/
-#ifndef RenderListBox_H
-#define RenderListBox_H
+#ifndef RenderListBox_h
+#define RenderListBox_h
#include "RenderBlock.h"
RenderListBox(HTMLSelectElement*);
~RenderListBox();
+ virtual const char* renderName() const { return "RenderListBox"; }
+
virtual bool isListBox() const { return true; }
virtual void setStyle(RenderStyle*);
void setSelectionChanged(bool selectionChanged) { m_selectionChanged = selectionChanged; }
virtual bool canHaveChildren() const { return false; }
- virtual const char* renderName() const { return "RenderListBox"; }
+
virtual void paintObject(PaintInfo&, int tx, int ty);
virtual bool isPointInScrollbar(HitTestResult&, int x, int y, int tx, int ty);
- virtual bool scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier=1.0);
+ virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f);
virtual void calcMinMaxWidth();
- virtual short baselinePosition(bool, bool isRootLineBox) const;
+ virtual short baselinePosition(bool firstLine, bool isRootLineBox) const;
virtual void calcHeight();
void setOptionsChanged(bool c) { m_optionsChanged = c; }
void valueChanged(unsigned listIndex);
-
+
// ScrollbarClient interface.
virtual void valueChanged(Scrollbar*);
virtual IntRect windowClipRect() const;
HTMLOptionElement* optionAtPoint(int x, int y);
-
+
bool scrollToRevealElementAtListIndex(int index);
-
+
virtual bool shouldAutoscroll() const { return numItems() > size(); }
virtual void autoscroll();
private:
- bool m_optionsChanged;
- int m_optionsWidth;
- int m_optionsMaxHeight;
- int m_optionsTotalHeight;
- int m_indexOffset;
- bool m_selectionChanged;
-
int size() const;
int numItems() const;
IntRect itemBoundingBoxRect(int tx, int ty, int index);
void paintScrollbar(PaintInfo&);
void paintItemForeground(PaintInfo&, int tx, int ty, int listIndex);
void paintItemBackground(PaintInfo&, int tx, int ty, int listIndex);
-
+
+ bool m_optionsChanged;
+ int m_optionsWidth;
+ int m_optionsMaxHeight;
+ int m_optionsTotalHeight;
+ int m_indexOffset;
+ bool m_selectionChanged;
+
Scrollbar* m_vBar;
};
-}
+} // namepace WebCore
-#endif
+#endif // RenderListBox_h
setInline(false); // our object is not Inline
}
-void RenderListItem::setStyle(RenderStyle* _style)
+void RenderListItem::setStyle(RenderStyle* newStyle)
{
- RenderBlock::setStyle(_style);
+ RenderBlock::setStyle(newStyle);
if (style()->listStyleType() != LNONE ||
(style()->listStyleImage() && !style()->listStyleImage()->isErrorImage())) {
RenderObject* firstChild = curr->firstChild();
if (!firstChild)
return 0;
-
+
for (RenderObject* currChild = firstChild; currChild; currChild = currChild->nextSibling()) {
if (currChild == marker)
continue;
-
+
if (currChild->isInline())
return curr;
-
+
if (currChild->isFloating() || currChild->isPositioned())
continue;
-
+
if (currChild->isTable() || !currChild->isRenderBlock())
break;
-
+
if (currChild->style()->htmlHacks() && currChild->element() &&
(currChild->element()->hasTagName(ulTag)|| currChild->element()->hasTagName(olTag)))
break;
-
+
RenderObject* lineBox = getParentOfFirstLineBox(currChild, marker);
if (lineBox)
return lineBox;
}
-
+
return 0;
}
else
lineBoxParent = this;
}
-
+
if (markerPar != lineBoxParent || !m_marker->minMaxKnown()) {
m_marker->remove();
if (!lineBoxParent)
yOffset += o->yPos();
xOffset += o->xPos();
}
-
+
RootInlineBox* root = m_marker->inlineBoxWrapper()->root();
if (style()->direction() == LTR) {
int leftLineOffset = leftRelOffset(yOffset, leftOffset(yOffset));
}
}
-void RenderListItem::paint(PaintInfo& i, int _tx, int _ty)
+void RenderListItem::paint(PaintInfo& paintInfo, int tx, int ty)
{
if (!m_height)
return;
- RenderBlock::paint(i, _tx, _ty);
+ RenderBlock::paint(paintInfo, tx, ty);
}
DeprecatedString RenderListItem::markerStringValue()
return m_marker ? m_marker->text() : "";
}
-}
+} // namespace WebCore
*
*/
-#ifndef RenderListItem_H
-#define RenderListItem_H
+#ifndef RenderListItem_h
+#define RenderListItem_h
#include "RenderBlock.h"
class RenderListMarker;
-class RenderListItem : public RenderBlock
-{
+class RenderListItem : public RenderBlock {
public:
RenderListItem(Node*);
-
- virtual void destroy();
virtual const char* renderName() const { return "RenderListItem"; }
- virtual void setStyle(RenderStyle*);
-
virtual bool isListItem() const { return true; }
+ virtual void destroy();
+
+ virtual void setStyle(RenderStyle*);
+
int value() const { return m_value; }
void setValue(int v) { m_predefVal = v; }
void calcValue();
virtual void positionListMarker();
void updateMarkerLocation();
-
+
void setNotInList(bool notInList) { m_notInList = notInList; }
bool notInList() const { return m_notInList; }
int m_value;
};
+} // namespace WebCore
-} //namespace
-
-#endif
+#endif // RenderListItem_h
return IntRect(absx + xPos(), absy + root->selectionTop(), width(), root->selectionHeight());
}
-}
+} // namespace WebCore
*
*/
-#ifndef RenderListMarker_H
-#define RenderListMarker_H
+#ifndef RenderListMarker_h
+#define RenderListMarker_h
#include "DeprecatedString.h"
#include "RenderBox.h"
/* used to render the lists marker.
This class always has to be a direct child of a RenderListItem!
*/
-class RenderListMarker : public RenderBox
-{
+class RenderListMarker : public RenderBox {
public:
RenderListMarker(Document*);
~RenderListMarker();
+ virtual const char* renderName() const { return "RenderListMarker"; }
+
+ virtual bool isListMarker() const { return true; }
+
virtual void setStyle(RenderStyle*);
- virtual const char* renderName() const { return "RenderListMarker"; }
+ virtual void paint(PaintInfo&, int xoff, int yoff);
+
// so the marker gets to layout itself. Only needed for
// list-style-position: inside
-
- virtual void paint(PaintInfo&, int xoff, int yoff);
virtual void layout();
virtual void calcMinMaxWidth();
virtual InlineBox* createInlineBox(bool, bool, bool);
- virtual short lineHeight(bool b, bool isRootLineBox=false) const;
- virtual short baselinePosition(bool b, bool isRootLineBox=false) const;
+ virtual short lineHeight(bool firstLine, bool isRootLineBox = false) const;
+ virtual short baselinePosition(bool firstLine, bool isRootLineBox = false) const;
- virtual bool isListMarker() const { return true; }
-
CachedImage* listImage() const { return m_listImage; }
-
+
RenderListItem* listItem() { return m_listItem; }
void setListItem(RenderListItem* listItem) { m_listItem = listItem; }
-
+
const DeprecatedString& text() const { return m_item; }
bool isInside() const;
-
+
IntRect getRelativeMarkerRect();
-
+
virtual SelectionState selectionState() const { return m_selectionState; }
virtual void setSelectionState(SelectionState);
virtual IntRect selectionRect();
SelectionState m_selectionState;
};
-} //namespace
+} // namespace WebCore
-#endif
+#endif // RenderListMarker_h