Changeset 96152 in webkit
- Timestamp:
- Sep 27, 2011 1:55:00 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r96151 r96152 1 2011-09-27 Ojan Vafai <ojan@chromium.org> 2 3 offsetTop/offsetLeft return the wrong values for horizontal-bt/vertical-rl writing modes 4 https://bugs.webkit.org/show_bug.cgi?id=68304 5 6 Reviewed by David Hyatt. 7 8 * css3/flexbox/writing-modes-expected.txt: 9 * css3/flexbox/writing-modes.html: 10 * fast/dom/offset-position-writing-modes-expected.txt: Added. 11 * fast/dom/offset-position-writing-modes.html: Added. 12 1 13 2011-09-27 Tim Horton <timothy_horton@apple.com> 2 14 -
trunk/LayoutTests/css3/flexbox/writing-modes-expected.txt
r95577 r96152 13 13 PASS 14 14 PASS 15 Expected 580 for offsetLeft, but got 0. Expected 580 for offsetLeft, but got 0. Expected 580 for offsetLeft, but got 0. 16 Expected 580 for offsetLeft, but got 0. Expected 180 for offsetTop, but got 0. Expected 580 for offsetLeft, but got 150. Expected 180 for offsetTop, but got 0. Expected 580 for offsetLeft, but got 450. Expected 180 for offsetTop, but got 0. 15 PASS 16 PASS 17 17 -
trunk/LayoutTests/css3/flexbox/writing-modes.html
r95644 r96152 159 159 </div> 160 160 161 <!-- FIXME: There's a bug where offsetLeft reports the wrong value in vertical-rl writing-mode.-->162 161 <div style="position:relative"> 163 162 <div class="flexbox vertical-rl"> … … 168 167 </div> 169 168 170 <!-- FIXME: There's a bug where offsetTop reports the wrong value in horizontal-bt writing-mode.-->171 169 <div style="position:relative"> 172 170 <div class="flexbox bt" style="height:200px"> 173 <div data- offset-y="180" data-offset-x="580" style="width: -webkit-flex(1 0 0);"></div>174 <div data- offset-y="180" data-offset-x="580" style="width: -webkit-flex(2 0 0);"></div>175 <div data- offset-y="180" data-offset-x="580" style="width: -webkit-flex(1 0 0);"></div>171 <div data-expected-width="150" data-offset-y="180" data-offset-x="0" style="width: -webkit-flex(1 0 0);"></div> 172 <div data-expected-width="300" data-offset-y="180" data-offset-x="150" style="width: -webkit-flex(2 0 0);"></div> 173 <div data-expected-width="150" data-offset-y="180" data-offset-x="450" style="width: -webkit-flex(1 0 0);"></div> 176 174 </div> 177 175 </div> -
trunk/Source/WebCore/ChangeLog
r96151 r96152 1 2011-09-27 Ojan Vafai <ojan@chromium.org> 2 3 offsetTop/offsetLeft return the wrong values for horizontal-bt/vertical-rl writing modes 4 https://bugs.webkit.org/show_bug.cgi?id=68304 5 6 Reviewed by David Hyatt. 7 8 When grabbing the x/y values of the RenderBox, we need to take writing mode 9 flipping into account. 10 11 Test: fast/dom/offset-position-writing-modes.html 12 13 * rendering/RenderBox.cpp: 14 (WebCore::RenderBox::locationIncludingFlipping): 15 * rendering/RenderBox.h: 16 (WebCore::RenderBox::yFlippedForWritingMode): 17 (WebCore::RenderBox::xFlippedForWritingMode): 18 * rendering/RenderBoxModelObject.cpp: 19 (WebCore::RenderBoxModelObject::offsetLeft): 20 (WebCore::RenderBoxModelObject::offsetTop): 21 1 22 2011-09-27 Tim Horton <timothy_horton@apple.com> 2 23 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r96139 r96152 1384 1384 o->adjustForColumns(offset, columnRect.location()); 1385 1385 } else 1386 offset += locationOffsetIncludingFlipping();1386 offset += topLeftLocationOffset(); 1387 1387 } else 1388 offset += locationOffsetIncludingFlipping();1388 offset += topLeftLocationOffset(); 1389 1389 } 1390 1390 … … 3650 3650 } 3651 3651 3652 LayoutSize RenderBox::locationOffsetIncludingFlipping() const 3652 LayoutPoint RenderBox::topLeftLocation() const 3653 { 3654 RenderBlock* containerBlock = containingBlock(); 3655 if (!containerBlock || containerBlock == this) 3656 return location(); 3657 return containerBlock->flipForWritingMode(this, location(), RenderBox::ParentToChildFlippingAdjustment); 3658 } 3659 3660 LayoutSize RenderBox::topLeftLocationOffset() const 3653 3661 { 3654 3662 RenderBlock* containerBlock = containingBlock(); -
trunk/Source/WebCore/rendering/RenderBox.h
r96139 r96152 50 50 LayoutUnit height() const { return m_frameRect.height(); } 51 51 52 // These represent your location relative to your container as a physical offset. 53 // In layout related methods you almost always want the logical location (e.g. x() and y()). 54 LayoutUnit top() const { return topLeftLocation().y(); } 55 LayoutUnit left() const { return topLeftLocation().x(); } 56 52 57 void setX(LayoutUnit x) { m_frameRect.setX(x); } 53 58 void setY(LayoutUnit y) { m_frameRect.setY(y); } … … 403 408 FloatPoint flipForWritingMode(const FloatPoint&) const; 404 409 void flipForWritingMode(FloatRect&) const; 405 LayoutSize locationOffsetIncludingFlipping() const; 410 // These represent your location relative to your container as a physical offset. 411 // In layout related methods you almost always want the logical location (e.g. x() and y()). 412 LayoutPoint topLeftLocation() const; 413 LayoutSize topLeftLocationOffset() const; 406 414 407 415 LayoutRect logicalVisualOverflowRectForPropagation(RenderStyle*) const; -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r95901 r96152 439 439 440 440 RenderBoxModelObject* offsetPar = offsetParent(); 441 LayoutUnit xPos = (isBox() ? toRenderBox(this)-> x() : 0);441 LayoutUnit xPos = (isBox() ? toRenderBox(this)->left() : 0); 442 442 443 443 // If the offsetParent of the element is null, or is the HTML body element, … … 454 454 // FIXME: What are we supposed to do inside SVG content? 455 455 if (curr->isBox() && !curr->isTableRow()) 456 xPos += toRenderBox(curr)-> x();456 xPos += toRenderBox(curr)->left(); 457 457 curr = curr->parent(); 458 458 } 459 459 if (offsetPar->isBox() && offsetPar->isBody() && !offsetPar->isRelPositioned() && !offsetPar->isPositioned()) 460 xPos += toRenderBox(offsetPar)-> x();460 xPos += toRenderBox(offsetPar)->left(); 461 461 } 462 462 } … … 473 473 474 474 RenderBoxModelObject* offsetPar = offsetParent(); 475 LayoutUnit yPos = (isBox() ? toRenderBox(this)-> y() : 0);475 LayoutUnit yPos = (isBox() ? toRenderBox(this)->top() : 0); 476 476 477 477 // If the offsetParent of the element is null, or is the HTML body element, … … 488 488 // FIXME: What are we supposed to do inside SVG content? 489 489 if (curr->isBox() && !curr->isTableRow()) 490 yPos += toRenderBox(curr)-> y();490 yPos += toRenderBox(curr)->top(); 491 491 curr = curr->parent(); 492 492 } 493 493 if (offsetPar->isBox() && offsetPar->isBody() && !offsetPar->isRelPositioned() && !offsetPar->isPositioned()) 494 yPos += toRenderBox(offsetPar)-> y();494 yPos += toRenderBox(offsetPar)->top(); 495 495 } 496 496 } -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r95863 r96152 708 708 } else if (RenderBox* box = renderBox()) { 709 709 setSize(box->size()); 710 localPoint += box-> locationOffsetIncludingFlipping();710 localPoint += box->topLeftLocationOffset(); 711 711 } 712 712 … … 722 722 // Rows and cells share the same coordinate space (that of the section). 723 723 // Omit them when computing our xpos/ypos. 724 localPoint += toRenderBox(curr)-> locationOffsetIncludingFlipping();724 localPoint += toRenderBox(curr)->topLeftLocationOffset(); 725 725 } 726 726 curr = curr->parent(); … … 728 728 if (curr->isBox() && curr->isTableRow()) { 729 729 // Put ourselves into the row coordinate space. 730 localPoint -= toRenderBox(curr)-> locationOffsetIncludingFlipping();730 localPoint -= toRenderBox(curr)->topLeftLocationOffset(); 731 731 } 732 732 }
Note: See TracChangeset
for help on using the changeset viewer.