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

Side by Side Diff: sky/engine/core/dom/Element.cpp

Issue 684353002: Remove more stuff from Widget. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
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) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 } 549 }
550 550
551 int Element::scrollHeight() 551 int Element::scrollHeight()
552 { 552 {
553 document().updateLayoutIgnorePendingStylesheets(); 553 document().updateLayoutIgnorePendingStylesheets();
554 if (RenderBox* rend = renderBox()) 554 if (RenderBox* rend = renderBox())
555 return adjustLayoutUnitForAbsoluteZoom(rend->scrollHeight(), *rend).toDo uble(); 555 return adjustLayoutUnitForAbsoluteZoom(rend->scrollHeight(), *rend).toDo uble();
556 return 0; 556 return 0;
557 } 557 }
558 558
559 IntRect Element::boundsInRootViewSpace()
560 {
561 document().updateLayoutIgnorePendingStylesheets();
562
563 FrameView* view = document().view();
564 if (!view)
565 return IntRect();
566
567 Vector<FloatQuad> quads;
568 // Get the bounding rectangle from the box model.
569 if (renderBoxModelObject())
570 renderBoxModelObject()->absoluteQuads(quads);
571
572 if (quads.isEmpty())
573 return IntRect();
574
575 IntRect result = quads[0].enclosingBoundingBox();
576 for (size_t i = 1; i < quads.size(); ++i)
577 result.unite(quads[i].enclosingBoundingBox());
578
579 result = view->contentsToRootView(result);
580 return result;
581 }
582
583 PassRefPtr<ClientRectList> Element::getClientRects() 559 PassRefPtr<ClientRectList> Element::getClientRects()
584 { 560 {
585 document().updateLayoutIgnorePendingStylesheets(); 561 document().updateLayoutIgnorePendingStylesheets();
586 562
587 RenderBoxModelObject* renderBoxModelObject = this->renderBoxModelObject(); 563 RenderBoxModelObject* renderBoxModelObject = this->renderBoxModelObject();
588 if (!renderBoxModelObject) 564 if (!renderBoxModelObject)
589 return ClientRectList::create(); 565 return ClientRectList::create();
590 566
591 // FIXME: Handle SVG elements. 567 // FIXME: Handle SVG elements.
592 // FIXME: Handle table/inline-table with a caption. 568 // FIXME: Handle table/inline-table with a caption.
(...skipping 18 matching lines...) Expand all
611 587
612 FloatRect result = quads[0].boundingBox(); 588 FloatRect result = quads[0].boundingBox();
613 for (size_t i = 1; i < quads.size(); ++i) 589 for (size_t i = 1; i < quads.size(); ++i)
614 result.unite(quads[i].boundingBox()); 590 result.unite(quads[i].boundingBox());
615 591
616 ASSERT(renderer()); 592 ASSERT(renderer());
617 document().adjustFloatRectForScrollAndAbsoluteZoom(result, *renderer()); 593 document().adjustFloatRectForScrollAndAbsoluteZoom(result, *renderer());
618 return ClientRect::create(result); 594 return ClientRect::create(result);
619 } 595 }
620 596
621 IntRect Element::screenRect() const
622 {
623 if (!renderer())
624 return IntRect();
625 // FIXME: this should probably respect transforms
626 return document().view()->contentsToScreen(renderer()->absoluteBoundingBoxRe ctIgnoringTransforms());
627 }
628
629 void Element::setAttribute(const AtomicString& localName, const AtomicString& va lue, ExceptionState& exceptionState) 597 void Element::setAttribute(const AtomicString& localName, const AtomicString& va lue, ExceptionState& exceptionState)
630 { 598 {
631 if (!Document::isValidName(localName)) { 599 if (!Document::isValidName(localName)) {
632 exceptionState.throwDOMException(InvalidCharacterError, "'" + localName + "' is not a valid attribute name."); 600 exceptionState.throwDOMException(InvalidCharacterError, "'" + localName + "' is not a valid attribute name.");
633 return; 601 return;
634 } 602 }
635 603
636 synchronizeAttribute(localName); 604 synchronizeAttribute(localName);
637 605
638 if (!elementData()) { 606 if (!elementData()) {
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 { 2092 {
2125 #if ENABLE(OILPAN) 2093 #if ENABLE(OILPAN)
2126 if (hasRareData()) 2094 if (hasRareData())
2127 visitor->trace(elementRareData()); 2095 visitor->trace(elementRareData());
2128 visitor->trace(m_elementData); 2096 visitor->trace(m_elementData);
2129 #endif 2097 #endif
2130 ContainerNode::trace(visitor); 2098 ContainerNode::trace(visitor);
2131 } 2099 }
2132 2100
2133 } // namespace blink 2101 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698