| 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, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 if (hasOverflowClip()) { | 299 if (hasOverflowClip()) { |
| 300 if (gDelayUpdateScrollInfo) | 300 if (gDelayUpdateScrollInfo) |
| 301 gDelayedUpdateScrollInfoSet->add(this); | 301 gDelayedUpdateScrollInfoSet->add(this); |
| 302 else | 302 else |
| 303 layer()->scrollableArea()->updateAfterLayout(); | 303 layer()->scrollableArea()->updateAfterLayout(); |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 | 306 |
| 307 void RenderBlock::layout() | 307 void RenderBlock::layout() |
| 308 { | 308 { |
| 309 // Table cells call layoutBlock directly, so don't add any logic here. Put
code into | 309 // FIXME(sky): Inline layoutBlock here and get rid of it. |
| 310 // layoutBlock(). | |
| 311 layoutBlock(false); | 310 layoutBlock(false); |
| 312 | |
| 313 // It's safe to check for control clip here, since controls can never be tab
le cells. | |
| 314 // If we have a lightweight clip, there can never be any overflow from child
ren. | |
| 315 if (hasControlClip() && m_overflow) | |
| 316 clearLayoutOverflow(); | |
| 317 } | 311 } |
| 318 | 312 |
| 319 bool RenderBlock::widthAvailableToChildrenHasChanged() | 313 bool RenderBlock::widthAvailableToChildrenHasChanged() |
| 320 { | 314 { |
| 321 bool widthAvailableToChildrenHasChanged = m_hasBorderOrPaddingLogicalWidthCh
anged; | 315 bool widthAvailableToChildrenHasChanged = m_hasBorderOrPaddingLogicalWidthCh
anged; |
| 322 m_hasBorderOrPaddingLogicalWidthChanged = false; | 316 m_hasBorderOrPaddingLogicalWidthChanged = false; |
| 323 | 317 |
| 324 // If we use border-box sizing, have percentage padding, and our parent has
changed width then the width available to our children has changed even | 318 // If we use border-box sizing, have percentage padding, and our parent has
changed width then the width available to our children has changed even |
| 325 // though our own width has remained the same. | 319 // though our own width has remained the same. |
| 326 widthAvailableToChildrenHasChanged |= style()->boxSizing() == BORDER_BOX &&
needsPreferredWidthsRecalculation() && view()->layoutState()->containingBlockLog
icalWidthChanged(); | 320 widthAvailableToChildrenHasChanged |= style()->boxSizing() == BORDER_BOX &&
needsPreferredWidthsRecalculation() && view()->layoutState()->containingBlockLog
icalWidthChanged(); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 if (!isDocumentElement()) { | 519 if (!isDocumentElement()) { |
| 526 overflowBox = visualOverflowRect(); | 520 overflowBox = visualOverflowRect(); |
| 527 overflowBox.moveBy(adjustedPaintOffset); | 521 overflowBox.moveBy(adjustedPaintOffset); |
| 528 if (!overflowBox.intersects(paintInfo.rect)) | 522 if (!overflowBox.intersects(paintInfo.rect)) |
| 529 return; | 523 return; |
| 530 } | 524 } |
| 531 | 525 |
| 532 // There are some cases where not all clipped visual overflow is accounted f
or. | 526 // There are some cases where not all clipped visual overflow is accounted f
or. |
| 533 // FIXME: reduce the number of such cases. | 527 // FIXME: reduce the number of such cases. |
| 534 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; | 528 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; |
| 535 if (hasOverflowClip() && !hasControlClip() && !(shouldPaintSelectionGaps() &
& phase == PaintPhaseForeground) && !hasCaret()) | 529 if (hasOverflowClip() && !(shouldPaintSelectionGaps() && phase == PaintPhase
Foreground) && !hasCaret()) |
| 536 contentsClipBehavior = SkipContentsClipIfPossible; | 530 contentsClipBehavior = SkipContentsClipIfPossible; |
| 537 | 531 |
| 538 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsC
lipBehavior); | 532 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsC
lipBehavior); |
| 539 { | 533 { |
| 540 paintObject(paintInfo, adjustedPaintOffset); | 534 paintObject(paintInfo, adjustedPaintOffset); |
| 541 } | 535 } |
| 542 if (pushedClip) | 536 if (pushedClip) |
| 543 popContentsClip(paintInfo, phase, adjustedPaintOffset); | 537 popContentsClip(paintInfo, phase, adjustedPaintOffset); |
| 544 | 538 |
| 545 // Our scrollbar widgets paint exactly when we tell them to, so that they wo
rk properly with | 539 // Our scrollbar widgets paint exactly when we tell them to, so that they wo
rk properly with |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 return false; | 1181 return false; |
| 1188 break; | 1182 break; |
| 1189 } | 1183 } |
| 1190 case ClipPathOperation::REFERENCE: | 1184 case ClipPathOperation::REFERENCE: |
| 1191 break; | 1185 break; |
| 1192 } | 1186 } |
| 1193 } | 1187 } |
| 1194 | 1188 |
| 1195 // If we have clipping, then we can't have any spillout. | 1189 // If we have clipping, then we can't have any spillout. |
| 1196 bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer(); | 1190 bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer(); |
| 1197 bool useClip = (hasControlClip() || useOverflowClip); | 1191 bool checkChildren = !useOverflowClip; |
| 1198 bool checkChildren = !useClip; | |
| 1199 if (!checkChildren) { | 1192 if (!checkChildren) { |
| 1200 if (hasControlClip()) { | 1193 LayoutRect clipRect = overflowClipRect(adjustedLocation); |
| 1201 checkChildren = locationInContainer.intersects(controlClipRect(adjus
tedLocation)); | 1194 if (style()->hasBorderRadius()) |
| 1202 } else { | 1195 checkChildren = locationInContainer.intersects(style()->getRoundedBo
rderFor(clipRect)); |
| 1203 LayoutRect clipRect = overflowClipRect(adjustedLocation); | 1196 else |
| 1204 if (style()->hasBorderRadius()) | 1197 checkChildren = locationInContainer.intersects(clipRect); |
| 1205 checkChildren = locationInContainer.intersects(style()->getRound
edBorderFor(clipRect)); | |
| 1206 else | |
| 1207 checkChildren = locationInContainer.intersects(clipRect); | |
| 1208 } | |
| 1209 } | 1198 } |
| 1210 if (checkChildren) { | 1199 if (checkChildren) { |
| 1211 // Hit test descendants first. | 1200 // Hit test descendants first. |
| 1212 LayoutSize scrolledOffset(localOffset); | 1201 LayoutSize scrolledOffset(localOffset); |
| 1213 if (hasOverflowClip()) | 1202 if (hasOverflowClip()) |
| 1214 scrolledOffset -= scrolledContentOffset(); | 1203 scrolledOffset -= scrolledContentOffset(); |
| 1215 | 1204 |
| 1216 if (hitTestContents(request, result, locationInContainer, toLayoutPoint(
scrolledOffset), hitTestAction)) { | 1205 if (hitTestContents(request, result, locationInContainer, toLayoutPoint(
scrolledOffset), hitTestAction)) { |
| 1217 updateHitTestResult(result, locationInContainer.point() - localOffse
t); | 1206 updateHitTestResult(result, locationInContainer.point() - localOffse
t); |
| 1218 return true; | 1207 return true; |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 *extraWidthToEndOfLine = width() - caretRect.maxX(); | 1746 *extraWidthToEndOfLine = width() - caretRect.maxX(); |
| 1758 | 1747 |
| 1759 return caretRect; | 1748 return caretRect; |
| 1760 } | 1749 } |
| 1761 | 1750 |
| 1762 void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& a
dditionalOffset, const RenderLayerModelObject* paintContainer) const | 1751 void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& a
dditionalOffset, const RenderLayerModelObject* paintContainer) const |
| 1763 { | 1752 { |
| 1764 if (width() && height()) | 1753 if (width() && height()) |
| 1765 rects.append(pixelSnappedIntRect(additionalOffset, size())); | 1754 rects.append(pixelSnappedIntRect(additionalOffset, size())); |
| 1766 | 1755 |
| 1767 if (!hasOverflowClip() && !hasControlClip()) { | 1756 if (!hasOverflowClip()) { |
| 1768 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { | 1757 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { |
| 1769 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); | 1758 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); |
| 1770 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); | 1759 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); |
| 1771 LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y
() + top, curr->width(), bottom - top); | 1760 LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y
() + top, curr->width(), bottom - top); |
| 1772 if (!rect.isEmpty()) | 1761 if (!rect.isEmpty()) |
| 1773 rects.append(pixelSnappedIntRect(rect)); | 1762 rects.append(pixelSnappedIntRect(rect)); |
| 1774 } | 1763 } |
| 1775 | 1764 |
| 1776 addChildFocusRingRects(rects, additionalOffset, paintContainer); | 1765 addChildFocusRingRects(rects, additionalOffset, paintContainer); |
| 1777 } | 1766 } |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1931 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 1920 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
| 1932 { | 1921 { |
| 1933 showRenderObject(); | 1922 showRenderObject(); |
| 1934 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 1923 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 1935 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 1924 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 1936 } | 1925 } |
| 1937 | 1926 |
| 1938 #endif | 1927 #endif |
| 1939 | 1928 |
| 1940 } // namespace blink | 1929 } // namespace blink |
| OLD | NEW |