OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r
ights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "wtf/ListHashSet.h" | 36 #include "wtf/ListHashSet.h" |
37 #include "wtf/OwnPtr.h" | 37 #include "wtf/OwnPtr.h" |
38 | 38 |
39 namespace WebCore { | 39 namespace WebCore { |
40 | 40 |
41 class BasicShape; | 41 class BasicShape; |
42 class BidiContext; | 42 class BidiContext; |
43 class LayoutStateMaintainer; | 43 class LayoutStateMaintainer; |
44 class LineLayoutState; | 44 class LineLayoutState; |
45 class RenderInline; | 45 class RenderInline; |
| 46 class RenderRegion; |
46 class RenderText; | 47 class RenderText; |
47 | 48 |
48 struct BidiRun; | 49 struct BidiRun; |
49 struct PaintInfo; | 50 struct PaintInfo; |
50 class LineInfo; | 51 class LineInfo; |
51 class RenderRubyRun; | 52 class RenderRubyRun; |
52 class WordMeasurement; | 53 class WordMeasurement; |
53 | 54 |
54 template <class Run> class BidiRunList; | 55 template <class Run> class BidiRunList; |
55 typedef WTF::ListHashSet<RenderBox*, 16> TrackedRendererListHashSet; | 56 typedef WTF::ListHashSet<RenderBox*, 16> TrackedRendererListHashSet; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 void setMarginEndForChild(RenderBox* child, LayoutUnit value) const { child-
>setMarginEnd(value, style()); } | 245 void setMarginEndForChild(RenderBox* child, LayoutUnit value) const { child-
>setMarginEnd(value, style()); } |
245 void setMarginBeforeForChild(RenderBox* child, LayoutUnit value) const { chi
ld->setMarginBefore(value, style()); } | 246 void setMarginBeforeForChild(RenderBox* child, LayoutUnit value) const { chi
ld->setMarginBefore(value, style()); } |
246 void setMarginAfterForChild(RenderBox* child, LayoutUnit value) const { chil
d->setMarginAfter(value, style()); } | 247 void setMarginAfterForChild(RenderBox* child, LayoutUnit value) const { chil
d->setMarginAfter(value, style()); } |
247 LayoutUnit collapsedMarginBeforeForChild(const RenderBox* child) const; | 248 LayoutUnit collapsedMarginBeforeForChild(const RenderBox* child) const; |
248 LayoutUnit collapsedMarginAfterForChild(const RenderBox* child) const; | 249 LayoutUnit collapsedMarginAfterForChild(const RenderBox* child) const; |
249 | 250 |
250 virtual void updateFirstLetter(); | 251 virtual void updateFirstLetter(); |
251 | 252 |
252 virtual void scrollbarsChanged(bool /*horizontalScrollbarChanged*/, bool /*v
erticalScrollbarChanged*/) { }; | 253 virtual void scrollbarsChanged(bool /*horizontalScrollbarChanged*/, bool /*v
erticalScrollbarChanged*/) { }; |
253 | 254 |
254 LayoutUnit logicalLeftOffsetForContent(RenderRegion*) const; | 255 LayoutUnit availableLogicalWidthForContent() const { return max<LayoutUnit>(
0, logicalRightOffsetForContent() - logicalLeftOffsetForContent()); } |
255 LayoutUnit logicalRightOffsetForContent(RenderRegion*) const; | |
256 LayoutUnit availableLogicalWidthForContent(RenderRegion* region) const | |
257 { | |
258 return max<LayoutUnit>(0, logicalRightOffsetForContent(region) - logical
LeftOffsetForContent(region)); | |
259 } | |
260 LayoutUnit startOffsetForContent(RenderRegion* region) const | |
261 { | |
262 return style()->isLeftToRightDirection() ? logicalLeftOffsetForContent(r
egion) : logicalWidth() - logicalRightOffsetForContent(region); | |
263 } | |
264 LayoutUnit endOffsetForContent(RenderRegion* region) const | |
265 { | |
266 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForContent(
region) : logicalWidth() - logicalRightOffsetForContent(region); | |
267 } | |
268 LayoutUnit logicalLeftOffsetForContent(LayoutUnit blockOffset) const | |
269 { | |
270 return logicalLeftOffsetForContent(regionAtBlockOffset(blockOffset)); | |
271 } | |
272 LayoutUnit logicalRightOffsetForContent(LayoutUnit blockOffset) const | |
273 { | |
274 return logicalRightOffsetForContent(regionAtBlockOffset(blockOffset)); | |
275 } | |
276 LayoutUnit availableLogicalWidthForContent(LayoutUnit blockOffset) const | |
277 { | |
278 return availableLogicalWidthForContent(regionAtBlockOffset(blockOffset))
; | |
279 } | |
280 LayoutUnit startOffsetForContent(LayoutUnit blockOffset) const | |
281 { | |
282 return startOffsetForContent(regionAtBlockOffset(blockOffset)); | |
283 } | |
284 LayoutUnit endOffsetForContent(LayoutUnit blockOffset) const | |
285 { | |
286 return endOffsetForContent(regionAtBlockOffset(blockOffset)); | |
287 } | |
288 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingM
ode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } | 256 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingM
ode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } |
289 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetFo
rContent() + availableLogicalWidth(); } | 257 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetFo
rContent() + availableLogicalWidth(); } |
290 LayoutUnit startOffsetForContent() const { return style()->isLeftToRightDire
ction() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetFor
Content(); } | 258 LayoutUnit startOffsetForContent() const { return style()->isLeftToRightDire
ction() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetFor
Content(); } |
291 LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirec
tion() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForC
ontent(); } | 259 LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirec
tion() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForC
ontent(); } |
292 | 260 |
293 #ifndef NDEBUG | 261 #ifndef NDEBUG |
294 void checkPositionedObjectsNeedLayout(); | 262 void checkPositionedObjectsNeedLayout(); |
295 void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, const Inline
Box* = 0, const char* = 0, const RenderObject* = 0) const; | 263 void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, const Inline
Box* = 0, const char* = 0, const RenderObject* = 0) const; |
296 #endif | 264 #endif |
297 | 265 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 protected: | 492 protected: |
525 void determineLogicalLeftPositionForChild(RenderBox* child, ApplyLayoutDelta
Mode = DoNotApplyLayoutDelta); | 493 void determineLogicalLeftPositionForChild(RenderBox* child, ApplyLayoutDelta
Mode = DoNotApplyLayoutDelta); |
526 | 494 |
527 // Returns the logicalOffset at the top of the next page. If the offset pass
ed in is already at the top of the current page, | 495 // Returns the logicalOffset at the top of the next page. If the offset pass
ed in is already at the top of the current page, |
528 // then nextPageLogicalTop with ExcludePageBoundary will still move to the t
op of the next page. nextPageLogicalTop with | 496 // then nextPageLogicalTop with ExcludePageBoundary will still move to the t
op of the next page. nextPageLogicalTop with |
529 // IncludePageBoundary set will not. | 497 // IncludePageBoundary set will not. |
530 // | 498 // |
531 // For a page height of 800px, the first rule will return 800 if the value p
assed in is 0. The second rule will simply return 0. | 499 // For a page height of 800px, the first rule will return 800 if the value p
assed in is 0. The second rule will simply return 0. |
532 enum PageBoundaryRule { ExcludePageBoundary, IncludePageBoundary }; | 500 enum PageBoundaryRule { ExcludePageBoundary, IncludePageBoundary }; |
533 LayoutUnit nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundaryRule = E
xcludePageBoundary) const; | 501 LayoutUnit nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundaryRule = E
xcludePageBoundary) const; |
534 bool hasNextPage(LayoutUnit logicalOffset, PageBoundaryRule = ExcludePageBou
ndary) const; | |
535 | 502 |
536 bool createsBlockFormattingContext() const; | 503 bool createsBlockFormattingContext() const; |
537 | 504 |
538 public: | 505 public: |
539 LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const; | 506 LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const; |
540 LayoutUnit pageLogicalHeightForOffset(LayoutUnit offset) const; | 507 LayoutUnit pageLogicalHeightForOffset(LayoutUnit offset) const; |
541 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBounda
ryRule = IncludePageBoundary) const; | 508 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBounda
ryRule = IncludePageBoundary) const; |
542 | 509 |
543 protected: | 510 protected: |
544 bool pushToNextPageWithMinimumLogicalHeight(LayoutUnit& adjustment, LayoutUn
it logicalOffset, LayoutUnit minimumLogicalHeight) const; | 511 bool pushToNextPageWithMinimumLogicalHeight(LayoutUnit& adjustment, LayoutUn
it logicalOffset, LayoutUnit minimumLogicalHeight) const; |
545 | 512 |
546 // A page break is required at some offset due to space shortage in the curr
ent fragmentainer. | 513 // A page break is required at some offset due to space shortage in the curr
ent fragmentainer. |
547 void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage); | 514 void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage); |
548 | 515 |
549 // Update minimum page height required to avoid fragmentation where it shoul
dn't occur (inside | 516 // Update minimum page height required to avoid fragmentation where it shoul
dn't occur (inside |
550 // unbreakable content, between orphans and widows, etc.). This will be used
as a hint to the | 517 // unbreakable content, between orphans and widows, etc.). This will be used
as a hint to the |
551 // column balancer to help set a good minimum column height. | 518 // column balancer to help set a good minimum column height. |
552 void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight); | 519 void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight); |
553 | 520 |
554 LayoutUnit adjustForUnsplittableChild(RenderBox* child, LayoutUnit logicalOf
fset, bool includeMargins = false); // If the child is unsplittable and can't fi
t on the current page, return the top of the next page/column. | 521 LayoutUnit adjustForUnsplittableChild(RenderBox* child, LayoutUnit logicalOf
fset, bool includeMargins = false); // If the child is unsplittable and can't fi
t on the current page, return the top of the next page/column. |
555 void adjustLinePositionForPagination(RootInlineBox*, LayoutUnit& deltaOffset
, RenderFlowThread*); // Computes a deltaOffset value that put a line at the top
of the next page if it doesn't fit on the current page. | 522 void adjustLinePositionForPagination(RootInlineBox*, LayoutUnit& deltaOffset
, RenderFlowThread*); // Computes a deltaOffset value that put a line at the top
of the next page if it doesn't fit on the current page. |
556 void updateRegionForLine(RootInlineBox*) const; | |
557 | 523 |
558 // Adjust from painting offsets to the local coords of this renderer | 524 // Adjust from painting offsets to the local coords of this renderer |
559 void offsetForContents(LayoutPoint&) const; | 525 void offsetForContents(LayoutPoint&) const; |
560 | 526 |
561 // This function is called to test a line box that has moved in the block di
rection to see if it has ended up in a new | |
562 // region/page/column that has a different available line width than the old
one. Used to know when you have to dirty a | |
563 // line, i.e., that it can't be re-used. | |
564 bool lineWidthForPaginatedLineChanged(RootInlineBox*, LayoutUnit lineDelta,
RenderFlowThread*) const; | |
565 | |
566 bool logicalWidthChangedInRegions(RenderFlowThread*) const; | |
567 | |
568 bool requiresColumns(int desiredColumnCount) const; | 527 bool requiresColumns(int desiredColumnCount) const; |
569 | 528 |
570 virtual bool updateLogicalWidthAndColumnWidth(); | 529 virtual bool updateLogicalWidthAndColumnWidth(); |
571 | 530 |
572 virtual bool canCollapseAnonymousBlockChild() const { return true; } | 531 virtual bool canCollapseAnonymousBlockChild() const { return true; } |
573 | 532 |
574 public: | 533 public: |
575 virtual LayoutUnit offsetFromLogicalTopOfFirstPage() const OVERRIDE FINAL; | 534 virtual LayoutUnit offsetFromLogicalTopOfFirstPage() const OVERRIDE FINAL; |
576 RenderRegion* regionAtBlockOffset(LayoutUnit) const; | 535 RenderRegion* regionAtBlockOffset(LayoutUnit) const; |
577 RenderRegion* clampToStartAndEndRegions(RenderRegion*) const; | |
578 | 536 |
579 public: | 537 public: |
580 | 538 |
581 // Allocated only when some of these fields have non-default values | 539 // Allocated only when some of these fields have non-default values |
582 struct RenderBlockRareData { | 540 struct RenderBlockRareData { |
583 WTF_MAKE_NONCOPYABLE(RenderBlockRareData); WTF_MAKE_FAST_ALLOCATED; | 541 WTF_MAKE_NONCOPYABLE(RenderBlockRareData); WTF_MAKE_FAST_ALLOCATED; |
584 public: | 542 public: |
585 RenderBlockRareData() | 543 RenderBlockRareData() |
586 : m_paginationStrut(0) | 544 : m_paginationStrut(0) |
587 , m_pageLogicalOffset(0) | 545 , m_pageLogicalOffset(0) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 return false; | 593 return false; |
636 } | 594 } |
637 return true; | 595 return true; |
638 } | 596 } |
639 | 597 |
640 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock()); | 598 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock()); |
641 | 599 |
642 } // namespace WebCore | 600 } // namespace WebCore |
643 | 601 |
644 #endif // RenderBlock_h | 602 #endif // RenderBlock_h |
OLD | NEW |