Skip to content

Commit

Permalink
(Box::boxFromPoint, Block::layOutInlineBlock) : Fix bugs so that we c…
Browse files Browse the repository at this point in the history
…an click scrolled boxes inside an inline block box
  • Loading branch information
ShikiOkasaka committed Dec 15, 2013
1 parent 227a6d1 commit 2b19d34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/css/Box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ void Block::resolveHeight()

void Block::layOutInlineBlock(ViewCSSImp* view, Node node, const BlockPtr& inlineBlock, FormattingContext* context)
{
InlineBoxPtr inlineBox = std::make_shared<InlineBox>(node, inlineBlock->style);
InlineBoxPtr inlineBox = std::make_shared<InlineBox>(nullptr, nullptr); // Treat this box as an anonymous box
if (!inlineBox)
return; // TODO error

Expand Down
10 changes: 6 additions & 4 deletions src/css/Box.h
Original file line number Diff line number Diff line change
Expand Up @@ -490,14 +490,16 @@ class Box : public ContainingBlock

BoxPtr boxFromPoint(int x, int y, StackingContext* context = 0) {
if (context && stackingContext && stackingContext != context)
return 0;
return nullptr;
int xx(x);
int yy(y);
if (!isAnonymous() && Element::hasInstance(node)) {
Element element = interface_cast<Element>(node);
x += element.getScrollLeft();
y += element.getScrollTop();
xx += element.getScrollLeft();
yy += element.getScrollTop();
}
for (BoxPtr box = getFirstChild(); box; box = box->getNextSibling()) {
if (BoxPtr target = box->boxFromPoint(x, y, context)) {
if (BoxPtr target = box->boxFromPoint(xx, yy, context)) {
if (!isClipped() || isInside(x, y))
return target;
}
Expand Down

0 comments on commit 2b19d34

Please sign in to comment.