Bug 1101627 - Add touch action regions. r=kats
This commit is contained in:
@@ -15,32 +15,6 @@
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
uint32_t
|
||||
ContentHelper::GetTouchActionFromFrame(nsIFrame* aFrame)
|
||||
{
|
||||
// If aFrame is null then return default value
|
||||
if (!aFrame) {
|
||||
return NS_STYLE_TOUCH_ACTION_AUTO;
|
||||
}
|
||||
|
||||
// The touch-action CSS property applies to: all elements except:
|
||||
// non-replaced inline elements, table rows, row groups, table columns, and column groups
|
||||
bool isNonReplacedInlineElement = aFrame->IsFrameOfType(nsIFrame::eLineParticipant);
|
||||
if (isNonReplacedInlineElement) {
|
||||
return NS_STYLE_TOUCH_ACTION_AUTO;
|
||||
}
|
||||
|
||||
const nsStyleDisplay* disp = aFrame->StyleDisplay();
|
||||
bool isTableElement = disp->IsInnerTableStyle() &&
|
||||
disp->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL &&
|
||||
disp->mDisplay != NS_STYLE_DISPLAY_TABLE_CAPTION;
|
||||
if (isTableElement) {
|
||||
return NS_STYLE_TOUCH_ACTION_AUTO;
|
||||
}
|
||||
|
||||
return disp->mTouchAction;
|
||||
}
|
||||
|
||||
void
|
||||
ContentHelper::UpdateAllowedBehavior(uint32_t aTouchActionValue, bool aConsiderPanning, TouchBehaviorFlags& aOutBehavior)
|
||||
{
|
||||
@@ -103,7 +77,7 @@ ContentHelper::GetAllowedTouchBehavior(nsIWidget* aWidget, const LayoutDeviceInt
|
||||
AllowedTouchBehavior::PINCH_ZOOM | AllowedTouchBehavior::DOUBLE_TAP_ZOOM;
|
||||
|
||||
for (nsIFrame *frame = target; frame && frame->GetContent() && behavior; frame = frame->GetParent()) {
|
||||
UpdateAllowedBehavior(GetTouchActionFromFrame(frame), considerPanning, behavior);
|
||||
UpdateAllowedBehavior(nsLayoutUtils::GetTouchActionFromFrame(frame), considerPanning, behavior);
|
||||
|
||||
if (frame == nearestScrollableFrame) {
|
||||
// We met the scrollable element, after it we shouldn't consider touch-action
|
||||
|
||||
Reference in New Issue
Block a user