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

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: add one more test, more spec compliant 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..9ad44bc51ab4e5e494a0f973a5e9836cd8eac6d6 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,49 @@ 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;
+
+ return layoutObject->offsetParent(this);
+}
+
} // namespace blink
#ifndef NDEBUG

Powered by Google App Engine
This is Rietveld 408576698