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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 void setMarginEndForChild(RenderBox* child, LayoutUnit value) const { child-
>setMarginEnd(value, style()); } | 241 void setMarginEndForChild(RenderBox* child, LayoutUnit value) const { child-
>setMarginEnd(value, style()); } |
241 void setMarginBeforeForChild(RenderBox* child, LayoutUnit value) const { chi
ld->setMarginBefore(value, style()); } | 242 void setMarginBeforeForChild(RenderBox* child, LayoutUnit value) const { chi
ld->setMarginBefore(value, style()); } |
242 void setMarginAfterForChild(RenderBox* child, LayoutUnit value) const { chil
d->setMarginAfter(value, style()); } | 243 void setMarginAfterForChild(RenderBox* child, LayoutUnit value) const { chil
d->setMarginAfter(value, style()); } |
243 LayoutUnit collapsedMarginBeforeForChild(const RenderBox* child) const; | 244 LayoutUnit collapsedMarginBeforeForChild(const RenderBox* child) const; |
244 LayoutUnit collapsedMarginAfterForChild(const RenderBox* child) const; | 245 LayoutUnit collapsedMarginAfterForChild(const RenderBox* child) const; |
245 | 246 |
246 virtual void updateFirstLetter(); | 247 virtual void updateFirstLetter(); |
247 | 248 |
248 virtual void scrollbarsChanged(bool /*horizontalScrollbarChanged*/, bool /*v
erticalScrollbarChanged*/) { }; | 249 virtual void scrollbarsChanged(bool /*horizontalScrollbarChanged*/, bool /*v
erticalScrollbarChanged*/) { }; |
249 | 250 |
250 LayoutUnit logicalLeftOffsetForContent(RenderRegion*) const; | 251 LayoutUnit availableLogicalWidthForContent() const { return max<LayoutUnit>(
0, logicalRightOffsetForContent() - logicalLeftOffsetForContent()); } |
251 LayoutUnit logicalRightOffsetForContent(RenderRegion*) const; | |
252 LayoutUnit availableLogicalWidthForContent(RenderRegion* region) const | |
253 { | |
254 return max<LayoutUnit>(0, logicalRightOffsetForContent(region) - logical
LeftOffsetForContent(region)); | |
255 } | |
256 LayoutUnit startOffsetForContent(RenderRegion* region) const | |
257 { | |
258 return style()->isLeftToRightDirection() ? logicalLeftOffsetForContent(r
egion) : logicalWidth() - logicalRightOffsetForContent(region); | |
259 } | |
260 LayoutUnit endOffsetForContent(RenderRegion* region) const | |
261 { | |
262 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForContent(
region) : logicalWidth() - logicalRightOffsetForContent(region); | |
263 } | |
264 LayoutUnit logicalLeftOffsetForContent(LayoutUnit blockOffset) const | |
265 { | |
266 return logicalLeftOffsetForContent(regionAtBlockOffset(blockOffset)); | |
267 } | |
268 LayoutUnit logicalRightOffsetForContent(LayoutUnit blockOffset) const | |
269 { | |
270 return logicalRightOffsetForContent(regionAtBlockOffset(blockOffset)); | |
271 } | |
272 LayoutUnit availableLogicalWidthForContent(LayoutUnit blockOffset) const | |
273 { | |
274 return availableLogicalWidthForContent(regionAtBlockOffset(blockOffset))
; | |
275 } | |
276 LayoutUnit startOffsetForContent(LayoutUnit blockOffset) const | |
277 { | |
278 return startOffsetForContent(regionAtBlockOffset(blockOffset)); | |
279 } | |
280 LayoutUnit endOffsetForContent(LayoutUnit blockOffset) const | |
281 { | |
282 return endOffsetForContent(regionAtBlockOffset(blockOffset)); | |
283 } | |
284 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingM
ode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } | 252 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingM
ode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } |
285 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetFo
rContent() + availableLogicalWidth(); } | 253 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetFo
rContent() + availableLogicalWidth(); } |
286 LayoutUnit startOffsetForContent() const { return style()->isLeftToRightDire
ction() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetFor
Content(); } | 254 LayoutUnit startOffsetForContent() const { return style()->isLeftToRightDire
ction() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetFor
Content(); } |
287 LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirec
tion() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForC
ontent(); } | 255 LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirec
tion() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForC
ontent(); } |
288 | 256 |
289 #ifndef NDEBUG | 257 #ifndef NDEBUG |
290 void checkPositionedObjectsNeedLayout(); | 258 void checkPositionedObjectsNeedLayout(); |
291 void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, const Inline
Box* = 0, const char* = 0, const RenderObject* = 0) const; | 259 void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, const Inline
Box* = 0, const char* = 0, const RenderObject* = 0) const; |
292 #endif | 260 #endif |
293 | 261 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 protected: | 488 protected: |
521 void determineLogicalLeftPositionForChild(RenderBox* child, ApplyLayoutDelta
Mode = DoNotApplyLayoutDelta); | 489 void determineLogicalLeftPositionForChild(RenderBox* child, ApplyLayoutDelta
Mode = DoNotApplyLayoutDelta); |
522 | 490 |
523 // 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, | 491 // 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, |
524 // then nextPageLogicalTop with ExcludePageBoundary will still move to the t
op of the next page. nextPageLogicalTop with | 492 // then nextPageLogicalTop with ExcludePageBoundary will still move to the t
op of the next page. nextPageLogicalTop with |
525 // IncludePageBoundary set will not. | 493 // IncludePageBoundary set will not. |
526 // | 494 // |
527 // 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. | 495 // 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. |
528 enum PageBoundaryRule { ExcludePageBoundary, IncludePageBoundary }; | 496 enum PageBoundaryRule { ExcludePageBoundary, IncludePageBoundary }; |
529 LayoutUnit nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundaryRule = E
xcludePageBoundary) const; | 497 LayoutUnit nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundaryRule = E
xcludePageBoundary) const; |
530 bool hasNextPage(LayoutUnit logicalOffset, PageBoundaryRule = ExcludePageBou
ndary) const; | |
531 | 498 |
532 virtual ColumnInfo::PaginationUnit paginationUnit() const; | 499 virtual ColumnInfo::PaginationUnit paginationUnit() const; |
533 | 500 |
534 bool createsBlockFormattingContext() const; | 501 bool createsBlockFormattingContext() const; |
535 | 502 |
536 public: | 503 public: |
537 LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const; | 504 LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const; |
538 LayoutUnit pageLogicalHeightForOffset(LayoutUnit offset) const; | 505 LayoutUnit pageLogicalHeightForOffset(LayoutUnit offset) const; |
539 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBounda
ryRule = IncludePageBoundary) const; | 506 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBounda
ryRule = IncludePageBoundary) const; |
540 | 507 |
541 protected: | 508 protected: |
542 bool pushToNextPageWithMinimumLogicalHeight(LayoutUnit& adjustment, LayoutUn
it logicalOffset, LayoutUnit minimumLogicalHeight) const; | 509 bool pushToNextPageWithMinimumLogicalHeight(LayoutUnit& adjustment, LayoutUn
it logicalOffset, LayoutUnit minimumLogicalHeight) const; |
543 | 510 |
544 // A page break is required at some offset due to space shortage in the curr
ent fragmentainer. | 511 // A page break is required at some offset due to space shortage in the curr
ent fragmentainer. |
545 void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage); | 512 void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage); |
546 | 513 |
547 // Update minimum page height required to avoid fragmentation where it shoul
dn't occur (inside | 514 // Update minimum page height required to avoid fragmentation where it shoul
dn't occur (inside |
548 // unbreakable content, between orphans and widows, etc.). This will be used
as a hint to the | 515 // unbreakable content, between orphans and widows, etc.). This will be used
as a hint to the |
549 // column balancer to help set a good minimum column height. | 516 // column balancer to help set a good minimum column height. |
550 void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight); | 517 void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight); |
551 | 518 |
552 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. | 519 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. |
553 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. | 520 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. |
554 void updateRegionForLine(RootInlineBox*) const; | |
555 | 521 |
556 // Adjust from painting offsets to the local coords of this renderer | 522 // Adjust from painting offsets to the local coords of this renderer |
557 void offsetForContents(LayoutPoint&) const; | 523 void offsetForContents(LayoutPoint&) const; |
558 | 524 |
559 // 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 | |
560 // region/page/column that has a different available line width than the old
one. Used to know when you have to dirty a | |
561 // line, i.e., that it can't be re-used. | |
562 bool lineWidthForPaginatedLineChanged(RootInlineBox*, LayoutUnit lineDelta,
RenderFlowThread*) const; | |
563 | |
564 bool logicalWidthChangedInRegions(RenderFlowThread*) const; | |
565 | |
566 virtual bool requiresColumns(int desiredColumnCount) const; | 525 virtual bool requiresColumns(int desiredColumnCount) const; |
567 | 526 |
568 virtual bool updateLogicalWidthAndColumnWidth(); | 527 virtual bool updateLogicalWidthAndColumnWidth(); |
569 | 528 |
570 virtual bool canCollapseAnonymousBlockChild() const { return true; } | 529 virtual bool canCollapseAnonymousBlockChild() const { return true; } |
571 | 530 |
572 public: | 531 public: |
573 virtual LayoutUnit offsetFromLogicalTopOfFirstPage() const OVERRIDE FINAL; | 532 virtual LayoutUnit offsetFromLogicalTopOfFirstPage() const OVERRIDE FINAL; |
574 RenderRegion* regionAtBlockOffset(LayoutUnit) const; | 533 RenderRegion* regionAtBlockOffset(LayoutUnit) const; |
575 RenderRegion* clampToStartAndEndRegions(RenderRegion*) const; | |
576 | 534 |
577 public: | 535 public: |
578 | 536 |
579 // Allocated only when some of these fields have non-default values | 537 // Allocated only when some of these fields have non-default values |
580 struct RenderBlockRareData { | 538 struct RenderBlockRareData { |
581 WTF_MAKE_NONCOPYABLE(RenderBlockRareData); WTF_MAKE_FAST_ALLOCATED; | 539 WTF_MAKE_NONCOPYABLE(RenderBlockRareData); WTF_MAKE_FAST_ALLOCATED; |
582 public: | 540 public: |
583 RenderBlockRareData() | 541 RenderBlockRareData() |
584 : m_paginationStrut(0) | 542 : m_paginationStrut(0) |
585 , m_pageLogicalOffset(0) | 543 , m_pageLogicalOffset(0) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 return false; | 591 return false; |
634 } | 592 } |
635 return true; | 593 return true; |
636 } | 594 } |
637 | 595 |
638 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock()); | 596 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock()); |
639 | 597 |
640 } // namespace WebCore | 598 } // namespace WebCore |
641 | 599 |
642 #endif // RenderBlock_h | 600 #endif // RenderBlock_h |
OLD | NEW |