Changeset 123980 in webkit
- Timestamp:
- Jul 29, 2012 10:27:35 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r123978 r123980 1 2012-07-29 Dan Bernstein <mitz@apple.com> 2 3 In flipped blocks, a point on the top edge of a box is considered outside the box (and vice versa) 4 https://bugs.webkit.org/show_bug.cgi?id=92593 5 6 Reviewed by Simon Fraser. 7 8 * fast/writing-mode/flipped-blocks-hit-test-box-edges-expected.txt: Added. 9 * fast/writing-mode/flipped-blocks-hit-test-box-edges.html: Added. 10 * fast/writing-mode/flipped-blocks-hit-test-line-edges-expected.txt: Added. 11 * fast/writing-mode/flipped-blocks-hit-test-line-edges.html: Added. 12 1 13 2012-07-29 Mike West <mkwst@chromium.org> 2 14 -
trunk/Source/WebCore/ChangeLog
r123977 r123980 1 2012-07-29 Dan Bernstein <mitz@apple.com> 2 3 In flipped blocks, a point on the top edge of a box is considered outside the box (and vice versa) 4 https://bugs.webkit.org/show_bug.cgi?id=92593 5 6 Reviewed by Simon Fraser. 7 8 With respect to hit testing, boxes should always behave as half-open intervals which include 9 the physical top and left edges and not the bottom and right edges. 10 RenderBlock::positionForPoint was not adhering to this, since it was comparing flipped 11 coordinates. 12 13 Tests: fast/writing-mode/flipped-blocks-hit-test-box-edges.html 14 fast/writing-mode/flipped-blocks-hit-test-line-edges.html 15 16 * rendering/RenderBlock.cpp: 17 (WebCore::RenderBlock::positionForPointWithInlineChildren): When blocks are flipped, changed 18 strict inequalities of y coordinates into non-strict ones and non-strict inequalities into 19 strict ones. 20 (WebCore::RenderBlock::positionForPoint): Ditto, except for the test for being under the top 21 of the last candidate box, which was made non-strict in the unflipped case and remained 22 strict. 23 1 24 2012-07-28 Dan Bernstein <mitz@apple.com> 2 25 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r123977 r123980 4918 4918 4919 4919 bool linesAreFlipped = style()->isFlippedLinesWritingMode(); 4920 bool blocksAreFlipped = style()->isFlippedBlocksWritingMode(); 4920 4921 4921 4922 // look for the closest line box in the root box which is at the passed-in y coordinate … … 4929 4930 firstRootBoxWithChildren = root; 4930 4931 4931 if (!linesAreFlipped && root->isFirstAfterPageBreak() && pointInLogicalContents.y() < root->lineTopWithLeading()) 4932 if (!linesAreFlipped && root->isFirstAfterPageBreak() && (pointInLogicalContents.y() < root->lineTopWithLeading() 4933 || (blocksAreFlipped && pointInLogicalContents.y() == root->lineTopWithLeading()))) 4932 4934 break; 4933 4935 … … 4935 4937 4936 4938 // check if this root line box is located at this y coordinate 4937 if (pointInLogicalContents.y() < root->selectionBottom() ) {4939 if (pointInLogicalContents.y() < root->selectionBottom() || (blocksAreFlipped && pointInLogicalContents.y() == root->selectionBottom())) { 4938 4940 if (linesAreFlipped) { 4939 4941 RootInlineBox* nextRootBoxWithChildren = root->nextRootBox(); … … 4941 4943 nextRootBoxWithChildren = nextRootBoxWithChildren->nextRootBox(); 4942 4944 4943 if (nextRootBoxWithChildren && nextRootBoxWithChildren->isFirstAfterPageBreak() && pointInLogicalContents.y() >= nextRootBoxWithChildren->lineTopWithLeading()) 4945 if (nextRootBoxWithChildren && nextRootBoxWithChildren->isFirstAfterPageBreak() && (pointInLogicalContents.y() > nextRootBoxWithChildren->lineTopWithLeading() 4946 || (!blocksAreFlipped && pointInLogicalContents.y() == nextRootBoxWithChildren->lineTopWithLeading()))) 4944 4947 continue; 4945 4948 } … … 4958 4961 4959 4962 if (closestBox) { 4960 if (moveCaretToBoundary && pointInLogicalContents.y() < firstRootBoxWithChildren->selectionTop() 4961 && pointInLogicalContents.y() < firstRootBoxWithChildren->logicalTop()) { 4962 InlineBox* box = firstRootBoxWithChildren->firstLeafChild(); 4963 if (box->isLineBreak()) { 4964 if (InlineBox* newBox = box->nextLeafChildIgnoringLineBreak()) 4965 box = newBox; 4963 if (moveCaretToBoundary) { 4964 LayoutUnit firstRootBoxWithChildrenTop = min<LayoutUnit>(firstRootBoxWithChildren->selectionTop(), firstRootBoxWithChildren->logicalTop()); 4965 if (pointInLogicalContents.y() < firstRootBoxWithChildrenTop 4966 || (blocksAreFlipped && pointInLogicalContents.y() == firstRootBoxWithChildrenTop)) { 4967 InlineBox* box = firstRootBoxWithChildren->firstLeafChild(); 4968 if (box->isLineBreak()) { 4969 if (InlineBox* newBox = box->nextLeafChildIgnoringLineBreak()) 4970 box = newBox; 4971 } 4972 // y coordinate is above first root line box, so return the start of the first 4973 return VisiblePosition(positionForBox(box, true), DOWNSTREAM); 4966 4974 } 4967 // y coordinate is above first root line box, so return the start of the first4968 return VisiblePosition(positionForBox(box, true), DOWNSTREAM);4969 4975 } 4970 4976 … … 5026 5032 lastCandidateBox = lastCandidateBox->previousSiblingBox(); 5027 5033 5034 bool blocksAreFlipped = style()->isFlippedBlocksWritingMode(); 5028 5035 if (lastCandidateBox) { 5029 if (pointInLogicalContents.y() > logicalTopForChild(lastCandidateBox)) 5036 if (pointInLogicalContents.y() > logicalTopForChild(lastCandidateBox) 5037 || (!blocksAreFlipped && pointInLogicalContents.y() == logicalTopForChild(lastCandidateBox))) 5030 5038 return positionForPointRespectingEditingBoundaries(this, lastCandidateBox, pointInContents); 5031 5039 5032 5040 for (RenderBox* childBox = firstChildBox(); childBox; childBox = childBox->nextSiblingBox()) { 5041 if (!isChildHitTestCandidate(childBox)) 5042 continue; 5043 LayoutUnit childLogicalBottom = logicalTopForChild(childBox) + logicalHeightForChild(childBox); 5033 5044 // We hit child if our click is above the bottom of its padding box (like IE6/7 and FF3). 5034 if (isChildHitTestCandidate(childBox) && pointInLogicalContents.y() < logicalTopForChild(childBox) + logicalHeightForChild(childBox)) 5045 if (isChildHitTestCandidate(childBox) && (pointInLogicalContents.y() < childLogicalBottom 5046 || (blocksAreFlipped && pointInLogicalContents.y() == childLogicalBottom))) 5035 5047 return positionForPointRespectingEditingBoundaries(this, childBox, pointInContents); 5036 5048 }
Note: See TracChangeset
for help on using the changeset viewer.