Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1156)

Side by Side Diff: sky/engine/core/rendering/RenderBlock.cpp

Issue 878303002: Remove more scrolling code from Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/rendering/RenderBlock.h ('k') | sky/engine/core/rendering/RenderBox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 DragCaretController& dragCaretController = frame()->page()->dragCaretControl ler(); 553 DragCaretController& dragCaretController = frame()->page()->dragCaretControl ler();
554 if (hasDragCaret(dragCaretController, this)) { 554 if (hasDragCaret(dragCaretController, this)) {
555 dragCaretController.paintDragCaret(frame(), paintInfo.context, paintOffs et, paintInfo.rect); 555 dragCaretController.paintDragCaret(frame(), paintInfo.context, paintOffs et, paintInfo.rect);
556 } 556 }
557 } 557 }
558 558
559 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs et) 559 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs et)
560 { 560 {
561 PaintPhase paintPhase = paintInfo.phase; 561 PaintPhase paintPhase = paintInfo.phase;
562 562
563 LayoutPoint scrolledOffset = paintOffset;
564 if (hasOverflowClip())
565 scrolledOffset.move(-scrolledContentOffset());
566
567 if (paintPhase == PaintPhaseForeground) { 563 if (paintPhase == PaintPhaseForeground) {
568 if (hasBoxDecorationBackground()) 564 if (hasBoxDecorationBackground())
569 paintBoxDecorationBackground(paintInfo, paintOffset); 565 paintBoxDecorationBackground(paintInfo, paintOffset);
570 } 566 }
571 567
572 if (paintPhase == PaintPhaseMask) { 568 if (paintPhase == PaintPhaseMask) {
573 paintMask(paintInfo, paintOffset); 569 paintMask(paintInfo, paintOffset);
574 return; 570 return;
575 } 571 }
576 572
577 if (paintPhase != PaintPhaseSelfOutline) 573 if (paintPhase != PaintPhaseSelfOutline)
578 paintContents(paintInfo, scrolledOffset); 574 paintContents(paintInfo, paintOffset);
579 575
580 paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection on l ines and between blocks. 576 paintSelection(paintInfo, paintOffset); // Fill in gaps in selection on line s and between blocks.
581 577
582 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) 578 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline)
583 && style()->hasOutline() && !style()->outlineStyleIsAuto()) { 579 && style()->hasOutline() && !style()->outlineStyleIsAuto()) {
584 paintOutline(paintInfo, LayoutRect(paintOffset, size())); 580 paintOutline(paintInfo, LayoutRect(paintOffset, size()));
585 } 581 }
586 582
587 // If the caret's node's render object's containing block is this block, and the paint action is PaintPhaseForeground, 583 // If the caret's node's render object's containing block is this block, and the paint action is PaintPhaseForeground,
588 // then paint the caret. 584 // then paint the caret.
589 if (paintPhase == PaintPhaseForeground) 585 if (paintPhase == PaintPhaseForeground)
590 paintCarets(paintInfo, paintOffset); 586 paintCarets(paintInfo, paintOffset);
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer(); 1120 bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer();
1125 bool checkChildren = !useOverflowClip; 1121 bool checkChildren = !useOverflowClip;
1126 if (!checkChildren) { 1122 if (!checkChildren) {
1127 LayoutRect clipRect = overflowClipRect(adjustedLocation); 1123 LayoutRect clipRect = overflowClipRect(adjustedLocation);
1128 if (style()->hasBorderRadius()) 1124 if (style()->hasBorderRadius())
1129 checkChildren = locationInContainer.intersects(style()->getRoundedBo rderFor(clipRect)); 1125 checkChildren = locationInContainer.intersects(style()->getRoundedBo rderFor(clipRect));
1130 else 1126 else
1131 checkChildren = locationInContainer.intersects(clipRect); 1127 checkChildren = locationInContainer.intersects(clipRect);
1132 } 1128 }
1133 if (checkChildren) { 1129 if (checkChildren) {
1134 // Hit test descendants first. 1130 if (hitTestContents(request, result, locationInContainer, toLayoutPoint( localOffset), hitTestAction)) {
1135 LayoutSize scrolledOffset(localOffset);
1136 if (hasOverflowClip())
1137 scrolledOffset -= scrolledContentOffset();
1138
1139 if (hitTestContents(request, result, locationInContainer, toLayoutPoint( scrolledOffset), hitTestAction)) {
1140 updateHitTestResult(result, locationInContainer.point() - localOffse t); 1131 updateHitTestResult(result, locationInContainer.point() - localOffse t);
1141 return true; 1132 return true;
1142 } 1133 }
1143 } 1134 }
1144 1135
1145 // Check if the point is outside radii. 1136 // Check if the point is outside radii.
1146 if (style()->hasBorderRadius()) { 1137 if (style()->hasBorderRadius()) {
1147 LayoutRect borderRect = borderBoxRect(); 1138 LayoutRect borderRect = borderBoxRect();
1148 borderRect.moveBy(adjustedLocation); 1139 borderRect.moveBy(adjustedLocation);
1149 RoundedRect border = style()->getRoundedBorderFor(borderRect); 1140 RoundedRect border = style()->getRoundedBorderFor(borderRect);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); 1315 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM);
1325 if (pointLogicalLeft >= logicalWidth()) 1316 if (pointLogicalLeft >= logicalWidth())
1326 return createPositionWithAffinity(caretMaxOffset(), DOWNSTREAM); 1317 return createPositionWithAffinity(caretMaxOffset(), DOWNSTREAM);
1327 if (pointLogicalTop < 0) 1318 if (pointLogicalTop < 0)
1328 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); 1319 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM);
1329 if (pointLogicalTop >= logicalHeight()) 1320 if (pointLogicalTop >= logicalHeight())
1330 return createPositionWithAffinity(caretMaxOffset(), DOWNSTREAM); 1321 return createPositionWithAffinity(caretMaxOffset(), DOWNSTREAM);
1331 } 1322 }
1332 1323
1333 LayoutPoint pointInContents = point; 1324 LayoutPoint pointInContents = point;
1334 offsetForContents(pointInContents);
1335 LayoutPoint pointInLogicalContents(pointInContents); 1325 LayoutPoint pointInLogicalContents(pointInContents);
1336 1326
1337 if (isRenderParagraph()) 1327 if (isRenderParagraph())
1338 return positionForPointWithInlineChildren(pointInLogicalContents); 1328 return positionForPointWithInlineChildren(pointInLogicalContents);
1339 1329
1340 RenderBox* lastCandidateBox = lastChildBox(); 1330 RenderBox* lastCandidateBox = lastChildBox();
1341 while (lastCandidateBox && !isChildHitTestCandidate(lastCandidateBox)) 1331 while (lastCandidateBox && !isChildHitTestCandidate(lastCandidateBox))
1342 lastCandidateBox = lastCandidateBox->previousSiblingBox(); 1332 lastCandidateBox = lastCandidateBox->previousSiblingBox();
1343 1333
1344 if (lastCandidateBox) { 1334 if (lastCandidateBox) {
1345 if (pointInLogicalContents.y() > logicalTopForChild(lastCandidateBox) 1335 if (pointInLogicalContents.y() > logicalTopForChild(lastCandidateBox)
1346 || (pointInLogicalContents.y() == logicalTopForChild(lastCandidateBo x))) 1336 || (pointInLogicalContents.y() == logicalTopForChild(lastCandidateBo x)))
1347 return positionForPointRespectingEditingBoundaries(this, lastCandida teBox, pointInContents); 1337 return positionForPointRespectingEditingBoundaries(this, lastCandida teBox, pointInContents);
1348 1338
1349 for (RenderBox* childBox = firstChildBox(); childBox; childBox = childBo x->nextSiblingBox()) { 1339 for (RenderBox* childBox = firstChildBox(); childBox; childBox = childBo x->nextSiblingBox()) {
1350 if (!isChildHitTestCandidate(childBox)) 1340 if (!isChildHitTestCandidate(childBox))
1351 continue; 1341 continue;
1352 LayoutUnit childLogicalBottom = logicalTopForChild(childBox) + logic alHeightForChild(childBox); 1342 LayoutUnit childLogicalBottom = logicalTopForChild(childBox) + logic alHeightForChild(childBox);
1353 // We hit child if our click is above the bottom of its padding box (like IE6/7 and FF3). 1343 // We hit child if our click is above the bottom of its padding box (like IE6/7 and FF3).
1354 if (isChildHitTestCandidate(childBox) && (pointInLogicalContents.y() < childLogicalBottom)) 1344 if (isChildHitTestCandidate(childBox) && (pointInLogicalContents.y() < childLogicalBottom))
1355 return positionForPointRespectingEditingBoundaries(this, childBo x, pointInContents); 1345 return positionForPointRespectingEditingBoundaries(this, childBo x, pointInContents);
1356 } 1346 }
1357 } 1347 }
1358 1348
1359 // We only get here if there are no hit test candidate children below the cl ick. 1349 // We only get here if there are no hit test candidate children below the cl ick.
1360 return RenderBox::positionForPoint(point); 1350 return RenderBox::positionForPoint(point);
1361 } 1351 }
1362 1352
1363 void RenderBlock::offsetForContents(LayoutPoint& offset) const
1364 {
1365 if (hasOverflowClip())
1366 offset += scrolledContentOffset();
1367 }
1368
1369 LayoutUnit RenderBlock::availableLogicalWidth() const 1353 LayoutUnit RenderBlock::availableLogicalWidth() const
1370 { 1354 {
1371 return RenderBox::availableLogicalWidth(); 1355 return RenderBox::availableLogicalWidth();
1372 } 1356 }
1373 1357
1374 void RenderBlock::computePreferredLogicalWidths() 1358 void RenderBlock::computePreferredLogicalWidths()
1375 { 1359 {
1376 ASSERT(preferredLogicalWidthsDirty()); 1360 ASSERT(preferredLogicalWidthsDirty());
1377 1361
1378 m_minPreferredLogicalWidth = 0; 1362 m_minPreferredLogicalWidth = 0;
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 1831 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
1848 { 1832 {
1849 showRenderObject(); 1833 showRenderObject();
1850 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 1834 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
1851 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 1835 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
1852 } 1836 }
1853 1837
1854 #endif 1838 #endif
1855 1839
1856 } // namespace blink 1840 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBlock.h ('k') | sky/engine/core/rendering/RenderBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698