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