Title: [232346] trunk/Source/WebCore
Revision
232346
Author
[email protected]
Date
2018-05-31 07:58:24 -0700 (Thu, 31 May 2018)

Log Message

[LFC] Add quirks mode setter/getting to LayoutContext
https://bugs.webkit.org/show_bug.cgi?id=186122

Reviewed by Antti Koivisto.

* layout/LayoutContext.h:
(WebCore::Layout::LayoutContext::setInQuirksMode):
(WebCore::Layout::LayoutContext::inQuirksMode const):
* page/FrameViewLayoutContext.cpp:
(WebCore::layoutUsingFormattingContext):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (232345 => 232346)


--- trunk/Source/WebCore/ChangeLog	2018-05-31 11:00:16 UTC (rev 232345)
+++ trunk/Source/WebCore/ChangeLog	2018-05-31 14:58:24 UTC (rev 232346)
@@ -1,3 +1,16 @@
+2018-05-31  Zalan Bujtas  <[email protected]>
+
+        [LFC] Add quirks mode setter/getting to LayoutContext
+        https://bugs.webkit.org/show_bug.cgi?id=186122
+
+        Reviewed by Antti Koivisto.
+
+        * layout/LayoutContext.h:
+        (WebCore::Layout::LayoutContext::setInQuirksMode):
+        (WebCore::Layout::LayoutContext::inQuirksMode const):
+        * page/FrameViewLayoutContext.cpp:
+        (WebCore::layoutUsingFormattingContext):
+
 2018-05-30  Carlos Eduardo Ramalho  <[email protected]>
 
         [GTK] Hardcoded text color in input fields

Modified: trunk/Source/WebCore/layout/LayoutContext.h (232345 => 232346)


--- trunk/Source/WebCore/layout/LayoutContext.h	2018-05-31 11:00:16 UTC (rev 232345)
+++ trunk/Source/WebCore/layout/LayoutContext.h	2018-05-31 14:58:24 UTC (rev 232346)
@@ -63,6 +63,7 @@
     void initializeRoot(const Container&, const LayoutSize&);
     void updateLayout();
     void styleChanged(const Box&, StyleDiff);
+    void setInQuirksMode(bool inQuirksMode) { m_inQuirksMode = inQuirksMode; }
 
     enum class UpdateType {
         Overflow = 1 << 0,
@@ -80,6 +81,7 @@
     Display::Box& createDisplayBox(const Box&);
     Display::Box* displayBoxForLayoutBox(const Box& layoutBox) const { return m_layoutToDisplayBox.get(&layoutBox); }
 
+    bool inQuirksMode() const { return m_inQuirksMode; }
     // For testing purposes only
     void verifyAndOutputMismatchingLayoutTree(const RenderView&) const;
 
@@ -88,6 +90,7 @@
     HashSet<const Container*> m_formattingContextRootListForLayout;
     HashMap<const Box*, std::unique_ptr<FormattingState>> m_formattingStates;
     HashMap<const Box*, std::unique_ptr<Display::Box>> m_layoutToDisplayBox;
+    bool m_inQuirksMode { false };
 };
 
 }

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (232345 => 232346)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2018-05-31 11:00:16 UTC (rev 232345)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2018-05-31 14:58:24 UTC (rev 232346)
@@ -33,12 +33,12 @@
 namespace WebCore {
 namespace Layout {
 
-static bool isStretchedToViewport(const Box& layoutBox)
+static bool isStretchedToViewport(const LayoutContext& layoutContext, const Box& layoutBox)
 {
     ASSERT(layoutBox.isInFlow());
     // In quirks mode, body and html stretch to the viewport.
-    // if (!layoutBox.document().inQuirksMode())
-    //    return false;
+    if (!layoutContext.inQuirksMode())
+        return false;
 
     if (!layoutBox.isDocumentBox() || !layoutBox.isBodyBox())
         return false;
@@ -107,7 +107,7 @@
     };
 
     auto computedHeight = compute();
-    if (!isStretchedToViewport(layoutBox))
+    if (!isStretchedToViewport(layoutContext, layoutBox))
         return computedHeight;
     auto initialContainingBlockHeight = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox))->contentBox().height();
     return std::max(computedHeight, initialContainingBlockHeight);
@@ -147,7 +147,7 @@
     };
 
     auto computedWidth = compute();
-    if (!isStretchedToViewport(layoutBox))
+    if (!isStretchedToViewport(layoutContext, layoutBox))
         return computedWidth;
     auto initialContainingBlockWidth = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox))->contentBox().width();
     return std::max(computedWidth, initialContainingBlockWidth);

Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.cpp (232345 => 232346)


--- trunk/Source/WebCore/page/FrameViewLayoutContext.cpp	2018-05-31 11:00:16 UTC (rev 232345)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.cpp	2018-05-31 14:58:24 UTC (rev 232346)
@@ -57,6 +57,7 @@
     auto initialContainingBlock = Layout::TreeBuilder::createLayoutTree(renderView);
     auto layoutContext = std::make_unique<Layout::LayoutContext>();
     layoutContext->initializeRoot(*initialContainingBlock, renderView.size());
+    layoutContext->setInQuirksMode(renderView.document().inQuirksMode());
     layoutContext->updateLayout();
     layoutContext->verifyAndOutputMismatchingLayoutTree(renderView);
 } 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to