Enable fieldsets to be flexboxes, grids and multicolumn.
[WebKit-https.git] / Source / WebCore / ChangeLog
index 6f5fad6..1300973 100644 (file)
@@ -1,3 +1,321 @@
+2017-03-06  Dave Hyatt  <hyatt@apple.com>
+
+        Enable fieldsets to be flexboxes, grids and multicolumn.
+        https://bugs.webkit.org/show_bug.cgi?id=169082
+
+        Reviewed by Simon Fraser .
+
+        Added new tests in fast/forms/fieldset.
+
+        This patch eliminates RenderFieldset and moves the functionality into RenderBlock so that
+        derived classes can also be fieldsets.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        Remove RenderFieldset from the project.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::titleUIElement):
+        Call in to RenderBlock now instead of RenderFieldset.
+
+        * html/HTMLFieldSetElement.cpp:
+        (WebCore::HTMLFieldSetElement::createElementRenderer):
+        * html/HTMLFieldSetElement.h:
+        The fieldset DOM element now uses RenderElement::createFor to make renderers so that multiple display types
+        can be supported. A special flag has been added that indicates only to make flexbox and block-related
+        renderers (not table display types).
+
+        * rendering/OrderIterator.cpp:
+        (WebCore::OrderIterator::shouldSkipChild):
+        (WebCore::OrderIteratorPopulator::collectChild):
+        * rendering/OrderIterator.h:
+        Streamline child collection for flexboxes and grids to indicate whether the child should be skipped as a return
+        value from collectChild. Add a shouldSkipChild method that skips both out of flow positioned objects and
+        excluded children like the legends of fieldsets.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlockRareData::RenderBlockRareData):
+        When the legend is taller than the fieldset's borderBefore(), intrinsic border is added to the CSS border width.
+        This intrinsic border being factored in ensures that the padding and content boxes of fieldsets are correct
+        across any layout system, since the legend is now just treated as part of the border.
+
+        (WebCore::RenderBlock::computePreferredLogicalWidths):
+        (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
+        Call the new computePreferredWidthsForExcludedChildren to ensure that excluded children contribute to
+        preferred width in their own way and not as part of a specific layout system.
+
+        (WebCore::RenderBlock::renderName):
+        Hacked to still return RenderFieldSet for RenderBlockFlow-backed fieldsets for layout test compatibility.
+
+        (WebCore::RenderBlock::layoutExcludedChildren):
+        Renamed from layoutSpecialExcludedChild to more accurately reflect the fact that multiple excluded children
+        can be included here (e.g., both a multicolumn flow thread and a legend). The RenderBlock base class handles
+        the layout of legends by both placing them and setting the correct intrinsic border before amount on the
+        block.
+
+        (WebCore::RenderBlock::findFieldsetLegend):
+        Moved from RenderFieldset.
+
+        (WebCore::RenderBlock::adjustBorderBoxRectForPainting):
+        (WebCore::RenderBlock::paintRectToClipOutFromBorder):
+        These methods are used when painting to shrink the border box as needed to account for the legend and to
+        provide the portion of the border that needs to be clipped out. These methods have been enhanced to
+        properly support all writing modes.
+
+        (WebCore::RenderBlock::intrinsicBorderForFieldset):
+        (WebCore::RenderBlock::setIntrinsicBorderForFieldset):
+        (WebCore::RenderBlock::borderTop):
+        (WebCore::RenderBlock::borderLeft):
+        (WebCore::RenderBlock::borderBottom):
+        (WebCore::RenderBlock::borderRight):
+        (WebCore::RenderBlock::borderBefore):
+        These methods are overridden for border to ensure that the intrinsic border added by a tall legend is
+        properly factored in.
+
+        (WebCore::RenderBlock::computePreferredWidthsForExcludedChildren):
+        * rendering/RenderBlock.h:
+        This method computes the preferred widths for legend children in order to ensure that the legend properly
+        grows the width of the fieldset when it is the widest item.
+
+        (WebCore::RenderBlock::adjustBorderBoxLogicalHeightForBoxSizing):
+        (WebCore::RenderBlock::adjustContentBoxLogicalHeightForBoxSizing):
+        Preserve the behavior of fieldsets in that the available content size includes the space lost accounting
+        for the legend. I don't think this makes much sense, but it matches the behavior of other browsers
+        (and our old behavior).
+
+        (WebCore::RenderBlock::paintExcludedChildrenInBorder):
+        Method for painting the excluded children that might be present in our border. We only do this if the
+        paint phase is a box decoration painting phase and if the legend isn't self-painting.
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::willCreateColumns):
+        Allow fieldsets to create columns now.
+
+        (WebCore::RenderBlockFlow::layoutBlockChildren):
+        (WebCore::RenderBlockFlow::layoutExcludedChildren):
+        Renamed this method and change it to call the base class to ensure that legends in multicolumn fieldsets
+        get handled properly.
+
+        (WebCore::RenderBlockFlow::addChild):
+        Patched to make sure legends don't get put into the multicolumn flow thread, as they need to
+        remain outside of it.
+
+        (WebCore::RenderBlockFlow::layoutSpecialExcludedChild): Deleted.
+        Renamed to layoutExcludedChildren.
+
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::paintBoxDecorations):
+        (WebCore::RenderBox::paintMask):
+        Patched to call the new adjustBorderBoxRectForPainting and paintRectToClipOutFromBorder methods in
+        order to properly shrink the border box rect for painting and to clip out the portion of the border
+        covered by the legend.
+
+        (WebCore::RenderBox::avoidsFloats):
+        Add fieldsets as avoiding floats. RenderFieldset used to subclass this method to return true, but with
+        its removal, we need to put this in the base class along with legends.
+
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::isGridItem):
+        (WebCore::RenderBox::isFlexItem):
+        Patched to exclude legends so that they don't try to size like they are really in the grid or flexbox.
+
+        (WebCore::RenderBox::adjustBorderBoxRectForPainting):
+        This method is overridden by RenderBLock to handle adjusting fieldset border rects for painting.
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintBorder):
+        * rendering/RenderBoxModelObject.h:
+        (WebCore::RenderBoxModelObject::paintRectToClipOutFromBorder):
+        Patched to properly paint fieldsets using the new helpers.
+
+        * rendering/RenderDeprecatedFlexibleBox.cpp:
+        (WebCore::FlexBoxIterator::next):
+        (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
+        (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
+        Make sure deprecated flexible boxes lay out their legends properly by calling layoutExcludedChildren.
+
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::createFor):
+        * rendering/RenderElement.h:
+        Patched to take a flag that limits what renderers can be created so that fieldsets don't make table
+        display types.
+
+        * rendering/RenderFieldset.cpp: Removed.
+        * rendering/RenderFieldset.h: Removed.
+        Remove RenderFieldset files from the tree.
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths):
+        (WebCore::RenderFlexibleBox::firstLineBaseline):
+        (WebCore::RenderFlexibleBox::layoutBlock):
+        (WebCore::RenderFlexibleBox::layoutFlexItems):
+        (WebCore::RenderFlexibleBox::prepareOrderIteratorAndMargins):
+        Make sure flexible boxes lay out their legends properly by calling layoutExcludedChildren.
+        Patch methods to use the OrderIterator's new shouldSkipChild method to ensure legends aren't
+        part of the flexible box layout.
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::layoutBlock):
+        (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
+        (WebCore::RenderGrid::placeItemsOnGrid):
+        (WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
+        (WebCore::RenderGrid::layoutGridItems):
+        Make sure grids lay out their legends properly by calling layoutExcludedChildren.
+        Patch methods to use the OrderIterator's new shouldSkipChild method to ensure legends aren't
+        part of the grid's layout.
+
+        * rendering/RenderMultiColumnFlowThread.cpp:
+        (WebCore::RenderMultiColumnFlowThread::populate):
+        Pull legends back up into the block and don't let them be part of the flow thread.
+
+        * rendering/RenderMultiColumnSet.cpp:
+        (WebCore::RenderMultiColumnSet::requiresBalancing):
+        Fix an assert to allow legends to exist as siblings of multicolumn sets.
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::isFieldset):
+        Changed to examine the HTML element rather than RenderFieldset.
+
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::isExcludedFromNormalLayout):
+        (WebCore::RenderObject::setIsExcludedFromNormalLayout):
+        (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
+        RenderObjects now have a new bit that is set for excluded objects like legends, flow threads,
+        placeholders, and ruby text. This bit lets code easily detect that an object is excluded from
+        the layout system and can be skipped.
+
+        (WebCore::RenderObject::isExcludedAndPlacedInBorder):
+        Helper method for asking if an object is painting inside the border. Used to know we
+        need to factor it into preferred width calculations outside of any one layout system
+        and also to know that we need to paint it when we paint the fieldset's border instead of
+        later (after we might have scrolled or clipped the child painting area).
+
+        * rendering/RenderRubyRun.cpp:
+        (WebCore::RenderRubyRun::layoutExcludedChildren):
+        (WebCore::RenderRubyRun::layoutSpecialExcludedChild): Deleted.
+        * rendering/RenderRubyRun.h:
+        Rename layoutSpecialExcludedChild to layoutExcludedChildren.
+
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::adjustBorderBoxRectForPainting):
+        (WebCore::RenderTable::paintBoxDecorations):
+        (WebCore::RenderTable::paintMask):
+        (WebCore::RenderTable::subtractCaptionRect): Deleted.
+        * rendering/RenderTable.h:
+        Patched tables to share the same border box rect adjustment used by fieldsets when subtracting
+        out captions. This is prep work to allow tables to be fieldsets, but for now I didn't go all the
+        way.
+
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::paintBoxDecorations):
+        (WebCore::RenderTableCell::paintMask):
+        Make sure table cells adjust their border box rects for painting. Again this is prep work for
+        cells potentially being fieldsets, but not supported yet.
+
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::layoutExcludedChildren):
+        (WebCore::RenderTextControl::layoutSpecialExcludedChild): Deleted.
+        * rendering/RenderTextControl.h:
+        * rendering/RenderTextControlMultiLine.cpp:
+        (WebCore::RenderTextControlMultiLine::layoutExcludedChildren):
+        (WebCore::RenderTextControlMultiLine::layoutSpecialExcludedChild): Deleted.
+        * rendering/RenderTextControlMultiLine.h:
+        Renamed the methods for doing the excluded child layout.
+
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::RenderTreeAsText::writeRenderObject):
+        Make sure to dump the original fieldset border and not the border with the extra legend stuff in it.
+
+2017-03-06  Antoine Quint  <graouts@apple.com>
+
+        [Modern Media Controls] Tracks panel should clip and scroll content when numerous tracks are available
+        https://bugs.webkit.org/show_bug.cgi?id=169201
+        <rdar://problem/30867979>
+
+        Reviewed by Eric Carlson.
+
+        We now position and size the tracks panel dynamically and ensure a max-height is applied
+        to the panel so that it allows a margin of 10px above it within the media controls. We also
+        apply that same max-height to a new intermediary scrollable container for the track lists,
+        so that it scrolls independently of the container and the background tint.
+
+        Test: media/modern-media-controls/tracks-panel/tracks-panel-position-and-size.html
+
+        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
+        (MacOSFullscreenMediaControls.prototype.showTracksPanel): Deleted.
+        * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
+        (.media-controls.mac.inline .volume.slider):
+        (.media-controls.mac.inline .tracks-panel): Deleted.
+        * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
+        (MacOSInlineMediaControls.prototype.showTracksPanel): Deleted.
+        * Modules/modern-media-controls/controls/macos-media-controls.js:
+        (MacOSMediaControls.prototype.showTracksPanel):
+        * Modules/modern-media-controls/controls/tracks-panel.css:
+        (.tracks-panel > .background-tint > div,):
+        (.tracks-panel > .scrollable-container):
+        (.tracks-panel section):
+        (.tracks-panel section:first-of-type):
+        (.tracks-panel section > h3):
+        (.tracks-panel section > ul):
+        (.tracks-panel section > ul > li):
+        (.tracks-panel section > ul > li:focus):
+        (.tracks-panel section > ul > li.selected:before):
+        (.tracks-panel section > ul > li.animated):
+        (.tracks-panel > .background-tint > div): Deleted.
+        (.tracks-panel > section): Deleted.
+        (.tracks-panel > section:first-of-type): Deleted.
+        (.tracks-panel > section > h3): Deleted.
+        (.tracks-panel > section > ul): Deleted.
+        (.tracks-panel > section > ul > li): Deleted.
+        (.tracks-panel > section > ul > li:focus): Deleted.
+        (.tracks-panel > section > ul > li.selected:before): Deleted.
+        (.tracks-panel > section > ul > li.animated): Deleted.
+        * Modules/modern-media-controls/controls/tracks-panel.js:
+        (TracksPanel.prototype.presentInParent):
+        (TracksPanel.prototype.get maxHeight):
+        (TracksPanel.prototype.set maxHeight):
+        (TracksPanel.prototype.commitProperty):
+        (TracksPanel.prototype._childrenFromDataSource):
+
+2017-03-06  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [css-grid] Stretch should grow and shrink items to fit its grid area
+        https://bugs.webkit.org/show_bug.cgi?id=163200
+
+        Reviewed by Darin Adler.
+
+        After some discussions the CSS WG agreed that stretch should not only
+        grow items, but also shrink them to fit its grid area.
+        That way the "min-width|height: auto" is somehow ignored for grid items.
+        More info at: https://github.com/w3c/csswg-drafts/issues/283
+
+        The good part is that this allows us to remove some ugly code we've
+        in RenderBox that was only used by Grid Layout.
+
+        For images, we'll be stretching on both axis right now, so the aspect
+        ratio won't be preserved. The default behavior might change in those
+        cases, but that should be implemented in a different patch.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeLogicalWidthInRegion):
+        (WebCore::RenderBox::computeLogicalHeight):
+
+2017-03-06  Miguel Gomez  <magomez@igalia.com>
+
+        [GTK] WebProcess from WebKitGtk+ 2.15.x SIGSEVs in GIFLZWContext::doLZW(unsigned char const*, unsigned long) at Source/WebCore/platform/image-decoders/gif/GIFImageReader.cpp:303
+        https://bugs.webkit.org/show_bug.cgi?id=167304
+
+        Reviewed by Carlos Garcia Campos.
+
+        Add a lock to ensure that the GIFImageReader that we are using for decoding is not deleted while
+        the decoding thread is using it.
+
+        No new tests.
+
+        * platform/image-decoders/gif/GIFImageDecoder.cpp:
+        (WebCore::GIFImageDecoder::clearFrameBufferCache):
+
 2017-03-06  Antti Koivisto  <antti@apple.com>
 
         Allow render tree building before loading stylesheet elements