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

Unified Diff: third_party/WebKit/Source/core/html/HTMLElement.cpp

Issue 2051703002: Implement closed shadow adjustment for Element.offsetParent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLElement.cpp b/third_party/WebKit/Source/core/html/HTMLElement.cpp
index 97f7595717213225f3016ec684e83d20fafde47f..7d232d27b792980f594d03353f394ffd3b571dda 100644
--- a/third_party/WebKit/Source/core/html/HTMLElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLElement.cpp
@@ -54,6 +54,7 @@
#include "core/html/HTMLTemplateElement.h"
#include "core/html/HTMLTextFormControlElement.h"
#include "core/html/parser/HTMLParserIdioms.h"
+#include "core/layout/LayoutBoxModelObject.h"
#include "core/layout/LayoutObject.h"
#include "core/page/SpatialNavigation.h"
#include "platform/Language.h"
@@ -1051,6 +1052,52 @@ const AtomicString& HTMLElement::eventParameterName()
return eventString;
}
+int HTMLElement::offsetLeftForBinding()
+{
+ document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+ if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject())
+ return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSnappedOffsetLeft(unclosedOffsetParent())), layoutObject->styleRef()).round();
+ return 0;
+}
+
+int HTMLElement::offsetTopForBinding()
+{
+ document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+ if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject())
+ return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSnappedOffsetTop(unclosedOffsetParent())), layoutObject->styleRef()).round();
+ return 0;
+}
+
+int HTMLElement::offsetWidthForBinding()
+{
+ document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+ if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject())
+ return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSnappedOffsetWidth(unclosedOffsetParent())), layoutObject->styleRef()).round();
+ return 0;
+}
+
+int HTMLElement::offsetHeightForBinding()
+{
+ document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+ if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject())
+ return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSnappedOffsetHeight(unclosedOffsetParent())), layoutObject->styleRef()).round();
+ return 0;
+}
+
+Element* HTMLElement::unclosedOffsetParent()
+{
+ document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+
+ LayoutObject* layoutObject = this->layoutObject();
+ if (!layoutObject)
+ return nullptr;
+
+ Element* element = layoutObject->offsetParent();
+ while (element && (!element->isUnclosedNodeOf(*this) || (element->isInShadowTree() && element->containingShadowRoot()->type() == ShadowRootType::UserAgent)))
hayato 2016/06/27 06:58:32 I do not think it is a good idea to loop here by c
kochi 2016/06/28 07:59:59 That will break LayoutObject::offsetParent, as you
+ element = element->layoutObject()->offsetParent();
+ return element;
+}
+
} // namespace blink
#ifndef NDEBUG
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLElement.h ('k') | third_party/WebKit/Source/core/html/HTMLElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698